From 3958a83e9f452cbeaf8015f0ffbd5f9569a745dc Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 6 Jun 2013 17:35:58 +0200 Subject: [PATCH] Bookmarks: Ask for confirmation before removing all bookmarks Change-Id: Ib55d38269e6a2c5a28d320b115d3491a4e1b479b Reviewed-by: Eike Ziller --- src/plugins/bookmarks/bookmarkmanager.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index c4a7d4ca648..79ba85d943c 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -279,10 +280,23 @@ void BookmarkView::removeBookmark(const QModelIndex& index) m_manager->removeBookmark(bm); } -// The perforcemance of this function could be greatly improved. -// void BookmarkView::removeAll() { + const QString key = QLatin1String("Bookmarks.DontAskAgain"); + QSettings *settings = ICore::settings(); + bool checked = settings->value(key).toBool(); + if (!checked) { + if (Utils::CheckableMessageBox::question(this, + tr("Remove All Bookmarks"), + tr("Are you sure you want to remove all bookmarks from all files in the current session?"), + tr("Do not &ask again."), + &checked, QDialogButtonBox::Yes | QDialogButtonBox::No, QDialogButtonBox::No) + != QDialogButtonBox::Yes) + return; + settings->setValue(key, checked); + } + + // The performance of this function could be greatly improved. while (m_manager->rowCount()) { QModelIndex index = m_manager->index(0, 0); removeBookmark(index);