summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
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 /src/mainwindow.cpp
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)
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp28
1 files changed, 27 insertions, 1 deletions
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);
+}