summaryrefslogtreecommitdiff
authorandyq <andyq>2002-12-12 00:18:40 (UTC)
committer andyq <andyq>2002-12-12 00:18:40 (UTC)
commit1d044ba4d276240b60bc98d18365a80183960751 (patch) (side-by-side diff)
tree98f69f03bb7ff4a904c02322be6480c54b6a7e08
parentfe063bdf069cd33def6347777624798e4f3a7059 (diff)
downloadopie-1d044ba4d276240b60bc98d18365a80183960751.zip
opie-1d044ba4d276240b60bc98d18365a80183960751.tar.gz
opie-1d044ba4d276240b60bc98d18365a80183960751.tar.bz2
Added proxy support
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/datamgr.cpp28
-rw-r--r--noncore/settings/aqpkg/datamgr.h18
-rw-r--r--noncore/settings/aqpkg/settings.ui1135
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp21
-rw-r--r--noncore/settings/aqpkg/settingsimpl.h2
5 files changed, 743 insertions, 461 deletions
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
@@ -85,171 +85,191 @@ void DataManager :: loadServers()
fp = fopen( ipkg_conf, "r" );
char line[130];
QString lineStr;
if ( fp == NULL )
{
cout << "Couldn't open " << ipkg_conf << "! err = " << fp << endl;
return;
}
else
{
while ( fgets( line, sizeof line, fp) != NULL )
{
lineStr = line;
if ( lineStr.startsWith( "src" ) || lineStr.startsWith( "#src" ) || lineStr.startsWith( "# src" ) )
{
char alias[20];
char url[100];
// Looks a little wierd but read up to the r of src (throwing it away),
// then read up to the next space and throw that away, the alias
// is next.
// Should Handle #src, # src, src, and combinations of
sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url );
Server s( alias, url );
if ( lineStr.startsWith( "src" ) )
s.setActive( true );
else
s.setActive( false );
serverList.push_back( s );
}
else if ( lineStr.startsWith( "dest" ) )
{
char alias[20];
char path[50];
sscanf( lineStr, "%*[^ ] %s %s", alias, path );
Destination d( alias, path );
bool linkToRoot = true;
#ifdef QWS
QString key = alias;
key += "_linkToRoot";
linkToRoot = cfg.readBoolEntry( key, true );
#endif
d.linkToRoot( linkToRoot );
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 )
proxyPassword = val;
}
}
}
fclose( fp );
reloadServerData( );
}
void DataManager :: reloadServerData( )
{
vector<Server>::iterator it = serverList.begin();
for ( it = serverList.begin() ; it != serverList.end() ; ++it )
{
// Now we've read the config file in we need to read the servers
// The local server is a special case. This holds the contents of the
// status files the number of which depends on how many destinations
// we've set up
// The other servers files hold the contents of the server package list
if ( it->getServerName() == LOCAL_SERVER )
it->readStatusFile( destList );
else if ( it->getServerName() == LOCAL_IPKGS )
it->readLocalIpks( &( *getServer( LOCAL_SERVER ) ) );
else
it->readPackageFile( &( *getServer( LOCAL_SERVER ) ) );
}
}
void DataManager :: writeOutIpkgConf()
{
QString ipkg_conf = IPKG_CONF;
ofstream out( ipkg_conf );
out << "# Written by AQPkg" << endl;
out << "# Must have one or more source entries of the form:" << endl;
out << "#" << endl;
out << "# src <src-name> <source-url>" << endl;
out << "#" << endl;
out << "# and one or more destination entries of the form:" << endl;
out << "#" << endl;
out << "# dest <dest-name> <target-path>" << endl;
out << "#" << endl;
out << "# where <src-name> and <dest-names> are identifiers that" << endl;
out << "# should match [a-zA-Z0-9._-]+, <source-url> should be a" << endl;
out << "# URL that points to a directory containing a Familiar" << endl;
out << "# Packages file, and <target-path> should be a directory" << endl;
out << "# that exists on the target system." << endl << endl;
// Write out servers
vector<Server>::iterator it = serverList.begin();
while ( it != serverList.end() )
{
QString alias = it->getServerName();
// Don't write out local as its a dummy
if ( alias != LOCAL_SERVER && alias != LOCAL_IPKGS )
{
QString url = it->getServerUrl();;
if ( !it->isServerActive() )
out << "#";
out << "src " << alias << " " << url << endl;
}
it++;
}
out << endl;
// Write out destinations
vector<Destination>::iterator it2 = destList.begin();
while ( it2 != destList.end() )
{
out << "dest " << it2->getDestinationName() << " " << it2->getDestinationPath() << endl;
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 <username>" << endl;
else
out << "option proxy_username " << proxyUsername << endl;
if ( proxyPassword == "" )
out << "#option proxy_password <password>" << endl << endl;
else
out << "option proxy_password " << proxyPassword << endl<< endl;
out << "# Offline mode (for use in constructing flash images offline)" << endl;
out << "#option offline_root target" << endl;
out.close();
}
void DataManager :: setAvailableCategories( QString section )
{
section = section.lower();
if ( availableCategories.find( "#" + section + "#" ) == -1 )
availableCategories += section + "#";
}
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
@@ -13,61 +13,79 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef DATAMGR_H
#define DATAMGR_H
#include <map>
using namespace std;
#include <qstring.h>
#include "server.h"
#include "destination.h"
#define LOCAL_SERVER "Installed Pkgs"
#define LOCAL_IPKGS "local IPKG"
/**
*@author Andy Qua
*/
class DataManager
{
public:
DataManager();
~DataManager();
void setActiveServer( const QString &act ) { activeServer = act; }
QString &getActiveServer( ) { return activeServer; }
Server *getLocalServer() { return &( *getServer( LOCAL_SERVER ) ); }
vector<Server> &getServerList() { return serverList; }
vector<Server>::iterator getServer( const char *name );
vector<Destination> &getDestinationList() { return destList; }
vector<Destination>::iterator getDestination( const char *name );
void loadServers();
void reloadServerData( );
void writeOutIpkgConf();
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;
QString httpProxy;
QString ftpProxy;
QString proxyUsername;
QString proxyPassword;
+ bool httpProxyEnabled;
+ bool ftpProxyEnabled;
+
vector<Server> serverList;
vector<Destination> destList;
};
#endif
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
@@ -1,650 +1,871 @@
<!DOCTYPE UI><UI>
<class>SettingsBase</class>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>Settings</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>235</width>
+ <width>211</width>
<height>390</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Package Servers</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
- <grid>
+ <widget>
+ <class>QTabWidget</class>
<property stdset="1">
- <name>margin</name>
- <number>11</number>
+ <name>name</name>
+ <cstring>TabWidget</cstring>
</property>
<property stdset="1">
- <name>spacing</name>
- <number>6</number>
+ <name>enabled</name>
+ <bool>true</bool>
</property>
- <widget row="0" column="0" >
- <class>QTabWidget</class>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>11</x>
+ <y>11</y>
+ <width>209</width>
+ <height>368</height>
+ </rect>
+ </property>
+ <property>
+ <name>layoutMargin</name>
+ </property>
+ <property>
+ <name>layoutSpacing</name>
+ </property>
+ <widget>
+ <class>QWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>TabWidget</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
+ <cstring>tab</cstring>
</property>
- <property>
- <name>layoutMargin</name>
- </property>
- <property>
- <name>layoutSpacing</name>
- </property>
- <widget>
- <class>QWidget</class>
+ <attribute>
+ <name>title</name>
+ <string>Servers</string>
+ </attribute>
+ <grid>
<property stdset="1">
- <name>name</name>
- <cstring>tab</cstring>
+ <name>margin</name>
+ <number>11</number>
</property>
- <attribute>
- <name>title</name>
- <string>Servers</string>
- </attribute>
- <grid>
- <property stdset="1">
- <name>margin</name>
- <number>11</number>
- </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" >
+ <class>QLayoutWidget</class>
<property stdset="1">
- <name>spacing</name>
- <number>6</number>
+ <name>name</name>
+ <cstring>Layout2</cstring>
</property>
- <widget row="0" column="0" >
- <class>QLayoutWidget</class>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
<property stdset="1">
- <name>name</name>
- <cstring>Layout2</cstring>
+ <name>spacing</name>
+ <number>6</number>
</property>
- <hbox>
+ <widget>
+ <class>QLabel</class>
<property stdset="1">
- <name>margin</name>
- <number>0</number>
+ <name>name</name>
+ <cstring>Servers</cstring>
</property>
<property stdset="1">
- <name>spacing</name>
- <number>6</number>
+ <name>text</name>
+ <string>Servers</string>
</property>
- <widget>
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Servers</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Servers</string>
- </property>
- </widget>
- <spacer>
- <property>
- <name>name</name>
- <cstring>Spacer2</cstring>
- </property>
- <property stdset="1">
- <name>orientation</name>
- <enum>Horizontal</enum>
- </property>
- <property stdset="1">
- <name>sizeType</name>
- <enum>Expanding</enum>
- </property>
- <property>
- <name>sizeHint</name>
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </hbox>
- </widget>
- <widget row="1" column="0" >
- <class>QLayoutWidget</class>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer2</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout8</cstring>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
<property stdset="1">
- <name>name</name>
- <cstring>Layout8</cstring>
+ <name>spacing</name>
+ <number>6</number>
</property>
- <grid>
+ <widget row="0" column="0" rowspan="1" colspan="2" >
+ <class>QListBox</class>
<property stdset="1">
- <name>margin</name>
- <number>0</number>
+ <name>name</name>
+ <cstring>servers</cstring>
</property>
<property stdset="1">
- <name>spacing</name>
- <number>6</number>
+ <name>selectionMode</name>
+ <enum>Extended</enum>
</property>
- <widget row="0" column="0" rowspan="1" colspan="2" >
- <class>QListBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>servers</cstring>
- </property>
+ </widget>
+ <widget row="2" column="0" rowspan="1" colspan="2" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout6</cstring>
+ </property>
+ <grid>
<property stdset="1">
- <name>selectionMode</name>
- <enum>Extended</enum>
+ <name>margin</name>
+ <number>0</number>
</property>
- </widget>
- <widget row="2" column="0" rowspan="1" colspan="2" >
- <class>QLayoutWidget</class>
<property stdset="1">
- <name>name</name>
- <cstring>Layout6</cstring>
+ <name>spacing</name>
+ <number>6</number>
</property>
- <grid>
+ <widget row="2" column="1" >
+ <class>QCheckBox</class>
<property stdset="1">
- <name>margin</name>
- <number>0</number>
+ <name>name</name>
+ <cstring>active</cstring>
</property>
<property stdset="1">
- <name>spacing</name>
- <number>6</number>
+ <name>text</name>
+ <string>Active Server</string>
</property>
- <widget row="2" column="1" >
- <class>QCheckBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>active</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Active Server</string>
- </property>
- </widget>
- <widget row="0" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>TextLabel1_3</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Name:</string>
- </property>
- </widget>
- <widget row="1" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>TextLabel2_3</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>URL:</string>
- </property>
- </widget>
- <widget row="0" column="1" >
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>servername</cstring>
- </property>
- </widget>
- <widget row="1" column="1" >
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>serverurl</cstring>
- </property>
- </widget>
- <widget row="3" column="1" >
- <class>QPushButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>btnChangeServer</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Change</string>
- </property>
- </widget>
- </grid>
- </widget>
- <widget row="1" column="1" >
- <class>QPushButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>removeserver</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Remove</string>
- </property>
- <property stdset="1">
- <name>autoDefault</name>
- <bool>false</bool>
- </property>
- </widget>
- <widget row="1" column="0" >
- <class>QPushButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>newserver</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>New</string>
- </property>
- <property stdset="1">
- <name>autoDefault</name>
- <bool>false</bool>
- </property>
- </widget>
- </grid>
- </widget>
- </grid>
- </widget>
- <widget>
- <class>QWidget</class>
+ </widget>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_3</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Name:</string>
+ </property>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2_3</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>URL:</string>
+ </property>
+ </widget>
+ <widget row="0" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>servername</cstring>
+ </property>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>serverurl</cstring>
+ </property>
+ </widget>
+ <widget row="3" column="1" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>btnChangeServer</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Change</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>removeserver</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Remove</string>
+ </property>
+ <property stdset="1">
+ <name>autoDefault</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>newserver</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>New</string>
+ </property>
+ <property stdset="1">
+ <name>autoDefault</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>Destinations</string>
+ </attribute>
+ <grid>
<property stdset="1">
- <name>name</name>
- <cstring>tab</cstring>
+ <name>margin</name>
+ <number>11</number>
</property>
- <attribute>
- <name>title</name>
- <string>Destinations</string>
- </attribute>
- <grid>
- <property stdset="1">
- <name>margin</name>
- <number>11</number>
- </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" >
+ <class>QLayoutWidget</class>
<property stdset="1">
- <name>spacing</name>
- <number>6</number>
+ <name>name</name>
+ <cstring>Layout3</cstring>
</property>
- <widget row="0" column="0" >
- <class>QLayoutWidget</class>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
<property stdset="1">
- <name>name</name>
- <cstring>Layout3</cstring>
+ <name>spacing</name>
+ <number>6</number>
</property>
- <hbox>
+ <widget>
+ <class>QLabel</class>
<property stdset="1">
- <name>margin</name>
- <number>0</number>
+ <name>name</name>
+ <cstring>Destinations</cstring>
</property>
<property stdset="1">
- <name>spacing</name>
- <number>6</number>
+ <name>text</name>
+ <string>Destinations</string>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer2_2</cstring>
</property>
- <widget>
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Destinations</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Destinations</string>
- </property>
- </widget>
- <spacer>
- <property>
- <name>name</name>
- <cstring>Spacer2_2</cstring>
- </property>
- <property stdset="1">
- <name>orientation</name>
- <enum>Horizontal</enum>
- </property>
- <property stdset="1">
- <name>sizeType</name>
- <enum>Expanding</enum>
- </property>
- <property>
- <name>sizeHint</name>
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </hbox>
- </widget>
- <widget row="2" column="0" >
- <class>QLayoutWidget</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Layout5</cstring>
- </property>
- <hbox>
<property stdset="1">
- <name>margin</name>
- <number>0</number>
+ <name>orientation</name>
+ <enum>Horizontal</enum>
</property>
<property stdset="1">
- <name>spacing</name>
- <number>6</number>
+ <name>sizeType</name>
+ <enum>Expanding</enum>
</property>
- <widget>
- <class>QPushButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>newdestination</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>New</string>
- </property>
- <property stdset="1">
- <name>autoDefault</name>
- <bool>false</bool>
- </property>
- </widget>
- <widget>
- <class>QPushButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>removedestination</cstring>
- </property>
- <property stdset="1">
- <name>enabled</name>
- <bool>true</bool>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Remove</string>
- </property>
- <property stdset="1">
- <name>autoDefault</name>
- <bool>false</bool>
- </property>
- </widget>
- </hbox>
- </widget>
- <spacer row="0" column="0" >
- <property>
- <name>name</name>
- <cstring>Spacer3</cstring>
- </property>
- <property stdset="1">
- <name>orientation</name>
- <enum>Horizontal</enum>
- </property>
- <property stdset="1">
- <name>sizeType</name>
- <enum>Expanding</enum>
- </property>
- <property>
- <name>sizeHint</name>
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget row="1" column="0" >
- <class>QListBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>destinations</cstring>
- </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget row="2" column="0" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout5</cstring>
+ </property>
+ <hbox>
<property stdset="1">
- <name>selectionMode</name>
- <enum>Single</enum>
+ <name>margin</name>
+ <number>0</number>
</property>
- </widget>
- <widget row="3" column="0" >
- <class>QLayoutWidget</class>
<property stdset="1">
- <name>name</name>
- <cstring>Layout13</cstring>
+ <name>spacing</name>
+ <number>6</number>
</property>
- <grid>
+ <widget>
+ <class>QPushButton</class>
<property stdset="1">
- <name>margin</name>
- <number>0</number>
+ <name>name</name>
+ <cstring>newdestination</cstring>
</property>
<property stdset="1">
- <name>spacing</name>
- <number>6</number>
+ <name>enabled</name>
+ <bool>true</bool>
</property>
- <widget row="1" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>TextLabel1_3_2_2</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>URL:</string>
- </property>
- </widget>
- <widget row="3" column="1" >
- <class>QPushButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>btnChangeDest</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Change</string>
- </property>
- </widget>
- <widget row="0" column="1" >
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>destinationname</cstring>
- </property>
- </widget>
- <widget row="0" column="0" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>TextLabel1_3_2</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Name:</string>
- </property>
- </widget>
- <widget row="2" column="1" >
- <class>QCheckBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>linkToRoot</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Link To Root</string>
- </property>
- <property stdset="1">
- <name>checked</name>
- <bool>true</bool>
- </property>
- </widget>
- <widget row="1" column="1" >
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>destinationurl</cstring>
- </property>
- </widget>
- </grid>
- </widget>
- </grid>
- </widget>
- <widget>
- <class>QWidget</class>
- <property stdset="1">
- <name>name</name>
- <cstring>tab</cstring>
- </property>
- <attribute>
- <name>title</name>
- <string>General</string>
- </attribute>
- <widget>
- <class>QLabel</class>
- <property stdset="1">
+ <property stdset="1">
+ <name>text</name>
+ <string>New</string>
+ </property>
+ <property stdset="1">
+ <name>autoDefault</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>removedestination</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Remove</string>
+ </property>
+ <property stdset="1">
+ <name>autoDefault</name>
+ <bool>false</bool>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <spacer row="0" column="0" >
+ <property>
<name>name</name>
- <cstring>TextLabel1</cstring>
+ <cstring>Spacer3</cstring>
</property>
<property stdset="1">
- <name>geometry</name>
- <rect>
- <x>20</x>
- <y>30</y>
- <width>150</width>
- <height>20</height>
- </rect>
+ <name>orientation</name>
+ <enum>Horizontal</enum>
</property>
<property stdset="1">
- <name>text</name>
- <string>(Will take effect on restart)</string>
+ <name>sizeType</name>
+ <enum>Expanding</enum>
</property>
- </widget>
- <widget>
- <class>QCheckBox</class>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget row="1" column="0" >
+ <class>QListBox</class>
<property stdset="1">
<name>name</name>
- <cstring>jumpTo</cstring>
+ <cstring>destinations</cstring>
</property>
<property stdset="1">
- <name>geometry</name>
- <rect>
- <x>17</x>
- <y>14</y>
- <width>150</width>
- <height>20</height>
- </rect>
+ <name>selectionMode</name>
+ <enum>Single</enum>
</property>
+ </widget>
+ <widget row="3" column="0" >
+ <class>QLayoutWidget</class>
<property stdset="1">
- <name>text</name>
- <string>Show Jump To Letters</string>
+ <name>name</name>
+ <cstring>Layout13</cstring>
</property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="1" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_3_2_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>URL:</string>
+ </property>
+ </widget>
+ <widget row="3" column="1" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>btnChangeDest</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Change</string>
+ </property>
+ </widget>
+ <widget row="0" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>destinationname</cstring>
+ </property>
+ </widget>
+ <widget row="0" column="0" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_3_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Name:</string>
+ </property>
+ </widget>
+ <widget row="2" column="1" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>linkToRoot</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Link To Root</string>
+ </property>
+ <property stdset="1">
+ <name>checked</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget row="1" column="1" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>destinationurl</cstring>
+ </property>
+ </widget>
+ </grid>
</widget>
+ </grid>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>Proxys</string>
+ </attribute>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>1</x>
+ <y>19</y>
+ <width>67</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>HTTP Proxy</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>txtFtpProxy</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>74</x>
+ <y>72</y>
+ <width>110</width>
+ <height>22</height>
+ </rect>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>txtHttpProxy</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>74</x>
+ <y>19</y>
+ <width>110</width>
+ <height>22</height>
+ </rect>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel4</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>1</x>
+ <y>153</y>
+ <width>67</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Password</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>txtUsername</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>74</x>
+ <y>125</y>
+ <width>110</width>
+ <height>22</height>
+ </rect>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>txtPassword</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>74</x>
+ <y>153</y>
+ <width>110</width>
+ <height>22</height>
+ </rect>
+ </property>
+ </widget>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>chkFtpProxyEnabled</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>74</x>
+ <y>100</y>
+ <width>110</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Enabled</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>1</x>
+ <y>72</y>
+ <width>67</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>FTP Proxy</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>1</x>
+ <y>125</y>
+ <width>67</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Username</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>chkHttpProxyEnabled</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>74</x>
+ <y>47</y>
+ <width>110</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Enabled</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>btnProxyApply</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>74</x>
+ <y>181</y>
+ <width>110</width>
+ <height>28</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&amp;Apply</string>
+ </property>
+ </widget>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>General</string>
+ </attribute>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>20</x>
+ <y>30</y>
+ <width>150</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>(Will take effect on restart)</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>jumpTo</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>17</x>
+ <y>14</y>
+ <width>150</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Show Jump To Letters</string>
+ </property>
</widget>
</widget>
- </grid>
+ </widget>
</widget>
<connections>
<connection>
<sender>newserver</sender>
<signal>clicked()</signal>
<receiver>Settings</receiver>
<slot>newServer()</slot>
</connection>
<connection>
<sender>removeserver</sender>
<signal>clicked()</signal>
<receiver>Settings</receiver>
<slot>removeServer()</slot>
</connection>
<connection>
<sender>newdestination</sender>
<signal>clicked()</signal>
<receiver>Settings</receiver>
<slot>newDestination()</slot>
</connection>
<connection>
<sender>removedestination</sender>
<signal>clicked()</signal>
<receiver>Settings</receiver>
<slot>removeDestination()</slot>
</connection>
<connection>
<sender>servers</sender>
<signal>highlighted(int)</signal>
<receiver>Settings</receiver>
<slot>editServer(int)</slot>
</connection>
<connection>
<sender>destinations</sender>
<signal>highlighted(int)</signal>
<receiver>Settings</receiver>
<slot>editDestination(int)</slot>
</connection>
<connection>
<sender>btnChangeServer</sender>
<signal>clicked()</signal>
<receiver>Settings</receiver>
<slot>changeServerDetails()</slot>
</connection>
<connection>
<sender>btnChangeDest</sender>
<signal>clicked()</signal>
<receiver>Settings</receiver>
<slot>changeDestinationDetails()</slot>
</connection>
<connection>
<sender>jumpTo</sender>
<signal>toggled(bool)</signal>
<receiver>Settings</receiver>
<slot>toggleJumpTo(bool)</slot>
</connection>
+ <connection>
+ <sender>btnProxyApply</sender>
+ <signal>clicked()</signal>
+ <receiver>Settings</receiver>
+ <slot>proxyApplyChanges()</slot>
+ </connection>
<slot access="public">activeServerChanged()</slot>
<slot access="public">changeDestinationDetails()</slot>
<slot access="public">changeServerDetails()</slot>
<slot access="public">createLinksToDest()</slot>
<slot access="public">destNameChanged(const QString&amp;)</slot>
<slot access="public">destUrlChanged(const QString&amp;)</slot>
<slot access="public">editDestination(int)</slot>
<slot access="public">editServer(int)</slot>
<slot access="public">installationSettingChange(int)</slot>
<slot access="public">installationSettingSetName(const QString &amp;)</slot>
<slot access="public">linkEnabled(bool)</slot>
<slot access="public">newDestination()</slot>
<slot access="public">newInstallationSetting()</slot>
<slot access="public">newServer()</slot>
+ <slot access="public">proxyApplyChanges()</slot>
<slot access="public">removeDestination()</slot>
<slot access="public">removeInstallationSetting()</slot>
<slot access="public">removeLinksToDest()</slot>
<slot access="public">removeServer()</slot>
<slot access="public">renameInstallationSetting()</slot>
<slot access="public">serverNameChanged(const QString&amp;)</slot>
<slot access="public">serverUrlChanged(const QString&amp;)</slot>
<slot access="public">toggleJumpTo(bool)</slot>
</connections>
<tabstops>
<tabstop>servers</tabstop>
<tabstop>newserver</tabstop>
<tabstop>removeserver</tabstop>
<tabstop>servername</tabstop>
<tabstop>serverurl</tabstop>
<tabstop>active</tabstop>
<tabstop>btnChangeServer</tabstop>
<tabstop>TabWidget</tabstop>
<tabstop>destinations</tabstop>
<tabstop>newdestination</tabstop>
<tabstop>removedestination</tabstop>
<tabstop>destinationname</tabstop>
<tabstop>destinationurl</tabstop>
<tabstop>linkToRoot</tabstop>
<tabstop>btnChangeDest</tabstop>
<tabstop>jumpTo</tabstop>
</tabstops>
</UI>
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
@@ -33,103 +33,112 @@ using namespace std;
#include "global.h"
SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
: SettingsBase( parent, name, modal, fl )
{
dataMgr = dataManager;
setupData();
changed = false;
newserver = false;
newdestination = false;
}
SettingsImpl :: ~SettingsImpl()
{
}
bool SettingsImpl :: showDlg( int i )
{
TabWidget->setCurrentPage( i );
showMaximized();
exec();
if ( changed )
dataMgr->writeOutIpkgConf();
return changed;
}
void SettingsImpl :: setupData()
{
// add servers
vector<Server>::iterator it;
for ( it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it )
{
if ( it->getServerName() == LOCAL_SERVER || it->getServerName() == LOCAL_IPKGS )
continue;
servers->insertItem( it->getServerName() );
}
// add destinations
vector<Destination>::iterator it2;
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" );
jumpTo->setChecked( cfg.readBoolEntry( "showJumpTo", "true" ) );
#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 ----------------------
void SettingsImpl :: editServer( int sel )
{
currentSelectedServer = sel;
vector<Server>::iterator s = dataMgr->getServer( servers->currentText() );
serverName = s->getServerName();
servername->setText( s->getServerName() );
serverurl->setText( s->getServerUrl() );
active->setChecked( s->isServerActive() );
}
void SettingsImpl :: newServer()
{
newserver = true;
servername->setText( "" );
serverurl->setText( "" );
servername->setFocus();
active->setChecked( true );
}
void SettingsImpl :: removeServer()
{
changed = true;
vector<Server>::iterator s = dataMgr->getServer( servers->currentText() );
dataMgr->getServerList().erase( s );
servers->removeItem( currentSelectedServer );
}
void SettingsImpl :: changeServerDetails()
{
changed = true;
QString newName = servername->text();
if ( !newserver )
{
vector<Server>::iterator s = dataMgr->getServer( servers->currentText() );
// Update url
s->setServerUrl( serverurl->text() );
s->setActive( active->isChecked() );
// Check if server name has changed, if it has then we need to replace the key in the map
if ( serverName != newName )
{
@@ -199,48 +208,60 @@ void SettingsImpl :: changeDestinationDetails()
vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() );
// Update url
d->setDestinationPath( destinationurl->text() );
d->linkToRoot( linkToRoot->isChecked() );
// Check if server name has changed, if it has then we need to replace the key in the map
if ( destinationName != newName )
{
// Update server name
d->setDestinationName( newName );
// Update list box
destinations->changeItem( newName, currentSelectedDestination );
}
#ifdef QWS
QString key = newName;
key += "_linkToRoot";
int val = d->linkToRoot();
cfg.writeEntry( key, val );
#endif
}
else
{
dataMgr->getDestinationList().push_back( Destination( newName, destinationurl->text() ) );
destinations->insertItem( newName );
destinations->setCurrentItem( destinations->count() );
newdestination = false;
#ifdef QWS
QString key = newName;
key += "_linkToRoot";
cfg.writeEntry( key, true );
#endif
}
}
//------------------ General tab ----------------------
void SettingsImpl :: toggleJumpTo( bool val )
{
#ifdef QWS
Config cfg( "aqpkg" );
cfg.setGroup( "settings" );
cfg.writeEntry( "showJumpTo", 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
@@ -6,49 +6,51 @@
email : andy.qua@blueyonder.co.uk
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "settings.h"
#include "datamgr.h"
class SettingsImpl : public SettingsBase
{
public:
SettingsImpl( DataManager *dataManager, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~SettingsImpl();
bool showDlg( int i );
private:
DataManager *dataMgr;
QString serverName;
QString destinationName;
int currentSelectedServer;
int currentSelectedDestination;
bool changed;
bool newserver;
bool newdestination;
void setupConnections();
void setupData();
void editServer( int s );
void changeServerDetails();
void newServer();
void removeServer();
void editDestination( int s );
void changeDestinationDetails();
void newDestination();
void removeDestination();
void toggleJumpTo( bool val );
+
+ void proxyApplyChanges();
};