diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-08-11 21:25:16 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-08-11 23:43:48 +0300 |
commit | 44e80c70513022b6c378f64d6bf5d25dda7b0e7f (patch) | |
tree | acbdb6be0ba4377d908c017f593832589acb444f /src | |
parent | 69c4bf1494b19ca3b3333effff83086b0f0b87fd (diff) | |
download | manaplus-44e80c70513022b6c378f64d6bf5d25dda7b0e7f.tar.gz manaplus-44e80c70513022b6c378f64d6bf5d25dda7b0e7f.tar.bz2 manaplus-44e80c70513022b6c378f64d6bf5d25dda7b0e7f.tar.xz manaplus-44e80c70513022b6c378f64d6bf5d25dda7b0e7f.zip |
Fix saving opened tabs state.
Diffstat (limited to 'src')
-rw-r--r-- | src/commandhandler.cpp | 16 | ||||
-rw-r--r-- | src/gui/chatwindow.cpp | 14 | ||||
-rw-r--r-- | src/gui/setup.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/avatarlistbox.cpp | 6 |
4 files changed, 26 insertions, 13 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index b87dcf583..dc9a4d1bf 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -403,8 +403,14 @@ void CommandHandler::handleMsg(const std::string &args, ChatTab *tab) void CommandHandler::handleQuery(const std::string &args, ChatTab *tab) { - if (chatWindow && chatWindow->addWhisperTab(args, true)) - return; + if (chatWindow) + { + if (chatWindow->addWhisperTab(args, true)) + { + chatWindow->saveState(); + return; + } + } tab->chatLog(strprintf(_("Cannot create a whisper tab for nick \"%s\"! " "It either already exists, or is you."), @@ -736,14 +742,20 @@ void CommandHandler::handleCloseAll(const std::string &args A_UNUSED, ChatTab *tab A_UNUSED) { if (chatWindow) + { chatWindow->removeAllWhispers(); + chatWindow->saveState(); + } } void CommandHandler::handleIgnoreAll(const std::string &args A_UNUSED, ChatTab *tab A_UNUSED) { if (chatWindow) + { chatWindow->ignoreAllWhispers(); + chatWindow->saveState(); + } } void CommandHandler::handleOutfit(const std::string &args, diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index c266374ef..1ef3139db 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -215,6 +215,7 @@ ChatWindow::ChatWindow(): ChatWindow::~ChatWindow() { + saveState(); config.setValue("ReturnToggles", mReturnToggles); removeAllWhispers(); delete mItemLinkHandler; @@ -935,7 +936,11 @@ void ChatWindow::whisper(const std::string &nick, if (i != mWhispers.end()) tab = i->second; else if (config.getBoolValue("whispertab")) + { tab = addWhisperTab(nick); + if (tab) + saveState(); + } if (tab) { @@ -1414,15 +1419,6 @@ void ChatWindow::loadState() tab->setRemoveNames((flags & 2) / 2); tab->setNoAway((flags & 4) / 4); } - serverConfig.deleteKey("chatWhisper" + toString(num)); - serverConfig.deleteKey("chatWhisperFlags" + toString(num)); - num ++; - } - - while (num < 50) - { - serverConfig.deleteKey("chatWhisper" + toString(num)); - serverConfig.deleteKey("chatWhisperFlags" + toString(num)); num ++; } } diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index d73212d48..0b40d8c01 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -22,6 +22,7 @@ #include "gui/setup.h" +#include "chatwindow.h" #include "configuration.h" #include "game.h" #include "main.h" @@ -149,6 +150,8 @@ void Setup::action(const gcn::ActionEvent &event) } else if (event.getId() == "Store") { + if (chatWindow) + chatWindow->saveState(); config.write(); serverConfig.write(); } diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 748e038e2..5ac6721a5 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -366,8 +366,10 @@ void AvatarListBox::mousePressed(gcn::MouseEvent &event) { if (ava->getType() == AVATAR_PLAYER && chatWindow) { - chatWindow->addWhisperTab(model->getAvatarAt(selected) - ->getName(), true); + ChatTab *tab = chatWindow->addWhisperTab( + model->getAvatarAt(selected)->getName(), true); + if (chatWindow && tab) + chatWindow->saveState(); } } } |