diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-11-15 09:34:09 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-11-15 09:34:09 (GMT) |
commit | 004677623739ef53ae9f565d3ffd4d2b02a65d5a (patch) | |
tree | daf4af8c2e5898643ebffb483256832206cb4b1a /Swift/QtUI/ContextMenus | |
parent | 72bb119c3e18d4881a649c04e7d966676364e1d6 (diff) | |
download | swift-004677623739ef53ae9f565d3ffd4d2b02a65d5a.zip swift-004677623739ef53ae9f565d3ffd4d2b02a65d5a.tar.bz2 |
Ask for confirmation before removing contacts.
Resolves: #628
Release-Notes: You'll now be asked for confirmation before removing contacts.
Diffstat (limited to 'Swift/QtUI/ContextMenus')
-rw-r--r-- | Swift/QtUI/ContextMenus/QtRosterContextMenu.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Swift/QtUI/ContextMenus/QtRosterContextMenu.cpp b/Swift/QtUI/ContextMenus/QtRosterContextMenu.cpp index d4473d8..1989dfb 100644 --- a/Swift/QtUI/ContextMenus/QtRosterContextMenu.cpp +++ b/Swift/QtUI/ContextMenus/QtRosterContextMenu.cpp @@ -11,6 +11,7 @@ #include <QMenu> #include <QDebug> #include <QDialog> +#include <QMessageBox> #include <boost/shared_ptr.hpp> @@ -37,9 +38,10 @@ void QtRosterContextMenu::show(RosterItem* item) { item_ = item; QMenu contextMenu; if (contact) { - contextMenu.addAction("Remove", this, SLOT(handleRemoveContact())); contextMenu.addAction("Rename", this, SLOT(handleRenameContact())); contextMenu.addAction("Groups", this, SLOT(handleRegroupContact())); + contextMenu.addSeparator(); + contextMenu.addAction("Remove", this, SLOT(handleRemoveContact())); } GroupRosterItem* group = dynamic_cast<GroupRosterItem*>(item); if (group) { @@ -68,7 +70,16 @@ void QtRosterContextMenu::handleRegroupContact() { void QtRosterContextMenu::handleRemoveContact() { ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item_); assert(contact); - eventStream_->send(boost::shared_ptr<UIEvent>(new RemoveRosterItemUIEvent(contact->getJID()))); + QMessageBox msgBox; + msgBox.setWindowTitle("Confirm contact deletion"); + msgBox.setText("Are you sure you want to delete this contact?"); + msgBox.setInformativeText("This will remove the contact from all groups they may be in."); + msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); + msgBox.setDefaultButton(QMessageBox::Yes); + int ret = msgBox.exec(); + if (ret == QMessageBox::Yes) { + eventStream_->send(boost::shared_ptr<UIEvent>(new RemoveRosterItemUIEvent(contact->getJID()))); + } } void QtRosterContextMenu::handleRenameContact() { |