summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/bookmarkscontextmenu.cpp183
-rw-r--r--src/bookmarks/bookmarkscontextmenu.h24
-rw-r--r--src/bookmarks/bookmarksmanager.cpp161
-rw-r--r--src/bookmarks/bookmarksmanager.h55
-rw-r--r--src/bookmarks/bookmarkspanel.cpp3
-rw-r--r--src/bookmarks/bookmarkstoolbar.cpp2
-rw-r--r--src/urlbar/bookmarkwidget.cpp11
7 files changed, 174 insertions, 265 deletions
diff --git a/src/bookmarks/bookmarkscontextmenu.cpp b/src/bookmarks/bookmarkscontextmenu.cpp
index eaf4a9d9..8f64ee4b 100644
--- a/src/bookmarks/bookmarkscontextmenu.cpp
+++ b/src/bookmarks/bookmarkscontextmenu.cpp
@@ -30,93 +30,40 @@
// Local Includes
#include "bookmarksmanager.h"
-// KDE Includes
-#include <KActionCollection>
-// Qt Includes
-#include <QClipboard>
-
-
-BookmarksContextMenu::BookmarksContextMenu(const KBookmark & bookmark, KBookmarkManager *manager, KBookmarkOwner *owner, QWidget *parent)
+BookmarksContextMenu::BookmarksContextMenu(const KBookmark &bookmark, KBookmarkManager *manager, BookmarkOwner *owner, QWidget *parent)
: KBookmarkContextMenu(bookmark, manager, owner, parent)
- , m_ac(new KActionCollection(this))
+ , bmOwner(owner)
{
- setupActions();
+ bmOwner->bookmarkSelected(bookmark);
}
BookmarksContextMenu::~BookmarksContextMenu()
{
- delete m_ac;
-}
-
-
-void BookmarksContextMenu::setupActions()
-{
- KAction* action;
-
- action = new KAction(KIcon("tab-new"), i18n("Open"), this);
- connect(action, SIGNAL(triggered()), this, SLOT(openInCurrentTab()));
- m_ac->addAction("open", action);
-
- action = new KAction(KIcon("tab-new"), i18n("Open in New Tab"), this);
- connect(action, SIGNAL(triggered()), this, SLOT(openInNewTab()));
- m_ac->addAction("open_tab", action);
-
- action = new KAction(KIcon("window-new"), i18n("Open in New Window"), this);
- connect(action, SIGNAL(triggered()), this, SLOT(openInNewWindow()));
- m_ac->addAction("open_window", action);
-
- action = new KAction(KIcon("bookmark-new"), i18n("Add Bookmark Here"), this);
- connect(action, SIGNAL(triggered()), this, SLOT(bookmarkCurrentPage()));
- m_ac->addAction("bookmark_page", action);
-
- action = new KAction(KIcon("folder-new"), i18n("New Bookmark Folder"), this);
- connect(action, SIGNAL(triggered()), this, SLOT(newBookmarkGroup()));
- m_ac->addAction("folder_new", action);
-
- action = new KAction(KIcon("edit-clear"), i18n("New Separator"), this);
- connect(action, SIGNAL(triggered()), this, SLOT(newSeparator()));
- m_ac->addAction("separator_new", action);
-
- action = new KAction(KIcon("edit-copy"), i18n("Copy Link Address"), this);
- connect(action, SIGNAL(triggered()), this, SLOT(copyToClipboard()));
- m_ac->addAction("copy", action);
-
- action = new KAction(KIcon("edit-delete"), i18n("Delete Bookmark"), this);
- connect(action, SIGNAL(triggered()), this, SLOT(deleteBookmark()));
- m_ac->addAction("delete", action);
-
- action = new KAction(KIcon("configure"), i18n("Properties"), this);
- connect(action, SIGNAL(triggered()), this, SLOT(editBookmark()));
- m_ac->addAction("properties", action);
-
- action = new KAction(KIcon("tab-new"), i18n("Open Folder in Tabs"), this);
- connect(action, SIGNAL(triggered()), this, SLOT(openFolderInTabs()));
- m_ac->addAction("open_all", action);
}
void BookmarksContextMenu::addBookmarkActions()
{
- addAction(m_ac->action("open"));
- addAction(m_ac->action("open_tab"));
- addAction(m_ac->action("open_window"));
+ addAction(bmOwner->action(BookmarkOwner::OPEN));
+ addAction(bmOwner->action(BookmarkOwner::OPEN_IN_TAB));
+ addAction(bmOwner->action(BookmarkOwner::OPEN_IN_WINDOW));
addSeparator();
- addAction(m_ac->action("bookmark_page"));
- addAction(m_ac->action("folder_new"));
- addAction(m_ac->action("separator_new"));
+ addAction(bmOwner->action(BookmarkOwner::BOOKMARK_PAGE));
+ addAction(bmOwner->action(BookmarkOwner::NEW_FOLDER));
+ addAction(bmOwner->action(BookmarkOwner::NEW_SEPARATOR));
addSeparator();
- addAction(m_ac->action("copy"));
+ addAction(bmOwner->action(BookmarkOwner::COPY));
addSeparator();
- addAction(m_ac->action("delete"));
- addAction(m_ac->action("properties"));
+ addAction(bmOwner->action(BookmarkOwner::EDIT));
+ addAction(bmOwner->action(BookmarkOwner::DELETE));
}
@@ -124,30 +71,38 @@ void BookmarksContextMenu::addFolderActions()
{
if (!bookmark().toGroup().first().isNull())
{
- addAction(m_ac->action("open_all"));
+ addAction(bmOwner->action(BookmarkOwner::OPEN_FOLDER));
addSeparator();
}
- addAction(m_ac->action("bookmark_page"));
- addAction(m_ac->action("folder_new"));
- addAction(m_ac->action("separator_new"));
+ addAction(bmOwner->action(BookmarkOwner::BOOKMARK_PAGE));
+ addAction(bmOwner->action(BookmarkOwner::NEW_FOLDER));
+ addAction(bmOwner->action(BookmarkOwner::NEW_SEPARATOR));
addSeparator();
- addAction(m_ac->action("delete"));
- addAction(m_ac->action("properties"));
+ addAction(bmOwner->action(BookmarkOwner::EDIT));
+ addAction(bmOwner->action(BookmarkOwner::DELETE));
}
void BookmarksContextMenu::addSeparatorActions()
{
- addAction(m_ac->action("bookmark_page"));
- addAction(m_ac->action("folder_new"));
- addAction(m_ac->action("separator_new"));
+ addAction(bmOwner->action(BookmarkOwner::BOOKMARK_PAGE));
+ addAction(bmOwner->action(BookmarkOwner::NEW_FOLDER));
+ addAction(bmOwner->action(BookmarkOwner::NEW_SEPARATOR));
addSeparator();
- addAction(m_ac->action("delete"));
+ addAction(bmOwner->action(BookmarkOwner::DELETE));
+}
+
+
+void BookmarksContextMenu::addNullActions()
+{
+ addAction(bmOwner->action(BookmarkOwner::BOOKMARK_PAGE));
+ addAction(bmOwner->action(BookmarkOwner::NEW_FOLDER));
+ addAction(bmOwner->action(BookmarkOwner::NEW_SEPARATOR));
}
@@ -157,92 +112,16 @@ void BookmarksContextMenu::addActions()
{
addFolderActions();
}
-
else if (bookmark().isSeparator())
{
addSeparatorActions();
}
-
else if (bookmark().isNull())
{
- addAction(m_ac->action("bookmark_page"));
- addAction(m_ac->action("folder_new"));
- addAction(m_ac->action("separator_new"));
+ addNullActions();
}
-
else
{
addBookmarkActions();
}
}
-
-
-void BookmarksContextMenu::openInCurrentTab()
-{
- Application::instance()->loadUrl(bookmark().url());
-}
-
-
-void BookmarksContextMenu::openInNewTab()
-{
- Application::instance()->loadUrl(bookmark().url(), Rekonq::NewTab);
-}
-
-
-void BookmarksContextMenu::openInNewWindow()
-{
- Application::instance()->loadUrl(bookmark().url(), Rekonq::NewWindow);
-}
-
-
-void BookmarksContextMenu::copyToClipboard()
-{
- if (bookmark().isNull())
- return;
-
- QClipboard *cb = QApplication::clipboard();
- cb->setText(bookmark().url().url());
-}
-
-
-void BookmarksContextMenu::deleteBookmark()
-{
- KBookmark bm = bookmark();
- Application::bookmarkProvider()->bookmarkOwner()->deleteBookmark(bm);
-}
-
-
-void BookmarksContextMenu::editBookmark()
-{
- KBookmark bm = bookmark();
- Application::bookmarkProvider()->bookmarkOwner()->editBookmark(bm);
-}
-
-
-void BookmarksContextMenu::openFolderInTabs()
-{
- if (bookmark().isGroup())
- owner()->openFolderinTabs(bookmark().toGroup());
-}
-
-
-void BookmarksContextMenu::newBookmarkGroup()
-{
- KBookmark bm = bookmark();
- Application::bookmarkProvider()->bookmarkOwner()->newBookmarkFolder(bm);
-}
-
-
-void BookmarksContextMenu::newSeparator()
-{
- KBookmark bm = bookmark();
- Application::bookmarkProvider()->bookmarkOwner()->newSeparator(bm);
-}
-
-
-void BookmarksContextMenu::bookmarkCurrentPage()
-{
- KBookmark bm = bookmark();
- Application::bookmarkProvider()->bookmarkOwner()->bookmarkPage(bm);
-}
-
diff --git a/src/bookmarks/bookmarkscontextmenu.h b/src/bookmarks/bookmarkscontextmenu.h
index c32c5962..424f8da4 100644
--- a/src/bookmarks/bookmarkscontextmenu.h
+++ b/src/bookmarks/bookmarkscontextmenu.h
@@ -30,36 +30,24 @@
// KDE Includes
#include <KBookmarkMenu>
+// Forward Declarations
+class BookmarkOwner;
class BookmarksContextMenu : public KBookmarkContextMenu
{
- Q_OBJECT
-
public:
- BookmarksContextMenu(const KBookmark & bk, KBookmarkManager * manager, KBookmarkOwner *owner, QWidget * parent = 0);
- ~BookmarksContextMenu();
+ BookmarksContextMenu(const KBookmark &bookmark, KBookmarkManager *manager, BookmarkOwner *owner, QWidget *parent = 0);
+ virtual ~BookmarksContextMenu();
virtual void addActions();
-private slots:
- void openInCurrentTab();
- void openInNewTab();
- void openInNewWindow();
- void copyToClipboard();
- void deleteBookmark();
- void openFolderInTabs();
- void editBookmark();
- void newBookmarkGroup();
- void newSeparator();
- void bookmarkCurrentPage();
-
private:
- void setupActions();
void addFolderActions();
void addBookmarkActions();
void addSeparatorActions();
+ void addNullActions();
- KActionCollection *m_ac;
+ BookmarkOwner *bmOwner;
};
#endif // BOOKMARKCONTEXTMENU_H
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp
index c4fa68a1..4e675e45 100644
--- a/src/bookmarks/bookmarksmanager.cpp
+++ b/src/bookmarks/bookmarksmanager.cpp
@@ -52,11 +52,13 @@
// Qt Includes
#include <QtCore/QFile>
#include <QtGui/QActionGroup>
+#include <QtGui/QClipboard>
-BookmarkOwner::BookmarkOwner(QObject *parent)
+BookmarkOwner::BookmarkOwner(KBookmarkManager *manager, QObject *parent)
: QObject(parent)
, KBookmarkOwner()
+ , m_manager(manager)
, actions(QVector<KAction*>(NUM_ACTIONS))
{
setupActions();
@@ -84,53 +86,49 @@ void BookmarkOwner::openBookmark(const KBookmark & bookmark,
}
-void BookmarkOwner::bookmarkPage(KBookmark &position)
+void BookmarkOwner::bookmarkCurrentPage()
{
- BookmarkOwner *owner = Application::bookmarkProvider()->bookmarkOwner();
-
KBookmarkGroup parent;
- if (!position.isNull())
+ if (!selected.isNull())
{
- if (position.isGroup())
- parent = position.toGroup();
+ if (selected.isGroup())
+ parent = selected.toGroup();
else
- parent = position.parentGroup();
+ parent = selected.parentGroup();
- KBookmark newBk = parent.addBookmark(owner->currentTitle().replace('&', "&&"), KUrl(owner->currentUrl()));
- parent.moveBookmark(newBk, position.parentGroup().previous(position));
+ KBookmark newBk = parent.addBookmark(currentTitle().replace('&', "&&"), KUrl(currentUrl()));
+ parent.moveBookmark(newBk, selected);
}
else
{
parent = Application::bookmarkProvider()->rootGroup();
- parent.addBookmark(owner->currentTitle(), KUrl(owner->currentUrl()));
+ parent.addBookmark(currentTitle(), KUrl(currentUrl()));
}
- Application::bookmarkProvider()->bookmarkManager()->emitChanged(parent);
+ m_manager->emitChanged(parent);
}
-void BookmarkOwner::newBookmarkFolder(KBookmark &position)
+void BookmarkOwner::newBookmarkFolder()
{
- BookmarkOwner *owner = Application::bookmarkProvider()->bookmarkOwner();
- KBookmarkManager *manager = Application::bookmarkProvider()->bookmarkManager();
-
- KBookmarkDialog *dialog = owner->bookmarkDialog(manager, QApplication::activeWindow());
+ KBookmarkDialog *dialog = bookmarkDialog(m_manager, QApplication::activeWindow());
QString folderName = i18n("New folder");
- if (!position.isNull())
+ if (!selected.isNull())
{
- if (position.isGroup())
+ if (selected.isGroup())
{
- dialog->createNewFolder(folderName, position);
+ dialog->createNewFolder(folderName, selected);
}
else
{
- KBookmark newBk = dialog->createNewFolder(folderName, position.parentGroup());
+ KBookmark newBk = dialog->createNewFolder(folderName, selected.parentGroup());
if (!newBk.isNull())
{
- position.parentGroup().moveBookmark(newBk, position);
- manager->emitChanged(newBk.parentGroup());
+ KBookmarkGroup parent = newBk.parentGroup();
+ parent.moveBookmark(newBk, selected);
+ m_manager->emitChanged(parent);
}
}
}
@@ -143,58 +141,63 @@ void BookmarkOwner::newBookmarkFolder(KBookmark &position)
}
-void BookmarkOwner::newSeparator(KBookmark &position)
+void BookmarkOwner::newSeparator()
{
KBookmark newBk;
- if (!position.isNull())
+ if (!selected.isNull())
{
- if (position.isGroup())
- newBk = position.toGroup().createNewSeparator();
+ if (selected.isGroup())
+ {
+ newBk = selected.toGroup().createNewSeparator();
+ }
else
- newBk = position.parentGroup().createNewSeparator();
+ {
+ newBk = selected.parentGroup().createNewSeparator();
+ newBk.parentGroup().moveBookmark(newBk, selected);
+ }
}
else
{
newBk = Application::bookmarkProvider()->rootGroup().createNewSeparator();
}
- KBookmarkGroup parent = newBk.parentGroup();
- newBk.setIcon("edit-clear");
+ newBk.setIcon(("edit-clear"));
- if (!position.isNull())
- parent.moveBookmark(newBk, position);
-
- Application::bookmarkProvider()->bookmarkManager()->emitChanged(parent);
+ m_manager->emitChanged(newBk.parentGroup());
}
-void BookmarkOwner::editBookmark(KBookmark &bookmark)
+void BookmarkOwner::editBookmark()
{
- BookmarkOwner *owner = Application::bookmarkProvider()->bookmarkOwner();
- KBookmarkManager *manager = Application::bookmarkProvider()->bookmarkManager();
+ if (selected.isNull())
+ return;
- bookmark.setFullText(bookmark.fullText().replace("&&", "&"));
- KBookmarkDialog *dialog = owner->bookmarkDialog(manager, QApplication::activeWindow());
+ selected.setFullText(selected.fullText().replace("&&", "&"));
+ KBookmarkDialog *dialog = bookmarkDialog(m_manager, QApplication::activeWindow());
- dialog->editBookmark(bookmark);
- bookmark.setFullText(bookmark.fullText().replace('&', "&&"));
+ dialog->editBookmark(selected);
+ selected.setFullText(selected.fullText().replace('&', "&&"));
delete dialog;
}
-bool BookmarkOwner::deleteBookmark(KBookmark &bookmark)
+bool BookmarkOwner::deleteBookmark()
{
- QString name = QString(bookmark.fullText()).replace("&&", "&");
+ if (selected.isNull())
+ return false;
+
+ KBookmarkGroup bmg = selected.parentGroup();
+ QString name = QString(selected.fullText()).replace("&&", "&");
QString dialogCaption, dialogText;
- if (bookmark.isGroup())
+ if (selected.isGroup())
{
dialogCaption = i18n("Bookmark Folder Deletion");
dialogText = i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", name);
}
- else if (bookmark.isSeparator())
+ else if (selected.isSeparator())
{
dialogCaption = i18n("Separator Deletion");
dialogText = i18n("Are you sure you wish to remove this separator?", name);
@@ -216,9 +219,8 @@ bool BookmarkOwner::deleteBookmark(KBookmark &bookmark)
)
return false;
- KBookmarkGroup bmg = bookmark.parentGroup();
- bmg.deleteBookmark(bookmark);
- Application::bookmarkProvider()->bookmarkManager()->emitChanged(bmg);
+ bmg.deleteBookmark(selected);
+ m_manager->emitChanged(bmg);
return true;
}
@@ -285,6 +287,63 @@ QList< QPair<QString, QString> > BookmarkOwner::currentBookmarkList() const
}
+void BookmarkOwner::bookmarkSelected(const KBookmark &bookmark)
+{
+ selected = bookmark;
+}
+
+
+void BookmarkOwner::openBookmark()
+{
+ emit openUrl(selected.url(), Rekonq::CurrentTab);
+}
+
+
+void BookmarkOwner::openBookmarkInNewTab()
+{
+ emit openUrl(selected.url(), Rekonq::NewTab);
+}
+
+
+void BookmarkOwner::openBookmarkInNewWindow()
+{
+ emit openUrl(selected.url(), Rekonq::NewWindow);
+}
+
+
+void BookmarkOwner::openBookmarkFolder()
+{
+ if (!selected.isGroup())
+ return;
+
+ QList<KUrl> urlList = selected.toGroup().groupUrlList();
+
+ if (urlList.length() > 8)
+ {
+ if (KMessageBox::warningContinueCancel(
+ Application::instance()->mainWindow(),
+ i18n("You are about to open %1 tabs.\nAre you sure?", urlList.length()))
+ != KMessageBox::Continue
+ )
+ return;
+ }
+
+ foreach (KUrl url, urlList)
+ {
+ emit openUrl(url, Rekonq::NewFocusedTab);
+ }
+}
+
+
+void BookmarkOwner::copyLink()
+{
+ if (selected.isNull())
+ return;
+
+ QApplication::clipboard()->setText(selected.url().url());
+}
+
+
void BookmarkOwner::setupActions()
{
createAction(OPEN, i18n("Open"), "tab-new",
@@ -294,11 +353,11 @@ void BookmarkOwner::setupActions()
createAction(OPEN_IN_WINDOW, i18n("Open in New Window"), "window-new",
i18n("Open bookmark in new window"), SLOT(openBookmarkInNewWindow()));
createAction(OPEN_FOLDER, i18n("Open Folder in Tabs"), "tab-new",
- i18n("Open all the bookmarks in folder in tabs"), SLOT(openBookmarkGroup()));
+ i18n("Open all the bookmarks in folder in tabs"), SLOT(openBookmarkFolder()));
createAction(BOOKMARK_PAGE, i18n("Add Bookmark"), "bookmark-new",
i18n("Bookmark current page"), SLOT(bookmarkCurrentPage()));
createAction(NEW_FOLDER, i18n("New Folder"), "folder-new",
- i18n("Create a new bookmark folder"), SLOT(newBookmarkGroup()));
+ i18n("Create a new bookmark folder"), SLOT(newBookmarkFolder()));
createAction(NEW_SEPARATOR, i18n("New Separator"), "edit-clear",
i18n("Create a new bookmark separatork"), SLOT(newSeparator()));
createAction(COPY, i18n("Copy Link"), "edit-copy",
@@ -355,7 +414,7 @@ BookmarkProvider::BookmarkProvider(QObject *parent)
this, SLOT(slotBookmarksChanged(const QString &, const QString &)));
// setup menu
- m_owner = new BookmarkOwner(this);
+ m_owner = new BookmarkOwner(m_manager, this);
connect(m_owner, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType &)), this, SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType &)));
KAction *a = KStandardAction::addBookmark(this, SLOT(slotAddBookmark()), this);
diff --git a/src/bookmarks/bookmarksmanager.h b/src/bookmarks/bookmarksmanager.h
index af2cb158..7cbf0116 100644
--- a/src/bookmarks/bookmarksmanager.h
+++ b/src/bookmarks/bookmarksmanager.h
@@ -67,14 +67,7 @@ class REKONQ_TESTS_EXPORT BookmarkOwner : public QObject , public KBookmarkOwner
Q_OBJECT
public:
-
- /**
- * @short The class constructor.
- *
- * @param parent the pointer parent Bookmark provider. We need it
- * to get pointer to MainWindow
- */
- BookmarkOwner(QObject *parent = 0);
+ explicit BookmarkOwner(KBookmarkManager *manager, QObject *parent = 0);
virtual ~BookmarkOwner() {}
enum BookmarkAction
@@ -112,35 +105,6 @@ public:
/**
- * Bookmarks the current page.
- * @param position Where to insert the bookmark.
- */
- static void bookmarkPage(KBookmark &position);
- /**
- * Creates a new bookmark folder.
- * @param position Where to insert the folder.
- */
- static void newBookmarkFolder(KBookmark &position);
- /**
- * Creates a new separator.
- * @param position Where to insert the separator.
- */
- static void newSeparator(KBookmark &position);
-
- /**
- * Opens the edit dialog for a bookmark.
- * @param bookmark The bookmark to edit.
- */
- static void editBookmark(KBookmark &bookmark);
- /**
- * 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
* to the bookmark list, returning the URL page as QString.
*
@@ -179,8 +143,25 @@ signals:
*/
void openUrl(const KUrl &, const Rekonq::OpenType &);
+public slots:
+ void bookmarkSelected(const KBookmark &bookmark);
+
+ void openBookmark();
+ void openBookmarkInNewTab();
+ void openBookmarkInNewWindow();
+ void openBookmarkFolder();
+ void bookmarkCurrentPage();
+ void newBookmarkFolder();
+ void newSeparator();
+ void copyLink();
+ void editBookmark();
+ bool deleteBookmark();
+
private:
+ KBookmarkManager *m_manager;
+
QVector<KAction*> actions;
+ KBookmark selected;
void setupActions();
void createAction(const BookmarkAction &action,
diff --git a/src/bookmarks/bookmarkspanel.cpp b/src/bookmarks/bookmarkspanel.cpp
index 72778f7a..3ab49c1e 100644
--- a/src/bookmarks/bookmarkspanel.cpp
+++ b/src/bookmarks/bookmarkspanel.cpp
@@ -218,5 +218,6 @@ void BookmarksPanel::deleteBookmark()
return;
KBookmark bm = bookmarkForIndex(index);
- Application::instance()->bookmarkProvider()->bookmarkOwner()->deleteBookmark(bm);
+ Application::instance()->bookmarkProvider()->bookmarkOwner()->bookmarkSelected(bm);
+ Application::instance()->bookmarkProvider()->bookmarkOwner()->deleteBookmark();
}
diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp
index 1ec1d677..3fd9cdc7 100644
--- a/src/bookmarks/bookmarkstoolbar.cpp
+++ b/src/bookmarks/bookmarkstoolbar.cpp
@@ -65,7 +65,7 @@ KMenu * BookmarkMenu::contextMenu(QAction *act)
KBookmarkActionInterface* action = dynamic_cast<KBookmarkActionInterface *>(act);
if (!action)
return 0;
- return new BookmarksContextMenu(action->bookmark(), manager(), owner());
+ return new BookmarksContextMenu(action->bookmark(), manager(), static_cast<BookmarkOwner*>(owner()));
}
diff --git a/src/urlbar/bookmarkwidget.cpp b/src/urlbar/bookmarkwidget.cpp
index ccfe4914..196c9df1 100644
--- a/src/urlbar/bookmarkwidget.cpp
+++ b/src/urlbar/bookmarkwidget.cpp
@@ -57,12 +57,12 @@ BookmarkWidget::BookmarkWidget(const KBookmark &bookmark, QWidget *parent)
setLayout(layout);
QHBoxLayout *hLayout = new QHBoxLayout();
-
+
QLabel *bookmarkIcon = new QLabel(this);
bookmarkIcon->setPixmap(KIcon("bookmarks").pixmap(32, 32));
hLayout->addWidget(bookmarkIcon);
hLayout->setSpacing(10);
-
+
QVBoxLayout *vLayout = new QVBoxLayout();
QLabel *bookmarkInfo = new QLabel(this);
@@ -70,13 +70,13 @@ BookmarkWidget::BookmarkWidget(const KBookmark &bookmark, QWidget *parent)
QFont font;
font.setPointSize(font.pointSize() + 2);
bookmarkInfo->setFont(font);
-
+
vLayout->addWidget(bookmarkInfo);
QPushButton *removeButton = new QPushButton(this);
removeButton->setText(i18n("Remove this Bookmark"));
connect(removeButton, SIGNAL(clicked()), this, SLOT(removeBookmark()));
-
+
vLayout->addWidget(removeButton);
hLayout->addLayout(vLayout);
layout->addItem(hLayout);
@@ -152,6 +152,7 @@ void BookmarkWidget::showAt(const QPoint &pos)
void BookmarkWidget::removeBookmark()
{
- Application::bookmarkProvider()->bookmarkOwner()->deleteBookmark(m_bookmark);
+ Application::bookmarkProvider()->bookmarkOwner()->bookmarkSelected(m_bookmark);
+ Application::bookmarkProvider()->bookmarkOwner()->deleteBookmark();
reject();
}