From b7809a6ca9829405c7be07413fad67ad6794a2ea Mon Sep 17 00:00:00 2001 From: doitux Date: Tue, 30 Mar 2010 19:38:14 +0000 Subject: [PATCH] GUI: put player on ignore list slot bugfix --- .../gamelobbydialog/gamelobbydialogimpl.cpp | 19 ++++++++++++------- .../qt/gamelobbydialog/gamelobbydialogimpl.h | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp index a18d4ee0..a98c444d 100644 --- a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp +++ b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp @@ -1413,16 +1413,21 @@ bool gameLobbyDialogImpl::playerIsOnIgnoreList(unsigned playerId) { } -void gameLobbyDialogImpl::putPlayerOnIgnoreList(unsigned playerId) { +void gameLobbyDialogImpl::putPlayerOnIgnoreList() { - if(!playerIsOnIgnoreList(playerId)) { + if(!treeWidget_NickList->selectedItems().isEmpty()) { - list playerIgnoreList = myConfig->readConfigStringList("PlayerIgnoreList"); - playerIgnoreList.push_back(QString("%1,%2").arg(playerId).arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerId).playerName.c_str())).toUtf8().constData()); - myConfig->writeConfigStringList("PlayerIgnoreList", playerIgnoreList); - myConfig->writeBuffer(); + unsigned playerId = treeWidget_NickList->selectedItems().at(0)->data(0, Qt::UserRole).toUInt(); - myChat->refreshIgnoreList(); + if(!playerIsOnIgnoreList(playerId)) { + + list playerIgnoreList = myConfig->readConfigStringList("PlayerIgnoreList"); + playerIgnoreList.push_back(QString("%1,%2").arg(playerId).arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerId).playerName.c_str())).toUtf8().constData()); + myConfig->writeConfigStringList("PlayerIgnoreList", playerIgnoreList); + myConfig->writeBuffer(); + + myChat->refreshIgnoreList(); + } } } diff --git a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h index 3fc7cd6f..2c6ea3c3 100644 --- a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h +++ b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h @@ -108,7 +108,7 @@ public slots: void showInvitationDialog(unsigned gameId, unsigned playerIdFrom); void chatInfoPlayerInvitation(unsigned gameId, unsigned playerIdWho, unsigned playerIdFrom); void chatInfoPlayerRejectedInvitation(unsigned gameId, unsigned playerIdWho, DenyGameInvitationReason reason); - void putPlayerOnIgnoreList(unsigned playerid); + void putPlayerOnIgnoreList(); bool playerIsOnIgnoreList(unsigned playerid); private: