diff options
-rw-r--r-- | src/application.cpp | 235 | ||||
-rw-r--r-- | src/rekonq.kcfg | 6 | ||||
-rw-r--r-- | src/settings/settings_general.ui | 2 | ||||
-rw-r--r-- | src/settings/settings_tabs.ui | 28 | ||||
-rw-r--r-- | src/settings/settingsdialog.cpp | 14 | ||||
-rw-r--r-- | src/webtab/webview.cpp | 6 | ||||
-rw-r--r-- | src/webwindow/webwindow.cpp | 21 | ||||
-rw-r--r-- | src/webwindow/webwindow.h | 3 |
8 files changed, 143 insertions, 172 deletions
diff --git a/src/application.cpp b/src/application.cpp index 161ef5c6..4f1b623b 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -36,6 +36,7 @@ // Local Includes #include "searchengine.h" +#include "tabbar.h" #include "tabwindow.h" #include "webwindow.h" #include "urlresolver.h" @@ -384,132 +385,128 @@ bool Application::eventFilter(QObject* watched, QEvent* event) void Application::updateConfiguration() { - kDebug() << "Updating... NOTHING!!!"; -// // ============== Tabs ================== -// bool b = ReKonfig::closeTabSelectPrevious(); -// Q_FOREACH(const QWeakPointer<TabWindow> &w, m_tabWindows) -// { -// MainView *mv = w.data()->mainView(); -// mv->updateTabBar(); -// -// mv->tabBar()->setAnimatedTabHighlighting(ReKonfig::animatedTabHighlighting()); -// -// if (b) -// mv->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab); -// else -// mv->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectRightTab); -// } -// -// QWebSettings *defaultSettings = QWebSettings::globalSettings(); -// -// // =========== 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 -// if (tabWindow() && tabWindow()->currentTab()) -// { -// int logDpiY = tabWindow()->currentTab()->view()->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)); -// } -// -// // encodings -// QString enc = ReKonfig::defaultEncoding(); -// defaultSettings->setDefaultTextEncoding(enc); -// -// // ================ WebKit ============================ -// defaultSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, ReKonfig::dnsPrefetch()); -// defaultSettings->setAttribute(QWebSettings::PrintElementBackgrounds, ReKonfig::printElementBackgrounds()); -// -// defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, ReKonfig::javascriptEnabled()); -// defaultSettings->setAttribute(QWebSettings::JavascriptCanOpenWindows, ReKonfig::javascriptCanOpenWindows()); -// defaultSettings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, ReKonfig::javascriptCanAccessClipboard()); -// -// defaultSettings->setAttribute(QWebSettings::JavaEnabled, ReKonfig::javaEnabled()); -// -// if (ReKonfig::pluginsEnabled() == 2) -// defaultSettings->setAttribute(QWebSettings::PluginsEnabled, false); -// else -// defaultSettings->setAttribute(QWebSettings::PluginsEnabled, true); -// -// // Enabling WebKit "Page Cache" feature: http://webkit.org/blog/427/webkit-page-cache-i-the-basics/ -// defaultSettings->setMaximumPagesInCache(3); -// -// // ===== 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); -// } -// -// // ================= WebGl =================== -// defaultSettings->setAttribute(QWebSettings::WebGLEnabled, ReKonfig::webGL()); -// defaultSettings->setAttribute(QWebSettings::AcceleratedCompositingEnabled, ReKonfig::webGL()); -// -// // Applies user defined CSS to all open webpages. -// defaultSettings->setUserStyleSheetUrl(ReKonfig::userCSS()); -// + // ============== Tabs ================== + bool b = ReKonfig::closeTabSelectPrevious(); + Q_FOREACH(const QWeakPointer<TabWindow> &w, m_tabWindows) + { + if (b) + w.data()->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab); + else + w.data()->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectRightTab); + } + + + QWebSettings *defaultSettings = QWebSettings::globalSettings(); + + // =========== 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 + if (tabWindow() && tabWindow()->currentWebWindow()) + { + int logDpiY = tabWindow()->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)); + } + + // encodings + QString enc = ReKonfig::defaultEncoding(); + defaultSettings->setDefaultTextEncoding(enc); + + // ================ WebKit ============================ + defaultSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, ReKonfig::dnsPrefetch()); + defaultSettings->setAttribute(QWebSettings::PrintElementBackgrounds, ReKonfig::printElementBackgrounds()); + + defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, ReKonfig::javascriptEnabled()); + defaultSettings->setAttribute(QWebSettings::JavascriptCanOpenWindows, ReKonfig::javascriptCanOpenWindows()); + defaultSettings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, ReKonfig::javascriptCanAccessClipboard()); + + defaultSettings->setAttribute(QWebSettings::JavaEnabled, ReKonfig::javaEnabled()); + + if (ReKonfig::pluginsEnabled() == 2) + defaultSettings->setAttribute(QWebSettings::PluginsEnabled, false); + else + defaultSettings->setAttribute(QWebSettings::PluginsEnabled, true); + + // Enabling WebKit "Page Cache" feature: http://webkit.org/blog/427/webkit-page-cache-i-the-basics/ + defaultSettings->setMaximumPagesInCache(3); + + // ===== 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); + } + + // ================= WebGl =================== + defaultSettings->setAttribute(QWebSettings::WebGLEnabled, ReKonfig::webGL()); + defaultSettings->setAttribute(QWebSettings::AcceleratedCompositingEnabled, ReKonfig::webGL()); + + // Applies user defined CSS to all open webpages. + defaultSettings->setUserStyleSheetUrl(ReKonfig::userCSS()); + // ====== load Settings on main classes HistoryManager::self()->loadSettings(); -// -// defaultSettings = 0; -// -// if (!tabWindow()) -// return; -// + + defaultSettings = 0; + + if (!tabWindow()) + return; + + // FIXME What about this? // ReKonfig::useFavicon() // ? tabWindow()->changeWindowIcon(tabWindow()->mainView()->currentIndex()) // : tabWindow()->setWindowIcon(KIcon("rekonq")) // ; // -// // hovering unfocused tabs options -// switch (ReKonfig::hoveringTabOption()) -// { -// case 0: // tab previews -// case 3: // nothing -// for (int i = 0; i < tabWindow()->mainView()->tabBar()->count(); i++) -// { -// tabWindow()->mainView()->tabBar()->setTabToolTip(i, QL1S("")); -// } -// break; -// -// case 1: // title previews -// for (int i = 0; i < tabWindow()->mainView()->tabBar()->count(); i++) -// { -// tabWindow()->mainView()->tabBar()->setTabToolTip(i, tabWindow()->mainView()->tabText(i).remove('&')); -// } -// break; -// -// case 2: // url previews -// for (int i = 0; i < tabWindow()->mainView()->tabBar()->count(); i++) -// { -// tabWindow()->mainView()->tabBar()->setTabToolTip(i, tabWindow()->mainView()->webTab(i)->url().toMimeDataString()); -// } -// break; -// -// default: // non extant case -// ASSERT_NOT_REACHED(unknown hoveringTabOption); -// break; -// } + // hovering unfocused tabs options + switch (ReKonfig::hoveringTabOption()) + { + case 0: // tab previews + case 3: // nothing + for (int i = 0; i < tabWindow()->tabBar()->count(); i++) + { + tabWindow()->tabBar()->setTabToolTip(i, QL1S("")); + } + break; + + case 1: // title previews + for (int i = 0; i < tabWindow()->tabBar()->count(); i++) + { + tabWindow()->tabBar()->setTabToolTip(i, tabWindow()->tabText(i).remove('&')); + } + break; + + case 2: // url previews + for (int i = 0; i < tabWindow()->tabBar()->count(); i++) + { + tabWindow()->tabBar()->setTabToolTip(i, tabWindow()->webWindow(i)->url().toMimeDataString()); + } + break; + + default: // non extant case + ASSERT_NOT_REACHED(unknown hoveringTabOption); + break; + } } diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index 7def60c2..29bef9f1 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -120,12 +120,6 @@ <entry name="lastTabClosesWindow" type="Bool"> <default>false</default> </entry> - <entry name="openNewTabsInBackground" type="Bool"> - <default>true</default> - </entry> - <entry name="openNewTabsNearCurrent" type="Bool"> - <default>false</default> - </entry> <entry name="closeTabSelectPrevious" type="Bool"> <default>false</default> </entry> diff --git a/src/settings/settings_general.ui b/src/settings/settings_general.ui index 7d4419b8..3764df8b 100644 --- a/src/settings/settings_general.ui +++ b/src/settings/settings_general.ui @@ -151,7 +151,7 @@ <item> <widget class="QGroupBox" name="groupBox_4"> <property name="title"> - <string>Download Manager</string> + <string>Downloads Management</string> </property> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> diff --git a/src/settings/settings_tabs.ui b/src/settings/settings_tabs.ui index 4e19545f..ab43097c 100644 --- a/src/settings/settings_tabs.ui +++ b/src/settings/settings_tabs.ui @@ -202,13 +202,6 @@ </spacer> </item> <item> - <widget class="QCheckBox" name="kcfg_alwaysShowTabBar"> - <property name="text"> - <string>Always show tab bar</string> - </property> - </widget> - </item> - <item> <widget class="QCheckBox" name="kcfg_openLinksInNewWindow"> <property name="text"> <string>Don't use tabs: open links in new windows</string> @@ -230,20 +223,6 @@ </widget> </item> <item> - <widget class="QCheckBox" name="kcfg_openNewTabsInBackground"> - <property name="text"> - <string>Open new tabs in the background</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="kcfg_openNewTabsNearCurrent"> - <property name="text"> - <string>Open new tabs after currently active one</string> - </property> - </widget> - </item> - <item> <widget class="QCheckBox" name="kcfg_closeTabSelectPrevious"> <property name="text"> <string>Activate previously used tab when closing the current one</string> @@ -253,13 +232,6 @@ </property> </widget> </item> - <item> - <widget class="QCheckBox" name="kcfg_animatedTabHighlighting"> - <property name="text"> - <string>Animated tab highlighting</string> - </property> - </widget> - </item> </layout> </widget> </item> diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp index 9f6b372a..99922e54 100644 --- a/src/settings/settingsdialog.cpp +++ b/src/settings/settingsdialog.cpp @@ -47,7 +47,6 @@ #include <KConfig> #include <KStandardDirs> #include <KPageWidgetItem> -#include <KShortcutsEditor> #include <KCModuleInfo> #include <KCModuleProxy> @@ -70,8 +69,6 @@ private: KCModuleProxy *ebrowsingModule; - KShortcutsEditor *shortcutsEditor; - friend class SettingsDialog; }; @@ -118,12 +115,7 @@ Private::Private(SettingsDialog *parent) pageItem = parent->addPage(advancedWidg, i18n("Advanced")); pageItem->setIcon(KIcon("applications-system")); -// // -- 7 -// shortcutsEditor = new KShortcutsEditor(rApp->mainWindow()->actionCollection(), parent); -// pageItem = parent->addPage(shortcutsEditor , i18n("Shortcuts")); -// pageItem->setIcon(KIcon("configure-shortcuts")); - - // -- 8 + // -- 7 KCModuleInfo ebrowsingInfo("ebrowsing.desktop"); ebrowsingModule = new KCModuleProxy(ebrowsingInfo, parent); pageItem = parent->addPage(ebrowsingModule, i18n("Search Engines")); @@ -160,8 +152,6 @@ SettingsDialog::SettingsDialog(QWidget *parent) connect(d->advancedWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); connect(d->privacyWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons())); - connect(d->shortcutsEditor, SIGNAL(keyChange()), this, SLOT(updateButtons())); - // save settings connect(this, SIGNAL(applyClicked()), this, SLOT(saveSettings())); connect(this, SIGNAL(okClicked()), this, SLOT(saveSettings())); @@ -187,7 +177,6 @@ void SettingsDialog::saveSettings() d->webkitWidg->save(); d->advancedWidg->save(); d->privacyWidg->save(); - d->shortcutsEditor->save(); d->ebrowsingModule->save(); d->privacyWidg->reload(); @@ -209,7 +198,6 @@ bool SettingsDialog::hasChanged() || d->advancedWidg->changed() || d->privacyWidg->changed() || d->ebrowsingModule->changed() - || d->shortcutsEditor->isModified(); ; } diff --git a/src/webtab/webview.cpp b/src/webtab/webview.cpp index 43f62866..06412198 100644 --- a/src/webtab/webview.cpp +++ b/src/webtab/webview.cpp @@ -1226,12 +1226,10 @@ void WebView::mouseReleaseEvent(QMouseEvent *event) { if (event->button() & Qt::MidButton) { + // open tab as focused if (event->modifiers() & Qt::ShiftModifier) { - if (ReKonfig::openNewTabsInBackground()) - emit loadUrl(url, Rekonq::NewFocusedTab); - else - emit loadUrl(url, Rekonq::NewBackGroundTab); + emit loadUrl(url, Rekonq::NewFocusedTab); event->accept(); return; } diff --git a/src/webwindow/webwindow.cpp b/src/webwindow/webwindow.cpp index 2dc476c1..4d350d71 100644 --- a/src/webwindow/webwindow.cpp +++ b/src/webwindow/webwindow.cpp @@ -41,6 +41,7 @@ #include "bookmarkstoolbar.h" #include "rekonqfactory.h" #include "rekonqmenu.h" +#include "settingsdialog.h" #include "urlbar.h" #include "websnap.h" @@ -304,7 +305,7 @@ void WebWindow::setupActions() // <Action name="help_about_kde"/> // </Menu> // -// <Action name="options_configure" /> +// <Action name="options_configure" /> + // </Menu> } @@ -788,3 +789,21 @@ void WebWindow::setEditable(bool on) { page()->setContentEditable(on); } + + +void WebWindow::preferences() +{ + // an instance the dialog could be already created and could be cached, + // in which case you want to display the cached dialog + if (SettingsDialog::showDialog("rekonfig")) + return; + + // we didn't find an instance of this dialog, so lets create it + QPointer<SettingsDialog> s = new SettingsDialog(this); + + // keep us informed when the user changes settings + connect(s, SIGNAL(settingsChanged(QString)), rApp, SLOT(updateConfiguration())); + connect(s, SIGNAL(finished(int)), s, SLOT(deleteLater())); + + s->show(); +} diff --git a/src/webwindow/webwindow.h b/src/webwindow/webwindow.h index ef8a502b..8d9afefc 100644 --- a/src/webwindow/webwindow.h +++ b/src/webwindow/webwindow.h @@ -115,6 +115,9 @@ private Q_SLOTS: void populateUserAgentMenu(); void setEditable(bool); + // Settings Menu slot + void preferences(); + Q_SIGNALS: void titleChanged(QString); |