summaryrefslogtreecommitdiff
path: root/src/webview.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-05-07 11:37:48 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-05-07 11:37:48 +0200
commite70299ee2bc025a94c32153b7aa61b17f73f75a1 (patch)
treee08208da948dce30ec3dab07d66b13cd80537bc0 /src/webview.cpp
parentEBN Krazy issues. 3rd round... First chech finished! (diff)
downloadrekonq-e70299ee2bc025a94c32153b7aa61b17f73f75a1.tar.xz
Improved contextual menu usability
Diffstat (limited to 'src/webview.cpp')
-rw-r--r--src/webview.cpp69
1 files changed, 46 insertions, 23 deletions
diff --git a/src/webview.cpp b/src/webview.cpp
index a8efaa2d..4ae3986f 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -375,6 +375,35 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
addBookmarkAction->setData(QVariant());
KMenu menu(this);
+
+ // cut - copy - paste Actions.
+ // If someone selects text perhaps wanna work with it..
+ bool b = false;
+
+ if (result.isContentSelected() && result.isContentEditable())
+ {
+ menu.addAction(webActions()->action("edit_cut"));
+ b = true;
+ }
+
+ if (result.isContentSelected())
+ {
+ menu.addAction(webActions()->action("edit_copy"));
+ b = true;
+ }
+
+ if (result.isContentEditable())
+ {
+ menu.addAction(webActions()->action("edit_paste"));
+ b = true;
+ }
+
+ if(b)
+ {
+ menu.addSeparator();
+ }
+
+ // link actions
bool linkIsEmpty = result.linkUrl().isEmpty();
if (!linkIsEmpty)
{
@@ -387,48 +416,42 @@ void WebView::contextMenuEvent(QContextMenuEvent *event)
menu.addAction(mainwindow->actionByName("view_redisplay"));
menu.addSeparator();
+ // Developer Extras actions
if (page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled))
{
menu.addAction(webActions()->action("inspect_element"));
menu.addSeparator();
}
- menu.addAction(mainwindow->actionByName("history_back"));
- menu.addAction(mainwindow->actionByName("history_forward"));
- menu.addSeparator();
-
- if (result.isContentSelected() && result.isContentEditable())
- {
- menu.addAction(webActions()->action("edit_cut"));
- }
-
- if (result.isContentSelected())
- {
- menu.addAction(webActions()->action("edit_copy"));
- }
-
- if (result.isContentEditable())
- {
- menu.addAction(webActions()->action("edit_paste"));
- }
-
+ // save/copy link actions
if (!linkIsEmpty)
{
+ menu.addAction(webActions()->action("save_link_as"));
+ menu.addAction(webActions()->action("copy_link_location"));
menu.addSeparator();
+
if (!result.pixmap().isNull())
{
// TODO Add "View Image"
menu.addAction(webActions()->action("save_image_as"));
menu.addAction(webActions()->action("copy_this_image"));
+ menu.addSeparator();
}
- menu.addAction(webActions()->action("save_link_as"));
- menu.addAction(webActions()->action("copy_link_location"));
+ }
+
+ // history actions
+ menu.addAction(mainwindow->actionByName("history_back"));
+ menu.addAction(mainwindow->actionByName("history_forward"));
+
+ // bookmark link action
+ if (!linkIsEmpty)
+ {
+ menu.addSeparator();
addBookmarkAction->setData(result.linkUrl());
addBookmarkAction->setText(i18n("&Bookmark This Link"));
+ menu.addAction(addBookmarkAction);
}
- menu.addSeparator();
- menu.addAction(addBookmarkAction);
menu.exec(mapToGlobal(event->pos()));
}