[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/libs/webkitkde
From: Dawit Alemayehu <adawit () kde ! org>
Date: 2009-11-07 19:44:14
Message-ID: 1257623054.859769.23437.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1046192 by adawit:
Sync with the changes in kdereview:
Renamed the signals in KWebView to be consistent with the signal naming scheme in Qt:
openUrlInNewWindow -> linkMiddleOrCtrlClicked
saveUrl -> linkShiftClicked
openUrl -> selectionClipboardUrlPasted
Added a flag to KWebView to disable the creation of a custom KWebPage.
M +9 -2 kdewebkit/kwebpage.h
M +6 -5 kdewebkit/kwebview.cpp
M +31 -16 kdewebkit/kwebview.h
M +5 -5 part/webkitpart.cpp
M +1 -1 part/webkitpart.h
M +2 -4 part/webview.cpp
--- trunk/playground/libs/webkitkde/kdewebkit/kwebpage.h #1046191:1046192
@@ -4,7 +4,7 @@
* Copyright (C) 2008 Dirk Mueller <mueller@kde.org>
* Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org>
* Copyright (C) 2008 Michael Howell <mhowell123@gmail.com>
- * Copyright (C) 2009 Dawit Alemayehu <adawit@kde.org>
+ * Copyright (C) 2009 Dawit Alemayehu <adawit @ kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -30,9 +30,16 @@
#include <QtWebKit/QWebPage>
/**
- * @short An enhanced QWebPage with integration into the KDE environment.
+ * @short An enhanced QWebPage that provides integration into the KDE environment.
*
+ * This is a convenience class that provides full integration with KDE
+ * technologies such as KIO for network request handling, KCookiejar for cookie
+ * handling and KWebPluginFactory for embeded non-html content handling using
+ * KDE KParts.
+ *
* @author Urs Wolfer <uwolfer @ kde.org>
+ * @author Dawit Alemayehu <adawit @ kde.org>
+ *
* @since 4.4
*/
--- trunk/playground/libs/webkitkde/kdewebkit/kwebview.cpp #1046191:1046192
@@ -52,10 +52,11 @@
};
-KWebView::KWebView(QWidget *parent)
+KWebView::KWebView(QWidget *parent, bool createCustomPage)
:QWebView(parent), d(new KWebView::KWebViewPrivate())
{
- setPage(new KWebPage(this));
+ if (createCustomPage)
+ setPage(new KWebPage(this));
}
KWebView::~KWebView()
@@ -106,12 +107,12 @@
if (url.isValid() && !url.isEmpty() && !url.scheme().isEmpty()) {
if ((d->pressedButtons & Qt::MidButton) ||
((d->pressedButtons & Qt::LeftButton) && (d->keyboardModifiers & Qt::ControlModifier))) {
- emit openUrlInNewWindow(url);
+ emit linkMiddleOrCtrlClicked(url);
return;
}
if ((d->pressedButtons & Qt::LeftButton) && (d->keyboardModifiers & Qt::ShiftModifier)) {
- emit saveUrl(url);
+ emit linkShiftClicked(url);
return;
}
}
@@ -127,7 +128,7 @@
QString clipboardText(QApplication::clipboard()->text(QClipboard::Selection).trimmed());
if (KUriFilter::self()->filterUri(clipboardText, QStringList() << "kshorturifilter")) {
kDebug() << "Navigating to" << clipboardText;
- emit openUrl(KUrl(clipboardText));
+ emit selectionClipboardUrlPasted(KUrl(clipboardText));
}
}
}
--- trunk/playground/libs/webkitkde/kdewebkit/kwebview.h #1046191:1046192
@@ -31,6 +31,7 @@
#include <QtWebKit/QWebView>
class KUrl;
+class KWebPage;
namespace KParts
{
@@ -39,13 +40,16 @@
}
/**
- * @short A re-implementation of QWebView to provide KDE integration.
+ * @short A reimplementation of QWebView with full KDE integration.
*
- * This is a convenience class that provides an implementation of QWebView with
- * full integration with KDE technologies for networking (KIO), cookie handling
- * (KCookieJar) and embeded non-html content (<embed>) handling (KPart apps).
+ * This is a drop-in replacement for QWebView that provides full KDE integration
+ * through the use of @ref KWebPage. It also provides signals that capture
+ * middle/shift/ctrl mouse clicks on links and url pasting from the selection
+ * clipboard.
*
* @author Urs Wolfer <uwolfer @ kde.org>
+ * @author Dawit Alemayehu <adawit @ kde.org>
+ *
* @since 4.4
*/
class KDEWEBKIT_EXPORT KWebView : public QWebView
@@ -53,9 +57,17 @@
Q_OBJECT
public:
/**
- * Constructs an empty KWebView with parent @p parent.
+ * Constructs a KWebView object with parent @p parent.
+ *
+ * The @p createCustomPage flag allows you to prevent the creation of a
+ * custom KWebPage object that is used to provide KDE integration. If you
+ * are going to use your own implementation of KWebPage, you should set
+ * this flag to false to avoid unnecessary creation and deletion of objects.
+ *
+ * @param parent the parent object.
+ * @param createCustomPage if true, the default, creates a custom KWebPage object.
*/
- explicit KWebView(QWidget *parent = 0);
+ explicit KWebView(QWidget *parent = 0, bool createCustomPage = true);
/**
* Destroys the KWebView.
@@ -86,25 +98,28 @@
Q_SIGNALS:
/**
- * This signal is emitted when the user wants to navigate to @p url.
+ * This signal is emitted when a url from the selection clipboard is pasted
+ * on this view.
+ *
+ * @param url the url of the clicked link.
*/
- void openUrl(const KUrl &url);
+ void selectionClipboardUrlPasted(const KUrl &url);
/**
- * This signal is emitted when the user wants to save @p url.
+ * This signal is emitted when a link is shift clicked with the left mouse
+ * button.
*
- * It is activated as a result of a shift-click on a link with the left
- * mouse button.
+ * @param url the url of the clicked link.
*/
- void saveUrl(const KUrl &url);
+ void linkShiftClicked(const KUrl &url);
/**
- * This signal is emitted when the user wants to open @p url in a new window.
+ * This signal is emitted when a link is either clicked with middle mouse
+ * button or ctrl-clicked with the left moust button.
*
- * It is activated as a result of a click on a link with the middle mouse
- * button or a ctrl-click with the left mouse button.
+ * @param url the url of the clicked link.
*/
- void openUrlInNewWindow(const KUrl &url);
+ void linkMiddleOrCtrlClicked(const KUrl &url);
protected:
/**
--- trunk/playground/libs/webkitkde/part/webkitpart.cpp #1046191:1046192
@@ -202,8 +202,8 @@
this, SLOT(loadFinished(bool)));
connect(d->webView, SIGNAL(urlChanged(const QUrl &)),
this, SLOT(urlChanged(const QUrl &)));
- connect(d->webView, SIGNAL(openUrlInNewWindow(const KUrl &)),
- this, SLOT(openUrlInNewWindow(const KUrl &)));
+ connect(d->webView, SIGNAL(linkMiddleOrCtrlClicked(const KUrl &)),
+ this, SLOT(openUrlInNewTab(const KUrl &)));
// Add the search bar...
d->searchBar = new KDEPrivate::SearchBar;
@@ -226,7 +226,7 @@
this, SLOT(saveFrameState(QWebFrame *, QWebHistoryItem *)));
connect(d->webPage, SIGNAL(jsStatusBarMessage(const QString &)),
this, SIGNAL(setStatusBarText(const QString &)));
- connect(d->webView, SIGNAL(saveUrl(const KUrl &)),
+ connect(d->webView, SIGNAL(linkShiftClicked(const KUrl &)),
d->webPage, SLOT(saveUrl(const KUrl &)));
d->browserExtension = new WebKitBrowserExtension(this);
@@ -237,7 +237,7 @@
connect(d->browserExtension, SIGNAL(saveUrl(const KUrl&)),
d->webPage, SLOT(saveUrl(const KUrl &)));
- connect(d->webView, SIGNAL(openUrl(const KUrl &)),
+ connect(d->webView, SIGNAL(selectionClipboardUrlPasted(const KUrl &)),
d->browserExtension, SIGNAL(openUrlRequest(const KUrl &)));
setXMLFile("webkitpart.rc");
@@ -633,7 +633,7 @@
d->searchBar->show();
}
-void WebKitPart::openUrlInNewWindow(const KUrl& linkUrl)
+void WebKitPart::openUrlInNewTab(const KUrl& linkUrl)
{
KParts::OpenUrlArguments args;
args.metaData()["referrer"] = url().url();
--- trunk/playground/libs/webkitkde/part/webkitpart.h #1046191:1046192
@@ -67,7 +67,7 @@
void searchForText(const QString &text, bool backward);
void linkHovered(const QString &, const QString&, const QString &);
void saveFrameState(QWebFrame *frame, QWebHistoryItem *item);
- void openUrlInNewWindow(const KUrl&);
+ void openUrlInNewTab(const KUrl&);
void urlChanged(const QUrl &);
--- trunk/playground/libs/webkitkde/part/webview.cpp #1046191:1046192
@@ -70,16 +70,14 @@
WebView::WebView(WebKitPart *wpart, QWidget *parent)
- :KWebView(parent), d(new WebViewPrivate())
+ :KWebView(parent, false), d(new WebViewPrivate())
{
d->part = wpart;
d->actionCollection = new KActionCollection(this);
setAcceptDrops(true);
- // Use our own custom re-implementation of KWebPage...
+ // Create the custom page...
setPage(new WebPage(wpart, this));
-
- // Connect parent's saveUrl signal...
}
WebView::~WebView()
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic