diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-04-17 15:47:42 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-04-17 15:47:42 +0200 |
commit | 3111b2b469b0ce1077a4630ec2cc1de42d1ece6a (patch) | |
tree | c3cbd2df492730449fcb975ba1dc522efdbf2147 | |
parent | As we are providing an "Add preview" mechanism, no need to show 6 (diff) | |
parent | Fix a bug in NewTabPage::snapFinished (diff) | |
download | rekonq-3111b2b469b0ce1077a4630ec2cc1de42d1ece6a.tar.xz |
Merge commit 'refs/merge-requests/79' of git://gitorious.org/rekonq/mainline into m79
-rw-r--r-- | src/newtabpage.cpp | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp index 043648e7..d7671937 100644 --- a/src/newtabpage.cpp +++ b/src/newtabpage.cpp @@ -283,20 +283,9 @@ void NewTabPage::setupPreview(QWebElement e, int index) void NewTabPage::snapFinished(int index, const KUrl &url, const QString &title) { - // do not try to modify the page if it isn't the newTabPage - if(m_root.document().findAll("#rekonq-newtabpage").count() == 0) - return; - - QWebElement prev = m_root.findFirst("#preview" + QVariant(index).toString()); - QWebElement newPrev = validPreview(index, url, title); - - if(m_root.findAll(".closedTabs").count() != 0) - hideControls(newPrev); - - prev.replace(newPrev); - - // update title - if(m_root.findAll(".favorites").count() != 0) + // Update title if necessary + QStringList urls = ReKonfig::previewUrls(); + if(KUrl(urls.at(index)) == url) { QStringList names = ReKonfig::previewNames(); names.replace(index, title); @@ -304,6 +293,23 @@ void NewTabPage::snapFinished(int index, const KUrl &url, const QString &title) ReKonfig::self()->writeConfig(); } + + // Update page, but only if open + if(m_root.document().findAll("#rekonq-newtabpage").count() == 0) + return; + if(m_root.findAll(".favorites").count() == 0 && m_root.findAll(".closedTabs").count() == 0) + return; + + QWebElement prev = m_root.findFirst("#preview" + QVariant(index).toString()); + if(KUrl(prev.findFirst("a").attribute("href")) == url) + { + QWebElement newPrev = validPreview(index, url, title); + + if(m_root.findAll(".closedTabs").count() != 0) + hideControls(newPrev); + + prev.replace(newPrev); + } } |