diff options
Diffstat (limited to 'src/bookmarks/bookmarksmanager.cpp')
-rw-r--r-- | src/bookmarks/bookmarksmanager.cpp | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp index bba9dd77..28f9ad8e 100644 --- a/src/bookmarks/bookmarksmanager.cpp +++ b/src/bookmarks/bookmarksmanager.cpp @@ -75,6 +75,31 @@ void BookmarkOwner::openBookmark(const KBookmark & bookmark, } +bool BookmarkOwner::deleteBookmark(KBookmark &bookmark) +{ + KBookmarkGroup bmg = bookmark.parentGroup(); + bool folder = bookmark.isGroup(); + QString name = QString(bookmark.fullText()).replace("&&", "&"); + + if (KMessageBox::warningContinueCancel( + QApplication::activeWindow(), + folder ? i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", name) + : i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", name), + folder ? i18n("Bookmark Folder Deletion") + : i18n("Bookmark Deletion"), + KStandardGuiItem::del(), + KStandardGuiItem::cancel(), + "bookmarkDeletition_askAgain") + != KMessageBox::Continue + ) + return false; + + bmg.deleteBookmark(bookmark); + Application::bookmarkProvider()->bookmarkManager()->emitChanged(bmg); + return true; +} + + bool BookmarkOwner::supportsTabs() const { return true; @@ -99,16 +124,16 @@ void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bookmark) if (urlList.length() > 8) { - if ( !(KMessageBox::warningContinueCancel( Application::instance()->mainWindow(), + if ( !(KMessageBox::warningContinueCancel( Application::instance()->mainWindow(), i18ncp("%1=Number of tabs. Value is always >=8", "You are about to open %1 tabs.\nAre you sure?", - "You are about to open %1 tabs.\nAre you sure?", + "You are about to open %1 tabs.\nAre you sure?", urlList.length()), "", KStandardGuiItem::cont(), KStandardGuiItem::cancel(), "openFolderInTabs_askAgain" - ) == KMessageBox::Continue) + ) == KMessageBox::Continue) ) return; } @@ -335,7 +360,7 @@ void BookmarkToolBar::actionHovered() // ------------------------------------------------------------------------------------------------------ - + BookmarkProvider::BookmarkProvider(QObject *parent) : QObject(parent) , m_manager(0) @@ -396,7 +421,7 @@ void BookmarkProvider::setupBookmarkBar(BookmarkToolBar *toolbar) m_bookmarkToolBars.append(toolbar); toolbar->setContextMenuPolicy(Qt::CustomContextMenu); connect(toolbar, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenu(const QPoint &))); - + kDebug() << "new bookmark bar... DONE!"; } @@ -453,7 +478,7 @@ void BookmarkProvider::contextMenu(const QPoint &point) KActionMenu* BookmarkProvider::bookmarkActionMenu(QWidget *parent) { kDebug() << "new Bookmarks Menu..."; - + KMenu *menu = new KMenu(parent); _bookmarkActionMenu = new KActionMenu(parent); _bookmarkActionMenu->setMenu(menu); @@ -524,7 +549,7 @@ QList<KBookmark> BookmarkProvider::find(QString text) return list; } - KBookmark bookmark = bookGroup.first(); + KBookmark bookmark = bookGroup.first(); while (!bookmark.isNull()) { list = find(list, bookmark, text); |