From 667bd0a8450835f9b95b8ce83fb4f04a7df6d4ca Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 8 Sep 2009 02:38:18 +0200 Subject: HUGE HUGE HUGE COMMIT! First implementation of "rekonq home page" - Added icons && htmls for it - fixed pics places && CMakeLists.txt - Added a HomePage class to create the "rekonq home Page" - Modified setting to load on new tab start 1) rekonq home page (default) 2) blank page 3) an url (to set) - removed home page button - fixed WebPage && loadUrl slot to load "home:" scheme - Added a toolbar method in BookmarksProvider to load bookmarks in the homepage The page needs a lot of love, but I think this is a really good starting point for. Hope you like it :) --- src/CMakeLists.txt | 1 + src/application.cpp | 6 ++ src/bookmarks.cpp | 6 ++ src/bookmarks.h | 6 ++ src/historymodels.h | 1 + src/homepage.cpp | 173 ++++++++++++++++++++++++++++++++++++++++++++++++ src/homepage.h | 59 +++++++++++++++++ src/mainview.cpp | 13 +++- src/mainwindow.cpp | 19 ++++-- src/mainwindow.h | 1 - src/rekonq.kcfg | 8 +-- src/settings.cpp | 19 ++++++ src/settings.h | 1 + src/settings_general.ui | 78 +++++++++++----------- src/webpage.cpp | 7 ++ 15 files changed, 348 insertions(+), 50 deletions(-) create mode 100644 src/homepage.cpp create mode 100644 src/homepage.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1b760a64..f7d54c39 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,7 @@ ### ------- SETTING REKONQ FILES.. SET( rekonq_SRCS + homepage.cpp networkaccessmanager.cpp autosaver.cpp application.cpp diff --git a/src/application.cpp b/src/application.cpp index 1e30cfd0..f2a6c554 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -309,6 +309,12 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type) return; } + if(url.scheme() == QLatin1String("home")) + { + mainWindow()->slotHome(); + return; + } + KUrl loadingUrl(url); if (loadingUrl.isRelative()) diff --git a/src/bookmarks.cpp b/src/bookmarks.cpp index 69f6c945..b1e482cf 100644 --- a/src/bookmarks.cpp +++ b/src/bookmarks.cpp @@ -295,3 +295,9 @@ KAction *BookmarkProvider::fillBookmarkBar(const KBookmark &bookmark) return new KBookmarkAction(bookmark, m_owner, this); } } + + +KBookmarkGroup BookmarkProvider::toolbar() +{ + return m_manager->toolbar(); +} diff --git a/src/bookmarks.h b/src/bookmarks.h index df6a8767..09d05f6c 100644 --- a/src/bookmarks.h +++ b/src/bookmarks.h @@ -200,6 +200,12 @@ public: */ QAction *actionByName(const QString &name); + /** + * returns Bookmark Manager toolbar + * + * Used in rekonq home page + */ + KBookmarkGroup toolbar(); signals: /** * @short This signal is emitted when an url has to be loaded diff --git a/src/historymodels.h b/src/historymodels.h index d6a04826..22a7bccd 100644 --- a/src/historymodels.h +++ b/src/historymodels.h @@ -236,6 +236,7 @@ private: * A modified QSortFilterProxyModel that always accepts * the root nodes in the tree * so filtering is only done on the children. + * * Used in the HistoryDialog. * */ diff --git a/src/homepage.cpp b/src/homepage.cpp new file mode 100644 index 00000000..bba49999 --- /dev/null +++ b/src/homepage.cpp @@ -0,0 +1,173 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2009 by Andrea Diamantini +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* 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 +* 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 +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* ============================================================ */ + + +// Self Includes +#include "homepage.h" +#include "homepage.moc" + +// Local Includes +#include "historymodels.h" +#include "bookmarks.h" +#include "application.h" + +// KDE Includes +#include +#include + +// Qt Includes +#include + + +HomePage::HomePage(QObject *parent) + : QObject(parent) +{ + m_homePagePath = KStandardDirs::locate("data", "rekonq/htmls/home.html"); + m_imagesPath = "file://" + KStandardDirs::locate("appdata", "pics/"); +} + + +HomePage::~HomePage() +{ +} + + +QString HomePage::rekonqHomePage() +{ + QFile file(m_homePagePath); + bool isOpened = file.open(QIODevice::ReadOnly); + if (!isOpened) + { + kWarning() << "Couldn't open the home.html file"; + return QString(""); + } + + QString history = fillHistory(); + + QString bookmarks = fillBookmarks(); + + QString html = QString(QLatin1String(file.readAll())) + .arg(m_imagesPath) + .arg(history) + .arg(bookmarks); + + return html; +} + + +QString HomePage::fillHistory() +{ + QString history = QString(); + HistoryTreeModel *model = Application::historyManager()->historyTreeModel(); + + int i = 0; + do + { + QModelIndex index = model->index(i, 0, QModelIndex() ); + if(model->hasChildren(index)) + { + QString s = QString::number(i); + history += createSubMenu(index.data().toString(), s); + history += "

