summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2013-04-25 08:59:47 +0200
committerAndrea Diamantini <adjam7@gmail.com>2013-04-25 09:02:06 +0200
commit072490b92b33bd37672e4ac34d3b7df0705c84ae (patch)
tree493d44450ba062e80aad2048e41e8fd0ce74a91a /src
parentChanges order of link actions for link context menu (diff)
downloadrekonq-072490b92b33bd37672e4ac34d3b7df0705c84ae.tar.xz
appmenu-qt support :)
BUG: 309148
Diffstat (limited to 'src')
-rw-r--r--src/tabwindow/rekonqwindow.cpp6
-rw-r--r--src/webwindow/rekonqfactory.cpp42
-rw-r--r--src/webwindow/rekonqui.rc66
-rw-r--r--src/webwindow/webwindow.cpp14
4 files changed, 98 insertions, 30 deletions
diff --git a/src/tabwindow/rekonqwindow.cpp b/src/tabwindow/rekonqwindow.cpp
index e67e21c8..c0785b67 100644
--- a/src/tabwindow/rekonqwindow.cpp
+++ b/src/tabwindow/rekonqwindow.cpp
@@ -36,6 +36,7 @@
#include "tabwidget.h"
#include "tabbar.h"
+#include "rekonqfactory.h"
#include "webpage.h"
#include "webwindow.h"
@@ -47,6 +48,7 @@
// Qt Includes
#include <QVBoxLayout>
#include <QSizePolicy>
+#include <QDBusConnection>
RekonqWindow::RekonqWindow(bool withTab, bool privateBrowsingMode, QWidget *parent)
@@ -97,6 +99,10 @@ void RekonqWindow::init()
// signals
connect(_tabWidget, SIGNAL(closeWindow()), this, SLOT(close()));
connect(_tabWidget, SIGNAL(windowTitleChanged(QString)), this, SLOT(setWindowTitle(QString)));
+
+ // This is needed to properly support appmenu-qt feature
+ RekonqFactory::createWidget(QL1S("menuBar"), this);
+ QDBusConnection::sessionBus().registerObject(QL1S("rekonq"), this);
}
// --------------------------------------------------------------------------------------------------
diff --git a/src/webwindow/rekonqfactory.cpp b/src/webwindow/rekonqfactory.cpp
index 75fd0baa..03711464 100644
--- a/src/webwindow/rekonqfactory.cpp
+++ b/src/webwindow/rekonqfactory.cpp
@@ -38,6 +38,7 @@
#include <KToolBar>
#include <QFile>
+#include <QMenuBar>
#include <QString>
#include <QWidget>
@@ -177,6 +178,47 @@ QWidget *RekonqFactory::createWidget(const QString &name, QWidget *parent)
}
+ // MenuBar ----------------------------------------------------------------------
+ QDomNodeList elementMenuBarList = document.elementsByTagName(QL1S("MenuBar"));
+ if (elementMenuBarList.isEmpty())
+ {
+ kDebug() << "ELEMENT MENUBAR LIST EMPTY. RETURNING NULL";
+ return 0;
+ }
+
+ if (name == QL1S("menuBar"))
+ {
+ QDomNode node = elementMenuBarList.at(0);
+ QDomNodeList menuNodes = node.childNodes();
+
+ QMenuBar *menuBar = new QMenuBar(parent);
+ for (unsigned int i = 0; i < menuNodes.length(); ++i)
+ {
+ QDomNode node = menuNodes.at(i);
+ if (node.isComment())
+ continue;
+
+ QDomElement element = node.toElement();
+
+ if (element.attribute("deleted").toLower() == "true")
+ continue;
+
+ if (element.attribute("name") == QL1S("help"))
+ {
+ KHelpMenu *m = new KHelpMenu(parent, KCmdLineArgs::aboutData());
+ menuBar->addMenu(m->menu());
+ continue;
+ }
+
+ KMenu *m = new KMenu(parent);
+ fillMenu(m, node);
+ menuBar->addMenu(m);
+ }
+
+ menuBar->hide();
+ return menuBar;
+ }
+
kDebug() << "NO WIDGET RETURNED";
return 0;
}
diff --git a/src/webwindow/rekonqui.rc b/src/webwindow/rekonqui.rc
index 6e23416f..cefdb96b 100644
--- a/src/webwindow/rekonqui.rc
+++ b/src/webwindow/rekonqui.rc
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
-<gui name="rekonq" version="69">
+<gui name="rekonq" version="70">
<!--- =========== Rekonq Menu ============= -->
<Menu name="rekonqMenu" noMerge="1">
@@ -75,17 +75,19 @@
<Separator/>
<Action name="file_quit" />
</Menu>
+
+
<!--- ====================================== -->
-<MenuBar>
- <!-- ============ FILE menu =========== -->
+<MenuBar name="menuBar">
<Menu name="file" noMerge="1"><text>&amp;File</text>
<Action name="file_open" />
<Action name="open_location" />
<Separator/>
<Action name="new_tab" />
<Action name="new_window" />
+ <Action name="private_browsing" />
<Separator/>
<Action name="file_save_as" />
<Separator/>
@@ -93,8 +95,7 @@
<Separator/>
<Action name="file_quit" />
</Menu>
-
- <!-- ============ EDIT menu =========== -->
+
<Menu name="edit" noMerge="1"><text>&amp;Edit</text>
<Action name="edit_undo" />
<Action name="edit_redo" />
@@ -107,54 +108,59 @@
<Action name="edit_find_next" />
<Action name="edit_find_prev" />
</Menu>
-
- <!-- ============ VIEW menu =========== -->
+
<Menu name="view" noMerge="1"><text>&amp;View</text>
<Action name="view_redisplay" />
- <Action name="go_home" />
+ <Action name="stop" />
<Separator/>
- <Action name="bigger_font" />
- <Action name="normal_font" />
- <Action name="smaller_font" />
+ <Action name="view_zoom_in"/>
+ <Action name="view_zoom_out"/>
+ <Action name="view_zoom"/>
<Separator/>
- <Action name="page_source" />
+ <Action name="show_bookmarks_panel" />
+ <Action name="show_history_panel" />
</Menu>
- <!-- ============ GO menu =========== -->
- <Menu name="go" deleted="true">
+ <Menu name="go" noMerge="1"><text>&amp;Go</text>
+ <Action name="go_back" />
+ <Action name="go_forward" />
+ <Action name="load_stop_reload" />
+ <Action name="go_home" />
+ <Separator/>
+ <Action name="open_bookmarks_page" />
+ <Action name="open_history_page" />
+ <Action name="open_downloads_page" />
+ <Separator/>
</Menu>
- <!-- ============ HISTORY menu =========== -->
- <Action name="history" ><text>Hi&amp;story</text>
- </Action>
-
- <!-- ============ BOOKMARKS menu =========== -->
- <Action name="bookmarksActionMenu" ><text>&amp;Bookmarks</text>
- </Action>
-
- <!-- ============ TOOLS menu =========== -->
<Menu name="tools" noMerge="1"><text>&amp;Tools</text>
- <Action name="web_inspector" />
- <Action name="private_browsing" />
<Action name="clear_private_data" />
+ <Separator/>
+ <Action name="session_manage" />
+ <Action name="webapp_shortcut" />
+ <Action name="web_inspector" />
<Action name="page_source" />
<Action name="set_editable" />
<Separator/>
<Action name="useragent" />
+ <Action name="sync" />
<Action name="adblock" />
</Menu>
- <!-- ============ SETTINGS menu =========== -->
+ <!-- ciao -->
<Menu name="settings" noMerge="1"><text>&amp;Settings</text>
- <Merge name="StandardToolBarMenuHandler" />
- <Merge/>
- <Separator/>
<Action name="fullscreen" />
<Separator/>
+ <Action name="show_bookmarks_toolbar" />
+ <Separator/>
<Action name="options_configure_keybinding" />
- <Action name="options_configure_toolbars" />
+ <Action name="configure_main_toolbar" />
<Action name="options_configure" />
</Menu>
+
+ <Menu name="help">
+ </Menu>
+
</MenuBar>
<!-- ============ Main ToolBar =========== -->
diff --git a/src/webwindow/webwindow.cpp b/src/webwindow/webwindow.cpp
index 5858ec6c..a2854460 100644
--- a/src/webwindow/webwindow.cpp
+++ b/src/webwindow/webwindow.cpp
@@ -219,6 +219,20 @@ void WebWindow::setupActions()
KStandardAction::keyBindings(this, SLOT(keyBindings()), actionCollection());
KStandardAction::quit(rApp, SLOT(queryQuit()), actionCollection());
+ // WebPage Actions
+ QAction *qa;
+
+ qa = _tab->page()->action(QWebPage::Undo);
+ actionCollection()->addAction(QL1S("edit_undo"), qa);
+ qa = _tab->page()->action(QWebPage::Redo);
+ actionCollection()->addAction(QL1S("edit_redo"), qa);
+ qa = _tab->page()->action(QWebPage::Cut);
+ actionCollection()->addAction(QL1S("edit_cut"), qa);
+ qa = _tab->page()->action(QWebPage::Copy);
+ actionCollection()->addAction(QL1S("edit_copy"), qa);
+ qa = _tab->page()->action(QWebPage::Paste);
+ actionCollection()->addAction(QL1S("edit_paste"), qa);
+
// Configure Main Toolbar
a = new KAction(KIcon("configure-toolbars"), i18n("Configure Main ToolBar"), this);
actionCollection()->addAction(QL1S("configure_main_toolbar"), a);