From 135523dbe6e4534dbccbe8b848b2e2ff266de52e Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 24 Nov 2011 22:11:45 +0100 Subject: Clean up webview contextual && tools menu - Moved "new window" action from contextual menu to tools menu (This is Google Code-in 2011 task by Yusuf Amir Tezcan! Thanks!!!) - clean up/review contextual menu actions - Followed FIXME to remove "copy image" action - Added "new_tab" && "new_window" action to Tools Menu REVIEW: 103216 REVIEWED-BY: nobody, oops... :) --- src/rekonqui.rc | 5 +++- src/webview.cpp | 81 ++++++++++++++++++++++++++------------------------------- 2 files changed, 41 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/rekonqui.rc b/src/rekonqui.rc index bad56615..1bbf8bf3 100644 --- a/src/rekonqui.rc +++ b/src/rekonqui.rc @@ -1,9 +1,12 @@ - + + + + diff --git a/src/webview.cpp b/src/webview.cpp index bc5473f2..18ec4550 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -197,49 +197,35 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) menu.addAction(mainwindow->actionByName("view_redisplay")); - if (result.pixmap().isNull()) - { - menu.addSeparator(); - - if (!ReKonfig::alwaysShowTabBar() && mainwindow->mainView()->count() == 1) - menu.addAction(mainwindow->actionByName("new_tab")); - - menu.addAction(mainwindow->actionByName("new_window")); - - menu.addSeparator(); - - //Frame - KActionMenu *frameMenu = new KActionMenu(i18n("Current Frame"), this); - - frameMenu->addAction(pageAction(KWebPage::OpenFrameInNewWindow)); - - a = new KAction(KIcon("document-print-frame"), i18n("Print Frame"), this); - connect(a, SIGNAL(triggered()), this, SLOT(printFrame())); - frameMenu->addAction(a); + menu.addSeparator(); - menu.addAction(frameMenu); + //Frame + KActionMenu *frameMenu = new KActionMenu(i18n("Current Frame"), this); + frameMenu->addAction(pageAction(KWebPage::OpenFrameInNewWindow)); - menu.addSeparator(); + a = new KAction(KIcon("document-print-frame"), i18n("Print Frame"), this); + connect(a, SIGNAL(triggered()), this, SLOT(printFrame())); + frameMenu->addAction(a); - // Page Actions - menu.addAction(pageAction(KWebPage::SelectAll)); + menu.addAction(frameMenu); - menu.addAction(mainwindow->actionByName(KStandardAction::name(KStandardAction::SaveAs))); + menu.addSeparator(); - if (!KStandardDirs::findExe("kget").isNull() && ReKonfig::kgetList()) - { - a = new KAction(KIcon("kget"), i18n("List All Links"), this); - connect(a, SIGNAL(triggered(bool)), page(), SLOT(downloadAllContentsWithKGet())); - menu.addAction(a); - } + // Page Actions + menu.addAction(pageAction(KWebPage::SelectAll)); - menu.addAction(mainwindow->actionByName("page_source")); - menu.addAction(inspectAction); + menu.addAction(mainwindow->actionByName(KStandardAction::name(KStandardAction::SaveAs))); - a = rApp->bookmarkProvider()->actionByName("rekonq_add_bookmark"); + if (!KStandardDirs::findExe("kget").isNull() && ReKonfig::kgetList()) + { + a = new KAction(KIcon("kget"), i18n("List All Links"), this); + connect(a, SIGNAL(triggered(bool)), page(), SLOT(downloadAllContentsWithKGet())); menu.addAction(a); } + menu.addAction(mainwindow->actionByName("page_source")); + menu.addAction(inspectAction); + if (mainwindow->isFullScreen()) { menu.addSeparator(); @@ -264,15 +250,9 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewWindow())); menu.addAction(a); - a = new KAction(KIcon("bookmark-new"), i18n("&Bookmark this Link"), this); - a->setData(result.linkUrl()); - connect(a, SIGNAL(triggered(bool)), this, SLOT(bookmarkLink())); - menu.addAction(a); - menu.addSeparator(); menu.addAction(pageAction(KWebPage::DownloadLinkToDisk)); menu.addAction(pageAction(KWebPage::CopyLinkToClipboard)); - menu.addSeparator(); } // IMAGE ACTIONS ------------------------------------------------------------------------------ @@ -282,14 +262,15 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) sendByMailAction->setData(result.imageUrl()); sendByMailAction->setText(i18n("Share image link")); - // TODO remove copy_this_image action - a = new KAction(KIcon("view-media-visualization"), i18n("&View Image"), this); + menu.addSeparator(); + + a = new KAction(KIcon("view-preview"), i18n("&View Image"), this); a->setData(result.imageUrl()); - connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(viewImage(Qt::MouseButtons, Qt::KeyboardModifiers))); + connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), + this, SLOT(viewImage(Qt::MouseButtons, Qt::KeyboardModifiers))); menu.addAction(a); menu.addAction(pageAction(KWebPage::DownloadImageToDisk)); - menu.addAction(pageAction(KWebPage::CopyImageToClipboard)); a = new KAction(KIcon("view-media-visualization"), i18n("&Copy Image Location"), this); a->setData(result.imageUrl()); @@ -379,6 +360,18 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) // DEFAULT ACTIONs (on the bottom) --------------------------------------------------- menu.addSeparator(); + if (resultHit & WebView::LinkSelection) + { + a = new KAction(KIcon("bookmark-new"), i18n("&Bookmark link"), this); + a->setData(result.linkUrl()); + connect(a, SIGNAL(triggered(bool)), this, SLOT(bookmarkLink())); + menu.addAction(a); + } + else + { + a = rApp->bookmarkProvider()->actionByName("rekonq_add_bookmark"); + menu.addAction(a); + } menu.addAction(sendByMailAction); menu.addAction(inspectAction); @@ -913,4 +906,4 @@ void WebView::sendByMail() kDebug() << "URL " << url; KToolInvocation::invokeMailer("", "", "", "", url); -} \ No newline at end of file +} -- cgit v1.2.1