diff options
Diffstat (limited to 'src/urlbar')
-rw-r--r-- | src/urlbar/urlbar.cpp | 21 | ||||
-rw-r--r-- | src/urlbar/urlbar.h | 7 |
2 files changed, 20 insertions, 8 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); } diff --git a/src/urlbar/urlbar.h b/src/urlbar/urlbar.h index fadd2f95..b2cf44ac 100644 --- a/src/urlbar/urlbar.h +++ b/src/urlbar/urlbar.h @@ -95,6 +95,12 @@ public: public Q_SLOTS: void setQUrl(const QUrl &url); + /** + * Let us add bookmarks as the major browsers do + * + */ + void manageBookmarks(); + private Q_SLOTS: void loadRequestedUrl(const KUrl& url, Rekonq::OpenType = Rekonq::CurrentTab); @@ -106,7 +112,6 @@ private Q_SLOTS: void detectTypedString(const QString &); void suggest(); - void manageBookmarks(QPoint); void manageFavorites(QPoint); void refreshFavicon(); |