diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/download.cpp | 19 | ||||
-rw-r--r-- | src/download.h | 4 | ||||
-rw-r--r-- | src/networkaccessmanager.cpp | 2 | ||||
-rw-r--r-- | src/rekonq.kcfg | 2 | ||||
-rw-r--r-- | src/settings.cpp | 11 | ||||
-rw-r--r-- | src/settings_proxy.ui | 41 | ||||
-rw-r--r-- | src/webview.cpp | 10 |
7 files changed, 54 insertions, 35 deletions
diff --git a/src/download.cpp b/src/download.cpp index aedd0a63..d1ed296a 100644 --- a/src/download.cpp +++ b/src/download.cpp @@ -33,7 +33,7 @@ Download::Download(const KUrl &srcUrl, const KUrl &destUrl) : m_srcUrl(srcUrl), m_destUrl(destUrl) { - kDebug(5001) << "DownloadFile: " << m_srcUrl.url() << " to dest: " << m_destUrl.url(); + kWarning() << "DownloadFile: " << m_srcUrl.url() << " to dest: " << m_destUrl.url(); m_copyJob = KIO::get(m_srcUrl); connect(m_copyJob, SIGNAL(data(KIO::Job*,const QByteArray &)), SLOT(slotData(KIO::Job*, const QByteArray&))); connect(m_copyJob, SIGNAL(result(KJob *)), SLOT(slotResult(KJob *))); @@ -56,27 +56,26 @@ void Download::slotResult(KJob * job) { case 0://The download has finished { - kDebug(5001) << "Downloading successfully finished" << m_destUrl.url(); - QFile torrentFile(m_destUrl.path()); - if (!torrentFile.open(QIODevice::WriteOnly | QIODevice::Text)) {} - torrentFile.write(m_data); - torrentFile.close(); - emit finishedSuccessfully(m_destUrl, m_data); + kDebug(5001) << "Downloading successfully finished: " << m_destUrl.url(); + QFile destFile(m_destUrl.path()); + if ( destFile.open(QIODevice::WriteOnly | QIODevice::Text) ) + { + destFile.write(m_data); + destFile.close(); + } m_data = 0; break; } case KIO::ERR_FILE_ALREADY_EXIST: { kDebug(5001) << "ERROR - File already exists"; - QFile file(m_destUrl.path()); - emit finishedSuccessfully(m_destUrl, file.readAll()); + // QFile file(m_destUrl.path()); m_data = 0; break; } default: kDebug(5001) << "We are sorry to say you, that there were errors while downloading :("; m_data = 0; - emit finishedWithError(); break; } } diff --git a/src/download.h b/src/download.h index 7986341d..65f36d3b 100644 --- a/src/download.h +++ b/src/download.h @@ -37,10 +37,6 @@ class Download : public QObject Download(const KUrl &srcUrl, const KUrl &destUrl); ~Download(); - Q_SIGNALS: - void finishedSuccessfully(KUrl dest, QByteArray data); - void finishedWithError(); - private slots: void slotResult(KJob * job); void slotData(KIO::Job *job, const QByteArray& data); diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp index 1d601440..82947c3b 100644 --- a/src/networkaccessmanager.cpp +++ b/src/networkaccessmanager.cpp @@ -64,7 +64,7 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent) void NetworkAccessManager::loadSettings() { QNetworkProxy proxy; - if ( ReKonfig::enableProxy() ) + if ( ReKonfig::isProxyEnabled() ) { if ( ReKonfig::proxyType() == 0 ) { diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index c20134be..a1b6ca4c 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -50,7 +50,7 @@ <!-- Proxy Settings --> <group name="Proxy"> - <entry name="enableProxy" type="Bool"> + <entry name="isProxyEnabled" type="Bool"> <default>false</default> </entry> <entry name="proxyType" type="Int"> diff --git a/src/settings.cpp b/src/settings.cpp index 462874f9..2181d0fd 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -131,10 +131,17 @@ void SettingsDialog::readConfig() connect(d->generalUi.downloadDirUrlRequester, SIGNAL(textChanged(QString)),this, SLOT(saveSettings())); // ======= Fonts - d->fontsUi.standardFontChooser->setFont(ReKonfig::standardFont(), false); + QFont stdFont = ReKonfig::standardFont(); + d->fontsUi.standardFontChooser->setFont(stdFont, false); connect(d->fontsUi.standardFontChooser, SIGNAL(fontSelected(QFont)),this, SLOT(saveSettings())); - d->fontsUi.fixedFontChooser->setFont(ReKonfig::fixedFont(), true); + QFont fxFont = ReKonfig::fixedFont(); + d->fontsUi.fixedFontChooser->setFont(fxFont, true); connect(d->fontsUi.fixedFontChooser, SIGNAL(fontSelected(QFont)),this, SLOT(saveSettings())); + + // ======= 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 index a7dd6073..bcee0a7e 100644 --- a/src/settings_proxy.ui +++ b/src/settings_proxy.ui @@ -5,21 +5,28 @@ <rect> <x>0</x> <y>0</y> - <width>472</width> - <height>221</height> + <width>440</width> + <height>223</height> </rect> </property> <property name="windowTitle" > <string>Proxy</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout" > + <layout class="QVBoxLayout" name="verticalLayout" > <item> - <widget class="QGroupBox" name="kcfg_enableProxy" > + <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>Enable proxy</string> + <string>Proxy Settings</string> </property> <layout class="QGridLayout" name="gridLayout_6" > - <item row="0" column="0" > + <item row="1" column="0" > <widget class="QLabel" name="label_9" > <property name="text" > <string>Type:</string> @@ -29,7 +36,7 @@ </property> </widget> </item> - <item row="0" column="1" colspan="2" > + <item row="1" column="1" colspan="2" > <widget class="QComboBox" name="kcfg_proxyType" > <item> <property name="text" > @@ -43,7 +50,7 @@ </item> </widget> </item> - <item row="1" column="0" > + <item row="2" column="0" > <widget class="QLabel" name="label_10" > <property name="text" > <string>Host:</string> @@ -53,10 +60,10 @@ </property> </widget> </item> - <item row="1" column="1" colspan="2" > + <item row="2" column="1" colspan="2" > <widget class="KLineEdit" name="kcfg_proxyHostName" /> </item> - <item row="2" column="0" > + <item row="3" column="0" > <widget class="QLabel" name="label_11" > <property name="text" > <string>Port:</string> @@ -66,7 +73,7 @@ </property> </widget> </item> - <item row="2" column="1" > + <item row="3" column="1" > <widget class="QSpinBox" name="kcfg_proxyPort" > <property name="maximum" > <number>10000</number> @@ -76,7 +83,7 @@ </property> </widget> </item> - <item row="2" column="2" > + <item row="3" column="2" > <spacer name="horizontalSpacer_2" > <property name="orientation" > <enum>Qt::Horizontal</enum> @@ -89,7 +96,7 @@ </property> </spacer> </item> - <item row="3" column="0" > + <item row="4" column="0" > <widget class="QLabel" name="label_12" > <property name="text" > <string>User Name:</string> @@ -99,10 +106,10 @@ </property> </widget> </item> - <item row="3" column="1" colspan="2" > + <item row="4" column="1" colspan="2" > <widget class="KLineEdit" name="kcfg_proxyUserName" /> </item> - <item row="4" column="0" > + <item row="5" column="0" > <widget class="QLabel" name="label_13" > <property name="text" > <string>Password:</string> @@ -112,10 +119,10 @@ </property> </widget> </item> - <item row="4" column="1" colspan="2" > + <item row="5" column="1" colspan="2" > <widget class="KLineEdit" name="kcfg_proxyPassword" /> </item> - <item row="5" column="0" > + <item row="6" column="0" > <spacer name="verticalSpacer_2" > <property name="orientation" > <enum>Qt::Vertical</enum> diff --git a/src/webview.cpp b/src/webview.cpp index a4ca8211..95fcdf83 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -126,6 +126,11 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) { KUrl srcUrl = reply->url(); QString path = ReKonfig::downloadDir() + QString("/") + srcUrl.fileName(); + QFile file(path); + if (file.exists()) + { + path = KFileDialog::getOpenFileName(); + } KUrl destUrl = KUrl(path); BrowserApplication::instance()->downloadUrl( srcUrl, destUrl ); return; @@ -312,6 +317,11 @@ void WebView::downloadRequested(const QNetworkRequest &request) { KUrl srcUrl = request.url(); QString path = ReKonfig::downloadDir() + QString("/") + srcUrl.fileName(); + QFile file(path); + if (file.exists()) + { + path = KFileDialog::getOpenFileName(); + } KUrl destUrl = KUrl(path); BrowserApplication::instance()->downloadUrl( srcUrl, destUrl ); } |