diff options
-rw-r--r-- | src/tabwindow/rekonqwindow.cpp | 6 | ||||
-rw-r--r-- | src/webwindow/rekonqfactory.cpp | 42 | ||||
-rw-r--r-- | src/webwindow/rekonqui.rc | 66 | ||||
-rw-r--r-- | src/webwindow/webwindow.cpp | 14 |
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>&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>&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>&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>&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&story</text> - </Action> - - <!-- ============ BOOKMARKS menu =========== --> - <Action name="bookmarksActionMenu" ><text>&Bookmarks</text> - </Action> - - <!-- ============ TOOLS menu =========== --> <Menu name="tools" noMerge="1"><text>&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>&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); |