diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-09-30 11:20:33 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-09-30 11:20:33 +0200 |
commit | 1888aa3f174b255197083918279692b4f73ebc2d (patch) | |
tree | 19f557c8ecc75dffd91c1cc1b555f42f44ce5317 /src | |
parent | rekonq 0.2.61 with new home page (diff) | |
download | rekonq-1888aa3f174b255197083918279692b4f73ebc2d.tar.xz |
Turned "Add bookmark" action to KDE one and implemented an "add to preferred"
mechanism (an action in the contextual menu)
Diffstat (limited to 'src')
-rw-r--r-- | src/bookmarks.cpp | 2 | ||||
-rw-r--r-- | src/mainwindow.cpp | 28 | ||||
-rw-r--r-- | src/mainwindow.h | 3 | ||||
-rw-r--r-- | src/webview.cpp | 1 |
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); |