diff options
author | hjk <hjk121@nokiamail.com> | 2013-06-06 17:35:58 +0200 |
---|---|---|
committer | hjk <hjk121@nokiamail.com> | 2013-06-11 11:49:59 +0200 |
commit | 3958a83e9f452cbeaf8015f0ffbd5f9569a745dc (patch) | |
tree | 9e59cae96db1ae20278b5e202174485b257d7a43 /src/plugins/bookmarks | |
parent | 880001822494830fcbc236c1e73af860a9052b5b (diff) | |
download | qt-creator-3958a83e9f452cbeaf8015f0ffbd5f9569a745dc.tar.gz |
Bookmarks: Ask for confirmation before removing all bookmarks
Change-Id: Ib55d38269e6a2c5a28d320b115d3491a4e1b479b
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Diffstat (limited to 'src/plugins/bookmarks')
-rw-r--r-- | src/plugins/bookmarks/bookmarkmanager.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index c4a7d4ca64..79ba85d943 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -43,6 +43,7 @@ #include <utils/tooltip/tooltip.h> #include <utils/tooltip/tipcontents.h> #include <utils/qtcassert.h> +#include <utils/checkablemessagebox.h> #include <QDebug> #include <QDir> @@ -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); |