summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2013-01-17 19:05:20 +0100
committerAndrea Diamantini <adjam7@gmail.com>2013-01-17 19:05:20 +0100
commit45f75ad2e9e9fffc730d2a99889be21fac9907e3 (patch)
treecc2296e85e1610967ace1b89fc689ace6bb9bc23 /src
parentfix url icon when dragging from bk toolbar. (diff)
downloadrekonq-45f75ad2e9e9fffc730d2a99889be21fac9907e3.tar.xz
Clean up BookmarkOwner API, restore bk middle click action
BUG: 313127
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/bookmarkowner.cpp20
-rw-r--r--src/bookmarks/bookmarkowner.h8
-rw-r--r--src/bookmarks/bookmarkstoolbar.cpp27
3 files changed, 34 insertions, 21 deletions
diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp
index ba2d8f63..f1f0aefb 100644
--- a/src/bookmarks/bookmarkowner.cpp
+++ b/src/bookmarks/bookmarkowner.cpp
@@ -71,16 +71,16 @@ KAction* BookmarkOwner::createAction(const KBookmark &bookmark, const BookmarkAc
{
case OPEN:
return createAction(i18n("Open"), "tab-new",
- i18n("Open bookmark in current tab"), SLOT(openBookmark(KBookmark)), bookmark);
+ i18n("Open bookmark in current tab"), SLOT(loadBookmark(KBookmark)), bookmark);
case OPEN_IN_TAB:
return createAction(i18n("Open in New Tab"), "tab-new",
- i18n("Open bookmark in new tab"), SLOT(openBookmarkInNewTab(KBookmark)), bookmark);
+ i18n("Open bookmark in new tab"), SLOT(loadBookmarkInNewTab(KBookmark)), bookmark);
case OPEN_IN_WINDOW:
return createAction(i18n("Open in New Window"), "window-new",
- i18n("Open bookmark in new window"), SLOT(openBookmarkInNewWindow(KBookmark)), bookmark);
+ i18n("Open bookmark in new window"), SLOT(loadBookmarkInNewWindow(KBookmark)), bookmark);
case OPEN_FOLDER:
return createAction(i18n("Open Folder in Tabs"), "tab-new",
- i18n("Open all the bookmarks in folder in tabs"), SLOT(openBookmarkFolder(KBookmark)), bookmark);
+ i18n("Open all the bookmarks in folder in tabs"), SLOT(loadBookmarkFolder(KBookmark)), bookmark);
case BOOKMARK_PAGE:
return createAction(i18n("Add Bookmark"), "bookmark-new",
i18n("Bookmark current page"), SLOT(bookmarkCurrentPage(KBookmark)), bookmark);
@@ -152,9 +152,9 @@ void BookmarkOwner::openBookmark(const KBookmark &bookmark,
Qt::KeyboardModifiers keyboardModifiers)
{
if (keyboardModifiers & Qt::ControlModifier || mouseButtons & Qt::MidButton)
- openBookmarkInNewTab(bookmark);
+ loadBookmarkInNewTab(bookmark);
else
- openBookmark(bookmark);
+ loadBookmark(bookmark);
}
@@ -181,25 +181,25 @@ void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bkGoup)
}
-void BookmarkOwner::openBookmark(const KBookmark &bookmark)
+void BookmarkOwner::loadBookmark(const KBookmark &bookmark)
{
emit openUrl(bookmark.url(), Rekonq::CurrentTab);
}
-void BookmarkOwner::openBookmarkInNewTab(const KBookmark &bookmark)
+void BookmarkOwner::loadBookmarkInNewTab(const KBookmark &bookmark)
{
emit openUrl(bookmark.url(), Rekonq::NewTab);
}
-void BookmarkOwner::openBookmarkInNewWindow(const KBookmark &bookmark)
+void BookmarkOwner::loadBookmarkInNewWindow(const KBookmark &bookmark)
{
emit openUrl(bookmark.url(), Rekonq::NewWindow);
}
-void BookmarkOwner::openBookmarkFolder(const KBookmark &bookmark)
+void BookmarkOwner::loadBookmarkFolder(const KBookmark &bookmark)
{
Q_ASSERT(bookmark.isGroup());
openFolderinTabs(bookmark.toGroup());
diff --git a/src/bookmarks/bookmarkowner.h b/src/bookmarks/bookmarkowner.h
index 6a18c237..c149a6e1 100644
--- a/src/bookmarks/bookmarkowner.h
+++ b/src/bookmarks/bookmarkowner.h
@@ -102,10 +102,10 @@ public:
// @}
public Q_SLOTS:
- void openBookmark(const KBookmark &bookmark);
- void openBookmarkInNewTab(const KBookmark &bookmark);
- void openBookmarkInNewWindow(const KBookmark &bookmark);
- void openBookmarkFolder(const KBookmark &bookmark);
+ void loadBookmark(const KBookmark &bookmark);
+ void loadBookmarkInNewTab(const KBookmark &bookmark);
+ void loadBookmarkInNewWindow(const KBookmark &bookmark);
+ void loadBookmarkFolder(const KBookmark &bookmark);
KBookmark bookmarkCurrentPage(const KBookmark &bookmark = KBookmark());
KBookmarkGroup newBookmarkFolder(const KBookmark &bookmark = KBookmark(), const QString &name = QString());
diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp
index b025aa61..c570622f 100644
--- a/src/bookmarks/bookmarkstoolbar.cpp
+++ b/src/bookmarks/bookmarkstoolbar.cpp
@@ -543,17 +543,30 @@ bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
int distance = (destPos - m_startDragPos).manhattanLength();
KBookmarkActionInterface *action = dynamic_cast<KBookmarkActionInterface *>(actionAt(destPos));
- if (action && action->bookmark().isGroup())
+ if (action)
{
- if (mouseEvent->button() == Qt::MidButton)
+ if (action->bookmark().isGroup())
{
- BookmarkManager::self()->owner()->openBookmarkFolder(action->bookmark());
+ if (mouseEvent->button() == Qt::MidButton)
+ {
+ BookmarkManager::self()->owner()->loadBookmarkFolder(action->bookmark());
+ }
+ else if (distance < QApplication::startDragDistance())
+ {
+ KBookmarkActionMenu *menu = dynamic_cast<KBookmarkActionMenu *>(actionAt(m_startDragPos));
+ QPoint actionPos = mapToGlobal(widgetForAction(menu)->pos());
+ menu->menu()->popup(QPoint(actionPos.x(), actionPos.y() + widgetForAction(menu)->height()));
+ }
}
- else if (distance < QApplication::startDragDistance())
+ else
{
- KBookmarkActionMenu *menu = dynamic_cast<KBookmarkActionMenu *>(actionAt(m_startDragPos));
- QPoint actionPos = mapToGlobal(widgetForAction(menu)->pos());
- menu->menu()->popup(QPoint(actionPos.x(), actionPos.y() + widgetForAction(menu)->height()));
+ if (!action->bookmark().isNull() && !action->bookmark().isSeparator())
+ {
+ if (mouseEvent->button() == Qt::MidButton)
+ {
+ BookmarkManager::self()->owner()->loadBookmarkInNewTab(action->bookmark());
+ }
+ }
}
}
}