diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/getaddressform.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/gui/getaddressform.cpp b/src/gui/getaddressform.cpp index dd81257..2a433a0 100644 --- a/src/gui/getaddressform.cpp +++ b/src/gui/getaddressform.cpp @@ -17,12 +17,14 @@ */ #include "getaddressform.h" +#include <QMessageBox> #include <QRegExp> #include "sys_settings.h" #include "gui.h" #include "address_book.h" #include "addresstablemodel.h" #include "addresscardform.h" +#include "audits/memman.h" #define TAB_KABC 0 #define TAB_LOCAL 1 @@ -234,14 +236,29 @@ void GetAddressForm::deleteLocalAddress() t_address_card card = m_model->getAddress(sel[0].row()); - if (ab_local->del_address(card)) { - m_model->removeAddress(sel[0].row()); + QString card_name = QString::fromStdString(card.get_display_name()); + QString msg = tr("Are you sure you want to delete contact '%1' from the local address book?").arg(card_name); + QMessageBox *mb = new QMessageBox(tr("Delete contact"), msg, + QMessageBox::Warning, + QMessageBox::Yes, + QMessageBox::No, + QMessageBox::NoButton, + this); + MEMMAN_NEW(mb); - string error_msg; - if (!ab_local->save(error_msg)) { - ui->cb_show_msg(error_msg, MSG_CRITICAL); + if (mb->exec() == QMessageBox::Yes) { + if (ab_local->del_address(card)) { + m_model->removeAddress(sel[0].row()); + + string error_msg; + if (!ab_local->save(error_msg)) { + ui->cb_show_msg(error_msg, MSG_CRITICAL); + } } } + + MEMMAN_DELETE(mb); + delete mb; } void GetAddressForm::editLocalAddress() |