summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2013-08-02 11:21:57 +0200
committerAndrea Diamantini <adjam7@gmail.com>2013-08-02 11:21:57 +0200
commit45e877d6e8c90b421c0a03e65cfa09d0bac76d5d (patch)
tree2cd475c204f0a8d391721765443fe196894179ad
parentContextual menu work (diff)
downloadrekonq-45e877d6e8c90b421c0a03e65cfa09d0bac76d5d.tar.xz
Get sure web settings are applied BEFORE loading pages
There is also a change in font size management, ignoring DPI and consi dering settings as pixels. Change default font size to 16 (default internet pixel font size) BUG: 322982
-rw-r--r--src/application.cpp74
-rw-r--r--src/rekonq.kcfg2
2 files changed, 24 insertions, 52 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 0c70c57a..a6d7288d 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -87,13 +87,20 @@ Application::Application()
#ifdef HAVE_KACTIVITIES
m_activityConsumer = new KActivities::Consumer();
#endif
+
+ // updating rekonq configuration
+ updateConfiguration();
+
+ setWindowIcon(KIcon("rekonq"));
+
+ // just create History Manager...
+ HistoryManager::self();
}
Application::~Application()
{
- // ok, we are closing well.
- // Don't recover on next load..
+ // ok, we are closing well: don't recover on next load..
ReKonfig::setRecoverOnCrash(0);
saveConfiguration();
@@ -152,17 +159,6 @@ int Application::newInstance()
loadUrl(u, Rekonq::WebApp);
- if (isFirstLoad)
- {
- // updating rekonq configuration
- updateConfiguration();
-
- setWindowIcon(KIcon("rekonq"));
-
- // just create History Manager...
- HistoryManager::self();
- }
-
KStartupInfo::appStarted();
isFirstLoad = false;
return 0;
@@ -348,14 +344,6 @@ int Application::newInstance()
if (ReKonfig::checkDefaultSearchEngine() && !hasToBeRecoveredFromCrash && SearchEngine::defaultEngine().isNull())
QTimer::singleShot(2000, rekonqWindow()->currentWebWindow()->tabView(), SLOT(showSearchEngineBar()));
- // updating rekonq configuration
- updateConfiguration();
-
- setWindowIcon(KIcon("rekonq"));
-
- // just create History Manager...
- HistoryManager::self();
-
ReKonfig::setRecoverOnCrash(ReKonfig::recoverOnCrash() + 1);
saveConfiguration();
}
@@ -598,17 +586,6 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
void Application::updateConfiguration()
{
- // ============== Tabs ==================
- bool b = ReKonfig::closeTabSelectPrevious();
- Q_FOREACH(const QWeakPointer<RekonqWindow> &w, m_rekonqWindows)
- {
- if (b)
- w.data()->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
- else
- w.data()->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectRightTab);
- }
-
-
QWebSettings *defaultSettings = QWebSettings::globalSettings();
// =========== Fonts ==============
@@ -619,23 +596,9 @@ void Application::updateConfiguration()
defaultSettings->setFontFamily(QWebSettings::CursiveFont, ReKonfig::cursiveFontFamily());
defaultSettings->setFontFamily(QWebSettings::FantasyFont, ReKonfig::fantasyFontFamily());
- // compute font size
- // (I have to admit I know nothing about these DPI questions..: copied from kwebkitpart, as someone suggested)
- // font size in pixels = font size in inches × screen dpi
- if (rekonqWindow() && rekonqWindow()->currentWebWindow())
- {
- int logDpiY = rekonqWindow()->currentWebWindow()->logicalDpiY();
- float toPix = (logDpiY < 96.0)
- ? 96.0 / 72.0
- : logDpiY / 72.0 ;
-
- int defaultFontSize = ReKonfig::defaultFontSize();
- int minimumFontSize = ReKonfig::minFontSize();
-
- defaultSettings->setFontSize(QWebSettings::DefaultFontSize, qRound(defaultFontSize * toPix));
- defaultSettings->setFontSize(QWebSettings::MinimumFontSize, qRound(minimumFontSize * toPix));
- }
-
+ defaultSettings->setFontSize(QWebSettings::DefaultFontSize, ReKonfig::defaultFontSize());
+ defaultSettings->setFontSize(QWebSettings::MinimumFontSize, ReKonfig::minFontSize());
+
// encodings
QString enc = ReKonfig::defaultEncoding();
defaultSettings->setDefaultTextEncoding(enc);
@@ -682,9 +645,19 @@ void Application::updateConfiguration()
HistoryManager::self()->loadSettings();
defaultSettings = 0;
-
+
if (!rekonqWindow())
return;
+
+ // ============== Tabs ==================
+ bool b = ReKonfig::closeTabSelectPrevious();
+ Q_FOREACH(const QWeakPointer<RekonqWindow> &w, m_rekonqWindows)
+ {
+ if (b)
+ w.data()->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
+ else
+ w.data()->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectRightTab);
+ }
// FIXME What about this?
// ReKonfig::useFavicon()
@@ -721,7 +694,6 @@ void Application::updateConfiguration()
ASSERT_NOT_REACHED(unknown hoveringTabOption);
break;
}
-
}
diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg
index 65e66822..c367251f 100644
--- a/src/rekonq.kcfg
+++ b/src/rekonq.kcfg
@@ -155,7 +155,7 @@
<default code="true">QWebSettings::globalSettings()->fontFamily(QWebSettings::FantasyFont)</default>
</entry>
<entry name="defaultFontSize" type="Int">
- <default>12</default>
+ <default>16</default>
</entry>
<entry name="minFontSize" type="Int">
<default>7</default>