aboutsummaryrefslogtreecommitdiff
path: root/examples/GuiClient/mainDialog.cpp
diff options
context:
space:
mode:
authorManjeet Dahiya <manjeetdahiya@gmail.com>2010-10-17 19:13:08 +0000
committerManjeet Dahiya <manjeetdahiya@gmail.com>2010-10-17 19:13:08 +0000
commit2212a59790804587dc31882cf2b80fc95af32448 (patch)
tree8deece8897c3f1d66bff068d73a59a32909fcc3a /examples/GuiClient/mainDialog.cpp
parenta42be87b426b7912aba0ae0a7b7bbed834660a56 (diff)
downloadqxmpp-2212a59790804587dc31882cf2b80fc95af32448.tar.gz
ask for confirmation before removing a contact
Diffstat (limited to 'examples/GuiClient/mainDialog.cpp')
-rw-r--r--examples/GuiClient/mainDialog.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/examples/GuiClient/mainDialog.cpp b/examples/GuiClient/mainDialog.cpp
index fbf7ae43..5e979223 100644
--- a/examples/GuiClient/mainDialog.cpp
+++ b/examples/GuiClient/mainDialog.cpp
@@ -817,13 +817,19 @@ void mainDialog::action_removeContact(const QString& bareJid)
if(!isValidBareJid(bareJid))
return;
- QXmppRosterIq remove;
- remove.setType(QXmppIq::Set);
- QXmppRosterIq::Item itemRemove;
- itemRemove.setSubscriptionType(QXmppRosterIq::Item::Remove);
- itemRemove.setBareJid(bareJid);
- remove.addItem(itemRemove);
- m_xmppClient.sendPacket(remove);
+ int answer = QMessageBox::question(this, "Remove contact",
+ QString("Do you want to remove the contact <I>%1</I>").arg(bareJid),
+ QMessageBox::Yes, QMessageBox::No);
+ if(answer == QMessageBox::Yes)
+ {
+ QXmppRosterIq remove;
+ remove.setType(QXmppIq::Set);
+ QXmppRosterIq::Item itemRemove;
+ itemRemove.setSubscriptionType(QXmppRosterIq::Item::Remove);
+ itemRemove.setBareJid(bareJid);
+ remove.addItem(itemRemove);
+ m_xmppClient.sendPacket(remove);
+ }
}
void mainDialog::errorClient(QXmppClient::Error error)