From f02f8f72b459a30169d3016463147f662dca7491 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 22 Oct 2009 16:43:56 +0200 Subject: (LAST hopefully) BIG change (before 0.3) A strange bug on new window loading, calling from .desktop file (krunner & friends). So I had to change the homePage launch mechanism. Working on that I started playing with startup settings and implemented this. I hope Pano like this very much: 0.3 gift :D Waiting for someone comments and reviews to merge.. --- src/CMakeLists.txt | 1 + src/application.cpp | 45 +++++----- src/application.h | 1 - src/mainview.cpp | 2 +- src/mainwindow.cpp | 29 +++++-- src/mainwindow.h | 2 + src/rekonq.kcfg | 17 ++-- src/settings.cpp | 22 ++--- src/settings_general.ui | 222 ++++++++++++++++++++++++++++++------------------ src/settings_tabs.ui | 81 ++++++++++++++++++ 10 files changed, 290 insertions(+), 132 deletions(-) create mode 100644 src/settings_tabs.ui (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 71b2d77b..4faece61 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -31,6 +31,7 @@ SET( rekonq_SRCS KDE4_ADD_UI_FILES( rekonq_SRCS settings_general.ui + settings_tabs.ui settings_fonts.ui settings_webkit.ui cleardata.ui diff --git a/src/application.cpp b/src/application.cpp index 41fcd515..0b9666a1 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -137,10 +137,25 @@ int Application::newInstance() return 3; } - // creating new window - MainWindow *w = newMainWindow(); - w->slotHome(); - + MainWindow *w = 0; + switch(ReKonfig::startupBehaviour()) + { + case 0: // open home page + w = newMainWindow(); + w->slotHome(); + break; + case 1: // open new tab page + w = newMainWindow(); + w->homePage(); + break; + case 2: // restore session + if(sessionManager()->restoreSession()) + break; + default: + w = newMainWindow(); + w->slotHome(); + break; + } return 0; } @@ -330,7 +345,7 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type) } // loading home pages - if (homePage(url)) + if (mainWindow()->homePage(url)) return; if (url.scheme() == QLatin1String("mailto")) @@ -445,23 +460,3 @@ MainWindowList Application::mainWindowList() { return m_mainWindows; } - - -bool Application::homePage(const KUrl &url) -{ - if ( url == KUrl("rekonq:closedTabs") - || url == KUrl("rekonq:history") - || url == KUrl("rekonq:bookmarks") - || url == KUrl("rekonq:favorites") - || url == KUrl("rekonq:home") - ) - { - kDebug() << "loading home: " << url; - MainView *view = mainWindow()->mainView(); - WebView *w = view->currentWebView(); - HomePage p(w); - w->setHtml( p.rekonqHomePage(url), url); - return true; - } - return false; -} diff --git a/src/application.h b/src/application.h index eadacfa0..e5616d59 100644 --- a/src/application.h +++ b/src/application.h @@ -101,7 +101,6 @@ public: MainWindow *mainWindow(); MainWindowList mainWindowList(); - bool homePage(const KUrl &url = KUrl("rekonq:home")); static KIcon icon(const KUrl &url); diff --git a/src/mainview.cpp b/src/mainview.cpp index 1848e682..de35715a 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -307,7 +307,7 @@ void MainView::newTab() switch(ReKonfig::newTabsBehaviour()) { case 0: - if(Application::instance()->homePage()) + if(Application::instance()->mainWindow()->homePage()) break; case 1: urlBar()->setUrl(KUrl("")); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 02102ae1..6ec6a3a6 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -46,6 +46,7 @@ #include "sidepanel.h" #include "urlbar.h" #include "tabbar.h" +#include "homepage.h" // Ui Includes #include "ui_cleardata.h" @@ -767,14 +768,7 @@ void MainWindow::slotViewPageSource() void MainWindow::slotHome() { - if(ReKonfig::newTabHomePage()) - { - Application::instance()->homePage(); - } - else - { - currentTab()->load( QUrl(ReKonfig::homePage()) ); - } + currentTab()->load( QUrl(ReKonfig::homePage()) ); } @@ -1095,3 +1089,22 @@ void MainWindow::slotOpenActionUrl(QAction *action) } } + + +bool MainWindow::homePage(const KUrl &url) +{ + if ( url == KUrl("rekonq:closedTabs") + || url == KUrl("rekonq:history") + || url == KUrl("rekonq:bookmarks") + || url == KUrl("rekonq:favorites") + || url == KUrl("rekonq:home") + ) + { + kDebug() << "loading home: " << url; + WebView *w = currentTab(); + HomePage p(w); + w->setHtml( p.rekonqHomePage(url), url); + return true; + } + return false; +} \ No newline at end of file diff --git a/src/mainwindow.h b/src/mainwindow.h index 5d8aeec2..06fec756 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -70,6 +70,8 @@ public: virtual QSize sizeHint() const; virtual KActionCollection *actionCollection () const; + bool homePage(const KUrl &url = KUrl("rekonq:home")); + private: void setupActions(); void setupTools(); diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index c55fce9c..5505e4b2 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -23,8 +23,8 @@ - - true + + 1 0 @@ -32,17 +32,21 @@ http://www.kde.org/ + + false + + + + + true true - - false - - false + true false @@ -52,6 +56,7 @@ + diff --git a/src/settings.cpp b/src/settings.cpp index 4a6c50b8..812c7f52 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -41,6 +41,7 @@ //Ui Includes #include "ui_settings_general.h" +#include "ui_settings_tabs.h" #include "ui_settings_fonts.h" #include "ui_settings_webkit.h" @@ -60,9 +61,12 @@ class Private { private: + Ui::general generalUi; + Ui::tabs tabsUi; Ui::fonts fontsUi; Ui::webkit webkitUi; + KCModuleProxy *proxyModule; KCModuleProxy *ebrowsingModule; KCModuleProxy *cookiesModule; @@ -85,6 +89,12 @@ Private::Private(SettingsDialog *parent) pageItem = parent->addPage(widget , i18n("General")); pageItem->setIcon(KIcon("rekonq")); + widget = new QWidget; + tabsUi.setupUi(widget); + widget->layout()->setMargin(0); + pageItem = parent->addPage(widget , i18n("Tabs")); + pageItem->setIcon(KIcon("tab-duplicate")); + widget = new QWidget; fontsUi.setupUi(widget); widget->layout()->setMargin(0); @@ -118,7 +128,7 @@ Private::Private(SettingsDialog *parent) pageItem = parent->addPage(ebrowsingModule, i18n(ebrowsingInfo.moduleName().toLocal8Bit())); pageItem->setIcon(KIcon(ebrowsingInfo.icon())); - parent->setMinimumSize(800,500); + parent->setMinimumSize(600,400); } @@ -129,7 +139,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) : KConfigDialog(parent, "rekonfig", ReKonfig::self()) , d(new Private(this)) { - setFaceType(KPageDialog::List); + setFaceType(KPageDialog::Tree); showButtonSeparator(true); setWindowTitle(i18n("rekonfig...")); @@ -178,12 +188,6 @@ void SettingsDialog::setWebSettingsToolTips() // we need this function to UPDATE the config widget data.. void SettingsDialog::readConfig() { - // ======= General Page - if( ReKonfig::newTabHomePage() ) - d->generalUi.rbUseNewTabPage->setChecked( true ); - else - d->generalUi.rbUseHomePage->setChecked( true ); - // ======= Fonts d->fontsUi.kcfg_fixedFont->setOnlyFixed(true); } @@ -192,8 +196,6 @@ void SettingsDialog::readConfig() // we need this function to SAVE settings in rc file.. void SettingsDialog::saveSettings() { - ReKonfig::setNewTabHomePage( d->generalUi.rbUseNewTabPage->isChecked() ); - ReKonfig::self()->writeConfig(); d->ebrowsingModule->save(); d->cookiesModule->save(); diff --git a/src/settings_general.ui b/src/settings_general.ui index 5ea19b09..d0d98b7b 100644 --- a/src/settings_general.ui +++ b/src/settings_general.ui @@ -6,8 +6,8 @@ 0 0 - 438 - 371 + 751 + 523 @@ -15,46 +15,113 @@ - + - Home Page + On startup - + - - - Use new tab page + + + + 0 + 0 + - - true + + + 120 + 0 + + + + + 0 + 0 + + + + Qt::LeftToRight + + + rekonq - + + + + 0 + 0 + + - - - Use this page: - - - false - - + + opens home page + - - - true - - - - 0 - 0 - - - + + opens new tab page + + + + + restores the last open pages + + + + + + + + + + Home Page + + + + + + + 0 + 0 + + + + + 120 + 0 + + + + + 120 + 0 + + + + Home Page Url: + + + + + + + true + + + + 0 + 0 + + + + + + @@ -62,6 +129,19 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -72,19 +152,43 @@ New Tabs Behaviour - - + + + + + 0 + 0 + + + + + 120 + 0 + + + + + 120 + 0 + + New tab opens: - + true + + + 0 + 0 + + New Tab Page @@ -105,62 +209,18 @@ - - - - Tabbed Browsing - - - - - - Open links in new tab instead of in new window - - - - - - - Always show tab bar - - - - - - - Open new tabs in the background - - - - - - - Open new tabs after currently active one - - - - - - - Show preview when hovering tab - - - false - - - - - - Qt::Vertical + + QSizePolicy::Expanding + 20 - 43 + 40 diff --git a/src/settings_tabs.ui b/src/settings_tabs.ui new file mode 100644 index 00000000..ba903ff4 --- /dev/null +++ b/src/settings_tabs.ui @@ -0,0 +1,81 @@ + + + tabs + + + + 0 + 0 + 456 + 329 + + + + Tabs + + + + + + Tabbed Browsing + + + + + + Open links in new tab instead of in new window + + + + + + + Always show tab bar + + + + + + + Open new tabs in the background + + + + + + + Open new tabs after currently active one + + + + + + + Show preview when hovering tab + + + false + + + + + + + + + + Qt::Vertical + + + + 20 + 142 + + + + + + + + + -- cgit v1.2.1