diff options
author | Furkan Uzumcu <furkanuzumcu@gmail.com> | 2011-02-05 19:02:24 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2011-02-05 19:02:24 +0100 |
commit | a77d9a208119224a9793e676a6263eed49356ac9 (patch) | |
tree | 83a590c74be39bf0b0ced4ac1a88cc5d102212ff /src | |
parent | fixuifiles (diff) | |
download | rekonq-a77d9a208119224a9793e676a6263eed49356ac9.tar.xz |
Added an option to show current website favicon as rekonq window icon
Reviewed by adjam
Diffstat (limited to 'src')
-rw-r--r-- | src/application.cpp | 4 | ||||
-rw-r--r-- | src/mainwindow.cpp | 13 | ||||
-rw-r--r-- | src/mainwindow.h | 6 | ||||
-rw-r--r-- | src/rekonq.kcfg | 3 | ||||
-rw-r--r-- | src/settings/settings_appearance.ui | 9 | ||||
-rw-r--r-- | src/webview.cpp | 15 | ||||
-rw-r--r-- | src/webview.h | 1 |
7 files changed, 47 insertions, 4 deletions
diff --git a/src/application.cpp b/src/application.cpp index 6f8cd8b2..5dd2909c 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -527,6 +527,10 @@ void Application::updateConfiguration() // ====== load Settings on main classes Application::historyManager()->loadSettings(); Application::adblockManager()->loadSettings(); + if(!ReKonfig::useFavicon()) + mainWindow()->setWindowIcon(KIcon("rekonq")); + else + mainWindow()->changeWindowIcon(mainWindow()->mainView()->currentIndex()); // hovering unfocused tabs options switch(ReKonfig::hoveringTabOption()) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 943f877d..3d76d35f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -321,6 +321,9 @@ void MainWindow::postLaunch() connect(m_view, SIGNAL(tabsChanged()), this, SLOT(updateActions())); connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(updateActions())); + //Change window icon according to tab icon + connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(changeWindowIcon(int))); + // launch it manually. Just the first time... updateActions(); @@ -350,6 +353,15 @@ QSize MainWindow::sizeHint() const return size; } +void MainWindow::changeWindowIcon(int index) +{ + if (ReKonfig::useFavicon()) + { + KUrl url = mainView()->webTab(index)->url(); + QIcon icon = Application::iconManager()->iconForUrl(url).pixmap(QSize(32,32)); + setWindowIcon(icon); + } +} void MainWindow::setupActions() { @@ -631,7 +643,6 @@ void MainWindow::setupPanels() m_analyzerPanel->hide(); } - void MainWindow::openLocation() { if(isFullScreen()) diff --git a/src/mainwindow.h b/src/mainwindow.h index 598d66e3..565843f2 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -109,14 +109,16 @@ public Q_SLOTS: void updateHighlight(); void findSelectedText(); + void changeWindowIcon(int index); + Q_SIGNALS: // switching tabs void ctrlTabPressed(); void shiftCtrlTabPressed(); - + void triggerPartPrint(); void triggerPartFind(); - + protected Q_SLOTS: void saveNewToolbarConfig(); diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index d7d496f0..704d54b6 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -123,6 +123,9 @@ <entry name="closeTabSelectPrevious" type="Bool"> <default>false</default> </entry> + <entry name="useFavicon" type="Bool"> + <default>false</default> + </entry> </group> diff --git a/src/settings/settings_appearance.ui b/src/settings/settings_appearance.ui index f7dd4747..b25af436 100644 --- a/src/settings/settings_appearance.ui +++ b/src/settings/settings_appearance.ui @@ -253,7 +253,14 @@ <bool>true</bool> </property> </widget> - </item> + </item> + <item> + <widget class="QCheckBox" name="kcfg_useFavicon"> + <property name="text"> + <string>Use favicon of the open website</string> + </property> + </widget> + </item> </layout> </widget> </item> diff --git a/src/webview.cpp b/src/webview.cpp index d3eb2f49..b41f1bd3 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -43,6 +43,7 @@ #include "urlbar.h" #include "webpage.h" #include "websnap.h" +#include "webtab.h" // KDE Includes #include <KAction> @@ -111,6 +112,8 @@ WebView::WebView(QWidget* parent) // Smooth scroll timer connect(m_smoothScrollTimer, SIGNAL(timeout()), this, SLOT(scrollTick())); m_smoothScrollTimer->setInterval(16); + + connect(this, SIGNAL(iconChanged()), this, SLOT(changeWindowIcon())); } @@ -127,6 +130,18 @@ WebView::~WebView() preview.save(path); } +void WebView::changeWindowIcon() +{ + if (ReKonfig::useFavicon()) + { + MainWindow *const mainWindow = Application::instance()->mainWindow(); + if (url() == mainWindow->currentTab()->url()) + { + const int index = mainWindow->mainView()->currentIndex(); + mainWindow->changeWindowIcon(index); + } + } +} WebPage *WebView::page() { diff --git a/src/webview.h b/src/webview.h index a06a2cb2..669705fa 100644 --- a/src/webview.h +++ b/src/webview.h @@ -81,6 +81,7 @@ private slots: void setupSmoothScrolling(int posY); void stopScrolling(); + void changeWindowIcon(); signals: void loadUrl(const KUrl &, const Rekonq::OpenType &); |