diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-04-25 02:37:55 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-04-25 02:37:55 +0200 |
commit | a1e2bbeced79c46d7ee0f4c96c79ff3f23298f6d (patch) | |
tree | fd008b480ad17ccfa04ec087d8e67ca99190533d /src/application.cpp | |
parent | Fixing new tab action position (diff) | |
parent | Fix error pages show (diff) | |
download | rekonq-a1e2bbeced79c46d7ee0f4c96c79ff3f23298f6d.tar.xz |
Merge branch 'NetworkRequestImprovements'
Diffstat (limited to 'src/application.cpp')
-rw-r--r-- | src/application.cpp | 77 |
1 files changed, 76 insertions, 1 deletions
diff --git a/src/application.cpp b/src/application.cpp index 45d115ae..b28055f7 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -44,6 +44,7 @@ #include "adblockmanager.h" #include "webview.h" #include "filterurljob.h" +#include "tabbar.h" // KDE Includes #include <KCmdLineArgs> @@ -182,7 +183,10 @@ Application *Application::instance() void Application::postLaunch() -{ +{ + // updating rekonq configuration + updateConfiguration(); + setWindowIcon(KIcon("rekonq")); // set Icon Database Path to store "favicons" associated with web sites @@ -392,3 +396,74 @@ void Application::newWindow() loadUrl( KUrl("about:home"), Rekonq::NewWindow ); mainWindow()->mainView()->urlBarWidget()->setFocus(); } + + +void Application::updateConfiguration() +{ + MainView *view = mainWindow()->mainView(); + + // ============== General ================== + view->updateTabBar(); + + // ============== Tabs ================== + if (ReKonfig::closeTabSelectPrevious()) + view->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab); + else + 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; +} |