From e1dc349d6bc117b5db8b8229804c3600ae57da0a Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 14 Jul 2012 12:03:31 +0200 Subject: 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 --- src/urlbar/urlbar.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'src/urlbar/urlbar.cpp') 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(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); } -- cgit v1.2.1