From 62e0a9d46eb4cbabe9fad31903a63d31df9e8432 Mon Sep 17 00:00:00 2001 From: Dario Freddi Date: Tue, 13 Oct 2009 00:40:44 +0200 Subject: Remove rekonq's custom proxy implementation to use KDE's proxy settings through KProtocolManager. This makes rekonq much more integrated withing KDE, as the user expects that changes in System Settings would take place everywhere. And it also leaves less code to maintain Signed-off-by: Dario Freddi --- src/CMakeLists.txt | 1 - src/networkaccessmanager.cpp | 39 +++++++----- src/rekonq.kcfg | 19 ------ src/settings.cpp | 15 +---- src/settings_proxy.ui | 145 ------------------------------------------- 5 files changed, 25 insertions(+), 194 deletions(-) delete mode 100644 src/settings_proxy.ui (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 11fc5c6b..8b7e6f78 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -34,7 +34,6 @@ KDE4_ADD_UI_FILES( rekonq_SRCS proxy.ui settings_general.ui settings_fonts.ui - settings_proxy.ui settings_webkit.ui cleardata.ui ) diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp index fd975062..1cdc6700 100644 --- a/src/networkaccessmanager.cpp +++ b/src/networkaccessmanager.cpp @@ -42,6 +42,7 @@ // KDE Includes #include #include +#include // Qt Includes #include @@ -69,7 +70,7 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent) // load AccessManager Settings loadSettings(); - + // resetting disk cache resetDiskCache(); } @@ -77,23 +78,31 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent) void NetworkAccessManager::loadSettings() { - if (ReKonfig::isProxyEnabled()) + // Grab proxy settings from KDE settings + if (KProtocolManager::useProxy()) { - QNetworkProxy proxy; - if (ReKonfig::proxyType() == 0) - { - proxy.setType(QNetworkProxy::Socks5Proxy); - } - else + QString proxyAddress = KProtocolManager::proxyFor("http"); + + if(!proxyAddress.isEmpty()) { - proxy.setType(QNetworkProxy::HttpProxy); + KUrl proxyUrl(proxyAddress); + QNetworkProxy::ProxyType proxyType = QNetworkProxy::NoProxy; + + // See what kind of proxy we have here + if(proxyUrl.protocol() == "socks") + { + proxyType = QNetworkProxy::Socks5Proxy; + } + else + { + proxyType = QNetworkProxy::HttpProxy; + } + + QNetworkProxy proxy(proxyType, proxyUrl.host(), (quint16)proxyUrl.port(), + proxyUrl.user(), proxyUrl.pass()); + + setProxy(proxy); } - proxy.setHostName(ReKonfig::proxyHostName()); - proxy.setPort(ReKonfig::proxyPort()); - proxy.setUser(ReKonfig::proxyUserName()); - proxy.setPassword(ReKonfig::proxyPassword()); - - setProxy(proxy); } } diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index 0a63922f..9e854f76 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -75,25 +75,6 @@ - - - - false - - - 0 - - - - - 8080 - - - - - - - diff --git a/src/settings.cpp b/src/settings.cpp index ec5094c2..7b320448 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -42,7 +42,6 @@ //Ui Includes #include "ui_settings_general.h" #include "ui_settings_fonts.h" -#include "ui_settings_proxy.h" #include "ui_settings_webkit.h" // KDE Includes @@ -63,7 +62,6 @@ class Private private: Ui::general generalUi; Ui::fonts fontsUi; - Ui::proxy proxyUi; Ui::webkit webkitUi; KCModuleProxy *ebrowsingModule; KCModuleProxy *cookiesModule; @@ -84,7 +82,7 @@ Private::Private(SettingsDialog *parent) widget->layout()->setMargin(0); pageItem = parent->addPage(widget , i18n("General")); pageItem->setIcon(KIcon("rekonq")); - + widget = new QWidget; fontsUi.setupUi(widget); widget->layout()->setMargin(0); @@ -96,12 +94,6 @@ Private::Private(SettingsDialog *parent) pageItem = parent->addPage(cookiesModule, i18n(cookiesInfo.moduleName().toLocal8Bit())); pageItem->setIcon(KIcon(cookiesInfo.icon())); - widget = new QWidget; - proxyUi.setupUi(widget); - widget->layout()->setMargin(0); - pageItem = parent->addPage(widget , i18n("Proxy")); - pageItem->setIcon(KIcon("preferences-system-network")); - widget = new QWidget; webkitUi.setupUi(widget); widget->layout()->setMargin(0); @@ -185,11 +177,6 @@ void SettingsDialog::readConfig() // ======= Fonts d->fontsUi.kcfg_fixedFont->setOnlyFixed(true); - - // ======= Proxy - bool proxyEnabled = ReKonfig::isProxyEnabled(); - d->proxyUi.groupBox->setEnabled(proxyEnabled); - connect(d->proxyUi.kcfg_isProxyEnabled, SIGNAL(clicked(bool)), d->proxyUi.groupBox, SLOT(setEnabled(bool))); } diff --git a/src/settings_proxy.ui b/src/settings_proxy.ui deleted file mode 100644 index 938529b0..00000000 --- a/src/settings_proxy.ui +++ /dev/null @@ -1,145 +0,0 @@ - - proxy - - - - 0 - 0 - 440 - 223 - - - - Proxy - - - - - - Enable proxy - - - - - - - Proxy Settings - - - - - - Type: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - SOCKS 5 - - - - - HTTP - - - - - - - - Host: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - Port: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 10000 - - - 1080 - - - - - - - Qt::Horizontal - - - - 293 - 20 - - - - - - - - Username: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - Password: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - Qt::Vertical - - - - 20 - 8 - - - - - - - - - - - - -- cgit v1.2.1 From aa1193e1190ef8775ce13573f8ff57b8f876bdff Mon Sep 17 00:00:00 2001 From: Dario Freddi Date: Tue, 13 Oct 2009 00:50:53 +0200 Subject: Small fixes (const issue, single char issue, file not ending with a new line), and adding the correct schema to kconfigxt files Signed-off-by: Dario Freddi --- src/homepage.cpp | 2 +- src/mainwindow.cpp | 2 +- src/rekonq.kcfg | 5 ++++- src/webview.cpp | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/homepage.cpp b/src/homepage.cpp index 398308be..e8608241 100644 --- a/src/homepage.cpp +++ b/src/homepage.cpp @@ -223,7 +223,7 @@ QString HomePage::fillHistory() { QModelIndex son = model->index(j, 0, index ); history += son.data(HistoryModel::DateTimeRole).toDateTime().toString("hh:mm"); - history += " "; + history += ' '; history += QString("") + son.data().toString() + QString(""); history += "
"; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7601e80e..1b527d1a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1020,7 +1020,7 @@ void MainWindow::clearPrivateData() kDebug() << path; QDir cacheDir(path); QStringList fileList = cacheDir.entryList(); - foreach(QString str, fileList) + foreach(const QString &str, fileList) { kDebug() << str; QFile file(path + str); diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index 9e854f76..c55fce9c 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -1,6 +1,9 @@ - + QtWebKit diff --git a/src/webview.cpp b/src/webview.cpp index a2662399..9e06c9da 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -432,4 +432,4 @@ void WebView::keyPressEvent(QKeyEvent *event) return; } QWebView::keyPressEvent(event); -} \ No newline at end of file +} -- cgit v1.2.1