summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-09-30 11:20:33 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-09-30 11:20:33 +0200
commit1888aa3f174b255197083918279692b4f73ebc2d (patch)
tree19f557c8ecc75dffd91c1cc1b555f42f44ce5317
parentrekonq 0.2.61 with new home page (diff)
downloadrekonq-1888aa3f174b255197083918279692b4f73ebc2d.tar.xz
Turned "Add bookmark" action to KDE one and implemented an "add to preferred"
mechanism (an action in the contextual menu)
-rw-r--r--src/bookmarks.cpp2
-rw-r--r--src/mainwindow.cpp28
-rw-r--r--src/mainwindow.h3
-rw-r--r--src/webview.cpp1
4 files changed, 32 insertions, 2 deletions
diff --git a/src/bookmarks.cpp b/src/bookmarks.cpp
index c542701c..e7f572b2 100644
--- a/src/bookmarks.cpp
+++ b/src/bookmarks.cpp
@@ -115,7 +115,7 @@ BookmarkMenu::BookmarkMenu(KBookmarkManager *manager,
{
KAction *a = KStandardAction::addBookmark(this, SLOT(slotAddBookmark()), this);
- a->setText(i18n("Add Bookmark"));
+// a->setText(i18n("Bookmark this Page"));
actionCollection->addAction(QLatin1String("rekonq_add_bookmark"),a);
}
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index e0aed6e7..c5f3c556 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -355,12 +355,17 @@ void MainWindow::setupActions()
qa->setText( i18n("Bookmarks Toolbar") );
qa->setIcon( KIcon("bookmark-toolbar") );
actionCollection()->addAction(QLatin1String("bm_bar"), qa);
-
+
// Bookmark Menu
KActionMenu *bmMenu = Application::bookmarkProvider()->bookmarkActionMenu(this);
bmMenu->setIcon(KIcon("rating"));
bmMenu->setDelayed(false);
actionCollection()->addAction(QLatin1String("bookmarksActionMenu"), bmMenu);
+
+ // Add to preferred
+ a = new KAction(KIcon("rating"), i18n("Add to preferred"), this);
+ actionCollection()->addAction(QLatin1String("add_to_preferred"), a);
+ connect(a, SIGNAL(triggered(bool)), this, SLOT(addPreferredLink()));
}
@@ -1025,3 +1030,24 @@ void MainWindow::slotOpenActionUrl(QAction *action)
}
}
}
+
+
+void MainWindow::addPreferredLink()
+{
+ QString name = currentTab()->title();
+ QString url = currentTab()->url().path();
+
+ QStringList names = ReKonfig::previewNames();
+ QStringList urls = ReKonfig::previewUrls();
+
+ names.prepend(name);
+ if(names.count() > 8)
+ names.removeLast();
+
+ urls.prepend(url);
+ if(urls.count() > 8)
+ urls.removeLast();
+
+ ReKonfig::setPreviewNames(names);
+ ReKonfig::setPreviewUrls(urls);
+}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index b2c41b49..f1bc6bc8 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -140,6 +140,9 @@ private slots:
void slotAboutToShowBackMenu();
void slotOpenActionUrl(QAction *action);
+ // add link to the preferred shown in the rekonq homepage
+ void addPreferredLink();
+
private:
MainView *m_view;
FindBar *m_findBar;
diff --git a/src/webview.cpp b/src/webview.cpp
index e4d98298..fac98f71 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -274,6 +274,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(mainwindow->actionByName(KStandardAction::name(KStandardAction::SaveAs)));
menu.addAction(mainwindow->actionByName("page_source"));
+ menu.addAction(mainwindow->actionByName("add_to_preferred"));
QAction *addBookmarkAction = Application::bookmarkProvider()->actionByName("rekonq_add_bookmark");
menu.addAction(addBookmarkAction);