summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-11-10 01:03:40 +0100
committerAndrea Diamantini <adjam7@gmail.com>2011-11-10 23:34:02 +0100
commit5424f5b7a49d29a5d2aba0c9dc6165779442796c (patch)
treed17ced13affebc2e1fff1c8b3c9caab622399bb6
parentFix BUG:280627 Force QApplication to quit when no more available window (diff)
downloadrekonq-5424f5b7a49d29a5d2aba0c9dc6165779442796c.tar.xz
Web app's icon on kwebapp window
Heavily based on Furkan's patch on rbo REVIEW: 103087
-rw-r--r--kwebapp/kwebmain.cpp3
-rw-r--r--kwebapp/webview.cpp22
-rw-r--r--kwebapp/webview.h5
3 files changed, 19 insertions, 11 deletions
diff --git a/kwebapp/kwebmain.cpp b/kwebapp/kwebmain.cpp
index 3de5b182..639d1533 100644
--- a/kwebapp/kwebmain.cpp
+++ b/kwebapp/kwebmain.cpp
@@ -55,9 +55,8 @@ int main(int argc, char **argv)
return 0;
}
- WebView *widg = new WebView;
+ WebView *widg = new WebView(QUrl::fromUserInput(args->arg(0)));
widg->show();
- widg->load(QUrl::fromUserInput(args->arg(0)));
args->clear();
return app.exec();
diff --git a/kwebapp/webview.cpp b/kwebapp/webview.cpp
index 7a5ba4c1..dbda6d59 100644
--- a/kwebapp/webview.cpp
+++ b/kwebapp/webview.cpp
@@ -46,21 +46,27 @@
#include <QPointer>
-WebView::WebView(QWidget *parent)
+WebView::WebView(const QUrl &url, QWidget *parent)
: KWebView(parent)
{
page()->setForwardUnsupportedContent(true);
connect(page(), SIGNAL(unsupportedContent(QNetworkReply *)), page(), SLOT(downloadResponse(QNetworkReply *)));
connect(page(), SIGNAL(downloadRequested(const QNetworkRequest &)), page(), SLOT(downloadRequest(const QNetworkRequest &)));
connect(this, SIGNAL(linkShiftClicked(const KUrl &)), page(), SLOT(downloadUrl(const KUrl &)));
-
- QWebSettings::setIconDatabasePath( KStandardDirs::locateLocal("cache","kwebapp.favicons") );
-
+
+ QWebSettings::setIconDatabasePath(KStandardDirs::locateLocal("cache", "kwebapp.favicons"));
+
setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, SIGNAL(titleChanged(const QString &)), this, SLOT(setTitle(const QString &)));
connect(this, SIGNAL(iconChanged()), this, SLOT(setIcon()));
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(menuRequested(const QPoint &)));
+
+ const QString iconPath = KStandardDirs::locateLocal("cache" , "favicons/" , true) + url.host() + "_WEBAPPICON.png";
+ setWindowIcon(QIcon(iconPath));
+
+ // last...
+ load(url);
}
@@ -72,7 +78,7 @@ void WebView::setTitle(const QString &t)
void WebView::setIcon()
{
- setWindowIcon(icon());
+ setWindowIcon(icon());
}
@@ -95,13 +101,13 @@ void WebView::menuRequested(const QPoint &pos)
menu.addAction(pageAction(KWebPage::CopyLinkToClipboard));
menu.addSeparator();
}
-
- if(history()->canGoBack())
+
+ if (history()->canGoBack())
{
menu.addAction(pageAction(KWebPage::Back));
}
- if(history()->canGoBack())
+ if (history()->canGoBack())
{
menu.addAction(pageAction(KWebPage::Forward));
}
diff --git a/kwebapp/webview.h b/kwebapp/webview.h
index 536dba8c..a53010ed 100644
--- a/kwebapp/webview.h
+++ b/kwebapp/webview.h
@@ -27,13 +27,16 @@
// KDE Includes
#include <KWebView>
+// Qt Includes
+#include <QUrl>
+
class WebView : public KWebView
{
Q_OBJECT
public:
- WebView(QWidget *parent = 0);
+ WebView(const QUrl &url, QWidget *parent = 0);
private Q_SLOTS:
void setTitle(const QString &);