summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/bookmarkcontextmenu.cpp20
-rw-r--r--src/bookmarks/bookmarksmanager.cpp39
-rw-r--r--src/bookmarks/bookmarksmanager.h19
-rw-r--r--src/bookmarks/bookmarkspanel.cpp29
4 files changed, 51 insertions, 56 deletions
diff --git a/src/bookmarks/bookmarkcontextmenu.cpp b/src/bookmarks/bookmarkcontextmenu.cpp
index 019d9eb9..714c8b51 100644
--- a/src/bookmarks/bookmarkcontextmenu.cpp
+++ b/src/bookmarks/bookmarkcontextmenu.cpp
@@ -212,25 +212,7 @@ void BookmarkContextMenu::copyToClipboard()
void BookmarkContextMenu::deleteBookmark()
{
KBookmark bm = bookmark();
- KBookmarkGroup bmg = bm.parentGroup();
- bool folder = bm.isGroup();
- QString name = QString(bm.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;
-
- bmg.deleteBookmark(bm);
- manager()->emitChanged(bmg);
+ Application::bookmarkProvider()->bookmarkOwner()->deleteBookmark(bm);
}
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);
diff --git a/src/bookmarks/bookmarksmanager.h b/src/bookmarks/bookmarksmanager.h
index eeb5391d..b084b8ee 100644
--- a/src/bookmarks/bookmarksmanager.h
+++ b/src/bookmarks/bookmarksmanager.h
@@ -89,6 +89,13 @@ public:
Qt::MouseButtons mouseButtons,
Qt::KeyboardModifiers keyboardModifiers);
+ /**
+ * Promps the user to delete a bookmark.
+ * @param bookmark The bookmark to delete.
+ * @return true if the bookmark was deleted, false if canceled.
+ */
+ static bool deleteBookmark(KBookmark &bookmark);
+
/**
* this method, from KBookmarkOwner interface, allows to add the current page
@@ -206,7 +213,7 @@ private:
// ------------------------------------------------------------------------------
-
+
/**
* This class represent the interface to rekonq bookmarks system.
* All rekonq needs (Bookmarks Menu, Bookmarks Toolbar) is provided
@@ -263,7 +270,7 @@ public:
KBookmarkGroup rootGroup();
inline KBookmarkManager *bookmarkManager() { return m_manager; }
-
+
inline BookmarkOwner *bookmarkOwner() { return m_owner; }
QList<KBookmark> find(QString text);
@@ -272,7 +279,7 @@ public:
void removeBookmarkPanel(BookmarksPanel *panel);
KBookmark bookmarkForUrl(const KUrl &url);
-
+
signals:
/**
* @short This signal is emitted when an url has to be loaded
@@ -299,11 +306,11 @@ public slots:
*/
void slotBookmarksChanged(const QString &group, const QString &caller);
void fillBookmarkBar(BookmarkToolBar *toolBar);
-
+
private slots:
void slotAddBookmark();
void slotPanelChanged();
-
+
private:
QList<KBookmark> find(QList<KBookmark> list, const KBookmark &bookmark, QString text);
@@ -315,7 +322,7 @@ private:
KActionCollection *m_actionCollection;
QList<BookmarkToolBar *> m_bookmarkToolBars;
QList<BookmarksPanel*> m_bookmarkPanels;
-
+
KActionMenu *_bookmarkActionMenu;
};
diff --git a/src/bookmarks/bookmarkspanel.cpp b/src/bookmarks/bookmarkspanel.cpp
index 75d8faf3..b49d4f5e 100644
--- a/src/bookmarks/bookmarkspanel.cpp
+++ b/src/bookmarks/bookmarkspanel.cpp
@@ -201,12 +201,12 @@ void BookmarksPanel::contextMenu(const QPoint &pos)
KBookmark selected = bookmarkForIndex(index);
- BookmarkContextMenu menu( selected,
- Application::bookmarkProvider()->bookmarkManager(),
- Application::bookmarkProvider()->bookmarkOwner(),
+ BookmarkContextMenu menu( selected,
+ Application::bookmarkProvider()->bookmarkManager(),
+ Application::bookmarkProvider()->bookmarkOwner(),
this
);
-
+
menu.exec(m_treeView->mapToGlobal(pos));
}
@@ -218,24 +218,5 @@ void BookmarksPanel::deleteBookmark()
return;
KBookmark bm = bookmarkForIndex(index);
- KBookmarkGroup bmg = bm.parentGroup();
- bool folder = bm.isGroup();
- QString name = QString(bm.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;
-
-
- bmg.deleteBookmark(bm);
- Application::instance()->bookmarkProvider()->bookmarkManager()->emitChanged(bmg);
+ Application::instance()->bookmarkProvider()->bookmarkOwner()->deleteBookmark(bm);
}