[WebKit-devel] [Patch] Add action "View Image" like in Konqueror

Dawit A. adawit at kde.org
Sat Oct 24 07:09:24 CEST 2009


Hi Alian,

Applied with the exception of the "browserArgs.setNewTab(true);" portion in 
slotViewImage. Thanks for the patch...

On Friday 23 October 2009 20:30:30 Alain Laporte wrote:
> 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
> _______________________________________________
> WebKit-devel mailing list
> WebKit-devel at kde.org
> https://mail.kde.org/mailman/listinfo/webkit-devel
> 


More information about the WebKit-devel mailing list