summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/findbar.cpp4
-rw-r--r--src/findbar.h5
-rw-r--r--src/mainview.cpp1
-rw-r--r--src/mainwindow.cpp77
-rw-r--r--src/mainwindow.h13
-rw-r--r--src/rekonqui.rc102
7 files changed, 62 insertions, 141 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d4e513fd..67a0c8df 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -71,4 +71,3 @@ TARGET_LINK_LIBRARIES ( rekonq
INSTALL( TARGETS 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/findbar.cpp b/src/findbar.cpp
index 6d108a15..4ec93d87 100644
--- a/src/findbar.cpp
+++ b/src/findbar.cpp
@@ -34,7 +34,7 @@
#include <KIcon>
#include <KPushButton>
#include <klocalizedstring.h>
-#include <KXmlGuiWindow>
+#include <KMainWindow>
#include <KApplication>
// Qt Includes
@@ -47,7 +47,7 @@
#include <QtCore/QString>
-FindBar::FindBar(KXmlGuiWindow *mainwindow)
+FindBar::FindBar(KMainWindow *mainwindow)
: QWidget(mainwindow)
, m_lineEdit(new KLineEdit(this))
, m_matchCase(new QCheckBox(i18n("&Match case"), this))
diff --git a/src/findbar.h b/src/findbar.h
index 6d92a645..0818d010 100644
--- a/src/findbar.h
+++ b/src/findbar.h
@@ -38,7 +38,7 @@
#include <QtGui/QKeyEvent>
// Forward Declarations
-class KXmlGuiWindow;
+class KMainWindow;
class QKeyEvent;
class QString;
@@ -48,7 +48,7 @@ class FindBar : public QWidget
Q_OBJECT
public:
- FindBar(KXmlGuiWindow *mainwindow);
+ FindBar(KMainWindow *mainwindow);
~FindBar();
KLineEdit *lineEdit() const;
bool matchCase() const;
@@ -71,4 +71,3 @@ private:
};
#endif
-
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 2b6d294c..9b3dfc21 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -415,7 +415,6 @@ void MainView::slotReloadAllTabs()
void MainView::windowCloseRequested()
{
-
WebPage *webPage = qobject_cast<WebPage*>(sender());
WebView *webView = qobject_cast<WebView*>(webPage->view());
int index = webViewIndex(webView);
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 8a84b844..f527a6cb 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -88,11 +88,15 @@
MainWindow::MainWindow()
- : KXmlGuiWindow()
+ : KMainWindow()
, m_view(new MainView(this))
, m_findBar(new FindBar(this))
, m_sidePanel(0)
+ , m_ac( new KActionCollection(this) )
{
+ // enable window size "auto-save"
+ setAutoSaveSettings();
+
// updating rekonq configuration
slotUpdateConfiguration();
@@ -116,27 +120,20 @@ MainWindow::MainWindow()
// then, setup our actions
setupActions();
- // setting up toolbars && location bar: this has to be done BEFORE setupGUI!!
- setupBars();
-
// Bookmark Menu
KActionMenu *bmMenu = Application::bookmarkProvider()->bookmarkActionMenu();
bmMenu->setIcon(KIcon("rating"));
actionCollection()->addAction(QLatin1String("bookmarksActionMenu"), bmMenu);
((KActionMenu *)actionByName("bookmarksActionMenu"))->setDelayed(false);
- // Side Panel: this has to be done BEFORE setupGUI!!
+ // setting Side Panel
setupSidePanel();
- // setting up rekonq tools: to be done BEFORE setupGUI!
+ // setting up rekonq tools
setupTools();
-
- // 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();
+
+ // setting up rekonq toolbar(s)
+ setupToolbar();
// no more status bar..
setStatusBar(0);
@@ -158,11 +155,27 @@ SidePanel *MainWindow::sidePanel()
}
-void MainWindow::postLaunch()
+void MainWindow::setupToolbar()
{
- // setup history menu: this has to be done AFTER setupGUI!!
- setupHistoryMenu();
+ KToolBar *mainToolBar = new KToolBar( QString("MainToolBar"), this, Qt::TopToolBarArea);
+ mainToolBar->setContextMenuPolicy(Qt::PreventContextMenu);
+ mainToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
+ mainToolBar->addAction( actionByName(KStandardAction::name(KStandardAction::Back)) );
+ mainToolBar->addAction( actionByName(KStandardAction::name(KStandardAction::Forward)) );
+ mainToolBar->addSeparator();
+ mainToolBar->addAction( actionByName("stop_reload") );
+ mainToolBar->addAction( actionByName(KStandardAction::name(KStandardAction::Home)) );
+ mainToolBar->addAction( actionByName("url_bar") );
+ mainToolBar->addAction( actionByName("bookmarksActionMenu") );
+ mainToolBar->addAction( actionByName("rekonq_tools") );
+
+ KToolBar::setToolBarsEditable(false);
+ KToolBar::setToolBarsLocked(true);
+}
+
+void MainWindow::postLaunch()
+{
// --------- connect signals and slots
connect(m_view, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(slotUpdateWindowTitle(const QString &)));
connect(m_view, SIGNAL(printRequested(QWebFrame *)), this, SLOT(printRequested(QWebFrame *)));
@@ -183,7 +196,8 @@ void MainWindow::postLaunch()
// accept d'n'd
setAcceptDrops(true);
-
+
+ // set CookieJar window Id
const qlonglong winId = window()->winId();
Application::cookieJar()->setWindowId(winId);
Application::networkAccessManager()->metaData().insert("window-id", QString::number(winId));
@@ -198,7 +212,13 @@ QSize MainWindow::sizeHint() const
}
-void MainWindow::setupBars()
+KActionCollection *MainWindow::actionCollection () const
+{
+ return m_ac;
+}
+
+
+void MainWindow::setupActions()
{
KAction *a;
@@ -211,12 +231,6 @@ void MainWindow::setupBars()
// bookmarks bar
KAction *bookmarkBarAction = Application::bookmarkProvider()->bookmarkToolBarAction();
a = actionCollection()->addAction(QLatin1String("bookmarks_bar"), bookmarkBarAction);
-}
-
-
-void MainWindow::setupActions()
-{
- KAction *a;
// Standard Actions
KStandardAction::open(this, SLOT(slotFileOpen()), actionCollection());
@@ -335,13 +349,21 @@ void MainWindow::setupActions()
void MainWindow::setupTools()
{
- KActionMenu *toolsMenu = new KActionMenu(KIcon("configure"), i18n("rekonq tools"), this);
+ KActionMenu *toolsMenu = new KActionMenu(KIcon("configure"), i18n("&Tools"), this);
toolsMenu->setDelayed(false);
toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::SaveAs)));
toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::PrintPreview)));
toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Find)));
+ KActionMenu *fontMenu = new KActionMenu(KIcon("page-zoom"), i18n("Zoom"), this);
+ fontMenu->addAction(actionByName(QLatin1String("smaller_font")));
+ fontMenu->addAction(actionByName(QLatin1String("normal_font")));
+ fontMenu->addAction(actionByName(QLatin1String("bigger_font")));
+ toolsMenu->addAction(fontMenu);
+
+ toolsMenu->addSeparator();
+
KActionMenu *webMenu = new KActionMenu(KIcon("applications-development-web"), i18n("Web Development"), this);
webMenu->addAction(actionByName(QLatin1String("web_inspector")));
webMenu->addAction(actionByName(QLatin1String("page_source")));
@@ -359,8 +381,7 @@ void MainWindow::setupTools()
toolsMenu->addSeparator();
- // TODO: decide if re-enable this when rekonq docs will be written
- // toolsMenu->addAction(KStandardAction::helpContents(this, SLOT(appHelpActivated()), actionCollection()));
+ toolsMenu->addAction(helpMenu()->menuAction());
toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Preferences)));
// adding rekonq_tools to rekonq actionCollection
@@ -875,7 +896,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
return;
}
- KXmlGuiWindow::keyPressEvent(event);
+ KMainWindow::keyPressEvent(event);
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index b7f9bae1..a2031692 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -36,7 +36,9 @@
#include "webview.h"
// KDE Includes
-#include <KXmlGuiWindow>
+#include <KMainWindow>
+#include <KActionCollection>
+#include <KToolBar>
// Forward Declarations
class QWebFrame;
@@ -55,7 +57,7 @@ class WebView;
* It handles the menus, toolbars, and status bars.
*
*/
-class MainWindow : public KXmlGuiWindow
+class MainWindow : public KMainWindow
{
Q_OBJECT
@@ -67,12 +69,13 @@ public:
WebView *currentTab() const;
QAction *actionByName(const QString name);
virtual QSize sizeHint() const;
-
+ virtual KActionCollection *actionCollection () const;
+
private:
void setupActions();
void setupHistoryMenu();
- void setupBars();
void setupTools();
+ void setupToolbar();
void setupSidePanel();
SidePanel *sidePanel();
@@ -152,6 +155,8 @@ private:
QString m_homePage;
QPointer<KPassivePopup> m_popup;
+
+ KActionCollection *m_ac;
};
#endif // MAINWINDOW_H
diff --git a/src/rekonqui.rc b/src/rekonqui.rc
deleted file mode 100644
index 6b250ab3..00000000
--- a/src/rekonqui.rc
+++ /dev/null
@@ -1,102 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE gui SYSTEM "kpartgui.dtd">
-<gui name="rekonq" version="44">
-
-<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="history_back" />
- <Action name="history_forward" />
- <Separator />
- <Action name="stop_reload" />
- <Action name="go_home" />
- <Action name="url_bar" />
- <Action name="bookmarksActionMenu" />
- <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>