summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/application.cpp4
-rw-r--r--src/mainwindow.cpp13
-rw-r--r--src/mainwindow.h6
-rw-r--r--src/rekonq.kcfg3
-rw-r--r--src/settings/settings_appearance.ui9
-rw-r--r--src/webview.cpp15
-rw-r--r--src/webview.h1
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 &);