From 48b25611c94d380b40948a3de0bfab5678668e1d Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 25 Mar 2009 00:47:24 +0100 Subject: Huge update. Fixed quite all of the settings troubles.. From now on, we (mainly) go on WebView bugfixing.. --- src/application.cpp | 2 +- src/cookiejar.cpp | 3 +- src/cookiejar.h | 11 +++-- src/history.cpp | 4 -- src/mainview.cpp | 16 +++++-- src/mainview.h | 14 +++--- src/mainwindow.cpp | 16 +++---- src/mainwindow.h | 2 +- src/networkaccessmanager.cpp | 2 + src/rekonq.kcfg | 18 ++++---- src/settings.cpp | 25 +++++----- src/settings_fonts.ui | 16 +++---- src/settings_general.ui | 107 +++++++++++++++++++------------------------ src/settings_privacy.ui | 58 ++++++++++++++++------- src/webview.cpp | 6 +-- 15 files changed, 151 insertions(+), 149 deletions(-) (limited to 'src') diff --git a/src/application.cpp b/src/application.cpp index de62bbef..6c621015 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -140,7 +140,7 @@ MainWindow *Application::mainWindow() WebView *Application::newTab() { - return m_mainWindow->tabWidget()->newTab(); + return m_mainWindow->mainView()->newTab(); } diff --git a/src/cookiejar.cpp b/src/cookiejar.cpp index 958adb42..d4ecb3f2 100644 --- a/src/cookiejar.cpp +++ b/src/cookiejar.cpp @@ -43,7 +43,7 @@ static const unsigned int JAR_VERSION = 23; -QT_BEGIN_NAMESPACE + QDataStream &operator<<(QDataStream &stream, const QList &list) { stream << JAR_VERSION; @@ -82,7 +82,6 @@ QDataStream &operator>>(QDataStream &stream, QList &list) } return stream; } -QT_END_NAMESPACE CookieJar::CookieJar(QObject *parent) diff --git a/src/cookiejar.h b/src/cookiejar.h index b61cebcc..1796d252 100644 --- a/src/cookiejar.h +++ b/src/cookiejar.h @@ -32,13 +32,12 @@ #include #include -QT_BEGIN_NAMESPACE +// Forward Declarations class QSortFilterProxyModel; class QKeyEvent; -QT_END_NAMESPACE - class AutoSaver; + class CookieJar : public QNetworkCookieJar { friend class CookieModel; @@ -55,13 +54,15 @@ signals: void cookiesChanged(); public: - enum AcceptPolicy { + enum AcceptPolicy + { AcceptAlways, AcceptNever, AcceptOnlyFromSitesNavigatedTo }; - enum KeepPolicy { + enum KeepPolicy + { KeepUntilExpire, KeepUntilExit, KeepUntilTimeLimit diff --git a/src/history.cpp b/src/history.cpp index 87910308..5023bfd3 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -309,10 +309,6 @@ void HistoryManager::load() void HistoryManager::save() { -// KConfig config("rekonqrc"); -// KConfigGroup group = config.group("history"); -// group.writeEntry( QString("historyLimit"), m_historyLimit ); - bool saveAll = m_lastSavedUrl.isEmpty(); int first = m_history.count() - 1; if (!saveAll) diff --git a/src/mainview.cpp b/src/mainview.cpp index a39c40b1..a1eed467 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -89,11 +89,17 @@ MainView::~MainView() } -void MainView::viewTabBar() +void MainView::showTabBar() { bool always = ReKonfig::alwaysShowTabBar(); if(always == true) + { + if( m_tabBar->isHidden() ) + { + m_tabBar->show(); + } return; + } if( m_tabBar->count() == 1 ) { @@ -391,7 +397,7 @@ WebView *MainView::newTab(bool makeCurrent) currentChanged(currentIndex()); emit tabsChanged(); - viewTabBar(); + showTabBar(); return webView; } @@ -447,7 +453,7 @@ void MainView::closeOtherTabs(int index) for (int i = index - 1; i >= 0; --i) closeTab(i); - viewTabBar(); + showTabBar(); } @@ -461,7 +467,7 @@ void MainView::cloneTab(int index) WebView *tab = newTab(false); tab->setUrl( webView(index)->url() ); - viewTabBar(); + showTabBar(); } @@ -505,7 +511,7 @@ void MainView::closeTab(int index) if (count() == 0) emit lastTabClosed(); - viewTabBar(); + showTabBar(); } diff --git a/src/mainview.h b/src/mainview.h index 6ad623fe..78fe2a2c 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -87,6 +87,13 @@ public: QLineEdit *lineEdit(int index) const; int webViewIndex(WebView *webView) const; + /** + * show and hide TabBar if user doesn't choose + * "Always Show TabBar" option + * + */ + void showTabBar(); + protected: void mouseDoubleClickEvent(QMouseEvent *event); void contextMenuEvent(QContextMenuEvent *event); @@ -129,13 +136,6 @@ private slots: private: - /** - * show and hide TabBar if user doesn't choose - * "Always Show TabBar" option - * - */ - void viewTabBar(); - KAction *m_recentlyClosedTabsAction; KMenu *m_recentlyClosedTabsMenu; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index df596bdd..e286cc36 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -309,7 +309,7 @@ void MainWindow::slotUpdateConf() { // ============== General ================== m_homePage = ReKonfig::homePage(); - + mainView()->showTabBar(); // =========== Fonts ============== QWebSettings *defaultSettings = QWebSettings::globalSettings(); @@ -320,33 +320,29 @@ void MainWindow::slotUpdateConf() defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFontSize, fnSize); - QFont fixedFont = ReKonfig::fixedFont(); defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fnSize); - // =========== Privacy ============== - bool arePluginsEnabled = ReKonfig::enablePlugins(); bool isJavascriptEnabled = ReKonfig::enableJavascript(); defaultSettings->setAttribute(QWebSettings::PluginsEnabled, arePluginsEnabled); defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, isJavascriptEnabled); - // load Settings on main classes + // ====== load Settings on main classes Application::networkAccessManager()->loadSettings(); Application::cookieJar()->loadSettings(); Application::historyManager()->loadSettings(); - // ============ Proxy ================ } void MainWindow::slotUpdateBrowser() { slotUpdateConf(); - tabWidget()->reloadAllTabs(); + mainView()->reloadAllTabs(); } @@ -435,7 +431,7 @@ void MainWindow::slotPreferences() { // an instance the dialog could be already created and could be cached, // in which case you want to display the cached dialog - if ( SettingsDialog::showDialog( "settings" ) ) + if ( SettingsDialog::showDialog( "rekonfig" ) ) return; // we didn't find an instance of this dialog, so lets create it @@ -546,7 +542,7 @@ void MainWindow::slotPrivateBrowsing() MainWindow* win = Application::instance()->mainWindow(); win->m_lastSearch = QString::null; - win->tabWidget()->clear(); + win->mainView()->clear(); } } @@ -688,7 +684,7 @@ void MainWindow::slotToggleInspector(bool enable) // } -MainView *MainWindow::tabWidget() const +MainView *MainWindow::mainView() const { return m_view; } diff --git a/src/mainwindow.h b/src/mainwindow.h index ee07707d..15eda7ec 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -56,7 +56,7 @@ public: ~MainWindow(); static KUrl guessUrlFromString(const QString &url); - MainView *tabWidget() const; + MainView *mainView() const; WebView *currentTab() const; virtual QSize sizeHint() const; diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp index 96e099b8..882ae4e1 100644 --- a/src/networkaccessmanager.cpp +++ b/src/networkaccessmanager.cpp @@ -36,6 +36,7 @@ // KDE Includes #include +#include // Qt Includes #include @@ -64,6 +65,7 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent) void NetworkAccessManager::loadSettings() { + kWarning() << "loading NetworkAccessManager settings.."; QNetworkProxy proxy; if ( ReKonfig::isProxyEnabled() ) { diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index 373f3fd1..f2a2cedd 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -17,12 +17,15 @@ $HOME - - 1 - true + + true + + + true + @@ -40,12 +43,9 @@ - - true - - - true - + + 1 + 2 diff --git a/src/settings.cpp b/src/settings.cpp index 68a051ea..860e7050 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -100,8 +100,8 @@ Private::Private(SettingsDialog *parent) // ----------------------------------------------------------------------------------------------------- SettingsDialog::SettingsDialog(QWidget *parent) - : KConfigDialog(parent, "settings", ReKonfig::self() ) - , d(new Private(this) ) + : KConfigDialog(parent, "rekonfig", ReKonfig::self()) + , d(new Private(this)) { setFaceType(KPageDialog::List); showButtonSeparator(true); @@ -123,6 +123,7 @@ SettingsDialog::~SettingsDialog() delete d; } + // we need this function to UPDATE the config widget data.. void SettingsDialog::readConfig() { @@ -132,15 +133,12 @@ void SettingsDialog::readConfig() connect(d->generalUi.downloadDirUrlRequester, SIGNAL(textChanged(QString)),this, SLOT(saveSettings())); // ======= Fonts - QFont stdFont = ReKonfig::standardFont(); - d->fontsUi.standardFont->setCurrentFont(stdFont); - - QFont fxFont = ReKonfig::fixedFont(); - d->fontsUi.fixedFont->setOnlyFixed(true); - d->fontsUi.fixedFont->setCurrentFont(fxFont); - - int fnSize = ReKonfig::fontSize(); - d->fontsUi.fontSize->setValue( fnSize ); +// QFont stdFont = ReKonfig::standardFont(); +// d->fontsUi.standardFont->setCurrentFont(stdFont); +// +// QFont fxFont = ReKonfig::fixedFont(); + d->fontsUi.kcfg_fixedFont->setOnlyFixed(true); +// d->fontsUi.fixedFont->setCurrentFont(fxFont); // ======= Proxy bool proxyEnabled = ReKonfig::isProxyEnabled(); @@ -156,9 +154,8 @@ void SettingsDialog::saveSettings() ReKonfig::setDownloadDir( d->generalUi.downloadDirUrlRequester->url().prettyUrl() ); // Fonts - ReKonfig::setStandardFont( d->fontsUi.standardFont->currentFont() ); - ReKonfig::setFixedFont( d->fontsUi.fixedFont->currentFont() ); - ReKonfig::setFontSize( d->fontsUi.fontSize->value() ); +// ReKonfig::setStandardFont( d->fontsUi.standardFont->currentFont() ); +// ReKonfig::setFixedFont( d->fontsUi.fixedFont->currentFont() ); // Save ReKonfig::self()->writeConfig(); diff --git a/src/settings_fonts.ui b/src/settings_fonts.ui index d3090ef7..de258cad 100644 --- a/src/settings_fonts.ui +++ b/src/settings_fonts.ui @@ -6,20 +6,20 @@ 0 0 - 363 - 241 + 414 + 298 Appearance - + Fonts - + @@ -37,16 +37,14 @@ - + - + - - @@ -65,7 +63,7 @@ - + diff --git a/src/settings_general.ui b/src/settings_general.ui index 9b963f89..3f07eaa5 100644 --- a/src/settings_general.ui +++ b/src/settings_general.ui @@ -6,18 +6,18 @@ 0 0 - 392 - 269 + 515 + 415 General - + - HomePage + Places @@ -64,76 +64,61 @@ + + + + + + + Save downloads to: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + - + - misc + Appearance - - - + + + - Remove history items: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + Always show TabBar - - - - - After one day - - - - - After one week - - - - - After two weeks - - - - - After one month - - - - - After one year - - - - - Manually - - - - - - + + + + + + + Web Content + + + + - Save downloads to: + Enable Plugins - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + true - - - - - + + - Always show TabBar + Enable Javascript + + + true @@ -141,14 +126,14 @@ - + Qt::Vertical - 384 - 36 + 20 + 40 diff --git a/src/settings_privacy.ui b/src/settings_privacy.ui index 7f3ff1a8..b04f0611 100644 --- a/src/settings_privacy.ui +++ b/src/settings_privacy.ui @@ -15,29 +15,53 @@ - + - Web Content + History - - - + + + - Enable Plugins + Remove history items: - - true + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - Enable Javascript - - - true - + + + + + After one day + + + + + After one week + + + + + After two weeks + + + + + After one month + + + + + After one year + + + + + Manually + + @@ -132,7 +156,7 @@ 20 - 40 + 136 diff --git a/src/webview.cpp b/src/webview.cpp index da286ee8..947b08cd 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -122,7 +122,7 @@ QWebPage *WebPage::createWindow(QWebPage::WebWindowType type) if (m_openInNewTab) { m_openInNewTab = false; - return mainWindow()->tabWidget()->newTab()->page(); + return mainWindow()->mainView()->newTab()->page(); } MainWindow *mainWindow = Application::instance()->mainWindow(); @@ -137,9 +137,7 @@ QObject *WebPage::createPlugin(const QString &classId, const QUrl &url, const QS kWarning() << "url = " << url; kWarning() << "Param Names = " << paramNames; kWarning() << "Param Values = " << paramValues; -// Q_UNUSED(url); -// Q_UNUSED(paramNames); -// Q_UNUSED(paramValues); + QUiLoader loader; return loader.createWidget(classId, view()); } -- cgit v1.2.1