From aab36b488647e298857b7ec24bce0f2b143e4520 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 20 Mar 2009 00:57:19 +0100 Subject: working on fixing font problem.. --- src/mainwindow.cpp | 34 +++++++------- src/rekonq.kcfg | 7 ++- src/settings.cpp | 18 ++++---- src/settings_fonts.ui | 121 +++++++++++++++++++++++++++++++++++++------------- src/webview.cpp | 8 +++- 5 files changed, 131 insertions(+), 57 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 22110c59..56eb6ecc 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -314,28 +314,30 @@ void MainWindow::slotUpdateConf() // =========== Fonts ============== QWebSettings *defaultSettings = QWebSettings::globalSettings(); + int fnSize = ReKonfig::fontSize(); + QFont standardFont = ReKonfig::standardFont(); - if( !standardFont.exactMatch() ) - { - kWarning() << "Webkit Standard Font doesn't match! Setting to KDE general font.."; - standardFont = KGlobalSettings::generalFont(); - ReKonfig::setStandardFont( standardFont ); - ReKonfig::self()->writeConfig(); - } +// if( !standardFont.exactMatch() ) +// { +// kWarning() << "Webkit Standard Font doesn't match! Setting to KDE general font.."; +// standardFont = KGlobalSettings::generalFont(); +// ReKonfig::setStandardFont( standardFont ); +// ReKonfig::self()->writeConfig(); +// } defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize()); + defaultSettings->setFontSize(QWebSettings::DefaultFontSize, fnSize); QFont fixedFont = ReKonfig::fixedFont(); - if( !fixedFont.exactMatch() ) - { - kWarning() << "Webkit Fixed Font doesn't match! Setting to KDE fixed font.."; - fixedFont = KGlobalSettings::fixedFont(); - ReKonfig::setFixedFont( fixedFont ); - ReKonfig::self()->writeConfig(); - } +// if( !fixedFont.exactMatch() ) +// { +// kWarning() << "Webkit Fixed Font doesn't match! Setting to KDE fixed font.."; +// fixedFont = KGlobalSettings::fixedFont(); +// ReKonfig::setFixedFont( fixedFont ); +// ReKonfig::self()->writeConfig(); +// } defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize()); + defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fnSize); // =========== Privacy ============== diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index f60d6e86..e7c433fd 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -28,10 +28,13 @@ - QFont( QWebSettings::globalSettings()->fontFamily(QWebSettings::StandardFont) ) + QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::StandardFont)) - QFont( QWebSettings::globalSettings()->fontFamily(QWebSettings::FixedFont) ) + QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::FixedFont)) + + + 10 diff --git a/src/settings.cpp b/src/settings.cpp index 43e3a5b0..68a051ea 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -133,13 +133,14 @@ void SettingsDialog::readConfig() // ======= Fonts QFont stdFont = ReKonfig::standardFont(); - d->fontsUi.standardFontChooser->setFont(stdFont, false); - d->fontsUi.standardFontChooser->setSampleText( stdFont.family() + " " + QString::number(stdFont.pointSize()) ); - connect(d->fontsUi.standardFontChooser, SIGNAL(fontSelected(QFont)),this, SLOT(saveSettings())); + d->fontsUi.standardFont->setCurrentFont(stdFont); + QFont fxFont = ReKonfig::fixedFont(); - d->fontsUi.fixedFontChooser->setFont(fxFont, true); - d->fontsUi.fixedFontChooser->setSampleText( fxFont.family() + " " + QString::number(fxFont.pointSize()) ); - connect(d->fontsUi.fixedFontChooser, SIGNAL(fontSelected(QFont)),this, SLOT(saveSettings())); + d->fontsUi.fixedFont->setOnlyFixed(true); + d->fontsUi.fixedFont->setCurrentFont(fxFont); + + int fnSize = ReKonfig::fontSize(); + d->fontsUi.fontSize->setValue( fnSize ); // ======= Proxy bool proxyEnabled = ReKonfig::isProxyEnabled(); @@ -155,8 +156,9 @@ void SettingsDialog::saveSettings() ReKonfig::setDownloadDir( d->generalUi.downloadDirUrlRequester->url().prettyUrl() ); // Fonts - ReKonfig::setStandardFont( d->fontsUi.standardFontChooser->font() ); - ReKonfig::setFixedFont( d->fontsUi.standardFontChooser->font() ); + ReKonfig::setStandardFont( d->fontsUi.standardFont->currentFont() ); + ReKonfig::setFixedFont( d->fontsUi.fixedFont->currentFont() ); + ReKonfig::setFontSize( d->fontsUi.fontSize->value() ); // Save ReKonfig::self()->writeConfig(); diff --git a/src/settings_fonts.ui b/src/settings_fonts.ui index 2d7168b0..ef97eeea 100644 --- a/src/settings_fonts.ui +++ b/src/settings_fonts.ui @@ -1,48 +1,109 @@ - + + fonts - - + + 0 0 - 391 - 179 + 369 + 211 - + Appearance - + - - - Standard Font + + + Qt::Vertical - - - - - - + + + 20 + 40 + + + + + + + + + + Standard Font + + + + + + + + + + Fixed Font + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + - - - Fixed Font + + + Qt::Horizontal - - - - - - - + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Font Size + + + + + + + + + + + Qt::Vertical - + 20 40 @@ -54,9 +115,9 @@ - KFontRequester - QWidget -
kfontrequester.h
+ KFontComboBox + KComboBox +
kfontcombobox.h
diff --git a/src/webview.cpp b/src/webview.cpp index 0c7ad356..0b981633 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -107,7 +107,13 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r QWebPage *WebPage::createWindow(QWebPage::WebWindowType type) { - Q_UNUSED(type); + // added to manage web modal dialogs + if(type == QWebPage::WebModalDialog) + { + WebView *w = new WebView; + return w->page(); + } + if (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton) { m_openInNewTab = true; -- cgit v1.2.1