summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Freddi <drf@kde.org>2009-10-13 00:40:44 +0200
committerDario Freddi <drf@kde.org>2009-10-13 00:40:44 +0200
commit62e0a9d46eb4cbabe9fad31903a63d31df9e8432 (patch)
treea8b11e766849562592f46017071335d9c82876d4
parentMerge commit 'refs/merge-requests/1757' of git://gitorious.org/rekonq/mainline (diff)
downloadrekonq-62e0a9d46eb4cbabe9fad31903a63d31df9e8432.tar.xz
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 <drf@kde.org>
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/networkaccessmanager.cpp39
-rw-r--r--src/rekonq.kcfg19
-rw-r--r--src/settings.cpp15
-rw-r--r--src/settings_proxy.ui145
5 files changed, 25 insertions, 194 deletions
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 <KMessageBox>
#include <KStandardDirs>
+#include <KProtocolManager>
// Qt Includes
#include <QtCore/QPointer>
@@ -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 @@
</entry>
</group>
-<!-- Proxy Settings -->
- <group name="Proxy">
- <entry name="isProxyEnabled" type="Bool">
- <default>false</default>
- </entry>
- <entry name="proxyType" type="Int">
- <default>0</default>
- </entry>
- <entry name="proxyHostName" type="String">
- </entry>
- <entry name="proxyPort" type="Int">
- <default>8080</default>
- </entry>
- <entry name="proxyUserName" type="String">
- </entry>
- <entry name="proxyPassword" type="Password">
- </entry>
- </group>
-
<!-- WebKit Settings -->
<group name="Webkit">
<entry name="autoLoadImages" type="Bool">
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);
@@ -97,12 +95,6 @@ Private::Private(SettingsDialog *parent)
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);
pageItem = parent->addPage(widget , i18n("WebKit"));
@@ -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 @@
-<ui version="4.0" >
- <class>proxy</class>
- <widget class="QWidget" name="proxy" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>440</width>
- <height>223</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Proxy</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout" >
- <item>
- <widget class="QCheckBox" name="kcfg_isProxyEnabled" >
- <property name="text" >
- <string>Enable proxy</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox" >
- <property name="title" >
- <string>Proxy Settings</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_6" >
- <item row="1" column="0" >
- <widget class="QLabel" name="label_9" >
- <property name="text" >
- <string>Type:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="1" colspan="2" >
- <widget class="KComboBox" name="kcfg_proxyType" >
- <item>
- <property name="text" >
- <string>SOCKS 5</string>
- </property>
- </item>
- <item>
- <property name="text" >
- <string>HTTP</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="label_10" >
- <property name="text" >
- <string>Host:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="2" column="1" colspan="2" >
- <widget class="KLineEdit" name="kcfg_proxyHostName" />
- </item>
- <item row="3" column="0" >
- <widget class="QLabel" name="label_11" >
- <property name="text" >
- <string>Port:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="3" column="1" >
- <widget class="QSpinBox" name="kcfg_proxyPort" >
- <property name="maximum" >
- <number>10000</number>
- </property>
- <property name="value" >
- <number>1080</number>
- </property>
- </widget>
- </item>
- <item row="3" column="2" >
- <spacer name="horizontalSpacer_2" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>293</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="4" column="0" >
- <widget class="QLabel" name="label_12" >
- <property name="text" >
- <string>Username:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="4" column="1" colspan="2" >
- <widget class="KLineEdit" name="kcfg_proxyUserName" />
- </item>
- <item row="5" column="0" >
- <widget class="QLabel" name="label_13" >
- <property name="text" >
- <string>Password:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="5" column="1" colspan="2" >
- <widget class="KLineEdit" name="kcfg_proxyPassword" />
- </item>
- <item row="6" column="0" >
- <spacer name="verticalSpacer_2" >
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>20</width>
- <height>8</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>