summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-10-23 00:13:54 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-10-23 00:13:54 +0200
commit0cd8eaf723eaaa4b6aa3ad7125f1d8ce0569d55e (patch)
tree24fce08448f43744d5ad4a3864be7b82567315fc /src
parentMerge commit 'refs/merge-requests/1884' of git://gitorious.org/rekonq/mainlin... (diff)
parent(LAST hopefully) BIG change (before 0.3) (diff)
downloadrekonq-0cd8eaf723eaaa4b6aa3ad7125f1d8ce0569d55e.tar.xz
Merge branch 'StartRekonq'
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/application.cpp45
-rw-r--r--src/application.h1
-rw-r--r--src/mainview.cpp2
-rw-r--r--src/mainwindow.cpp29
-rw-r--r--src/mainwindow.h2
-rw-r--r--src/rekonq.kcfg17
-rw-r--r--src/settings.cpp22
-rw-r--r--src/settings_general.ui222
-rw-r--r--src/settings_tabs.ui81
10 files changed, 290 insertions, 132 deletions
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 @@
<!-- General Settings -->
<group name="General">
- <entry name="newTabHomePage" type="Bool">
- <default>true</default>
+ <entry name="startupBehaviour" type="Int">
+ <default>1</default>
</entry>
<entry name="newTabsBehaviour" type="Int">
<default>0</default>
@@ -32,17 +32,21 @@
<entry name="homePage" type="String">
<default>http://www.kde.org/</default>
</entry>
+ <entry name="showSideBar" type="Bool">
+ <default>false</default>
+ </entry>
+ </group>
+
+<!-- Tabs Settings -->
+ <group name="Tabs">
<entry name="openTabNoWindow" type="Bool">
<default>true</default>
</entry>
<entry name="alwaysShowTabBar" type="Bool">
<default>true</default>
</entry>
- <entry name="showSideBar" type="Bool">
- <default>false</default>
- </entry>
<entry name="openTabsBack" type="Bool">
- <default>false</default>
+ <default>true</default>
</entry>
<entry name="openTabsNearCurrent" type="Bool">
<default>false</default>
@@ -52,6 +56,7 @@
</entry>
</group>
+
<!-- Fonts Settings -->
<group name="Fonts">
<entry name="standardFont" type="Font">
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;
@@ -86,6 +90,12 @@ Private::Private(SettingsDialog *parent)
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);
pageItem = parent->addPage(widget , i18n("Fonts"));
@@ -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 @@
<rect>
<x>0</x>
<y>0</y>
- <width>438</width>
- <height>371</height>
+ <width>751</width>
+ <height>523</height>
</rect>
</property>
<property name="windowTitle">
@@ -15,46 +15,113 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="QGroupBox" name="groupBox">
+ <widget class="QGroupBox" name="groupBox_2">
<property name="title">
- <string>Home Page</string>
+ <string>On startup</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
- <widget class="QRadioButton" name="rbUseNewTabPage">
- <property name="text">
- <string>Use new tab page</string>
+ <widget class="QLabel" name="label">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <property name="checked">
- <bool>true</bool>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="baseSize">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string>rekonq </string>
</property>
</widget>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout">
+ <widget class="KComboBox" name="kcfg_startupBehaviour">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<item>
- <widget class="QRadioButton" name="rbUseHomePage">
- <property name="text">
- <string>Use this page:</string>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- </widget>
+ <property name="text">
+ <string>opens home page</string>
+ </property>
</item>
<item>
- <widget class="KLineEdit" name="kcfg_homePage">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
+ <property name="text">
+ <string>opens new tab page</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>restores the last open pages</string>
+ </property>
</item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Home Page</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="baseSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Home Page Url:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="KLineEdit" name="kcfg_homePage">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="setHomeToCurrentPageButton">
<property name="text">
@@ -62,6 +129,19 @@
</property>
</widget>
</item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</item>
</layout>
@@ -72,19 +152,43 @@
<property name="title">
<string>New Tabs Behaviour</string>
</property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
<widget class="QLabel" name="label_4">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="baseSize">
+ <size>
+ <width>120</width>
+ <height>0</height>
+ </size>
+ </property>
<property name="text">
<string>New tab opens:</string>
</property>
</widget>
</item>
- <item row="0" column="1">
+ <item>
<widget class="KComboBox" name="kcfg_newTabsBehaviour">
<property name="enabled">
<bool>true</bool>
</property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<item>
<property name="text">
<string>New Tab Page</string>
@@ -106,61 +210,17 @@
</widget>
</item>
<item>
- <widget class="QGroupBox" name="groupBox_4">
- <property name="title">
- <string>Tabbed Browsing</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <widget class="QCheckBox" name="kcfg_openTabNoWindow">
- <property name="text">
- <string>Open links in new tab instead of in new window</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_alwaysShowTabBar">
- <property name="text">
- <string>Always show tab bar</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_openTabsBack">
- <property name="text">
- <string>Open new tabs in the background</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_openTabsNearCurrent">
- <property name="text">
- <string>Open new tabs after currently active one</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_alwaysShowTabPreviews">
- <property name="text">
- <string>Show preview when hovering tab</string>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
+ </property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
- <height>43</height>
+ <height>40</height>
</size>
</property>
</spacer>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>tabs</class>
+ <widget class="QWidget" name="tabs">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>456</width>
+ <height>329</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Tabs</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox_4">
+ <property name="title">
+ <string>Tabbed Browsing</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QCheckBox" name="kcfg_openTabNoWindow">
+ <property name="text">
+ <string>Open links in new tab instead of in new window</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="kcfg_alwaysShowTabBar">
+ <property name="text">
+ <string>Always show tab bar</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="kcfg_openTabsBack">
+ <property name="text">
+ <string>Open new tabs in the background</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="kcfg_openTabsNearCurrent">
+ <property name="text">
+ <string>Open new tabs after currently active one</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="kcfg_alwaysShowTabPreviews">
+ <property name="text">
+ <string>Show preview when hovering tab</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>142</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>