summaryrefslogtreecommitdiff
path: root/src/urlbar/urlbar.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-07-14 12:03:31 +0200
committerAndrea Diamantini <adjam7@gmail.com>2012-07-14 12:03:31 +0200
commite1dc349d6bc117b5db8b8229804c3600ae57da0a (patch)
tree9a83c9e8d7f984fbfaf335ee8ece31607d9d12d7 /src/urlbar/urlbar.cpp
parentSave a site snapshot when adding a favorite via the urlbar (diff)
downloadrekonq-e1dc349d6bc117b5db8b8229804c3600ae57da0a.tar.xz
Review boomarks management
Maybe this is a bit risky before release, but this lets us adding a bookmarks shortcut (CTRL+D) as used in the major browsers. With this commit, rekonq doubles this behavior. BUG: 303445
Diffstat (limited to 'src/urlbar/urlbar.cpp')
-rw-r--r--src/urlbar/urlbar.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index f3d759f7..21debceb 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -372,7 +372,7 @@ void UrlBar::loadFinished()
// show bookmark info
IconButton *bt = addRightIcon(UrlBar::BK);
- connect(bt, SIGNAL(clicked(QPoint)), this, SLOT(manageBookmarks(QPoint)));
+ connect(bt, SIGNAL(clicked(QPoint)), this, SLOT(manageBookmarks()));
// show favorite icon
IconButton *fbt = addRightIcon(UrlBar::Favorite);
@@ -697,12 +697,8 @@ void UrlBar::delSlot()
}
-void UrlBar::manageBookmarks(QPoint pos)
+void UrlBar::manageBookmarks()
{
- IconButton *bt = qobject_cast<IconButton *>(this->sender());
- if (!bt)
- return;
-
if (_tab->url().scheme() == QL1S("about"))
return;
@@ -713,8 +709,19 @@ void UrlBar::manageBookmarks(QPoint pos)
bookmark = rApp->bookmarkManager()->owner()->bookmarkCurrentPage();
}
+ // calculate position
+ int iconSize = IconSize(KIconLoader::Small) + c_iconMargin;
+
+ // Add a generic 10 to move it a bit below and right.
+ // No need to be precise...
+ int iconWidth = 10 + width() - ((iconSize + c_iconMargin));
+ int iconHeight = 10 + (height() - iconSize) / 2;
+
+ QPoint p = mapToGlobal(QPoint(iconWidth, iconHeight));
+
+ // show bookmark widget
BookmarkWidget *widget = new BookmarkWidget(bookmark, window());
- widget->showAt(pos);
+ widget->showAt(p);
}