diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/application.cpp | 38 | ||||
-rw-r--r-- | src/bookmarks/bookmarkcontextmenu.cpp | 4 | ||||
-rw-r--r-- | src/bookmarks/bookmarksmanager.cpp | 8 | ||||
-rw-r--r-- | src/bookmarks/bookmarkstreemodel.cpp | 2 | ||||
-rw-r--r-- | src/data/rekonq.desktop | 3 | ||||
-rw-r--r-- | src/history/historypanel.cpp | 6 | ||||
-rw-r--r-- | src/mainview.cpp | 3 | ||||
-rw-r--r-- | src/mainwindow.cpp | 19 | ||||
-rw-r--r-- | src/mainwindow.h | 4 | ||||
-rw-r--r-- | src/newtabpage.cpp | 5 | ||||
-rw-r--r-- | src/rekonq.kcfg | 32 | ||||
-rw-r--r-- | src/settings/appearancewidget.cpp | 74 | ||||
-rw-r--r-- | src/settings/appearancewidget.h | 12 | ||||
-rw-r--r-- | src/settings/settings_appearance.ui | 309 | ||||
-rw-r--r-- | src/tabbar.cpp | 5 | ||||
-rw-r--r-- | src/urlbar/completionwidget.cpp | 6 | ||||
-rw-r--r-- | src/urlbar/completionwidget.h | 2 | ||||
-rw-r--r-- | src/urlbar/listitem.cpp | 2 | ||||
-rw-r--r-- | src/urlbar/listitem.h | 2 | ||||
-rw-r--r-- | src/urlbar/urlresolver.cpp | 4 | ||||
-rw-r--r-- | src/webpage.cpp | 7 | ||||
-rw-r--r-- | src/webtab.cpp | 2 | ||||
-rw-r--r-- | src/webview.cpp | 19 | ||||
-rw-r--r-- | src/webview.h | 2 |
24 files changed, 368 insertions, 202 deletions
diff --git a/src/application.cpp b/src/application.cpp index 23e5b095..fb52dc51 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -433,30 +433,26 @@ void Application::updateConfiguration() QWebSettings *defaultSettings = QWebSettings::globalSettings(); - // =========== Fonts ============== - QFont standardFont = ReKonfig::standardFont(); - defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize()); - - QFont fixedFont = ReKonfig::fixedFont(); - defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize()); - - QFont serifFont = ReKonfig::serifFont(); - defaultSettings->setFontFamily(QWebSettings::SerifFont, serifFont.family()); - - QFont sansSerifFont = ReKonfig::sansSerifFont(); - defaultSettings->setFontFamily(QWebSettings::SansSerifFont, sansSerifFont.family()); - - QFont cursiveFont = ReKonfig::cursiveFont(); - defaultSettings->setFontFamily(QWebSettings::FixedFont, cursiveFont.family()); + // =========== Fonts ============== + defaultSettings->setFontFamily(QWebSettings::StandardFont, ReKonfig::standardFontFamily() ); + defaultSettings->setFontFamily(QWebSettings::FixedFont, ReKonfig::fixedFontFamily() ); + defaultSettings->setFontFamily(QWebSettings::SerifFont, ReKonfig::serifFontFamily() ); + defaultSettings->setFontFamily(QWebSettings::SansSerifFont, ReKonfig::sansSerifFontFamily() ); + 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 + int defaultFontSize = ReKonfig::defaultFontSize(); + int minimumFontSize = ReKonfig::minFontSize(); - QFont fantasyFont = ReKonfig::fantasyFont(); - defaultSettings->setFontFamily(QWebSettings::FantasyFont, fantasyFont.family()); + float toPix = mainWindow()->currentTab()->view()->logicalDpiY()/72.0; - int minimumFontSize = ReKonfig::minFontSize(); - defaultSettings->setFontSize(QWebSettings::MinimumFontSize, minimumFontSize); + defaultSettings->setFontSize(QWebSettings::DefaultFontSize, qRound(defaultFontSize * toPix) ); + defaultSettings->setFontSize(QWebSettings::MinimumFontSize, qRound(minimumFontSize * toPix) ); + // ================ WebKit ============================ defaultSettings->setAttribute(QWebSettings::AutoLoadImages, ReKonfig::autoLoadImages()); defaultSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, ReKonfig::dnsPrefetch()); diff --git a/src/bookmarks/bookmarkcontextmenu.cpp b/src/bookmarks/bookmarkcontextmenu.cpp index c96fa7bf..4422763a 100644 --- a/src/bookmarks/bookmarkcontextmenu.cpp +++ b/src/bookmarks/bookmarkcontextmenu.cpp @@ -237,7 +237,7 @@ void BookmarkContextMenu::editBookmark() selected.setFullText(selected.text().replace("&&", "&")); KBookmarkDialog *dialog = owner()->bookmarkDialog(manager(), QApplication::activeWindow()); dialog->editBookmark(selected); - selected.setFullText(selected.text().replace("&", "&&")); + selected.setFullText(selected.text().replace('&', "&&")); delete dialog; } @@ -319,7 +319,7 @@ void BookmarkContextMenu::bookmarkCurrentPage() if (selected.isGroup()) parent = selected.toGroup(); - KBookmark newBk = parent.addBookmark(owner()->currentTitle().replace("&", "&&"), KUrl(owner()->currentUrl()), "text-html"); + KBookmark newBk = parent.addBookmark(owner()->currentTitle().replace('&', "&&"), KUrl(owner()->currentUrl()), "text-html"); parent.moveBookmark(newBk, selected.parentGroup().previous(selected)); } diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp index 503e1df8..c430078b 100644 --- a/src/bookmarks/bookmarksmanager.cpp +++ b/src/bookmarks/bookmarksmanager.cpp @@ -100,8 +100,10 @@ void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bookmark) if (urlList.length() > 8) { if ( !(KMessageBox::warningContinueCancel( Application::instance()->mainWindow(), - i18n("You are about to open %1 tabs.\nAre you sure?", - QString::number( urlList.length() )) + i18ncp("%1=Number of tabs. Value is always >=8", + "You are about to open %1 tabs.\nAre you sure?", + "You are about to open %1 tabs.\nAre you sure?", + urlList.length()) ) == KMessageBox::Continue) ) return; @@ -410,7 +412,7 @@ void BookmarkProvider::fillBookmarkBar(KToolBar *toolBar) else { KBookmarkAction* a = new KBookmarkAction(bookmark, m_owner, this); - a->setIconText(a->iconText().replace("&", "&&")); + a->setIconText(a->iconText().replace('&', "&&")); toolBar->addAction(a); } } diff --git a/src/bookmarks/bookmarkstreemodel.cpp b/src/bookmarks/bookmarkstreemodel.cpp index 4003cf3f..a865a99d 100644 --- a/src/bookmarks/bookmarkstreemodel.cpp +++ b/src/bookmarks/bookmarkstreemodel.cpp @@ -75,7 +75,7 @@ QVariant BtmItem::data(int role) const } if (m_kbm.isGroup()) { - tooltip += i18nc("%1=Number of items in bookmark folder", " (%1 items)", QString::number(childCount())); + tooltip += i18nc("%1=Number of items in bookmark folder", " (%1 items)", childCount()); } if (!m_kbm.url().url().isEmpty()) { diff --git a/src/data/rekonq.desktop b/src/data/rekonq.desktop index 9f00873f..028a79cb 100644 --- a/src/data/rekonq.desktop +++ b/src/data/rekonq.desktop @@ -15,6 +15,7 @@ Name[nl]=rekonq Name[pl]=rekonq Name[pt]=rekonq Name[pt_BR]=rekonq +Name[ru]=rekonq Name[sv]=Rekonq Name[uk]=rekonq Name[x-test]=xxrekonqxx @@ -28,9 +29,11 @@ GenericName[fr]=Navigateur Webkit pour KDE GenericName[nl]=Webkit KDE Browser GenericName[pt]=Navegador do KDE Usando o WebKit GenericName[pt_BR]=Navegador WebKit do KDE +GenericName[ru]=Веб-браузер для KDE на базе WebKit GenericName[sv]=Webkit webbläsare för KDE GenericName[uk]=Переглядач мережі на WebKit для KDE GenericName[x-test]=xxWebKit KDE Browserxx +GenericName[zh_CN]=Webkit KDE 浏览器 Icon=rekonq Type=Application Exec=rekonq %u diff --git a/src/history/historypanel.cpp b/src/history/historypanel.cpp index 65c9de81..d8309eed 100644 --- a/src/history/historypanel.cpp +++ b/src/history/historypanel.cpp @@ -172,8 +172,10 @@ void HistoryPanel::openAll() if (allChild.length() > 8) { if (!(KMessageBox::warningContinueCancel(this, - i18n("You are about to open %1 tabs.\nAre you sure?", - QString::number(allChild.length()))) == KMessageBox::Continue) + i18ncp("%1=Number of tabs. Value is always >=8", + "You are about to open %1 tabs.\nAre you sure?", + "You are about to open %1 tabs.\nAre you sure?", + allChild.length())) == KMessageBox::Continue) ) return; } diff --git a/src/mainview.cpp b/src/mainview.cpp index 0bc6fbde..0b17ef2a 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -329,6 +329,7 @@ WebTab *MainView::newWebTab(bool focused, bool nearParent) connect(tab->view(), SIGNAL(iconChanged()), this, SLOT(webViewIconChanged())); connect(tab->view(), SIGNAL(titleChanged(const QString &)), this, SLOT(webViewTitleChanged(const QString &))); connect(tab->view(), SIGNAL(urlChanged(const QUrl &)), this, SLOT(webViewUrlChanged(const QUrl &))); + connect(tab->view(), SIGNAL(zoomChanged(qreal)), m_parentWindow, SLOT(setZoomSliderFactor(qreal))); // connecting webPage signals with mainview connect(tab->view()->page(), SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested())); @@ -596,7 +597,7 @@ void MainView::webViewTitleChanged(const QString &title) { QString viewTitle = title.isEmpty()? i18n("(Untitled)") : title; QString tabTitle = viewTitle; - tabTitle.replace("&", "&&"); + tabTitle.replace('&', "&&"); WebView *view = qobject_cast<WebView *>(sender()); int index = indexOf(view->parentWidget()); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 43418ed3..dc29d2eb 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -609,8 +609,19 @@ void MainWindow::openLocation() void MainWindow::fileSaveAs() { - KUrl srcUrl = currentTab()->url(); - + KUrl srcUrl; + WebTab *w = currentTab(); + if (w->page()->isOnRekonqPage()) + { + QWebElement el = w->page()->mainFrame()->documentElement(); + srcUrl = KUrl( el.findFirst("object").attribute("data") ); + } + else + { + srcUrl = w->url(); + } + kDebug() << "URL to save: " << srcUrl; + QString name = srcUrl.fileName(); if (name.isNull()) { @@ -669,7 +680,7 @@ void MainWindow::updateActions() if (am->menu()) am->menu()->clear(); - foreach (HistoryItem item, mainView()->recentlyClosedTabs()) + foreach (const HistoryItem &item, mainView()->recentlyClosedTabs()) { KAction *a = new KAction(Application::icon(item.url), item.title, this); a->setData(item.url); @@ -895,7 +906,7 @@ void MainWindow::setZoomFactor(int factor) void MainWindow::setZoomSliderFactor(qreal factor) { - m_zoomSlider->setValue(factor*10); + m_zoomSlider->setValue(factor * 10); } diff --git a/src/mainwindow.h b/src/mainwindow.h index ffc91086..8acbef56 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -78,8 +78,6 @@ public: virtual QSize sizeHint() const; void setWidgetsVisible(bool makeFullScreen); - void setZoomSliderFactor(qreal factor); - private: void setupActions(); void setupTools(); @@ -103,6 +101,8 @@ public slots: void updateActions(); + void setZoomSliderFactor(qreal factor); + signals: // switching tabs void ctrlTabPressed(); diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp index b3b9cf65..9c381f97 100644 --- a/src/newtabpage.cpp +++ b/src/newtabpage.cpp @@ -380,8 +380,7 @@ void NewTabPage::browsingMenu(const KUrl ¤tUrl) nav.findFirst("span").appendInside(i18n("Downloads")); navItems.append(nav); - QWebElement it; - foreach(it, navItems) + foreach(QWebElement it, navItems) { if (it.findFirst("a").attribute("href") == currentUrl.toMimeDataString()) it.addClass("current"); @@ -582,7 +581,7 @@ void NewTabPage::downloadsPage() div.appendInside("<em>" + date + "</em>"); div.appendInside("<br/>"); - div.appendInside(item.srcUrlString); + div.appendInside("<a href=" + item.srcUrlString + '>' + item.srcUrlString + "</a>"); div.appendInside("<br/>"); div.appendInside(markup("a")); diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index 07c079a5..b934c6d5 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -9,6 +9,7 @@ <include>QtWebKit</include> <include>QDateTime</include> <include>KUrl</include> +<include>KGlobalSettings</include> <kcfgfile name="rekonqrc" /> @@ -69,8 +70,8 @@ <entry name="searchEngine" type="Int"> <default>0</default> </entry> - <entry name="disableAutoScroll" type="Bool"> - <default>false</default> + <entry name="autoScroll" type="Bool"> + <default>true</default> </entry> </group> @@ -100,23 +101,26 @@ <!-- Fonts Settings --> <group name="Fonts"> - <entry name="standardFont" type="Font"> - <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::StandardFont))</default> + <entry name="standardFontFamily" type="String"> + <default code="true">KGlobalSettings::generalFont().family()</default> + </entry> + <entry name="fixedFontFamily" type="String"> + <default code="true">KGlobalSettings::fixedFont().family()</default> </entry> - <entry name="fixedFont" type="Font"> - <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::FixedFont))</default> + <entry name="serifFontFamily" type="String"> + <default code="true">QWebSettings::globalSettings()->fontFamily(QWebSettings::SerifFont)</default> </entry> - <entry name="serifFont" type="Font"> - <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::SerifFont))</default> + <entry name="sansSerifFontFamily" type="String"> + <default code="true">QWebSettings::globalSettings()->fontFamily(QWebSettings::SansSerifFont)</default> </entry> - <entry name="sansSerifFont" type="Font"> - <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::SansSerifFont))</default> + <entry name="cursiveFontFamily" type="String"> + <default code="true">QWebSettings::globalSettings()->fontFamily(QWebSettings::CursiveFont)</default> </entry> - <entry name="cursiveFont" type="Font"> - <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::CursiveFont))</default> + <entry name="fantasyFontFamily" type="String"> + <default code="true">QWebSettings::globalSettings()->fontFamily(QWebSettings::FantasyFont)</default> </entry> - <entry name="fantasyFont" type="Font"> - <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::FantasyFont))</default> + <entry name="defaultFontSize" type="Int"> + <default>16</default> </entry> <entry name="minFontSize" type="Int"> <default>8</default> diff --git a/src/settings/appearancewidget.cpp b/src/settings/appearancewidget.cpp index 40f53a85..20793d0a 100644 --- a/src/settings/appearancewidget.cpp +++ b/src/settings/appearancewidget.cpp @@ -28,8 +28,8 @@ #include "appearancewidget.h" #include "appearancewidget.moc" -// KDE Includes -#include <KFontRequester> +// Auto Includes +#include "rekonq.h" AppearanceWidget::AppearanceWidget(QWidget *parent) @@ -37,16 +37,33 @@ AppearanceWidget::AppearanceWidget(QWidget *parent) , _changed(false) { setupUi(this); - - KFontRequester *fixedFontRequester = new KFontRequester(this, true); - fixedFontRequester->setObjectName( QL1S("kcfg_fixedFont") ); - - gridLayout->addWidget(fixedFontRequester, 1, 1, 1, 1); + + fixedFontChooser->setOnlyFixed(true); + + standardFontChooser->setCurrentFont( QFont( ReKonfig::standardFontFamily() ) ); + fixedFontChooser->setCurrentFont( QFont( ReKonfig::fixedFontFamily() ) ); + serifFontChooser->setCurrentFont( QFont( ReKonfig::serifFontFamily() ) ); + sansSerifFontChooser->setCurrentFont( QFont( ReKonfig::sansSerifFontFamily() ) ); + cursiveFontChooser->setCurrentFont( QFont( ReKonfig::cursiveFontFamily() ) ); + fantasyFontChooser->setCurrentFont( QFont( ReKonfig::fantasyFontFamily() ) ); + + connect(standardFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotStandardFont(const QFont &))); + connect(fixedFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotFixedFont(const QFont &))); + connect(serifFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotSerifFont(const QFont &))); + connect(sansSerifFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotSansSerifFont(const QFont &))); + connect(cursiveFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotCursiveFont(const QFont &))); + connect(fantasyFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotFantasyFont(const QFont &))); } void AppearanceWidget::save() { + ReKonfig::setStandardFontFamily(reFont[0]); + ReKonfig::setFixedFontFamily(reFont[1]); + ReKonfig::setSerifFontFamily(reFont[2]); + ReKonfig::setSansSerifFontFamily(reFont[3]); + ReKonfig::setCursiveFontFamily(reFont[4]); + ReKonfig::setFantasyFontFamily(reFont[5]); } @@ -58,4 +75,47 @@ bool AppearanceWidget::changed() void AppearanceWidget::hasChanged() { + _changed = true; +} + + +void AppearanceWidget::slotStandardFont(const QFont &f) +{ + reFont[0] = f.family(); + hasChanged(); +} + + +void AppearanceWidget::slotFixedFont(const QFont &f) +{ + reFont[1] = f.family(); + hasChanged(); +} + + +void AppearanceWidget::slotSerifFont(const QFont &f) +{ + reFont[2] = f.family(); + hasChanged(); +} + + +void AppearanceWidget::slotSansSerifFont(const QFont &f) +{ + reFont[3] = f.family(); + hasChanged(); +} + + +void AppearanceWidget::slotCursiveFont(const QFont &f) +{ + reFont[4] = f.family(); + hasChanged(); +} + + +void AppearanceWidget::slotFantasyFont(const QFont &f) +{ + reFont[5] = f.family(); + hasChanged(); } diff --git a/src/settings/appearancewidget.h b/src/settings/appearancewidget.h index 5c7ddc6d..ea3de6a1 100644 --- a/src/settings/appearancewidget.h +++ b/src/settings/appearancewidget.h @@ -53,9 +53,19 @@ signals: private slots: void hasChanged(); - + + void slotStandardFont(const QFont &); + void slotFixedFont(const QFont &); + void slotSerifFont(const QFont &); + void slotSansSerifFont(const QFont &); + void slotCursiveFont(const QFont &); + void slotFantasyFont(const QFont &); + private: bool _changed; + + QString reFont[6]; + }; #endif // APPEARANCE_WIDGET_H diff --git a/src/settings/settings_appearance.ui b/src/settings/settings_appearance.ui index 92d15cc6..7ec23484 100644 --- a/src/settings/settings_appearance.ui +++ b/src/settings/settings_appearance.ui @@ -6,143 +6,186 @@ <rect> <x>0</x> <y>0</y> - <width>529</width> - <height>429</height> + <width>351</width> + <height>455</height> </rect> </property> <property name="windowTitle"> <string>Appearance</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> + <layout class="QVBoxLayout" name="verticalLayout_3"> <item> <widget class="QGroupBox" name="groupBox"> <property name="title"> <string>Fonts</string> </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Standard font:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="KFontRequester" name="kcfg_standardFont"/> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Fixed font:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="6" column="0"> - <widget class="QLabel" name="label_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Minimal font size:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="6" column="1"> - <widget class="KIntNumInput" name="kcfg_minFontSize"/> - </item> - <item row="2" column="1"> - <widget class="KFontRequester" name="kcfg_serifFont"/> - </item> - <item row="3" column="1"> - <widget class="KFontRequester" name="kcfg_sansSerifFont"/> - </item> - <item row="4" column="1"> - <widget class="KFontRequester" name="kcfg_cursiveFont"/> - </item> - <item row="5" column="1"> - <widget class="KFontRequester" name="kcfg_fantasyFont"/> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Serif font:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>Sans Serif font:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Standard font:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="KFontComboBox" name="standardFontChooser"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Fixed font:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="KFontComboBox" name="fixedFontChooser"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Serif font:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="KFontComboBox" name="serifFontChooser"/> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>Sans Serif font:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="KFontComboBox" name="sansSerifFontChooser"/> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_7"> + <property name="text"> + <string>Cursive font:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="4" column="1"> + <widget class="KFontComboBox" name="cursiveFontChooser"/> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="label_8"> + <property name="text"> + <string>Fantasy font:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="KFontComboBox" name="fantasyFontChooser"/> + </item> + </layout> </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>Cursive font:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + <item> + <widget class="Line" name="line"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> </widget> </item> - <item row="5" column="0"> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>Fantasy font:</string> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> + <item> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label_9"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Default font size:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="KIntNumInput" name="kcfg_defaultFontSize"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Minimal font size:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="KIntNumInput" name="kcfg_minFontSize"/> + </item> + </layout> </item> </layout> </widget> @@ -186,12 +229,15 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> - <widget class="QCheckBox" name="kcfg_disableAutoScroll"> + <widget class="QCheckBox" name="kcfg_autoScroll"> <property name="toolTip"> - <string>Disable automatic scrolling on middle click in a web page</string> + <string>Toggle automatic scrolling on middle click in a web page</string> </property> <property name="text"> - <string>Disable auto scrolling</string> + <string>Auto-scroll on middle-click</string> + </property> + <property name="checked"> + <bool>true</bool> </property> </widget> </item> @@ -220,9 +266,14 @@ <header>kurlrequester.h</header> </customwidget> <customwidget> - <class>KFontRequester</class> - <extends>QWidget</extends> - <header>kfontrequester.h</header> + <class>KFontComboBox</class> + <extends>KComboBox</extends> + <header>kfontcombobox.h</header> + </customwidget> + <customwidget> + <class>KComboBox</class> + <extends>QComboBox</extends> + <header>kcombobox.h</header> </customwidget> <customwidget> <class>KIntNumInput</class> diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 1274d813..5d6b7b2c 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -186,6 +186,11 @@ void TabBar::showTabPreview(int tab) void TabBar::mouseMoveEvent(QMouseEvent *event) { + if (count() == 1) + { + return; + } + if (event->buttons() & Qt::LeftButton) { // hide addNewTabButton when moving tabs diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp index 9a5c9432..af9bdc45 100644 --- a/src/urlbar/completionwidget.cpp +++ b/src/urlbar/completionwidget.cpp @@ -74,7 +74,7 @@ void CompletionWidget::insertSearchList(const UrlSearchList &list, const QString { ListItem *suggestion = ListItemFactory::create(item, text, this); suggestion->setBackgroundRole(i % 2 ? QPalette::AlternateBase : QPalette::Base); - connect(suggestion, SIGNAL(itemClicked(ListItem *, Qt::MouseButton)), this, SLOT(itemChosen(ListItem *, Qt::MouseButton))); + connect(suggestion, SIGNAL(itemClicked(ListItem *, Qt::MouseButton, Qt::KeyboardModifiers)), this, SLOT(itemChosen(ListItem *, Qt::MouseButton, Qt::KeyboardModifiers))); connect(this, SIGNAL(nextItemSubChoice()), suggestion, SLOT(nextItemSubChoice())); suggestion->setObjectName(QString::number(i++)); layout()->addWidget(suggestion); @@ -265,9 +265,9 @@ void CompletionWidget::setVisible(bool visible) } -void CompletionWidget::itemChosen(ListItem *item, Qt::MouseButton button) +void CompletionWidget::itemChosen(ListItem *item, Qt::MouseButton button, Qt::KeyboardModifiers modifier) { - if (button == Qt::MidButton) + if (button == Qt::MidButton || modifier == Qt::ControlModifier) emit chosenUrl(item->url(), Rekonq::NewCurrentTab); else emit chosenUrl(item->url(), Rekonq::CurrentTab); diff --git a/src/urlbar/completionwidget.h b/src/urlbar/completionwidget.h index 2d33b59f..423499fe 100644 --- a/src/urlbar/completionwidget.h +++ b/src/urlbar/completionwidget.h @@ -64,7 +64,7 @@ public: void suggestUrls(const QString &text); private slots: - void itemChosen(ListItem *item, Qt::MouseButton = Qt::LeftButton); + void itemChosen(ListItem *item, Qt::MouseButton = Qt::LeftButton, Qt::KeyboardModifiers = Qt::NoModifier); signals: void chosenUrl(const KUrl &, Rekonq::OpenType); diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp index 5254c7dc..3114c16a 100644 --- a/src/urlbar/listitem.cpp +++ b/src/urlbar/listitem.cpp @@ -129,7 +129,7 @@ void ListItem::leaveEvent(QEvent *e) void ListItem::mousePressEvent(QMouseEvent *e) { - emit itemClicked(this, e->button()); + emit itemClicked(this, e->button(), e->modifiers()); QWidget::mousePressEvent(e); } diff --git a/src/urlbar/listitem.h b/src/urlbar/listitem.h index c26a1893..dcb4f76d 100644 --- a/src/urlbar/listitem.h +++ b/src/urlbar/listitem.h @@ -66,7 +66,7 @@ public slots: virtual void nextItemSubChoice(); signals: - void itemClicked(ListItem *item, Qt::MouseButton); + void itemClicked(ListItem *item, Qt::MouseButton, Qt::KeyboardModifiers); protected: virtual void paintEvent(QPaintEvent *event); diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp index 07b40bac..7333e305 100644 --- a/src/urlbar/urlresolver.cpp +++ b/src/urlbar/urlresolver.cpp @@ -74,7 +74,7 @@ UrlResolver::UrlResolver(const QString &typedUrl) { kDebug() << "browse regexp empty. Setting value.."; - QString protocol = "^(http://|https://|file://|ftp://)"; + QString protocol = "^(http://|https://|file://|ftp://|man:|info:)"; QString local = "^/"; @@ -91,7 +91,7 @@ UrlResolver::UrlResolver(const QString &typedUrl) "y[etu]|z[amw]|aero|arpa|biz|com|coop|edu|info|int|gov|mil|museum|name|net|org|"\ "pro)"; - _browseRegexp = QRegExp("(" + protocol + ")|(" + local + ")|(" + address + ")|(" + ipv6 + ")|(" + ipv4 +")"); + _browseRegexp = QRegExp('(' + protocol + ")|(" + local + ")|(" + address + ")|(" + ipv6 + ")|(" + ipv4 +')'); } } diff --git a/src/webpage.cpp b/src/webpage.cpp index 00745445..4a8c8b6b 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -113,6 +113,9 @@ static bool downloadResource (const KUrl& srcUrl, const KIO::MetaData& metaData do { destUrl = KFileDialog::getSaveFileName(fileName, QString(), parent); + + if(destUrl.isEmpty()) + return false; if (destUrl.isLocalFile()) { @@ -615,14 +618,14 @@ void WebPage::downloadAllContentsWithKGet(QPoint) KUrl relativeUrl; QWebElementCollection images = mainFrame()->documentElement().findAll("img"); - foreach(QWebElement img, images) + foreach(const QWebElement &img, images) { relativeUrl.setEncodedUrl(img.attribute("src").toUtf8(), KUrl::TolerantMode); contents << baseUrl.resolved(relativeUrl).toString(); } QWebElementCollection links = mainFrame()->documentElement().findAll("a"); - foreach(QWebElement link, links) + foreach(const QWebElement &link, links) { relativeUrl.setEncodedUrl(link.attribute("href").toUtf8(), KUrl::TolerantMode); contents << baseUrl.resolved(relativeUrl).toString(); diff --git a/src/webtab.cpp b/src/webtab.cpp index a6bedc97..47780a44 100644 --- a/src/webtab.cpp +++ b/src/webtab.cpp @@ -183,7 +183,7 @@ void WebTab::showRSSInfo(QPoint pos) QMap<KUrl, QString> map; - foreach(QWebElement el, col) + foreach(const QWebElement &el, col) { QString urlString; if (el.attribute("href").startsWith(QL1S("http"))) diff --git a/src/webview.cpp b/src/webview.cpp index 878a7403..061dd256 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -316,7 +316,7 @@ void WebView::mousePressEvent(QMouseEvent *event) } QWebHitTestResult result = page()->mainFrame()->hitTestContent(event->pos()); - _canEnableAutoScroll = !ReKonfig::disableAutoScroll() && !result.isContentEditable() && result.linkUrl().isEmpty(); + _canEnableAutoScroll = ReKonfig::autoScroll() && !result.isContentEditable() && result.linkUrl().isEmpty(); switch (event->button()) { @@ -496,6 +496,23 @@ void WebView::keyPressEvent(QKeyEvent *event) KWebView::keyPressEvent(event); } +void WebView::wheelEvent(QWheelEvent *event) +{ + // Sync with the zoom slider + if (event->modifiers() == Qt::ControlModifier) + { + emit zoomChanged(zoomFactor()); + } + + KWebView::wheelEvent(event); + + // Limits of the slider + if (zoomFactor() > 1.9) + setZoomFactor(1.9); + else if (zoomFactor() < 0.1) + setZoomFactor(0.1); +} + void WebView::inspect() { diff --git a/src/webview.h b/src/webview.h index bac12e99..a4ba676c 100644 --- a/src/webview.h +++ b/src/webview.h @@ -56,6 +56,7 @@ protected: void mousePressEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); void keyPressEvent(QKeyEvent *event); + void wheelEvent(QWheelEvent *event); private slots: void search(); @@ -73,6 +74,7 @@ private slots: signals: void loadUrl(const KUrl &, const Rekonq::OpenType &); + void zoomChanged(qreal); private: QPoint _mousePos; |