[WebKit-devel] [Patch] Add action "View Image" like in Konqueror
Alain Laporte
alain_laporte123 at yahoo.fr
Sat Oct 24 02:30:30 CEST 2009
Hello everybody,
I have patched webkitkde for to add a action "View Image" in the popup menu, like in Konqueror.
I don't know if post in this mailing list is the right thing to do for submit patch, so, excuse me in advance if i'm wrong ;-)
Alain Laporte
Index: part/webkitpart_ext.h
===================================================================
--- part/webkitpart_ext.h (révision 1039128)
+++ part/webkitpart_ext.h (copie de travail)
@@ -67,6 +67,7 @@
void slotSaveImageAs();
void slotSendImage();
void slotCopyImage();
+ void slotViewImage();
void slotCopyLinkLocation();
void slotSaveLinkAs();
Index: part/webview.cpp
===================================================================
--- part/webview.cpp (révision 1039128)
+++ part/webview.cpp (copie de travail)
@@ -175,6 +175,13 @@
action = d->actionCollection->action("copyimage");
action->setEnabled(!d->result.pixmap().isNull());
partActions.append(action);
+
+ if (!d->actionCollection->action("viewimage")) {
+ action = new KAction(i18n("View Image (%1)").arg(KUrl(d->result.imageUrl()).fileName()), this);
+ d->actionCollection->addAction("viewimage", action);
+ connect(action, SIGNAL(triggered(bool)), d->part->browserExtension(), SLOT(slotViewImage()));
+ }
+ partActions.append(d->actionCollection->action("viewimage"));
}
if (d->result.linkUrl().isEmpty()) {
Index: part/webkitpart_ext.cpp
===================================================================
--- part/webkitpart_ext.cpp (révision 1039128)
+++ part/webkitpart_ext.cpp (copie de travail)
@@ -311,6 +311,17 @@
}
}
+void WebKitBrowserExtension::slotViewImage()
+{
+ if (d->view) {
+ KParts::OpenUrlArguments args;
+ args.metaData()["referrer"] = d->view->contextMenuResult().linkText();
+ KParts::BrowserArguments browserArgs;
+ browserArgs.setNewTab(true);
+ emit createNewWindow(d->view->contextMenuResult().imageUrl(), args, browserArgs);
+ }
+}
+
void WebKitBrowserExtension::slotCopyLinkLocation()
{
if (d->view) {
__________________________________________________
Do You Yahoo!?
En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités
http://mail.yahoo.fr Yahoo! Mail
More information about the WebKit-devel
mailing list