summaryrefslogtreecommitdiff
path: root/src/urlbar
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
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')
-rw-r--r--src/urlbar/urlbar.cpp21
-rw-r--r--src/urlbar/urlbar.h7
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();