From 92a5daa103a54c2c4253d45cc882da1990bfbd03 Mon Sep 17 00:00:00 2001 From: matgic78 Date: Wed, 14 Oct 2009 16:45:18 +0200 Subject: favorites management -right click menu to set the preview url by selecting one of the 15 last history entries -abitlity to remove previews and manage empty previews (show a toolbutton to set the url) -contextmenu->add to favorites now adds preview in an empty space when there is one -modified the loop used in HomePage::lastVisited because I encountered an infinite loop with it. (and because it is simpler this way) --- src/mainwindow.cpp | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ac9b83bb..8bd05dc7 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1076,18 +1076,33 @@ void MainWindow::slotOpenActionUrl(QAction *action) void MainWindow::addFavoriteLink() { QString name = currentTab()->title(); - QString url = currentTab()->url().pathOrUrl(); + QString url = currentTab()->url().prettyUrl(KUrl::RemoveTrailingSlash); 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(); + for (int i = 0; i < 8 && i < urls.size() ; ++i) + { + if(urls.at(i).isEmpty() || urls.at(i) == url) + { + names.replace(i, name); + urls.replace(i, url); + break; + } + if(i == 7) + { + names.prepend(name); + if(names.count() > 8) + names.removeLast(); + + urls.prepend(url); + if(urls.count() > 8) + urls.removeLast(); + + break; + } + } ReKonfig::setPreviewNames(names); ReKonfig::setPreviewUrls(urls); -- cgit v1.2.1