diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-10-15 00:21:09 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-10-15 00:21:09 +0200 |
commit | 0fbcfd6a77f41c0248f65537f615b4046433c6a0 (patch) | |
tree | 81bf41f48c1d31e613b4cf58104ab2229668d88e /src/mainwindow.cpp | |
parent | Merge commit 'refs/merge-requests/1806' of git://gitorious.org/rekonq/mainline (diff) | |
parent | favorites management (diff) | |
download | rekonq-0fbcfd6a77f41c0248f65537f615b4046433c6a0.tar.xz |
Merge commit 'refs/merge-requests/1805' of git://gitorious.org/rekonq/mainline into matgic
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index c0008cba..62f82e58 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1089,18 +1089,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); |