"; + for(int j=0; j< model->rowCount(index); ++j) + { + QModelIndex son = model->index(j, 0, index ); + history += QString("") + + son.data().toString() + QString("
"); + } + history += "

"; + } + else + { + history += QString("

NO CHILDREN: ") + index.data().toString() + QString("

"); + } + i++; + } + while( model->hasIndex( i , 0 , QModelIndex() ) ); + + return history; + +} + + +QString HomePage::fillBookmarks() +{ + KBookmarkGroup toolBarGroup = Application::bookmarkProvider()->toolbar(); + if (toolBarGroup.isNull()) + { + return QString("Error retrieving bookmarks!"); + } + + QString str = QString(""); + KBookmark bookmark = toolBarGroup.first(); + while (!bookmark.isNull()) + { + str += createBookItem(bookmark); + bookmark = toolBarGroup.next(bookmark); + } + + return str; +} + + +QString HomePage::createSubMenu(const QString &item, const QString &s) +{ + QString menu = "
"; + + menu += "

" + item + "

"; + return menu; +} + + +QString HomePage::createBookItem(const KBookmark &bookmark) +{ + static int i = 0; + + if (bookmark.isGroup()) + { + QString result = QString(""); + QString ss = "b" + QString::number(i); + i++; + + KBookmarkGroup group = bookmark.toGroup(); + KBookmark bm = group.first(); + result += createSubMenu( bookmark.text() , ss ); + result += "

"; + + while (!bm.isNull()) + { + result += createBookItem(bm); //menuAction->addAction(fillBookmarkBar(bm)); + bm = group.next(bm); + } + result += "

