summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtContactEditWindow.cpp')
-rw-r--r--Swift/QtUI/QtContactEditWindow.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/Swift/QtUI/QtContactEditWindow.cpp b/Swift/QtUI/QtContactEditWindow.cpp
index 543d39a..5affaef 100644
--- a/Swift/QtUI/QtContactEditWindow.cpp
+++ b/Swift/QtUI/QtContactEditWindow.cpp
@@ -72,16 +72,19 @@ void QtContactEditWindow::hide() {
}
void QtContactEditWindow::handleRemoveContact() {
+ if (confirmContactDeletion(jid_)) {
+ onRemoveContactRequest();
+ }
+}
+
+bool QtContactEditWindow::confirmContactDeletion(const JID& jid) {
QMessageBox msgBox;
msgBox.setWindowTitle(tr("Confirm contact deletion"));
msgBox.setText(tr("Are you sure you want to delete this contact?"));
- msgBox.setInformativeText(QString(tr("This will remove the contact '%1' from all groups they may be in.")).arg(P2QSTRING(jid_.toString())));
+ msgBox.setInformativeText(QString(tr("This will remove the contact '%1' from all groups they may be in.")).arg(P2QSTRING(jid.toString())));
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Yes);
- int ret = msgBox.exec();
- if (ret == QMessageBox::Yes) {
- onRemoveContactRequest();
- }
+ return msgBox.exec() == QMessageBox::Yes;
}
void QtContactEditWindow::handleUpdateContact() {