summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/webview.cpp128
1 files changed, 66 insertions, 62 deletions
diff --git a/src/webview.cpp b/src/webview.cpp
index a3682266..ec747b36 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -122,13 +122,9 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
KMenu menu(this);
QAction *a;
-
- bool linkIsEmpty = result.linkUrl().isEmpty();
-
- if (!linkIsEmpty)
+ if (!result.linkUrl().isEmpty())
{
// link actions
-
a = pageAction(QWebPage::OpenLinkInNewWindow);
a->setText(i18n("Open Link in New &Tab"));
a->setIcon(KIcon("window-new"));
@@ -144,8 +140,8 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
if (!result.pixmap().isNull())
{
- menu.addSeparator();
-
+ menu.addSeparator();
+
// TODO Add "View Image" && remove copy_this_image action
a = pageAction(QWebPage::DownloadImageToDisk);
a->setIcon(KIcon("document-save"));
@@ -155,81 +151,89 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
a->setIcon(KIcon("edit-copy"));
menu.addAction(a);
}
-
}
else if (result.isContentEditable() && result.isContentSelected())
{
- // actions for text selected in field
-
- a = pageAction(QWebPage::Cut);
- a->setIcon(KIcon("edit-cut"));
- a->setShortcut(KStandardShortcut::cut().primary());
- menu.addAction(a);
+ // actions for text selected in field
+ a = pageAction(QWebPage::Cut);
+ a->setIcon(KIcon("edit-cut"));
+ a->setShortcut(KStandardShortcut::cut().primary());
+ menu.addAction(a);
- a = pageAction(QWebPage::Copy);
- a->setIcon(KIcon("edit-copy"));
- a->setShortcut(KStandardShortcut::copy().primary());
- menu.addAction(a);
+ a = pageAction(QWebPage::Copy);
+ a->setIcon(KIcon("edit-copy"));
+ a->setShortcut(KStandardShortcut::copy().primary());
+ menu.addAction(a);
- a = pageAction(QWebPage::Paste);
- a->setIcon(KIcon("edit-paste"));
- a->setShortcut(KStandardShortcut::paste().primary());
- menu.addAction(a);
+ a = pageAction(QWebPage::Paste);
+ a->setIcon(KIcon("edit-paste"));
+ a->setShortcut(KStandardShortcut::paste().primary());
+ menu.addAction(a);
- // TODO Add translate, show translation
+ // TODO Add translate, show translation
}
else if (result.isContentEditable())
{
- // actions for a not selected field or a void field
-
- //Warning: why it doesn't automatically select a field ?
- //Why the paste action is disabled ?
-
- a = pageAction(QWebPage::Paste);
- a->setIcon(KIcon("edit-paste"));
- a->setShortcut(KStandardShortcut::paste().primary());
- menu.addAction(a);
+ // actions for a not selected field or a void field
+ // WARNING: why it doesn't automatically select a field?
+ // Why the paste action is disabled?
+
+ a = pageAction(QWebPage::Paste);
+ a->setIcon(KIcon("edit-paste"));
+ a->setShortcut(KStandardShortcut::paste().primary());
+ menu.addAction(a);
}
else if (result.isContentSelected())
{
- // actions for text selected in page
-
- a = pageAction(QWebPage::Copy);
+ // actions for text selected in page
+ a = pageAction(QWebPage::Copy);
a->setIcon(KIcon("edit-copy"));
a->setShortcut(KStandardShortcut::copy().primary());
menu.addAction(a);
- // TODO Add search with google, wikipedia, show translation
+ // TODO Add search with google, wikipedia, show translation
}
else
{
- //page actions
-
- menu.addAction(mainwindow->actionByName("new_tab"));
- if(mainwindow->isFullScreen())
- {
- menu.addAction(mainwindow->actionByName("fullscreen"));
- }
-
- menu.addSeparator();
-
- menu.addAction(mainwindow->actionByName("history_back"));
- menu.addAction(mainwindow->actionByName("history_forward"));
- menu.addAction(mainwindow->actionByName("view_redisplay"));
-
- menu.addSeparator();
-
- QAction *addBookmarkAction = Application::bookmarkProvider()->actionByName("rekonq_add_bookmark");
+ //page actions
+ menu.addAction(mainwindow->actionByName("new_tab"));
+ if(mainwindow->isFullScreen())
+ {
+ menu.addAction(mainwindow->actionByName("fullscreen"));
+ }
+
+ menu.addSeparator();
+
+ menu.addAction(mainwindow->actionByName("history_back"));
+ menu.addAction(mainwindow->actionByName("history_forward"));
+ menu.addAction(mainwindow->actionByName("view_redisplay"));
+
+ if (!result.pixmap().isNull())
+ {
+ menu.addSeparator();
+
+ // TODO Add "View Image" && remove copy_this_image action
+ a = pageAction(QWebPage::DownloadImageToDisk);
+ a->setIcon(KIcon("document-save"));
+ menu.addAction(a);
+
+ a = pageAction(QWebPage::CopyImageToClipboard);
+ a->setIcon(KIcon("edit-copy"));
+ menu.addAction(a);
+ }
+
+ menu.addSeparator();
+
+ QAction *addBookmarkAction = Application::bookmarkProvider()->actionByName("rekonq_add_bookmark");
menu.addAction(addBookmarkAction);
-
- if (page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled))
- {
- // Developer Extras actions
-
- a = pageAction(QWebPage::InspectElement);
- a->setIcon(KIcon("view-process-all"));
- menu.addAction(a);
- }
+
+ if (page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled))
+ {
+ // Developer Extras actions
+ a = pageAction(QWebPage::InspectElement);
+ a->setIcon(KIcon("view-process-all"));
+ menu.addAction(a);
+ }
}
menu.exec(mapToGlobal(event->pos()));