From 2212a59790804587dc31882cf2b80fc95af32448 Mon Sep 17 00:00:00 2001 From: Manjeet Dahiya Date: Sun, 17 Oct 2010 19:13:08 +0000 Subject: ask for confirmation before removing a contact --- examples/GuiClient/mainDialog.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'examples/GuiClient/mainDialog.cpp') 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 %1").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) -- cgit v1.2.3