From 50d2f90b32782c0712a59eed16f7b0b2778dc7ab Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 25 Apr 2010 02:14:04 +0200 Subject: Various changes - moved updateCOnfiguration slot to Application class from MainWindow (its right place) - loaded conf out of ctor (this will increase boot speed, but could in theory let rekonq fails on first load. We'll see..) - set accept-language (raw) header. RFC 2626, section 14. Choose your preferred language. - Try fixing CacheControl values (rekonq seems work quite well offline, now) --- src/mainwindow.cpp | 75 +----------------------------------------------------- 1 file changed, 1 insertion(+), 74 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index fe00ee7e..03a6194a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -113,9 +113,6 @@ MainWindow::MainWindow() // enable window size "auto-save" setAutoSaveSettings(); - // updating rekonq configuration - updateConfiguration(); - // creating a centralWidget containing panel, m_view and the hidden findbar QWidget *centralWidget = new QWidget; centralWidget->setContentsMargins(0, 0, 0, 0); @@ -543,76 +540,6 @@ void MainWindow::setupPanels() } - -void MainWindow::updateConfiguration() -{ - // ============== General ================== - m_view->updateTabBar(); - - // ============== Tabs ================== - if (ReKonfig::closeTabSelectPrevious()) - m_view->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab); - else - m_view->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectRightTab); - - // =========== Fonts ============== - QWebSettings *defaultSettings = QWebSettings::globalSettings(); - - int fnSize = ReKonfig::fontSize(); - int minFnSize = ReKonfig::minFontSize(); - - QFont standardFont = ReKonfig::standardFont(); - defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFontSize, fnSize); - defaultSettings->setFontSize(QWebSettings::MinimumFontSize, minFnSize); - - QFont fixedFont = ReKonfig::fixedFont(); - defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fnSize); - - // ================ WebKit ============================ - defaultSettings->setAttribute(QWebSettings::AutoLoadImages, ReKonfig::autoLoadImages()); - defaultSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, ReKonfig::dnsPrefetch()); - defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, ReKonfig::javascriptEnabled()); - defaultSettings->setAttribute(QWebSettings::JavaEnabled, ReKonfig::javaEnabled()); - defaultSettings->setAttribute(QWebSettings::JavascriptCanOpenWindows, ReKonfig::javascriptCanOpenWindows()); - defaultSettings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, ReKonfig::javascriptCanAccessClipboard()); - defaultSettings->setAttribute(QWebSettings::LinksIncludedInFocusChain, ReKonfig::linksIncludedInFocusChain()); - defaultSettings->setAttribute(QWebSettings::ZoomTextOnly, ReKonfig::zoomTextOnly()); - defaultSettings->setAttribute(QWebSettings::PrintElementBackgrounds, ReKonfig::printElementBackgrounds()); - - if(ReKonfig::pluginsEnabled() == 2) - defaultSettings->setAttribute(QWebSettings::PluginsEnabled, false); - else - defaultSettings->setAttribute(QWebSettings::PluginsEnabled, true); - - // ===== HTML 5 features WebKit support ====== - defaultSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, ReKonfig::offlineStorageDatabaseEnabled()); - defaultSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, ReKonfig::offlineWebApplicationCacheEnabled()); - defaultSettings->setAttribute(QWebSettings::LocalStorageEnabled, ReKonfig::localStorageEnabled()); - if(ReKonfig::localStorageEnabled()) - { - QString path = KStandardDirs::locateLocal("cache", QString("WebkitLocalStorage/rekonq"), true); - path.remove("rekonq"); - QWebSettings::setOfflineStoragePath(path); - QWebSettings::setOfflineStorageDefaultQuota(50000); - } - - // Applies user defined CSS to all open webpages. If there no longer is a - // user defined CSS removes it from all open webpages. - if(ReKonfig::userCSS().isEmpty()) - defaultSettings->setUserStyleSheetUrl( KUrl(KStandardDirs::locate("appdata" , "default.css")) ); - else - defaultSettings->setUserStyleSheetUrl(ReKonfig::userCSS()); - - // ====== load Settings on main classes - Application::historyManager()->loadSettings(); - Application::adblockManager()->loadSettings(); - - defaultSettings = 0; -} - - void MainWindow::openLocation() { m_view->urlBar()->selectAll(); @@ -649,7 +576,7 @@ void MainWindow::preferences() QPointer s = new SettingsDialog(this); // keep us informed when the user changes settings - connect(s, SIGNAL(settingsChanged(const QString&)), this, SLOT(updateConfiguration())); + connect(s, SIGNAL(settingsChanged(const QString&)), Application::instance(), SLOT(updateConfiguration())); s->exec(); delete s; -- cgit v1.2.1