diff options
-rw-r--r-- | src/mainwindow.cpp | 82 | ||||
-rw-r--r-- | src/mainwindow.h | 6 |
2 files changed, 44 insertions, 44 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 099a463e..1dc56f7a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -12,9 +12,9 @@ * published by the Free Software Foundation; either version 2 of * the License or (at your option) version 3 or any later version * accepted by the membership of KDE e.V. (or its successor approved -* by the membership of KDE e.V.), which shall act as a proxy +* by the membership of KDE e.V.), which shall act as a proxy * defined in Section 14 of version 3 of the license. -* +* * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -95,13 +95,13 @@ MainWindow::MainWindow() , m_findBar(new FindBar(this)) , m_sidePanel(0) , m_historyBackMenu(0) - , m_bmBar( new KToolBar( QString("BookmarkToolBar"), this, Qt::TopToolBarArea, true, false, true) ) - , m_mainBar( new KToolBar( QString("MainToolBar"), this, Qt::TopToolBarArea, true, false, false) ) + , m_mainBar( new KToolBar( QString("MainToolBar"), this, Qt::TopToolBarArea, true, true, true) ) + , m_bmBar( new KToolBar( QString("BookmarkToolBar"), this, Qt::TopToolBarArea, true, true, true) ) , m_ac( new KActionCollection(this) ) { // enable window size "auto-save" setAutoSaveSettings(); - + // updating rekonq configuration slotUpdateConfiguration(); @@ -125,20 +125,14 @@ MainWindow::MainWindow() // then, setup our actions setupActions(); - // Bookmark Menu - KActionMenu *bmMenu = Application::bookmarkProvider()->bookmarkActionMenu(this); - bmMenu->setIcon(KIcon("rating")); - actionCollection()->addAction(QLatin1String("bookmarksActionMenu"), bmMenu); - ((KActionMenu *)actionByName("bookmarksActionMenu"))->setDelayed(false); - // setting Side Panel setupSidePanel(); // setting up rekonq tools setupTools(); - - // setting up rekonq toolbar(s) - setupToolbar(); + + // setting up rekonq toolbar(s) + setupToolbars(); // no more status bar.. setStatusBar(0); @@ -160,12 +154,14 @@ SidePanel *MainWindow::sidePanel() } -void MainWindow::setupToolbar() +void MainWindow::setupToolbars() { // ============ Main ToolBar ================================ m_mainBar->setToolButtonStyle(Qt::ToolButtonIconOnly); - m_mainBar->setIconDimensions(22); m_mainBar->setContextMenuPolicy(Qt::PreventContextMenu); + m_mainBar->setFloatable(false); + m_mainBar->setMovable(false); + m_mainBar->addAction( actionByName(KStandardAction::name(KStandardAction::Back)) ); m_mainBar->addAction( actionByName(KStandardAction::name(KStandardAction::Forward)) ); m_mainBar->addSeparator(); @@ -174,14 +170,13 @@ void MainWindow::setupToolbar() m_mainBar->addAction( actionByName("url_bar") ); m_mainBar->addAction( actionByName("bookmarksActionMenu") ); m_mainBar->addAction( actionByName("rekonq_tools") ); - + // =========== Bookmarks ToolBar ================================ m_bmBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - m_bmBar->setIconDimensions(16); m_bmBar->setAcceptDrops(true); - m_bmBar->setContentsMargins(0, 0, 0, 0); - m_bmBar->setMinimumHeight(16); m_bmBar->setContextMenuPolicy(Qt::CustomContextMenu); + m_bmBar->setFloatable(false); + m_bmBar->setMovable(false); Application::bookmarkProvider()->setupBookmarkBar(m_bmBar); } @@ -196,7 +191,7 @@ 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 *))); - + // update toolbar actions signals connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions())); connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(slotUpdateActions())); @@ -205,7 +200,7 @@ void MainWindow::postLaunch() connect(m_findBar, SIGNAL(searchString(const QString &)), this, SLOT(slotFind(const QString &))); // bookmarks loading - connect(Application::bookmarkProvider(), SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType&)), + connect(Application::bookmarkProvider(), SIGNAL(openUrl(const KUrl&, const Rekonq::OpenType&)), Application::instance(), SLOT(loadUrl(const KUrl&, const Rekonq::OpenType&))); // setting up toolbars to NOT have context menu enabled @@ -234,7 +229,7 @@ void MainWindow::setupActions() { // this let shortcuts work.. actionCollection()->addAssociatedWidget(this); - + KAction *a; // location bar @@ -247,10 +242,10 @@ void MainWindow::setupActions() a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_N)); actionCollection()->addAction(QLatin1String("new_window"), a); connect(a, SIGNAL(triggered(bool)), Application::instance(), SLOT(newMainWindow())); - + // Standard Actions KStandardAction::open(this, SLOT(slotFileOpen()), actionCollection()); - KStandardAction::saveAs(this, SLOT(slotFileSaveAs()), actionCollection()); + KStandardAction::saveAs(this, SLOT(slotFileSaveAs()), actionCollection()); KStandardAction::print(this, SLOT(printRequested()), actionCollection()); KStandardAction::quit(this , SLOT(close()), actionCollection()); KStandardAction::find(m_findBar, SLOT(show()) , actionCollection()); @@ -285,7 +280,7 @@ void MainWindow::setupActions() actionCollection()->addAction(QLatin1String("open_location"), a); connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotOpenLocation())); - + // ============== Zoom Actions a = new KAction(KIcon("zoom-in"), i18n("&Enlarge Font"), this); a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Plus)); @@ -326,7 +321,7 @@ void MainWindow::setupActions() a->setMenu(m_historyBackMenu); connect(m_historyBackMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowBackMenu())); connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenActionUrl(QAction *))); - + KStandardAction::forward(this, SLOT(slotOpenNext()) , actionCollection()); // =================== Tab Actions @@ -360,6 +355,12 @@ void MainWindow::setupActions() qa->setText( i18n("Bookmarks Toolbar") ); qa->setIcon( KIcon("bookmark-toolbar") ); actionCollection()->addAction(QLatin1String("bm_bar"), qa); + + // Bookmark Menu + KActionMenu *bmMenu = Application::bookmarkProvider()->bookmarkActionMenu(this); + bmMenu->setIcon(KIcon("rating")); + bmMenu->setDelayed(false); + actionCollection()->addAction(QLatin1String("bookmarksActionMenu"), bmMenu); } @@ -384,15 +385,15 @@ void MainWindow::setupTools() toolsMenu->addAction(actionByName(QLatin1String("clear_private_data"))); 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"))); toolsMenu->addAction(webMenu); toolsMenu->addSeparator(); - - toolsMenu->addAction(actionByName(QLatin1String("bm_bar"))); + + toolsMenu->addAction(actionByName(QLatin1String("bm_bar"))); toolsMenu->addAction(actionByName(QLatin1String("show_history_panel"))); toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::FullScreen))); @@ -455,7 +456,7 @@ void MainWindow::slotUpdateConfiguration() defaultSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, ReKonfig::offlineStorageDatabaseEnabled()); defaultSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, ReKonfig::offlineWebApplicationCacheEnabled()); defaultSettings->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, ReKonfig::localStorageDatabaseEnabled()); - + // Applies user defined CSS to all open webpages. If there no longer is a // user defined CSS removes it from all open webpages. defaultSettings->setUserStyleSheetUrl(ReKonfig::userCSS()); @@ -520,7 +521,7 @@ void MainWindow::slotUpdateActions() { QAction *historyBackAction = actionByName(KStandardAction::name(KStandardAction::Back)); historyBackAction->setEnabled(currentTab()->history()->canGoBack()); - + QAction *historyForwardAction = actionByName(KStandardAction::name(KStandardAction::Forward)); historyForwardAction->setEnabled(currentTab()->history()->canGoForward()); } @@ -568,12 +569,12 @@ void MainWindow::printRequested(QWebFrame *frame) { printFrame = frame; } - + QPrinter printer; QPrintPreviewDialog previewdlg(&printer, this); - + connect(&previewdlg, SIGNAL(paintRequested(QPrinter *)), printFrame, SLOT(print(QPrinter *))); - + previewdlg.exec(); } @@ -685,7 +686,7 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen) // save current state bookmarksToolBarFlag = m_bmBar->isHidden(); m_bmBar->hide(); - + sidePanelFlag = sidePanel()->isHidden(); sidePanel()->hide(); @@ -696,7 +697,7 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen) { // show main toolbar m_mainBar->show(); - + // restore previous state if (!bookmarksToolBarFlag) m_bmBar->show(); @@ -725,8 +726,7 @@ void MainWindow::slotViewPageSource() if (sourceFile.open()) { - QDataStream stream(&sourceFile); - stream << currentTab()->page()->mainFrame()->toHtml().toUtf8(); + sourceFile.write(currentTab()->page()->mainFrame()->toHtml().toUtf8()); url = KUrl(); url.setPath(sourceFile.fileName()); @@ -950,10 +950,10 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status) QPoint p(x,y); m_popup->show(p); - + if(popup_sav) delete popup_sav; - + } diff --git a/src/mainwindow.h b/src/mainwindow.h index 8a87022c..b2c41b49 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -73,7 +73,7 @@ public: private: void setupActions(); void setupTools(); - void setupToolbar(); + void setupToolbars(); void setupSidePanel(); SidePanel *sidePanel(); @@ -148,9 +148,9 @@ private: KAction *m_stopReloadAction; KMenu *m_historyBackMenu; - KToolBar *m_bmBar; KToolBar *m_mainBar; - + KToolBar *m_bmBar; + QString m_lastSearch; QPointer<KPassivePopup> m_popup; |