diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-03-27 00:38:43 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-03-27 00:38:43 +0200 |
commit | 855c565e2242fa2504fb06f4579abc609de452f5 (patch) | |
tree | a07f2f2e99f56f80fbec31090dfea6fc06f57060 | |
parent | b26e72ed5e62e9079319e14ed82734f0659db3c4 (diff) | |
download | manaverse-855c565e2242fa2504fb06f4579abc609de452f5.tar.gz manaverse-855c565e2242fa2504fb06f4579abc609de452f5.tar.bz2 manaverse-855c565e2242fa2504fb06f4579abc609de452f5.tar.xz manaverse-855c565e2242fa2504fb06f4579abc609de452f5.zip |
Add no away to whisper chat context menu.
-rw-r--r-- | src/gui/chat.cpp | 4 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 18 | ||||
-rw-r--r-- | src/gui/widgets/chattab.h | 7 | ||||
-rw-r--r-- | src/localplayer.cpp | 2 |
4 files changed, 30 insertions, 1 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index d3ebb3955..88dbd1b0a 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -1353,6 +1353,7 @@ void ChatWindow::loadState() { tab->setAllowHighlight(flags & 1); tab->setRemoveNames((flags & 2) / 2); + tab->setNoAway((flags & 4) / 4); } serverConfig.deleteKey("chatWhisper" + toString(num)); serverConfig.deleteKey("chatWhisperFlags" + toString(num)); @@ -1386,7 +1387,8 @@ void ChatWindow::saveState() serverConfig.setValue("chatWhisperFlags" + toString(num), static_cast<int>(tab->getAllowHighlight()) - + (2 * static_cast<int>(tab->getRemoveNames()))); + + (2 * static_cast<int>(tab->getRemoveNames())) + + (4 * static_cast<int>(tab->getNoAway()))); num ++; } diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 1cca9daa6..183b006d5 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -492,6 +492,16 @@ void PopupMenu::showChatPopup(int x, int y, ChatTab *tab) mBrowserBox->addRow(strprintf("@@remove name|%s@@", _("Remove name"))); } + if (tab->getNoAway()) + { + mBrowserBox->addRow(strprintf("@@enable away|%s@@", + _("Enable away"))); + } + else + { + mBrowserBox->addRow(strprintf("@@disable away|%s@@", + _("Disable away"))); + } mBrowserBox->addRow("##3---"); if (tab->getType() == ChatTab::TAB_PARTY) @@ -1101,6 +1111,14 @@ void PopupMenu::handleLink(const std::string &link, { mTab->setRemoveNames(true); } + else if (link == "disable away" && mTab) + { + mTab->setNoAway(true); + } + else if (link == "enable away" && mTab) + { + mTab->setNoAway(false); + } else if (link == "guild-pos" && !mNick.empty()) { showChangePos(getX(), getY()); diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h index 998ad2e3d..611ca8ef3 100644 --- a/src/gui/widgets/chattab.h +++ b/src/gui/widgets/chattab.h @@ -153,6 +153,12 @@ class ChatTab : public Tab void setRemoveNames(bool n) { mRemoveNames = n; } + bool getNoAway() + { return mNoAway; } + + void setNoAway(bool n) + { mNoAway = n; } + protected: friend class ChatWindow; friend class WhisperWindow; @@ -173,6 +179,7 @@ class ChatTab : public Tab BrowserBox *mTextOutput; bool mAllowHightlight; bool mRemoveNames; + bool mNoAway; }; extern ChatTab *localChatTab; diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 4d085eae4..564c28f78 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -3119,6 +3119,8 @@ void LocalPlayer::afkRespond(ChatTab *tab, const std::string &nick) } else { + if (tab->getNoAway()) + return; tab->chatLog(getName(), msg); } mAfkTime = cur_time; |