From 1d044ba4d276240b60bc98d18365a80183960751 Mon Sep 17 00:00:00 2001 From: andyq Date: Thu, 12 Dec 2002 00:18:40 +0000 Subject: Added proxy support --- (limited to 'noncore/settings/aqpkg') diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp index 96c28c0..3933a22 100644 --- a/noncore/settings/aqpkg/datamgr.cpp +++ b/noncore/settings/aqpkg/datamgr.cpp @@ -130,15 +130,27 @@ void DataManager :: loadServers() destList.push_back( d ); } - else if ( lineStr.startsWith( "option" ) ) + else if ( lineStr.startsWith( "option" ) || lineStr.startsWith( "#option" ) ) { char type[20]; char val[100]; sscanf( lineStr, "%*[^ ] %s %s", type, val ); if ( stricmp( type, "http_proxy" ) == 0 ) + { httpProxy = val; + if ( lineStr.startsWith( "#" ) ) + httpProxyEnabled = false; + else + httpProxyEnabled = true; + } if ( stricmp( type, "ftp_proxy" ) == 0 ) + { ftpProxy = val; + if ( lineStr.startsWith( "#" ) ) + ftpProxyEnabled = false; + else + ftpProxyEnabled = true; + } if ( stricmp( type, "proxy_username" ) == 0 ) proxyUsername = val; if ( stricmp( type, "proxy_password" ) == 0 ) @@ -218,18 +230,26 @@ void DataManager :: writeOutIpkgConf() it2++; } + out << endl; out << "# Proxy Support" << endl; - out << "#" << endl; - if ( httpProxy == "" ) + if ( !httpProxyEnabled && httpProxy == "" ) out << "#option http_proxy http://proxy.tld:3128" << endl; else + { + if ( !httpProxyEnabled ) + out << "#"; out << "option http_proxy " << httpProxy << endl; + } - if ( ftpProxy == "" ) + if ( !ftpProxyEnabled && ftpProxy == "" ) out << "#option ftp_proxy http://proxy.tld:3128" << endl; else + { + if ( !ftpProxyEnabled ) + out << "#"; out << "option ftp_proxy " << ftpProxy << endl; + } if ( proxyUsername == "" ) out << "#option proxy_username " << endl; else diff --git a/noncore/settings/aqpkg/datamgr.h b/noncore/settings/aqpkg/datamgr.h index 41833df..0a7467f 100644 --- a/noncore/settings/aqpkg/datamgr.h +++ b/noncore/settings/aqpkg/datamgr.h @@ -58,6 +58,21 @@ public: static QString getAvailableCategories() { return availableCategories; } static void setAvailableCategories( QString section ); + QString getHttpProxy() { return httpProxy; } + QString getFtpProxy() { return ftpProxy; } + QString getProxyUsername() { return proxyUsername; } + QString getProxyPassword() { return proxyPassword; } + + bool getHttpProxyEnabled() { return httpProxyEnabled; } + bool getFtpProxyEnabled() { return ftpProxyEnabled; } + + void setHttpProxy( QString proxy ) { httpProxy = proxy; } + void setFtpProxy( QString proxy ) { ftpProxy = proxy; } + void setProxyUsername( QString name ) { proxyUsername = name; } + void setProxyPassword( QString pword ) { proxyPassword = pword; } + + void setHttpProxyEnabled( bool val ) { httpProxyEnabled = val; } + void setFtpProxyEnabled( bool val ) { ftpProxyEnabled = val; } private: static QString availableCategories; QString activeServer; @@ -66,6 +81,9 @@ private: QString proxyUsername; QString proxyPassword; + bool httpProxyEnabled; + bool ftpProxyEnabled; + vector serverList; vector destList; }; diff --git a/noncore/settings/aqpkg/settings.ui b/noncore/settings/aqpkg/settings.ui index 44e8fd9..b39d358 100644 --- a/noncore/settings/aqpkg/settings.ui +++ b/noncore/settings/aqpkg/settings.ui @@ -11,7 +11,7 @@ 0 0 - 235 + 211 390 @@ -25,531 +25,745 @@ layoutSpacing - + + QTabWidget - margin - 11 + name + TabWidget - spacing - 6 + enabled + true - - QTabWidget + + geometry + + 11 + 11 + 209 + 368 + + + + layoutMargin + + + layoutSpacing + + + QWidget name - TabWidget - - - enabled - true + tab - - layoutMargin - - - layoutSpacing - - - QWidget + + title + Servers + + - name - tab + margin + 11 - - title - Servers - - - - margin - 11 - + + spacing + 6 + + + QLayoutWidget - spacing - 6 + name + Layout2 - - QLayoutWidget + + + margin + 0 + - name - Layout2 + spacing + 6 - + + QLabel - margin - 0 + name + Servers - spacing - 6 + text + Servers - - QLabel - - name - Servers - - - text - Servers - - - - - name - Spacer2 - - - orientation - Horizontal - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - - - - QLayoutWidget + + + + name + Spacer2 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + + + QLayoutWidget + + name + Layout8 + + + + margin + 0 + - name - Layout8 + spacing + 6 - + + QListBox - margin - 0 + name + servers - spacing - 6 + selectionMode + Extended - - QListBox - - name - servers - + + + QLayoutWidget + + name + Layout6 + + - selectionMode - Extended + margin + 0 - - - QLayoutWidget - name - Layout6 + spacing + 6 - + + QCheckBox - margin - 0 + name + active - spacing - 6 + text + Active Server - - QCheckBox - - name - active - - - text - Active Server - - - - QLabel - - name - TextLabel1_3 - - - text - Name: - - - - QLabel - - name - TextLabel2_3 - - - text - URL: - - - - QLineEdit - - name - servername - - - - QLineEdit - - name - serverurl - - - - QPushButton - - name - btnChangeServer - - - text - Change - - - - - - QPushButton - - name - removeserver - - - enabled - true - - - text - Remove - - - autoDefault - false - - - - QPushButton - - name - newserver - - - enabled - true - - - text - New - - - autoDefault - false - - - - - - - - QWidget + + + QLabel + + name + TextLabel1_3 + + + text + Name: + + + + QLabel + + name + TextLabel2_3 + + + text + URL: + + + + QLineEdit + + name + servername + + + + QLineEdit + + name + serverurl + + + + QPushButton + + name + btnChangeServer + + + text + Change + + + + + + QPushButton + + name + removeserver + + + enabled + true + + + text + Remove + + + autoDefault + false + + + + QPushButton + + name + newserver + + + enabled + true + + + text + New + + + autoDefault + false + + + + + + + + QWidget + + name + tab + + + title + Destinations + + - name - tab + margin + 11 - - title - Destinations - - - - margin - 11 - + + spacing + 6 + + + QLayoutWidget - spacing - 6 + name + Layout3 - - QLayoutWidget + + + margin + 0 + - name - Layout3 + spacing + 6 - + + QLabel - margin - 0 + name + Destinations - spacing - 6 + text + Destinations + + + + + name + Spacer2_2 - - QLabel - - name - Destinations - - - text - Destinations - - - - - name - Spacer2_2 - - - orientation - Horizontal - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - - - - QLayoutWidget - - name - Layout5 - - - margin - 0 + orientation + Horizontal - spacing - 6 + sizeType + Expanding - - QPushButton - - name - newdestination - - - enabled - true - - - text - New - - - autoDefault - false - - - - QPushButton - - name - removedestination - - - enabled - true - - - text - Remove - - - autoDefault - false - - - - - - - name - Spacer3 - - - orientation - Horizontal - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - - QListBox - - name - destinations - + + sizeHint + + 20 + 20 + + + + + + + QLayoutWidget + + name + Layout5 + + - selectionMode - Single + margin + 0 - - - QLayoutWidget - name - Layout13 + spacing + 6 - + + QPushButton - margin - 0 + name + newdestination - spacing - 6 + enabled + true - - QLabel - - name - TextLabel1_3_2_2 - - - text - URL: - - - - QPushButton - - name - btnChangeDest - - - text - Change - - - - QLineEdit - - name - destinationname - - - - QLabel - - name - TextLabel1_3_2 - - - text - Name: - - - - QCheckBox - - name - linkToRoot - - - text - Link To Root - - - checked - true - - - - QLineEdit - - name - destinationurl - - - - - - - - QWidget - - name - tab - - - title - General - - - QLabel - + + text + New + + + autoDefault + false + + + + QPushButton + + name + removedestination + + + enabled + true + + + text + Remove + + + autoDefault + false + + + + + + name - TextLabel1 + Spacer3 - geometry - - 20 - 30 - 150 - 20 - + orientation + Horizontal - text - (Will take effect on restart) + sizeType + Expanding - - - QCheckBox + + sizeHint + + 20 + 20 + + + + + QListBox name - jumpTo + destinations - geometry - - 17 - 14 - 150 - 20 - + selectionMode + Single + + + QLayoutWidget - text - Show Jump To Letters + name + Layout13 + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + TextLabel1_3_2_2 + + + text + URL: + + + + QPushButton + + name + btnChangeDest + + + text + Change + + + + QLineEdit + + name + destinationname + + + + QLabel + + name + TextLabel1_3_2 + + + text + Name: + + + + QCheckBox + + name + linkToRoot + + + text + Link To Root + + + checked + true + + + + QLineEdit + + name + destinationurl + + + + + + + QWidget + + name + tab + + + title + Proxys + + + QLabel + + name + TextLabel1_2 + + + geometry + + 1 + 19 + 67 + 22 + + + + text + HTTP Proxy + + + + QLineEdit + + name + txtFtpProxy + + + geometry + + 74 + 72 + 110 + 22 + + + + + QLineEdit + + name + txtHttpProxy + + + geometry + + 74 + 19 + 110 + 22 + + + + + QLabel + + name + TextLabel4 + + + geometry + + 1 + 153 + 67 + 22 + + + + text + Password + + + + QLineEdit + + name + txtUsername + + + geometry + + 74 + 125 + 110 + 22 + + + + + QLineEdit + + name + txtPassword + + + geometry + + 74 + 153 + 110 + 22 + + + + + QCheckBox + + name + chkFtpProxyEnabled + + + geometry + + 74 + 100 + 110 + 19 + + + + text + Enabled + + + + QLabel + + name + TextLabel2 + + + geometry + + 1 + 72 + 67 + 22 + + + + text + FTP Proxy + + + + QLabel + + name + TextLabel3 + + + geometry + + 1 + 125 + 67 + 22 + + + + text + Username + + + + QCheckBox + + name + chkHttpProxyEnabled + + + geometry + + 74 + 47 + 110 + 19 + + + + text + Enabled + + + + QPushButton + + name + btnProxyApply + + + geometry + + 74 + 181 + 110 + 28 + + + + text + &Apply + + + + + QWidget + + name + tab + + + title + General + + + QLabel + + name + TextLabel1 + + + geometry + + 20 + 30 + 150 + 20 + + + + text + (Will take effect on restart) + + + + QCheckBox + + name + jumpTo + + + geometry + + 17 + 14 + 150 + 20 + + + + text + Show Jump To Letters + - + @@ -606,6 +820,12 @@ Settings toggleJumpTo(bool) + + btnProxyApply + clicked() + Settings + proxyApplyChanges() + activeServerChanged() changeDestinationDetails() changeServerDetails() @@ -620,6 +840,7 @@ newDestination() newInstallationSetting() newServer() + proxyApplyChanges() removeDestination() removeInstallationSetting() removeLinksToDest() diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp index 9dd2206..4bb928a 100644 --- a/noncore/settings/aqpkg/settingsimpl.cpp +++ b/noncore/settings/aqpkg/settingsimpl.cpp @@ -78,6 +78,7 @@ void SettingsImpl :: setupData() for ( it2 = dataMgr->getDestinationList().begin() ; it2 != dataMgr->getDestinationList().end() ; ++it2 ) destinations->insertItem( it2->getDestinationName() ); + // setup general tab #ifdef QWS Config cfg( "aqpkg" ); cfg.setGroup( "settings" ); @@ -85,6 +86,14 @@ void SettingsImpl :: setupData() #else jumpTo->setChecked( true ); #endif + + // setup proxy tab + txtHttpProxy->setText( dataMgr->getHttpProxy() ); + txtFtpProxy->setText( dataMgr->getFtpProxy() ); + txtUsername->setText( dataMgr->getProxyUsername() ); + txtPassword->setText( dataMgr->getProxyPassword() ); + chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() ); + chkFtpProxyEnabled->setChecked( dataMgr->getFtpProxyEnabled() ); } //------------------ Servers tab ---------------------- @@ -244,3 +253,15 @@ void SettingsImpl :: toggleJumpTo( bool val ) #endif } +//------------------ Proxy tab ---------------------- +void SettingsImpl :: proxyApplyChanges() +{ + changed = true; + dataMgr->setHttpProxy( txtHttpProxy->text() ); + dataMgr->setFtpProxy( txtFtpProxy->text() ); + dataMgr->setProxyUsername( txtUsername->text() ); + dataMgr->setProxyPassword( txtPassword->text() ); + + dataMgr->setHttpProxyEnabled( chkHttpProxyEnabled->isChecked() ); + dataMgr->setFtpProxyEnabled( chkFtpProxyEnabled->isChecked() ); +} diff --git a/noncore/settings/aqpkg/settingsimpl.h b/noncore/settings/aqpkg/settingsimpl.h index 971516b..bb027dc 100644 --- a/noncore/settings/aqpkg/settingsimpl.h +++ b/noncore/settings/aqpkg/settingsimpl.h @@ -51,4 +51,6 @@ private: void removeDestination(); void toggleJumpTo( bool val ); + + void proxyApplyChanges(); }; -- cgit v0.9.0.2