diff options
Diffstat (limited to 'kwebapp')
-rw-r--r-- | kwebapp/kwebmain.cpp | 3 | ||||
-rw-r--r-- | kwebapp/webview.cpp | 22 | ||||
-rw-r--r-- | kwebapp/webview.h | 5 |
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 &); |