summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-10-14 21:25:34 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-10-14 21:25:34 +0200
commit235473cac883a5f1192ca83f0f2102d69a7ca229 (patch)
tree646457062338c2ba71c748bd3ff2aaa5fbb22447
parentrekonq 0.2.66 (diff)
downloadrekonq-235473cac883a5f1192ca83f0f2102d69a7ca229.tar.xz
we are using KDE proxy settings (via KIO)
So we no more need our dialogs and error retrieving :)
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/mainwindow.cpp1
-rw-r--r--src/networkaccessmanager.cpp135
-rw-r--r--src/networkaccessmanager.h11
-rw-r--r--src/password.ui66
-rw-r--r--src/proxy.ui59
6 files changed, 0 insertions, 274 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8b7e6f78..daae3f44 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -30,8 +30,6 @@ SET( rekonq_SRCS
KDE4_ADD_UI_FILES( rekonq_SRCS
- password.ui
- proxy.ui
settings_general.ui
settings_fonts.ui
settings_webkit.ui
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index c0008cba..69831f97 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -494,7 +494,6 @@ void MainWindow::slotUpdateConfiguration()
defaultSettings->setUserStyleSheetUrl(ReKonfig::userCSS());
// ====== load Settings on main classes
- Application::networkAccessManager()->loadSettings();
Application::historyManager()->loadSettings();
}
diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp
index 1cdc6700..38f4c8c4 100644
--- a/src/networkaccessmanager.cpp
+++ b/src/networkaccessmanager.cpp
@@ -35,78 +35,21 @@
// Auto Includes
#include "rekonq.h"
-// Ui Includes
-#include "ui_password.h"
-#include "ui_proxy.h"
-
// KDE Includes
-#include <KMessageBox>
#include <KStandardDirs>
-#include <KProtocolManager>
// Qt Includes
-#include <QtCore/QPointer>
-#include <QtCore/QIODevice>
-
-#include <QtGui/QStyle>
-#include <QtGui/QTextDocument>
-
-#include <QtNetwork/QAuthenticator>
#include <QtNetwork/QNetworkDiskCache>
NetworkAccessManager::NetworkAccessManager(QObject *parent)
: AccessManager(parent)
{
- connect(this, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)),
- SLOT(authenticationRequired(QNetworkReply*, QAuthenticator*)));
- connect(this, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)),
- SLOT(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)));
-
-#ifndef QT_NO_OPENSSL
- connect(this, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)),
- SLOT(slotSSLErrors(QNetworkReply*, const QList<QSslError>&)));
-#endif
-
- // load AccessManager Settings
- loadSettings();
-
// resetting disk cache
resetDiskCache();
}
-void NetworkAccessManager::loadSettings()
-{
- // Grab proxy settings from KDE settings
- if (KProtocolManager::useProxy())
- {
- QString proxyAddress = KProtocolManager::proxyFor("http");
-
- if(!proxyAddress.isEmpty())
- {
- 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);
- }
- }
-}
-
-
void NetworkAccessManager::resetDiskCache()
{
if(!cache())
@@ -119,81 +62,3 @@ void NetworkAccessManager::resetDiskCache()
cache()->clear();
}
}
-
-
-void NetworkAccessManager::authenticationRequired(QNetworkReply *reply, QAuthenticator *auth)
-{
- MainWindow *mainWindow = Application::instance()->mainWindow();
-
- QPointer<KDialog> dialog = new KDialog(mainWindow, Qt::Sheet);
- dialog->setButtons(KDialog::Ok | KDialog::Cancel);
-
- Ui::passwordWidget passwordWidget;
- QWidget widget;
- passwordWidget.setupUi(&widget);
-
- dialog->setMainWidget(&widget);
-
- passwordWidget.iconLabel->setText(QString());
- passwordWidget.iconLabel->setPixmap(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mainWindow).pixmap(32, 32));
- //FIXME Replace the text below with an explanation of what exactly %1 and %2 mean
- QString introMessage = i18nc("%1=stuff %2=stuff2", "<qt>Enter username and password for %1 at %2</qt>",
- Qt::escape(reply->url().toString()),
- Qt::escape(reply->url().toString()) );
- passwordWidget.introLabel->setText(introMessage);
- passwordWidget.introLabel->setWordWrap(true);
-
- if (dialog->exec() == KDialog::Ok)
- {
- auth->setUser(passwordWidget.userNameLineEdit->text());
- auth->setPassword(passwordWidget.passwordLineEdit->text());
- }
- dialog->deleteLater();
-}
-
-
-void NetworkAccessManager::proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth)
-{
- MainWindow *mainWindow = Application::instance()->mainWindow();
-
- QPointer<KDialog> dialog = new KDialog(mainWindow, Qt::Sheet);
- dialog->setButtons(KDialog::Ok | KDialog::Cancel);
-
- Ui::proxyWidget proxyWdg;
- QWidget widget;
- proxyWdg.setupUi(&widget);
-
- dialog->setMainWidget(&widget);
-
- proxyWdg.iconLabel->setText(QString());
- proxyWdg.iconLabel->setPixmap(mainWindow->style()->standardIcon(QStyle::SP_MessageBoxQuestion, 0, mainWindow).pixmap(32, 32));
- //FIXME Connect to proxy %1 using what? Best solution would be adding a %2 after the "using:" part and explain %1 and %2 in an i18nc call
- QString introMessage = i18n("<qt>Connect to proxy %1 using:</qt>", Qt::escape(proxy.hostName()) );
- proxyWdg.introLabel->setText(introMessage);
- proxyWdg.introLabel->setWordWrap(true);
-
- if (dialog->exec() == KDialog::Ok)
- {
- auth->setUser(proxyWdg.userNameLineEdit->text());
- auth->setPassword(proxyWdg.passwordLineEdit->text());
- }
- dialog->deleteLater();
-}
-
-
-#ifndef QT_NO_OPENSSL
-void NetworkAccessManager::slotSSLErrors(QNetworkReply *reply, const QList<QSslError> &error)
-{
- MainWindow *mainWindow = Application::instance()->mainWindow();
-
- QStringList errorStrings;
- for (int i = 0; i < error.count(); ++i)
- errorStrings += error.at(i).errorString();
- QString errors = errorStrings.join(QLatin1String("\n"));
- int ret = KMessageBox::warningContinueCancel(mainWindow,
- i18n("SSL Errors:\n\n") + reply->url().toString() + "\n\n" + QString(errors) + "\n\n");
-
- if (ret == KMessageBox::Yes)
- reply->ignoreSslErrors();
-}
-#endif
diff --git a/src/networkaccessmanager.h b/src/networkaccessmanager.h
index cfe98806..6cade7fe 100644
--- a/src/networkaccessmanager.h
+++ b/src/networkaccessmanager.h
@@ -42,17 +42,6 @@ class NetworkAccessManager : public AccessManager
public:
NetworkAccessManager(QObject *parent = 0);
void resetDiskCache();
-
-public slots:
- void loadSettings();
-
-private slots:
- void authenticationRequired(QNetworkReply *reply, QAuthenticator *auth);
- void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *auth);
-
-#ifndef QT_NO_OPENSSL
- void slotSSLErrors(QNetworkReply *reply, const QList<QSslError> &error);
-#endif
};
#endif // NETWORKACCESSMANAGER_H
diff --git a/src/password.ui b/src/password.ui
deleted file mode 100644
index 81d1e321..00000000
--- a/src/password.ui
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>passwordWidget</class>
- <widget class="QWidget" name="passwordWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>343</width>
- <height>193</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" colspan="2">
- <layout class="QHBoxLayout">
- <item>
- <widget class="QLabel" name="iconLabel">
- <property name="text">
- <string comment="KDE::DoNotExtract">DUMMY ICON</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="introLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string comment="KDE::DoNotExtract">INTRO TEXT DUMMY</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Username:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="KLineEdit" name="userNameLineEdit"/>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="lblPassword">
- <property name="text">
- <string>Password:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="KLineEdit" name="passwordLineEdit">
- <property name="echoMode">
- <enum>QLineEdit::Password</enum>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/proxy.ui b/src/proxy.ui
deleted file mode 100644
index 4e64f357..00000000
--- a/src/proxy.ui
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>proxyWidget</class>
- <widget class="QWidget" name="proxyWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>264</width>
- <height>153</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="iconLabel">
- <property name="text">
- <string comment="KDE::DoNotExtract">ICON</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1" colspan="2">
- <widget class="QLabel" name="introLabel">
- <property name="text">
- <string>Connect to proxy</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="2">
- <widget class="QLabel" name="usernameLabel">
- <property name="text">
- <string>Username:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="KLineEdit" name="userNameLineEdit"/>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="QLabel" name="passwordLabel">
- <property name="text">
- <string>Password:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="KLineEdit" name="passwordLineEdit">
- <property name="echoMode">
- <enum>QLineEdit::Password</enum>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>