summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/bookmarks/bookmarksmanager.cpp10
-rw-r--r--src/bookmarks/bookmarksmanager.h1
-rw-r--r--src/mainwindow.cpp122
-rw-r--r--src/mainwindow.h11
-rw-r--r--src/rekonqui.rc100
6 files changed, 167 insertions, 79 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d0e5721c..9d691d36 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -120,4 +120,6 @@ TARGET_LINK_LIBRARIES ( kdeinit_rekonq
INSTALL( TARGETS rekonq ${INSTALL_TARGETS_DEFAULT_ARGS} )
INSTALL( TARGETS kdeinit_rekonq ${INSTALL_TARGETS_DEFAULT_ARGS} )
+
INSTALL( FILES rekonq.kcfg DESTINATION ${KCFG_INSTALL_DIR} )
+INSTALL( FILES rekonqui.rc DESTINATION ${DATA_INSTALL_DIR}/rekonq )
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp
index d0062ae1..7f07cf48 100644
--- a/src/bookmarks/bookmarksmanager.cpp
+++ b/src/bookmarks/bookmarksmanager.cpp
@@ -366,6 +366,16 @@ KActionMenu* BookmarkProvider::bookmarkActionMenu(QWidget *parent)
}
+KAction* BookmarkProvider::bookmarkToolBarAction(KToolBar *t)
+{
+ KAction *bookmarkToolBarAction = new KAction(this);
+ bookmarkToolBarAction->setDefaultWidget(t); // The ownership is transferred to action
+ bookmarkToolBarAction->setText(i18n("Bookmarks Bar"));
+ bookmarkToolBarAction->setShortcutConfigurable(false);
+ return bookmarkToolBarAction;
+}
+
+
void BookmarkProvider::triggerBookmarkMenu()
{
kDebug() << "triggering Bookmarks Menu...";
diff --git a/src/bookmarks/bookmarksmanager.h b/src/bookmarks/bookmarksmanager.h
index 64945eab..fd2cfcdc 100644
--- a/src/bookmarks/bookmarksmanager.h
+++ b/src/bookmarks/bookmarksmanager.h
@@ -200,6 +200,7 @@ public:
*/
KActionMenu *bookmarkActionMenu(QWidget *parent);
+ KAction *bookmarkToolBarAction(KToolBar *t);
/**
* @short set the Bookmarks Toolbar Action
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 55cc7a69..8d0f28a7 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -94,7 +94,7 @@
MainWindow::MainWindow()
- : KMainWindow()
+ : KXmlGuiWindow()
, m_view(new MainView(this))
, m_findBar(new FindBar(this))
, m_historyPanel(0)
@@ -103,16 +103,11 @@ MainWindow::MainWindow()
, m_analyzerPanel(0)
, m_historyBackMenu(0)
, m_encodingMenu(new KMenu(this))
- , m_mainBar(new KToolBar(QString("MainToolBar"), this, Qt::TopToolBarArea, true, true, true))
- , m_bmBar(new KToolBar(QString("BookmarkToolBar"), this, Qt::TopToolBarArea, true, false, true))
+// , m_mainBar(new KToolBar(QString("MainToolBar"), this, Qt::TopToolBarArea, true, true, true))
+// , m_bmBar(new KToolBar(QString("BookmarkToolBar"), this, Qt::TopToolBarArea, true, false, true))
, m_popup(new KPassivePopup(this))
, m_hidePopup(new QTimer(this))
- , m_ac(new KActionCollection(this))
{
- kDebug() << "MainWindow ctor...";
- // enable window size "auto-save"
- setAutoSaveSettings();
-
// creating a centralWidget containing panel, m_view and the hidden findbar
QWidget *centralWidget = new QWidget;
centralWidget->setContentsMargins(0, 0, 0, 0);
@@ -142,9 +137,33 @@ MainWindow::MainWindow()
// setting up rekonq toolbar(s)
setupToolbars();
+ // a call to KXmlGuiWindow::setupGUI() populates the GUI
+ // with actions, using KXMLGUI.
+ // It also applies the saved mainwindow settings, if any, and ask the
+ // mainwindow to automatically save settings if changed: window size,
+ // toolbar position, icon size, etc.
+ setupGUI();
+
+ // no menu bar in rekonq: we have other plans..
+ menuBar()->setVisible(false);
+
// no more status bar..
setStatusBar(0);
+ KToolBar *mainBar = toolBar("mainToolBar");
+
+ QToolButton *bookmarksButton = qobject_cast<QToolButton*>(mainBar->widgetForAction(actionByName( QL1S("bookmarksActionMenu") )));
+ if(bookmarksButton)
+ {
+ connect(actionByName(QL1S("bookmarksActionMenu")), SIGNAL(triggered()), bookmarksButton, SLOT(showMenu()));
+ }
+
+ QToolButton *toolsButton = qobject_cast<QToolButton*>(mainBar->widgetForAction(actionByName( QL1S("rekonq_tools") )));
+ if(toolsButton)
+ {
+ connect(actionByName(QL1S("rekonq_tools")), SIGNAL(triggered()), toolsButton, SLOT(showMenu()));
+ }
+
// setting popup notification
m_popup->setAutoDelete(false);
connect(Application::instance(), SIGNAL(focusChanged(QWidget*, QWidget*)), m_popup, SLOT(hide()));
@@ -160,7 +179,8 @@ MainWindow::MainWindow()
MainWindow::~MainWindow()
{
- Application::bookmarkProvider()->removeToolBar(m_bmBar);
+ KToolBar *bookBar = toolBar("bookmarksToolBar");
+ Application::bookmarkProvider()->removeToolBar(bookBar);
Application::bookmarkProvider()->removeBookmarkPanel(m_bookmarksPanel);
Application::instance()->removeMainWindow(this);
@@ -175,15 +195,10 @@ MainWindow::~MainWindow()
delete m_historyBackMenu;
delete m_encodingMenu;
- delete m_mainBar;
- delete m_bmBar;
-
delete m_zoomSlider;
delete m_popup;
delete m_hidePopup;
-
- delete m_ac;
}
@@ -191,52 +206,31 @@ void MainWindow::setupToolbars()
{
kDebug() << "setup toolbars...";
- // ============ Main ToolBar ================================
- m_mainBar->addAction(actionByName(KStandardAction::name(KStandardAction::Back)));
- m_mainBar->addAction(actionByName(KStandardAction::name(KStandardAction::Forward)));
- m_mainBar->addSeparator();
- m_mainBar->addAction(actionByName( QL1S("stop_reload") ));
-// m_mainBar->addAction(actionByName(KStandardAction::name(KStandardAction::Home)));
+ KAction *a;
// location bar
- KAction *urlBarAction = new KAction(this);
- urlBarAction->setDefaultWidget(m_view->widgetBar());
- m_mainBar->addAction(urlBarAction);
+ a = new KAction(i18n("Location Bar"), this);
+ a->setShortcut(KShortcut(Qt::Key_F6));
+ a->setDefaultWidget(m_view->widgetBar());
+ actionCollection()->addAction( QL1S("url_bar"), a);
-// m_mainBar->addAction(actionByName( QL1S("bookmarksActionMenu") ));
- connect(actionByName(QL1S("bookmarksActionMenu")), SIGNAL(triggered()),
- qobject_cast<QToolButton*>(m_mainBar->widgetForAction(actionByName(QL1S("bookmarksActionMenu")))), SLOT(showMenu()));
-
- m_mainBar->addAction(actionByName( QL1S("rekonq_tools") ));
- connect(actionByName(QL1S("rekonq_tools")), SIGNAL(triggered()),
- qobject_cast<QToolButton*>(m_mainBar->widgetForAction(actionByName(QL1S("rekonq_tools")))), SLOT(showMenu()));
+ KToolBar *mainBar = toolBar("mainToolBar");
+ KToolBar *bookBar = toolBar("bookmarksToolBar");
+
+ // bookmarks bar
+ KAction *bookmarkBarAction = Application::bookmarkProvider()->bookmarkToolBarAction(bookBar);
+ a = actionCollection()->addAction( QL1S("bookmarks_bar"), bookmarkBarAction);
- m_mainBar->show(); // this just to fix reopening rekonq after fullscreen close
+ mainBar->show(); // this just to fix reopening rekonq after fullscreen close
// =========== Bookmarks ToolBar ================================
- m_bmBar->setAcceptDrops(true);
- Application::bookmarkProvider()->setupBookmarkBar(m_bmBar);
-
- if (ReKonfig::firstExecution())
- {
- m_mainBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
-
- m_bmBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
- m_bmBar->setIconDimensions(16);
-
- KToolBar::setToolBarsEditable(false);
- KToolBar::setToolBarsLocked(true);
-
- ReKonfig::setFirstExecution(false);
- }
+ bookBar->setAcceptDrops(true);
+ Application::bookmarkProvider()->setupBookmarkBar(bookBar);
}
void MainWindow::postLaunch()
{
- // KActionCollection read settings
- m_ac->readSettings();
-
// notification system
connect(m_view, SIGNAL(showStatusBarMessage(const QString&, Rekonq::Notify)), this, SLOT(notifyMessage(const QString&, Rekonq::Notify)));
connect(m_view, SIGNAL(linkHovered(const QString&)), this, SLOT(notifyMessage(const QString&)));
@@ -411,7 +405,6 @@ void MainWindow::setupActions()
connect(a, SIGNAL(triggered(bool)), m_view, SLOT(switchToTab()));
}
-
// ============================== Indexed Tab Actions ====================================
a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this);
a->setShortcuts( KStandardShortcut::close() );
@@ -434,20 +427,6 @@ void MainWindow::setupActions()
actionCollection()->addAction(QL1S("detach_tab"), a);
connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(detachTab()));
-
- // ----------------------- Bookmarks ToolBar Action --------------------------------------
- QAction *qa;
-
- qa = m_mainBar->toggleViewAction();
- qa->setText(i18n("Main Toolbar"));
- qa->setIcon(KIcon("bookmark-toolbar"));
- actionCollection()->addAction(QL1S("main_bar"), qa);
-
- qa = m_bmBar->toggleViewAction();
- qa->setText(i18n("Bookmarks Toolbar"));
- qa->setIcon(KIcon("bookmark-toolbar"));
- actionCollection()->addAction(QL1S("bm_bar"), qa);
-
// Bookmark Menu
KActionMenu *bmMenu = Application::bookmarkProvider()->bookmarkActionMenu(this);
bmMenu->setIcon(KIcon("bookmarks"));
@@ -456,7 +435,6 @@ void MainWindow::setupActions()
bmMenu->setShortcut( KShortcut(Qt::ALT + Qt::Key_B) );
actionCollection()->addAction(QL1S("bookmarksActionMenu"), bmMenu);
-
// ---------------- Encodings -----------------------------------
a = new KAction(KIcon("character-set"), i18n("Set Encoding"), this);
actionCollection()->addAction(QL1S("encodings"), a);
@@ -530,7 +508,6 @@ void MainWindow::setupTools()
toolsMenu->addSeparator();
- toolsMenu->addAction(actionByName(QL1S("bm_bar")));
toolsMenu->addAction(actionByName(QL1S("show_history_panel")));
toolsMenu->addAction(actionByName(QL1S("show_bookmarks_panel")));
toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::FullScreen)));
@@ -915,33 +892,36 @@ void MainWindow::setWidgetsVisible(bool makeVisible)
static bool historyPanelFlag;
static bool bookmarksPanelFlag;
+ KToolBar *mainBar = toolBar("mainToolBar");
+ KToolBar *bookBar = toolBar("bookmarksToolBar");
+
if (!makeVisible)
{
// save current state, if in windowed mode
if (!isFullScreen())
{
- bookmarksToolBarFlag = m_bmBar->isHidden();
+ bookmarksToolBarFlag = bookBar->isHidden();
historyPanelFlag = m_historyPanel->isHidden();
bookmarksPanelFlag = m_bookmarksPanel->isHidden();
}
- m_bmBar->hide();
+ bookBar->hide();
m_view->setTabBarHidden(true);
m_historyPanel->hide();
m_bookmarksPanel->hide();
// hide main toolbar
- m_mainBar->hide();
+ mainBar->hide();
}
else
{
// show main toolbar
- m_mainBar->show();
+ mainBar->show();
m_view->setTabBarHidden(false);
// restore state of windowed mode
if (!bookmarksToolBarFlag)
- m_bmBar->show();
+ bookBar->show();
if (!historyPanelFlag)
m_historyPanel->show();
if (!bookmarksPanelFlag)
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 286290c0..1ec79a4b 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -35,7 +35,7 @@
#include "rekonq_defines.h"
// KDE Includes
-#include <KMainWindow>
+#include <KXmlGuiWindow>
#include <KActionCollection>
#include <KToolBar>
#include <KUrl>
@@ -61,7 +61,7 @@ class QSlider;
* It handles the menus, toolbars, and status bars.
*
*/
-class REKONQ_TESTS_EXPORT MainWindow : public KMainWindow
+class REKONQ_TESTS_EXPORT MainWindow : public KXmlGuiWindow
{
Q_OBJECT
@@ -70,7 +70,6 @@ public:
~MainWindow();
inline MainView *mainView() const { return m_view; }
- inline KActionCollection *actionCollection() const { return m_ac; }
inline QAction *actionByName(const QString &name) { return actionCollection()->action(name); }
WebTab *currentTab() const;
@@ -178,17 +177,13 @@ private:
KMenu *m_historyBackMenu;
KMenu *m_encodingMenu;
- KToolBar *m_mainBar;
- KToolBar *m_bmBar;
-
QSlider *m_zoomSlider;
QString m_lastSearch;
KPassivePopup *m_popup;
QTimer *m_hidePopup;
-
- KActionCollection *m_ac;
};
#endif // MAINWINDOW_H
+ \ No newline at end of file
diff --git a/src/rekonqui.rc b/src/rekonqui.rc
new file mode 100644
index 00000000..28baff5d
--- /dev/null
+++ b/src/rekonqui.rc
@@ -0,0 +1,100 @@
+<?xml version="1.0"?>
+<!DOCTYPE gui SYSTEM "kpartgui.dtd">
+<gui name="rekonq" version="51">
+
+<MenuBar>
+
+<!-- ============ FILE menu =========== -->
+<Menu name="file" noMerge="1"><text>&amp;File</text>
+ <Action name="file_open" />
+ <Action name="open_location" />
+ <Separator/>
+ <Action name="new_tab" />
+ <Action name="close_tab" />
+ <Separator/>
+ <Action name="file_save_as" />
+ <Separator/>
+ <Action name="file_print_preview" />
+ <Action name="file_print" />
+ <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" />
+ <Separator/>
+ <Action name="edit_cut" />
+ <Action name="edit_copy" />
+ <Action name="edit_paste" />
+ <Separator/>
+ <Action name="edit_find" />
+ <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" />
+ <Separator/>
+ <Action name="bigger_font" />
+ <Action name="normal_font" />
+ <Action name="smaller_font" />
+ <Separator/>
+ <Action name="page_source" />
+</Menu>
+
+<!-- ============ GO menu =========== -->
+<Menu name="go" deleted="true">
+</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" />
+</Menu>
+
+<!-- ============ SETTINGS menu =========== -->
+<Menu name="settings" noMerge="1"><text>&amp;Settings</text>
+ <Action name="options_show_menubar" />
+ <Merge name="StandardToolBarMenuHandler" />
+ <Merge/>
+ <Separator/>
+ <Action name="fullscreen" />
+ <Separator/>
+ <Action name="options_configure_keybinding" />
+ <Action name="options_configure_toolbars" />
+ <Action name="options_configure" />
+</Menu>
+
+</MenuBar>
+
+<!-- ============ Main ToolBar =========== -->
+<ToolBar name="mainToolBar" position="top" iconText="iconOnly" newline="true" noMerge="1">
+<text>Main Toolbar</text>
+ <Action name="go_back" />
+ <Action name="go_forward" />
+ <Separator />
+ <Action name="stop_reload" />
+ <Action name="url_bar" />
+ <Action name="rekonq_tools" />
+</ToolBar>
+
+<!-- ============ Bookmarks ToolBar =========== -->
+<ToolBar name="bookmarksToolBar" fullWidth="true" iconText="icontextright" iconSize="16" newline="true" hidden="true" noEdit="true">
+ <text>Bookmark Toolbar</text>
+ <Action noEdit="true" name="bookmarks_bar" />
+</ToolBar>
+
+</gui>