diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/application.cpp | 45 | ||||
-rw-r--r-- | src/application.h | 1 | ||||
-rw-r--r-- | src/mainview.cpp | 2 | ||||
-rw-r--r-- | src/mainwindow.cpp | 66 | ||||
-rw-r--r-- | src/mainwindow.h | 5 | ||||
-rw-r--r-- | src/previewimage.cpp | 5 | ||||
-rw-r--r-- | src/rekonq.kcfg | 17 | ||||
-rw-r--r-- | src/settings.cpp | 22 | ||||
-rw-r--r-- | src/settings_general.ui | 222 | ||||
-rw-r--r-- | src/settings_tabs.ui | 81 | ||||
-rw-r--r-- | src/webview.cpp | 3 |
12 files changed, 294 insertions, 176 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 4e9c4b26..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" @@ -147,7 +148,6 @@ MainWindow::~MainWindow() { Application::instance()->removeMainWindow(this); delete m_popup; -// delete m_view; } @@ -381,11 +381,6 @@ void MainWindow::setupActions() bmMenu->setIcon(KIcon("bookmarks")); bmMenu->setDelayed(false); actionCollection()->addAction(QLatin1String("bookmarksActionMenu"), bmMenu); - - // Add to favorites - a = new KAction(KIcon("rating"), i18n("Add to Favorites"), this); - actionCollection()->addAction(QLatin1String("add_to_favorites"), a); - connect(a, SIGNAL(triggered(bool)), this, SLOT(addFavoriteLink())); } @@ -394,6 +389,7 @@ void MainWindow::setupTools() KActionMenu *toolsMenu = new KActionMenu(KIcon("configure"), i18n("&Tools"), this); toolsMenu->setDelayed(false); + toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Open))); toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::SaveAs))); toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Print))); toolsMenu->addAction(actionByName(KStandardAction::name(KStandardAction::Find))); @@ -576,8 +572,8 @@ void MainWindow::slotUpdateWindowTitle(const QString &title) void MainWindow::slotFileOpen() { QString filePath = KFileDialog::getOpenFileName(KUrl(), - i18n("*.html *.htm *.svg *.png *.gif *.svgz|Web Resources (*.html *.htm *.svg *.png *.gif *.svgz)\n" \ - "*.*|All files (*.*)"), + i18n("*.html *.htm *.svg *.png *.gif *.svgz|Web Resources (*.html *.htm *.svg *.png *.gif *.svgz)\n" + "*.*|All files (*.*)"), this, i18n("Open Web Resource")); @@ -772,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()) ); } @@ -1102,37 +1091,20 @@ void MainWindow::slotOpenActionUrl(QAction *action) } -void MainWindow::addFavoriteLink() +bool MainWindow::homePage(const KUrl &url) { - QString name = currentTab()->title(); - QString url = currentTab()->url().prettyUrl(KUrl::RemoveTrailingSlash); - - QStringList names = ReKonfig::previewNames(); - QStringList urls = ReKonfig::previewUrls(); - - - for (int i = 0; i < 8 && i < urls.size() ; ++i) + if ( url == KUrl("rekonq:closedTabs") + || url == KUrl("rekonq:history") + || url == KUrl("rekonq:bookmarks") + || url == KUrl("rekonq:favorites") + || url == KUrl("rekonq:home") + ) { - if(urls.at(i).isEmpty() || urls.at(i) == url) - { - names.replace(i, name); - urls.replace(i, url); - break; - } - if(i == 7) - { - names.prepend(name); - if(names.count() > 8) - names.removeLast(); - - urls.prepend(url); - if(urls.count() > 8) - urls.removeLast(); - - break; - } + kDebug() << "loading home: " << url; + WebView *w = currentTab(); + HomePage p(w); + w->setHtml( p.rekonqHomePage(url), url); + return true; } - - ReKonfig::setPreviewNames(names); - ReKonfig::setPreviewUrls(urls); -} + return false; +}
\ No newline at end of file diff --git a/src/mainwindow.h b/src/mainwindow.h index c680cc60..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(); @@ -152,9 +154,6 @@ private slots: void slotAboutToShowBackMenu(); void slotOpenActionUrl(QAction *action); - // add link to the favorites shown in the rekonq homepage - void addFavoriteLink(); - private: MainView *m_view; FindBar *m_findBar; diff --git a/src/previewimage.cpp b/src/previewimage.cpp index 7869346b..f727db49 100644 --- a/src/previewimage.cpp +++ b/src/previewimage.cpp @@ -85,6 +85,8 @@ PreviewImage::PreviewImage(const QUrl &url, const QString &title, int index, boo setLayout(mainLayout); loadUrlPreview(url); + + setCursor(Qt::PointingHandCursor); } @@ -132,6 +134,7 @@ void PreviewImage::loadUrlPreview(const QUrl& url) m_imageLabel->setMovie(movie); movie->start(); m_textLabel->setText( i18n("Loading preview...") ); + setCursor(Qt::BusyCursor); } } @@ -148,6 +151,8 @@ void PreviewImage::snapFinished() checkTitle(); m_textLabel->setText(m_title); + setCursor(Qt::PointingHandCursor); + // kDebug() << "m_pixmap: " << m_pixmap.size(); // kDebug() << "text label: " << m_textLabel->size(); // kDebug() << "image label: " << m_imageLabel->size(); 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> diff --git a/src/webview.cpp b/src/webview.cpp index c9160e5a..e65aea9e 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -333,8 +333,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) menu.addAction(mainwindow->actionByName(KStandardAction::name(KStandardAction::SaveAs))); menu.addAction(mainwindow->actionByName("page_source")); - - menu.addAction(mainwindow->actionByName("add_to_favorites")); + QAction *addBookmarkAction = Application::bookmarkProvider()->actionByName("rekonq_add_bookmark"); menu.addAction(addBookmarkAction); |