From 508540644f1abd8728633f0678a748a7c3c94c22 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 23 Jan 2013 17:37:54 +0100 Subject: Remove double "rekonq - rekonq" from title --- src/webwindow/webwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/webwindow/webwindow.cpp b/src/webwindow/webwindow.cpp index d512620d..33cb6142 100644 --- a/src/webwindow/webwindow.cpp +++ b/src/webwindow/webwindow.cpp @@ -673,7 +673,7 @@ QString WebWindow::title() const if (url().isLocalFile()) return url().fileName(); else - return QL1S("rekonq"); + return url().prettyUrl(); } return t; -- cgit v1.2.1 From facc2f92fe73d4e925510fcb2936483798efba6a Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 23 Jan 2013 19:04:05 +0100 Subject: Improve icon management code In the 1.x way, IconManager notified all the tabs about icons changed. This way, just the interested tab is :) --- src/icons/iconmanager.cpp | 14 +------------- src/icons/iconmanager.h | 3 --- src/tabwindow/tabwindow.cpp | 30 ++++++++++++++++++++++++++++++ src/tabwindow/tabwindow.h | 1 + src/webtab/webpage.cpp | 3 --- src/webwindow/webwindow.cpp | 1 + src/webwindow/webwindow.h | 3 ++- 7 files changed, 35 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/icons/iconmanager.cpp b/src/icons/iconmanager.cpp index 49d637ad..e0408577 100644 --- a/src/icons/iconmanager.cpp +++ b/src/icons/iconmanager.cpp @@ -115,27 +115,15 @@ void IconManager::provideIcon(QWebFrame *mFrame, const KUrl &url, bool notify) { // provide icons just for http/https sites if (!url.scheme().startsWith(QL1S("http"))) - { - if (notify) - emit iconChanged(); return; - } // do not load new icons in private browsing.. if (mFrame->page()->settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) - { - if (notify) - emit iconChanged(); return; - } // check if icon exists if (!favIconForUrl(url).isEmpty()) - { - if (notify) - emit iconChanged(); return; - } // the simplest way.. const QString rootUrlString = url.scheme() + QL1S("://") + url.host(); @@ -165,7 +153,7 @@ void IconManager::provideIcon(QWebFrame *mFrame, const KUrl &url, bool notify) IconDownloader *id = new IconDownloader(faviconUrl, destUrl, this); if (notify) - connect(id, SIGNAL(iconReady()), this, SIGNAL(iconChanged())); + connect(id, SIGNAL(iconReady()), mFrame, SIGNAL(iconChanged())); } diff --git a/src/icons/iconmanager.h b/src/icons/iconmanager.h index 02ae6763..9f39f965 100644 --- a/src/icons/iconmanager.h +++ b/src/icons/iconmanager.h @@ -64,9 +64,6 @@ public: void saveDesktopIconForUrl(const KUrl &u); -Q_SIGNALS: - void iconChanged(); - private: IconManager(QObject *parent = 0); diff --git a/src/tabwindow/tabwindow.cpp b/src/tabwindow/tabwindow.cpp index e0b6224a..4f58ce3e 100644 --- a/src/tabwindow/tabwindow.cpp +++ b/src/tabwindow/tabwindow.cpp @@ -247,6 +247,7 @@ WebWindow *TabWindow::prepareNewTab(WebPage *page) WebWindow *tab = new WebWindow(this, _isPrivateBrowsing, page); connect(tab, SIGNAL(titleChanged(QString)), this, SLOT(tabTitleChanged(QString))); + connect(tab, SIGNAL(iconChanged()), this, SLOT(tabIconChanged())); connect(tab, SIGNAL(loadStarted()), this, SLOT(tabLoadStarted())); connect(tab, SIGNAL(loadFinished(bool)), this, SLOT(tabLoadFinished(bool))); @@ -409,6 +410,33 @@ void TabWindow::tabTitleChanged(const QString &title) } +void TabWindow::tabIconChanged() +{ + WebWindow *tab = qobject_cast(sender()); + if (!tab) + return; + + if (tab->isLoading()) + return; + + int index = indexOf(tab); + + if (-1 == index) + return; + + QLabel *label = qobject_cast(tabBar()->tabButton(index, QTabBar::LeftSide)); + if (!label) + { + label = new QLabel(this); + tabBar()->setTabButton(index, QTabBar::LeftSide, 0); + tabBar()->setTabButton(index, QTabBar::LeftSide, label); + } + + KIcon ic = IconManager::self()->iconForUrl(tab->url()); + label->setPixmap(ic.pixmap(16, 16)); +} + + void TabWindow::tabLoadStarted() { WebWindow *tab = qobject_cast(sender()); @@ -604,6 +632,7 @@ void TabWindow::detachTab(int index, TabWindow *toWindow) // WARNING: Code copied from prepareNewTab method. // Any new changes there should be applied here... disconnect(tab, SIGNAL(titleChanged(QString)), this, SLOT(tabTitleChanged(QString))); + disconnect(tab, SIGNAL(iconChanged()), this, SLOT(tabIconChanged())); disconnect(tab, SIGNAL(loadStarted()), this, SLOT(tabLoadStarted())); disconnect(tab, SIGNAL(loadFinished(bool)), this, SLOT(tabLoadFinished(bool))); disconnect(tab, SIGNAL(pageCreated(WebPage*)), this, SLOT(pageCreated(WebPage*))); @@ -612,6 +641,7 @@ void TabWindow::detachTab(int index, TabWindow *toWindow) // WARNING: Code copied from prepareNewTab method. // Any new changes there should be applied here... connect(tab, SIGNAL(titleChanged(QString)), w, SLOT(tabTitleChanged(QString))); + connect(tab, SIGNAL(iconChanged()), w, SLOT(tabIconChanged())); connect(tab, SIGNAL(loadStarted()), w, SLOT(tabLoadStarted())); connect(tab, SIGNAL(loadFinished(bool)), w, SLOT(tabLoadFinished(bool))); connect(tab, SIGNAL(pageCreated(WebPage*)), w, SLOT(pageCreated(WebPage*))); diff --git a/src/tabwindow/tabwindow.h b/src/tabwindow/tabwindow.h index c3df016c..3a00ac4a 100644 --- a/src/tabwindow/tabwindow.h +++ b/src/tabwindow/tabwindow.h @@ -92,6 +92,7 @@ private Q_SLOTS: void updateNewTabButtonPosition(); void tabTitleChanged(const QString &); + void tabIconChanged(); void tabLoadStarted(); void tabLoadFinished(bool); diff --git a/src/webtab/webpage.cpp b/src/webtab/webpage.cpp index a501c4bb..958dc5c1 100644 --- a/src/webtab/webpage.cpp +++ b/src/webtab/webpage.cpp @@ -177,9 +177,6 @@ WebPage::WebPage(QWidget *parent, bool isPrivateBrowsing) // protocol handler signals connect(&_protHandler, SIGNAL(downloadUrl(KUrl)), this, SLOT(downloadUrl(KUrl))); - - // TODO: Remove me and implement an icon retriever for each tab - connect(IconManager::self(), SIGNAL(iconChanged()), mainFrame(), SIGNAL(iconChanged())); } diff --git a/src/webwindow/webwindow.cpp b/src/webwindow/webwindow.cpp index 33cb6142..73543374 100644 --- a/src/webwindow/webwindow.cpp +++ b/src/webwindow/webwindow.cpp @@ -122,6 +122,7 @@ WebWindow::WebWindow(QWidget *parent, bool isPrivateBrowsing, WebPage *pg) // things changed signals connect(_tab->view(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString))); + connect(_tab->view(), SIGNAL(iconChanged()), this, SIGNAL(iconChanged())); // check view signals connect(_tab->view(), SIGNAL(loadStarted()), this, SLOT(webLoadStarted())); diff --git a/src/webwindow/webwindow.h b/src/webwindow/webwindow.h index e8e77dd7..de927305 100644 --- a/src/webwindow/webwindow.h +++ b/src/webwindow/webwindow.h @@ -145,7 +145,8 @@ private Q_SLOTS: Q_SIGNALS: void titleChanged(QString); - + void iconChanged(); + void loadStarted(); void loadProgress(int); void loadFinished(bool); -- cgit v1.2.1