"; + return result; + } + + if(bookmark.isSeparator()) + { + return QString("
"); + } + return "" + bookmark.text() + "
"; +} diff --git a/src/homepage.h b/src/homepage.h new file mode 100644 index 00000000..e8b5b4f5 --- /dev/null +++ b/src/homepage.h @@ -0,0 +1,59 @@ +/* ============================================================ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2009 by Andrea Diamantini +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* 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 +* 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 +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see . +* +* ============================================================ */ + + +#ifndef REKONQ_HOME_PAGE +#define REKONQ_HOME_PAGE + +// Qt Includes +#include +#include + +// Forward Includes +class KBookmark; + + +class HomePage : public QObject +{ +Q_OBJECT + +public: + HomePage(QObject *parent = 0); + ~HomePage(); + + QString rekonqHomePage(); + +private: + QString fillHistory(); + QString fillBookmarks(); + + QString createSubMenu(const QString &, const QString &); + QString createBookItem(const KBookmark &); + + QString m_homePagePath; + QString m_imagesPath; +}; + +#endif // REKONQ_HOME_PAGE diff --git a/src/mainview.cpp b/src/mainview.cpp index 76684c31..61122ad9 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -294,10 +294,17 @@ void MainView::newTab() urlBar()->setUrl(KUrl("")); urlBar()->setFocus(); - - if (ReKonfig::newTabsOpenHomePage()) + + switch(ReKonfig::newTabsBehaviour()) { - w->load(QUrl(ReKonfig::homePage())); + case 0: + w->load(QUrl("home:/")); + break; + case 2: + w->load( QUrl(ReKonfig::homePage()) ); + break; + default: + break; } } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7f5c5996..513b7d73 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -45,6 +45,7 @@ #include "findbar.h" #include "sidepanel.h" #include "urlbar.h" +#include "homepage.h" // Ui Includes #include "ui_cleardata.h" @@ -169,7 +170,6 @@ void MainWindow::setupToolbar() m_mainBar->addAction( actionByName(KStandardAction::name(KStandardAction::Forward)) ); m_mainBar->addSeparator(); m_mainBar->addAction( actionByName("stop_reload") ); - m_mainBar->addAction( actionByName(KStandardAction::name(KStandardAction::Home)) ); m_mainBar->addAction( actionByName("url_bar") ); m_mainBar->addAction( actionByName("bookmarksActionMenu") ); m_mainBar->addAction( actionByName("rekonq_tools") ); @@ -256,7 +256,6 @@ void MainWindow::setupActions() a = KStandardAction::fullScreen(this, SLOT(slotViewFullScreen(bool)), this, actionCollection()); a->setShortcut(KShortcut(Qt::Key_F11, Qt::CTRL + Qt::SHIFT + Qt::Key_F)); - KStandardAction::home(this, SLOT(slotHome()), actionCollection()); KStandardAction::preferences(this, SLOT(slotPreferences()), actionCollection()); // WEB Actions (NO KStandardActions..) @@ -422,7 +421,6 @@ void MainWindow::setupSidePanel() void MainWindow::slotUpdateConfiguration() { // ============== General ================== - m_homePage = ReKonfig::homePage(); mainView()->showTabBar(); // "status bar" messages (new notifyMessage system) @@ -752,7 +750,20 @@ void MainWindow::slotViewPageSource() void MainWindow::slotHome() { - Application::instance()->loadUrl(KUrl(m_homePage)); + WebView *w = Application::instance()->mainWindow()->mainView()->currentWebView(); + HomePage p; + + switch(ReKonfig::newTabsBehaviour()) + { + case 0: + w->setHtml( p.rekonqHomePage(), QUrl("home:/")); + break; + case 2: + w->load( QUrl(ReKonfig::homePage()) ); + break; + default: + break; + } } diff --git a/src/mainwindow.h b/src/mainwindow.h index 21cf1a4f..24e9a58e 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -152,7 +152,6 @@ private: KToolBar *m_mainBar; QString m_lastSearch; - QString m_homePage; QPointer m_popup; diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index 86b1a5df..2ac9b331 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -6,11 +6,14 @@ QtWebKit KUrl - + + + 0 + http://www.kde.org/ @@ -29,9 +32,6 @@ false - - false - true diff --git a/src/settings.cpp b/src/settings.cpp index 843b3375..0838b252 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -141,6 +141,10 @@ SettingsDialog::SettingsDialog(QWidget *parent) connect(d->generalUi.setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage())); + int n = d->generalUi.kcfg_newTabsBehaviour->currentIndex(); + checkLineEnable(n); + connect(d->generalUi.kcfg_newTabsBehaviour, SIGNAL(currentIndexChanged(int)), this, SLOT(checkLineEnable(int))); + connect(d->ebrowsingModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); connect(d->cookiesModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); @@ -214,3 +218,18 @@ void SettingsDialog::setHomeToCurrentPage() d->generalUi.kcfg_homePage->setText(webView->url().prettyUrl()); } } + + +void SettingsDialog::checkLineEnable(int n) +{ + if(n == 2) + { + d->generalUi.kcfg_homePage->setEnabled(true); + d->generalUi.setHomeToCurrentPageButton->setEnabled(true); + } + else + { + d->generalUi.kcfg_homePage->setEnabled(false); + d->generalUi.setHomeToCurrentPageButton->setEnabled(false); + } +} \ No newline at end of file diff --git a/src/settings.h b/src/settings.h index 0be89173..6cdbd5e3 100644 --- a/src/settings.h +++ b/src/settings.h @@ -55,6 +55,7 @@ private slots: void saveSettings(); void setHomeToCurrentPage(); + void checkLineEnable(int); }; #endif // SETTINGS_H diff --git a/src/settings_general.ui b/src/settings_general.ui index 6c18e8cc..70accdec 100644 --- a/src/settings_general.ui +++ b/src/settings_general.ui @@ -6,8 +6,8 @@ 0 0 - 515 - 415 + 662 + 539 @@ -17,60 +17,62 @@ - Home Page + New Tabs Behaviour - - + + - Home page: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + New tabs open - - - - - 0 - 0 - + + + + true + + + rekonq home page + + + + + blank page + + + + + url + + - - + + - - - Set to Current Page + + + true + + + + 0 + 0 + - - - Qt::Horizontal - - - - 40 - 20 - + + + Set to Current Page - + - - - - New tabs open home page - - - diff --git a/src/webpage.cpp b/src/webpage.cpp index ede503a5..cc7f7f10 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -97,6 +97,13 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r KToolInvocation::invokeMailer(m_requestedUrl); return false; } + + if(m_requestedUrl.scheme() == QLatin1String("home")) + { + Application::instance()->mainWindow()->slotHome(); + return false; + } + if (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton) { -- cgit v1.2.1 From 75b65dad7e2412533c45dc362ef85f833d31b1f8 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 9 Sep 2009 14:11:12 +0200 Subject: Fixed improper use of Bookmark Manager class --- src/bookmarks.cpp | 4 ++-- src/bookmarks.h | 6 +++--- src/homepage.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/bookmarks.cpp b/src/bookmarks.cpp index b1e482cf..a92cb2bb 100644 --- a/src/bookmarks.cpp +++ b/src/bookmarks.cpp @@ -297,7 +297,7 @@ KAction *BookmarkProvider::fillBookmarkBar(const KBookmark &bookmark) } -KBookmarkGroup BookmarkProvider::toolbar() +KBookmarkGroup BookmarkProvider::rootGroup() { - return m_manager->toolbar(); + return m_manager->root(); } diff --git a/src/bookmarks.h b/src/bookmarks.h index 09d05f6c..5fd0ebee 100644 --- a/src/bookmarks.h +++ b/src/bookmarks.h @@ -201,11 +201,11 @@ public: QAction *actionByName(const QString &name); /** - * returns Bookmark Manager toolbar + * returns Bookmark Manager root group * - * Used in rekonq home page + * @return the root bookmark group */ - KBookmarkGroup toolbar(); + KBookmarkGroup rootGroup(); signals: /** * @short This signal is emitted when an url has to be loaded diff --git a/src/homepage.cpp b/src/homepage.cpp index bba49999..f733d4c8 100644 --- a/src/homepage.cpp +++ b/src/homepage.cpp @@ -114,7 +114,7 @@ QString HomePage::fillHistory() QString HomePage::fillBookmarks() { - KBookmarkGroup toolBarGroup = Application::bookmarkProvider()->toolbar(); + KBookmarkGroup toolBarGroup = Application::bookmarkProvider()->rootGroup(); if (toolBarGroup.isNull()) { return QString("Error retrieving bookmarks!"); -- cgit v1.2.1 From 002bfdbaf5daf0a19f8c64cb9568ce6a24c63d4f Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 9 Sep 2009 14:13:43 +0200 Subject: Restored Home Action (and button in the main toolbar) --- src/mainwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 513b7d73..171739d5 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -170,6 +170,7 @@ void MainWindow::setupToolbar() m_mainBar->addAction( actionByName(KStandardAction::name(KStandardAction::Forward)) ); m_mainBar->addSeparator(); m_mainBar->addAction( actionByName("stop_reload") ); + m_mainBar->addAction( actionByName(KStandardAction::name(KStandardAction::Home)) ); m_mainBar->addAction( actionByName("url_bar") ); m_mainBar->addAction( actionByName("bookmarksActionMenu") ); m_mainBar->addAction( actionByName("rekonq_tools") ); @@ -256,6 +257,7 @@ void MainWindow::setupActions() a = KStandardAction::fullScreen(this, SLOT(slotViewFullScreen(bool)), this, actionCollection()); a->setShortcut(KShortcut(Qt::Key_F11, Qt::CTRL + Qt::SHIFT + Qt::Key_F)); + KStandardAction::home(this, SLOT(slotHome()), actionCollection()); KStandardAction::preferences(this, SLOT(slotPreferences()), actionCollection()); // WEB Actions (NO KStandardActions..) -- cgit v1.2.1 From 8d7145aef0e81d239a717118a8aa7c7e0f980639 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 9 Sep 2009 15:16:30 +0200 Subject: Added support for bookmark icons. Not yet working.. --- src/homepage.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/homepage.cpp b/src/homepage.cpp index f733d4c8..6acd4afd 100644 --- a/src/homepage.cpp +++ b/src/homepage.cpp @@ -35,6 +35,7 @@ // KDE Includes #include +#include #include // Qt Includes @@ -94,6 +95,7 @@ QString HomePage::fillHistory() for(int j=0; j< model->rowCount(index); ++j) { QModelIndex son = model->index(j, 0, index ); +// FIXME add an icon to each history item history += "\"icon\""; history += QString("") + son.data().toString() + QString("
"); } @@ -169,5 +171,8 @@ QString HomePage::createBookItem(const KBookmark &bookmark) { return QString("
"); } - return "" + bookmark.text() + "
"; + + QString str = ""; // FIXME Add icon "\"icon\""; + str += "" + bookmark.text() + "
"; + return str; } -- cgit v1.2.1 From 5b0de25722655673fcfc11a5c92fdfee188e55a5 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 10 Sep 2009 22:49:52 +0200 Subject: Removed "home" scheme --- src/application.cpp | 8 +------- src/mainview.cpp | 34 ++++++++++++++++++++++------------ src/mainview.h | 2 ++ src/mainwindow.cpp | 22 +--------------------- src/mainwindow.h | 1 - src/webpage.cpp | 9 +-------- 6 files changed, 27 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/application.cpp b/src/application.cpp index f2a6c554..3ca6b0fd 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -122,7 +122,7 @@ int Application::newInstance() { // creating new window MainWindow *w = newMainWindow(); - w->slotHome(); + w->mainView()->slotHome(); } return 0; @@ -309,12 +309,6 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type) return; } - if(url.scheme() == QLatin1String("home")) - { - mainWindow()->slotHome(); - return; - } - KUrl loadingUrl(url); if (loadingUrl.isRelative()) diff --git a/src/mainview.cpp b/src/mainview.cpp index 61122ad9..07f209b7 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -41,6 +41,7 @@ #include "urlbar.h" #include "webview.h" #include "sessionmanager.h" +#include "homepage.h" // KDE Includes #include @@ -294,18 +295,8 @@ void MainView::newTab() urlBar()->setUrl(KUrl("")); urlBar()->setFocus(); - - switch(ReKonfig::newTabsBehaviour()) - { - case 0: - w->load(QUrl("home:/")); - break; - case 2: - w->load( QUrl(ReKonfig::homePage()) ); - break; - default: - break; - } + + slotHome(); } @@ -579,3 +570,22 @@ void MainView::resizeEvent(QResizeEvent *event) { KTabWidget::resizeEvent(event); } + + +void MainView::slotHome() +{ + WebView *w = currentWebView(); + HomePage p; + + switch(ReKonfig::newTabsBehaviour()) + { + case 0: + w->setHtml( p.rekonqHomePage(), QUrl()); + break; + case 2: + w->load( QUrl(ReKonfig::homePage()) ); + break; + default: + break; + } +} diff --git a/src/mainview.h b/src/mainview.h index c59cca1a..783068f9 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -110,6 +110,8 @@ public slots: */ void newTab(); + void slotHome(); + void slotCloneTab(int index = -1); void slotCloseTab(int index = -1); void slotCloseOtherTabs(int index); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 171739d5..8e7a1040 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -45,7 +45,6 @@ #include "findbar.h" #include "sidepanel.h" #include "urlbar.h" -#include "homepage.h" // Ui Includes #include "ui_cleardata.h" @@ -257,7 +256,7 @@ void MainWindow::setupActions() a = KStandardAction::fullScreen(this, SLOT(slotViewFullScreen(bool)), this, actionCollection()); a->setShortcut(KShortcut(Qt::Key_F11, Qt::CTRL + Qt::SHIFT + Qt::Key_F)); - KStandardAction::home(this, SLOT(slotHome()), actionCollection()); + KStandardAction::home(m_view, SLOT(slotHome()), actionCollection()); KStandardAction::preferences(this, SLOT(slotPreferences()), actionCollection()); // WEB Actions (NO KStandardActions..) @@ -750,25 +749,6 @@ void MainWindow::slotViewPageSource() } -void MainWindow::slotHome() -{ - WebView *w = Application::instance()->mainWindow()->mainView()->currentWebView(); - HomePage p; - - switch(ReKonfig::newTabsBehaviour()) - { - case 0: - w->setHtml( p.rekonqHomePage(), QUrl("home:/")); - break; - case 2: - w->load( QUrl(ReKonfig::homePage()) ); - break; - default: - break; - } -} - - void MainWindow::slotToggleInspector(bool enable) { QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, enable); diff --git a/src/mainwindow.h b/src/mainwindow.h index 24e9a58e..c3976109 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -79,7 +79,6 @@ private: SidePanel *sidePanel(); public slots: - void slotHome(); void slotUpdateBrowser(); /** diff --git a/src/webpage.cpp b/src/webpage.cpp index cc7f7f10..274f8d60 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -97,14 +97,7 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r KToolInvocation::invokeMailer(m_requestedUrl); return false; } - - if(m_requestedUrl.scheme() == QLatin1String("home")) - { - Application::instance()->mainWindow()->slotHome(); - return false; - } - - + if (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton) { Application::instance()->loadUrl(request.url(), Rekonq::SettingOpenTab); -- cgit v1.2.1 From 0609b26165cda7672b9416d94dbc161751fd6ac6 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 12 Sep 2009 23:09:08 +0200 Subject: notification system made default and no more "unsettable" --- src/mainwindow.cpp | 21 ++++----------------- src/rekonq.kcfg | 3 --- 2 files changed, 4 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 8e7a1040..da51ac2a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -188,6 +188,10 @@ void MainWindow::setupToolbar() void MainWindow::postLaunch() { + // notification system + connect(m_view, SIGNAL(showStatusBarMessage(const QString&, Rekonq::Notify)), this, SLOT(notifyMessage(const QString&, Rekonq::Notify))); + connect(m_view, SIGNAL(linkHovered(const QString&)), this, SLOT(notifyMessage(const QString&))); + // --------- 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 *))); @@ -424,23 +428,6 @@ void MainWindow::slotUpdateConfiguration() // ============== General ================== mainView()->showTabBar(); - // "status bar" messages (new notifyMessage system) - if(ReKonfig::showUrlsPopup()) - { - connect(m_view, SIGNAL(showStatusBarMessage(const QString&, Rekonq::Notify)), - this, SLOT(notifyMessage(const QString&, Rekonq::Notify))); - connect(m_view, SIGNAL(linkHovered(const QString&)), - this, SLOT(notifyMessage(const QString&))); - } - else - { - disconnect(m_view, SIGNAL(showStatusBarMessage(const QString&, Rekonq::Notify)), - this, SLOT(notifyMessage(const QString&, Rekonq::Notify))); - disconnect(m_view, SIGNAL(linkHovered(const QString&)), - this, SLOT(notifyMessage(const QString&))); - } - - // =========== Fonts ============== QWebSettings *defaultSettings = QWebSettings::globalSettings(); diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index 2ac9b331..56f0b18c 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -32,9 +32,6 @@ false - - true -
-- cgit v1.2.1 From 09567d9fbf6e034319bbdf7820f4bceac42cee12 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 13 Sep 2009 03:14:55 +0200 Subject: Modified rekonq behaviour: HomePage has 2 choices: usual home page vs new tab page new tab has 3: new tabp page, home page, blank page --- src/application.cpp | 2 +- src/mainview.cpp | 33 ++++------ src/mainview.h | 2 - src/mainwindow.cpp | 19 +++++- src/mainwindow.h | 3 +- src/rekonq.kcfg | 3 + src/settings.cpp | 19 ------ src/settings.h | 1 - src/settings_general.ui | 162 ++++++++++++++++++------------------------------ 9 files changed, 98 insertions(+), 146 deletions(-) (limited to 'src') diff --git a/src/application.cpp b/src/application.cpp index 3ca6b0fd..1e30cfd0 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -122,7 +122,7 @@ int Application::newInstance() { // creating new window MainWindow *w = newMainWindow(); - w->mainView()->slotHome(); + w->slotHome(); } return 0; diff --git a/src/mainview.cpp b/src/mainview.cpp index 07f209b7..7c91b992 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -296,7 +296,19 @@ void MainView::newTab() urlBar()->setUrl(KUrl("")); urlBar()->setFocus(); - slotHome(); + HomePage p; + + switch(ReKonfig::newTabsBehaviour()) + { + case 0: + w->setHtml( p.rekonqHomePage() ); + break; + case 2: + w->load( QUrl(ReKonfig::homePage()) ); + break; + default: + break; + } } @@ -570,22 +582,3 @@ void MainView::resizeEvent(QResizeEvent *event) { KTabWidget::resizeEvent(event); } - - -void MainView::slotHome() -{ - WebView *w = currentWebView(); - HomePage p; - - switch(ReKonfig::newTabsBehaviour()) - { - case 0: - w->setHtml( p.rekonqHomePage(), QUrl()); - break; - case 2: - w->load( QUrl(ReKonfig::homePage()) ); - break; - default: - break; - } -} diff --git a/src/mainview.h b/src/mainview.h index 783068f9..c59cca1a 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -110,8 +110,6 @@ public slots: */ void newTab(); - void slotHome(); - void slotCloneTab(int index = -1); void slotCloseTab(int index = -1); void slotCloseOtherTabs(int index); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index da51ac2a..099a463e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -45,6 +45,7 @@ #include "findbar.h" #include "sidepanel.h" #include "urlbar.h" +#include "homepage.h" // Ui Includes #include "ui_cleardata.h" @@ -260,7 +261,7 @@ void MainWindow::setupActions() a = KStandardAction::fullScreen(this, SLOT(slotViewFullScreen(bool)), this, actionCollection()); a->setShortcut(KShortcut(Qt::Key_F11, Qt::CTRL + Qt::SHIFT + Qt::Key_F)); - KStandardAction::home(m_view, SLOT(slotHome()), actionCollection()); + KStandardAction::home(this, SLOT(slotHome()), actionCollection()); KStandardAction::preferences(this, SLOT(slotPreferences()), actionCollection()); // WEB Actions (NO KStandardActions..) @@ -736,6 +737,22 @@ void MainWindow::slotViewPageSource() } +void MainWindow::slotHome() +{ + WebView *w = currentTab(); + + if(ReKonfig::useNewTabPage()) + { + HomePage p; + w->setHtml( p.rekonqHomePage(), QUrl()); + } + else + { + w->load( QUrl(ReKonfig::homePage()) ); + } +} + + void MainWindow::slotToggleInspector(bool enable) { QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, enable); diff --git a/src/mainwindow.h b/src/mainwindow.h index c3976109..8a87022c 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -80,6 +80,7 @@ private: public slots: void slotUpdateBrowser(); + void slotHome(); /** * Notifies a message in a popup @@ -103,7 +104,7 @@ private slots: void slotBrowserLoading(bool); void slotUpdateActions(); void slotUpdateWindowTitle(const QString &title = QString()); - + // history related void slotOpenPrevious(); void slotOpenNext(); diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index 56f0b18c..401ce58c 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -11,6 +11,9 @@ + + true + 0 diff --git a/src/settings.cpp b/src/settings.cpp index 0838b252..843b3375 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -141,10 +141,6 @@ SettingsDialog::SettingsDialog(QWidget *parent) connect(d->generalUi.setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage())); - int n = d->generalUi.kcfg_newTabsBehaviour->currentIndex(); - checkLineEnable(n); - connect(d->generalUi.kcfg_newTabsBehaviour, SIGNAL(currentIndexChanged(int)), this, SLOT(checkLineEnable(int))); - connect(d->ebrowsingModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); connect(d->cookiesModule, SIGNAL(changed(bool)), this, SLOT(updateButtons())); @@ -218,18 +214,3 @@ void SettingsDialog::setHomeToCurrentPage() d->generalUi.kcfg_homePage->setText(webView->url().prettyUrl()); } } - - -void SettingsDialog::checkLineEnable(int n) -{ - if(n == 2) - { - d->generalUi.kcfg_homePage->setEnabled(true); - d->generalUi.setHomeToCurrentPageButton->setEnabled(true); - } - else - { - d->generalUi.kcfg_homePage->setEnabled(false); - d->generalUi.setHomeToCurrentPageButton->setEnabled(false); - } -} \ No newline at end of file diff --git a/src/settings.h b/src/settings.h index 6cdbd5e3..0be89173 100644 --- a/src/settings.h +++ b/src/settings.h @@ -55,7 +55,6 @@ private slots: void saveSettings(); void setHomeToCurrentPage(); - void checkLineEnable(int); }; #endif // SETTINGS_H diff --git a/src/settings_general.ui b/src/settings_general.ui index 70accdec..fe1ec457 100644 --- a/src/settings_general.ui +++ b/src/settings_general.ui @@ -6,51 +6,42 @@ 0 0 - 662 - 539 + 442 + 369 General - + - New Tabs Behaviour + Home Page - - - + + + - New tabs open + Use new tab page - - - - - + true - - - rekonq home page - - - - - blank page - - - - - url - - - - + + + + + + Use this page: + + + false + + + @@ -78,10 +69,48 @@ + + New Tabs Behaviour + + + + + + New tabs open + + + + + + + true + + + + new tab page + + + + + blank page + + + + + home page + + + + + + + + + Tabbed Browsing - + @@ -113,75 +142,6 @@ - - - - General Settings - - - - - - Show URLs of links in a popup - - - - - - - - - - History - - - - - - Remove history items: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - After one day - - - - - After one week - - - - - After two weeks - - - - - After one month - - - - - After one year - - - - - Manually - - - - - - - @@ -190,7 +150,7 @@ 20 - 40 + 43 -- cgit v1.2.1