summaryrefslogtreecommitdiff
path: root/noncore/settings
authorandyq <andyq>2002-11-21 20:16:40 (UTC)
committer andyq <andyq>2002-11-21 20:16:40 (UTC)
commit2185394da06d32a3655e71ec022da202477350e7 (patch) (unidiff)
treeb266ddecaa44a1fef5229bb0525c990d5e7cc51a /noncore/settings
parent6d302b82aab909da59852d99a31bcc7726ba9f34 (diff)
downloadopie-2185394da06d32a3655e71ec022da202477350e7.zip
opie-2185394da06d32a3655e71ec022da202477350e7.tar.gz
opie-2185394da06d32a3655e71ec022da202477350e7.tar.bz2
Re-applied patch for gcc3.2
Diffstat (limited to 'noncore/settings') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/datamgr.cpp29
-rw-r--r--noncore/settings/aqpkg/datamgr.h8
-rw-r--r--noncore/settings/aqpkg/global.h2
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp2
-rw-r--r--noncore/settings/aqpkg/ipkg.cpp1
-rw-r--r--noncore/settings/aqpkg/letterpushbutton.cpp2
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp5
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp4
-rw-r--r--noncore/settings/aqpkg/server.cpp2
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp23
10 files changed, 37 insertions, 41 deletions
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp
index e7fb75a..96c28c0 100644
--- a/noncore/settings/aqpkg/datamgr.cpp
+++ b/noncore/settings/aqpkg/datamgr.cpp
@@ -18,76 +18,74 @@
18#include <iostream> 18#include <iostream>
19using namespace std; 19using namespace std;
20 20
21#ifdef QWS 21#ifdef QWS
22#include <qpe/config.h> 22#include <qpe/config.h>
23#endif 23#endif
24 24
25#include <stdio.h> 25#include <stdio.h>
26 26
27#include "datamgr.h" 27#include "datamgr.h"
28#include "global.h" 28#include "global.h"
29 29
30 30
31QString DataManager::availableCategories = ""; 31QString DataManager::availableCategories = "";
32DataManager::DataManager() 32DataManager::DataManager()
33{ 33{
34 activeServer = ""; 34 activeServer = "";
35 availableCategories = "#"; 35 availableCategories = "#";
36} 36}
37 37
38DataManager::~DataManager() 38DataManager::~DataManager()
39{ 39{
40} 40}
41 41
42Server *DataManager :: getServer( const char *name ) 42vector<Server>::iterator DataManager :: getServer( const char *name )
43{ 43{
44 Server *s = 0; 44 vector<Server>::iterator it = serverList.begin();
45 vector<Server>::iterator it = serverList.begin(); 45 while ( it != serverList.end() )
46 while ( it != serverList.end() && s == 0 )
47 { 46 {
48 if ( it->getServerName() == name ) 47 if ( it->getServerName() == name )
49 s = &(*it); 48 return it;
50 49
51 ++it; 50 ++it;
52 } 51 }
53 52
54 return s; 53 return serverList.end();
55} 54}
56 55
57Destination *DataManager :: getDestination( const char *name ) 56vector<Destination>::iterator DataManager :: getDestination( const char *name )
58{ 57{
59 Destination *d = 0;
60 vector<Destination>::iterator it = destList.begin(); 58 vector<Destination>::iterator it = destList.begin();
61 while ( it != destList.end() && d == 0 ) 59 while ( it != destList.end() )
62 { 60 {
63 if ( it->getDestinationName() == name ) 61 if ( it->getDestinationName() == name )
64 d = &(*it); 62 return it;
65 63
66 ++it; 64 ++it;
67 } 65 }
68 66
69 return d; 67 return destList.end();
70} 68}
71 69
72void DataManager :: loadServers() 70void DataManager :: loadServers()
73{ 71{
74 // First add our local server - not really a server but 72 // First add our local server - not really a server but
75 // the local config (which packages are installed) 73 // the local config (which packages are installed)
76 serverList.push_back( Server( LOCAL_SERVER, "" ) ); 74 serverList.push_back( Server( LOCAL_SERVER, "" ) );
77 serverList.push_back( Server( LOCAL_IPKGS, "" ) ); 75 serverList.push_back( Server( LOCAL_IPKGS, "" ) );
78 76
79#ifdef QWS 77#ifdef QWS
80 Config cfg( "aqpkg" ); 78 Config cfg( "aqpkg" );
81 cfg.setGroup( "destinations" ); 79 cfg.setGroup( "destinations" );
82#endif 80#endif
83 81
84 // Read file from /etc/ipkg.conf 82 // Read file from /etc/ipkg.conf
85 QString ipkg_conf = IPKG_CONF; 83 QString ipkg_conf = IPKG_CONF;
86 FILE *fp; 84 FILE *fp;
87 fp = fopen( ipkg_conf, "r" ); 85 fp = fopen( ipkg_conf, "r" );
88 char line[130]; 86 char line[130];
89 QString lineStr; 87 QString lineStr;
90 if ( fp == NULL ) 88 if ( fp == NULL )
91 { 89 {
92 cout << "Couldn't open " << ipkg_conf << "! err = " << fp << endl; 90 cout << "Couldn't open " << ipkg_conf << "! err = " << fp << endl;
93 return; 91 return;
@@ -129,72 +127,67 @@ void DataManager :: loadServers()
129 linkToRoot = cfg.readBoolEntry( key, true ); 127 linkToRoot = cfg.readBoolEntry( key, true );
130#endif 128#endif
131 d.linkToRoot( linkToRoot ); 129 d.linkToRoot( linkToRoot );
132 130
133 destList.push_back( d ); 131 destList.push_back( d );
134 } 132 }
135 else if ( lineStr.startsWith( "option" ) ) 133 else if ( lineStr.startsWith( "option" ) )
136 { 134 {
137 char type[20]; 135 char type[20];
138 char val[100]; 136 char val[100];
139 sscanf( lineStr, "%*[^ ] %s %s", type, val ); 137 sscanf( lineStr, "%*[^ ] %s %s", type, val );
140 if ( stricmp( type, "http_proxy" ) == 0 ) 138 if ( stricmp( type, "http_proxy" ) == 0 )
141 httpProxy = val; 139 httpProxy = val;
142 if ( stricmp( type, "ftp_proxy" ) == 0 ) 140 if ( stricmp( type, "ftp_proxy" ) == 0 )
143 ftpProxy = val; 141 ftpProxy = val;
144 if ( stricmp( type, "proxy_username" ) == 0 ) 142 if ( stricmp( type, "proxy_username" ) == 0 )
145 proxyUsername = val; 143 proxyUsername = val;
146 if ( stricmp( type, "proxy_password" ) == 0 ) 144 if ( stricmp( type, "proxy_password" ) == 0 )
147 proxyPassword = val; 145 proxyPassword = val;
148 } 146 }
149 } 147 }
150 } 148 }
151 fclose( fp ); 149 fclose( fp );
152 150
153 cout << "httpProxy = " << httpProxy << endl;
154 cout << "ftpProxy = " << ftpProxy << endl;
155 cout << "proxyUsername = " << proxyUsername << endl;
156 cout << "proxyPassword = " << proxyPassword << endl;
157
158 reloadServerData( ); 151 reloadServerData( );
159} 152}
160 153
161void DataManager :: reloadServerData( ) 154void DataManager :: reloadServerData( )
162{ 155{
163 vector<Server>::iterator it = serverList.begin(); 156 vector<Server>::iterator it = serverList.begin();
164 for ( it = serverList.begin() ; it != serverList.end() ; ++it ) 157 for ( it = serverList.begin() ; it != serverList.end() ; ++it )
165 { 158 {
166 // Now we've read the config file in we need to read the servers 159 // Now we've read the config file in we need to read the servers
167 // The local server is a special case. This holds the contents of the 160 // The local server is a special case. This holds the contents of the
168 // status files the number of which depends on how many destinations 161 // status files the number of which depends on how many destinations
169 // we've set up 162 // we've set up
170 // The other servers files hold the contents of the server package list 163 // The other servers files hold the contents of the server package list
171 if ( it->getServerName() == LOCAL_SERVER ) 164 if ( it->getServerName() == LOCAL_SERVER )
172 it->readStatusFile( destList ); 165 it->readStatusFile( destList );
173 else if ( it->getServerName() == LOCAL_IPKGS ) 166 else if ( it->getServerName() == LOCAL_IPKGS )
174 it->readLocalIpks( getServer( LOCAL_SERVER ) ); 167 it->readLocalIpks( &( *getServer( LOCAL_SERVER ) ) );
175 else 168 else
176 it->readPackageFile( getServer( LOCAL_SERVER ) ); 169 it->readPackageFile( &( *getServer( LOCAL_SERVER ) ) );
177 } 170 }
178} 171}
179 172
180void DataManager :: writeOutIpkgConf() 173void DataManager :: writeOutIpkgConf()
181{ 174{
182 QString ipkg_conf = IPKG_CONF; 175 QString ipkg_conf = IPKG_CONF;
183 ofstream out( ipkg_conf ); 176 ofstream out( ipkg_conf );
184 177
185 out << "# Written by AQPkg" << endl; 178 out << "# Written by AQPkg" << endl;
186 out << "# Must have one or more source entries of the form:" << endl; 179 out << "# Must have one or more source entries of the form:" << endl;
187 out << "#" << endl; 180 out << "#" << endl;
188 out << "# src <src-name> <source-url>" << endl; 181 out << "# src <src-name> <source-url>" << endl;
189 out << "#" << endl; 182 out << "#" << endl;
190 out << "# and one or more destination entries of the form:" << endl; 183 out << "# and one or more destination entries of the form:" << endl;
191 out << "#" << endl; 184 out << "#" << endl;
192 out << "# dest <dest-name> <target-path>" << endl; 185 out << "# dest <dest-name> <target-path>" << endl;
193 out << "#" << endl; 186 out << "#" << endl;
194 out << "# where <src-name> and <dest-names> are identifiers that" << endl; 187 out << "# where <src-name> and <dest-names> are identifiers that" << endl;
195 out << "# should match [a-zA-Z0-9._-]+, <source-url> should be a" << endl; 188 out << "# should match [a-zA-Z0-9._-]+, <source-url> should be a" << endl;
196 out << "# URL that points to a directory containing a Familiar" << endl; 189 out << "# URL that points to a directory containing a Familiar" << endl;
197 out << "# Packages file, and <target-path> should be a directory" << endl; 190 out << "# Packages file, and <target-path> should be a directory" << endl;
198 out << "# that exists on the target system." << endl << endl; 191 out << "# that exists on the target system." << endl << endl;
199 192
200 // Write out servers 193 // Write out servers
diff --git a/noncore/settings/aqpkg/datamgr.h b/noncore/settings/aqpkg/datamgr.h
index 14b0b2f..41833df 100644
--- a/noncore/settings/aqpkg/datamgr.h
+++ b/noncore/settings/aqpkg/datamgr.h
@@ -17,57 +17,57 @@
17 17
18#ifndef DATAMGR_H 18#ifndef DATAMGR_H
19#define DATAMGR_H 19#define DATAMGR_H
20 20
21#include <map> 21#include <map>
22using namespace std; 22using namespace std;
23 23
24#include <qstring.h> 24#include <qstring.h>
25 25
26#include "server.h" 26#include "server.h"
27#include "destination.h" 27#include "destination.h"
28 28
29 #define LOCAL_SERVER "Installed Pkgs" 29 #define LOCAL_SERVER "Installed Pkgs"
30 #define LOCAL_IPKGS "local IPKG" 30 #define LOCAL_IPKGS "local IPKG"
31 31
32/** 32/**
33 *@author Andy Qua 33 *@author Andy Qua
34 */ 34 */
35 35
36 36
37class DataManager 37class DataManager
38{ 38{
39public: 39public:
40 DataManager(); 40 DataManager();
41 ~DataManager(); 41 ~DataManager();
42 42
43 void setActiveServer( const QString &act ) { activeServer = act; } 43 void setActiveServer( const QString &act ) { activeServer = act; }
44 QString &getActiveServer( ) { return activeServer; } 44 QString &getActiveServer( ) { return activeServer; }
45 45
46 Server *getLocalServer() { return getServer( LOCAL_SERVER ); } 46 Server *getLocalServer() { return &( *getServer( LOCAL_SERVER ) ); }
47 vector<Server> &getServerList() { return serverList; } 47 vector<Server> &getServerList() { return serverList; }
48 Server *getServer( const char *name ); 48 vector<Server>::iterator getServer( const char *name );
49 49
50 vector<Destination> &getDestinationList() { return destList; } 50 vector<Destination> &getDestinationList() { return destList; }
51 Destination *getDestination( const char *name ); 51 vector<Destination>::iterator getDestination( const char *name );
52 52
53 void loadServers(); 53 void loadServers();
54 void reloadServerData( ); 54 void reloadServerData( );
55 55
56 void writeOutIpkgConf(); 56 void writeOutIpkgConf();
57 57
58 static QString getAvailableCategories() { return availableCategories; } 58 static QString getAvailableCategories() { return availableCategories; }
59 static void setAvailableCategories( QString section ); 59 static void setAvailableCategories( QString section );
60 60
61private: 61private:
62 static QString availableCategories; 62 static QString availableCategories;
63 QString activeServer; 63 QString activeServer;
64 QString httpProxy; 64 QString httpProxy;
65 QString ftpProxy; 65 QString ftpProxy;
66 QString proxyUsername; 66 QString proxyUsername;
67 QString proxyPassword; 67 QString proxyPassword;
68 68
69 vector<Server> serverList; 69 vector<Server> serverList;
70 vector<Destination> destList; 70 vector<Destination> destList;
71}; 71};
72 72
73#endif 73#endif
diff --git a/noncore/settings/aqpkg/global.h b/noncore/settings/aqpkg/global.h
index fcec643..ddfb3ac 100644
--- a/noncore/settings/aqpkg/global.h
+++ b/noncore/settings/aqpkg/global.h
@@ -1,45 +1,45 @@
1/*************************************************************************** 1/***************************************************************************
2 global.h - description 2 global.h - description
3 ------------------- 3 -------------------
4 begin : Mon Aug 26 2002 4 begin : Mon Aug 26 2002
5 copyright : (C) 2002 by Andy Qua 5 copyright : (C) 2002 by Andy Qua
6 email : andy.qua@blueyonder.co.uk 6 email : andy.qua@blueyonder.co.uk
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#ifndef __GLOBAL_H 18#ifndef __GLOBAL_H
19#define __GLOBAL_H 19#define __GLOBAL_H
20 20
21#define VERSION_TEXT "AQPkg Version 1.3" 21#define VERSION_TEXT "AQPkg Version 1.4"
22 22
23// Uncomment the below line to run on a Linux box rather than a Zaurus 23// Uncomment the below line to run on a Linux box rather than a Zaurus
24// box this allows you to change where root is, and where to load config files from 24// box this allows you to change where root is, and where to load config files from
25// #define X86 25// #define X86
26 26
27// Sets up location of ipkg.conf and root directory 27// Sets up location of ipkg.conf and root directory
28#ifdef QWS 28#ifdef QWS
29 29
30#ifndef X86 30#ifndef X86
31 31
32// Running QT/Embedded on an arm processor 32// Running QT/Embedded on an arm processor
33#define IPKG_CONF "/etc/ipkg.conf" 33#define IPKG_CONF "/etc/ipkg.conf"
34#define ROOT "/" 34#define ROOT "/"
35#define IPKG_DIR "/usr/lib/ipkg/" 35#define IPKG_DIR "/usr/lib/ipkg/"
36 36
37#else 37#else
38 38
39// Running QT/Embedded on a X86 linux box 39// Running QT/Embedded on a X86 linux box
40#define IPKG_CONF "/home/andy/projects/aqpkg/aqpkg/data/ipkg.conf" 40#define IPKG_CONF "/home/andy/projects/aqpkg/aqpkg/data/ipkg.conf"
41#define ROOT "/home/andy/projects/aqpkg/aqpkg/data/root" 41#define ROOT "/home/andy/projects/aqpkg/aqpkg/data/root"
42#define IPKG_DIR "/home/andy/projects/aqpkg/aqpkg/data/" 42#define IPKG_DIR "/home/andy/projects/aqpkg/aqpkg/data/"
43 43
44#endif 44#endif
45 45
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index b297437..db9a259 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -144,49 +144,49 @@ void InstallDlgImpl :: optionsSelected()
144 cfg.writeEntry( "installFlags", flags ); 144 cfg.writeEntry( "installFlags", flags );
145#endif 145#endif
146} 146}
147 147
148void InstallDlgImpl :: installSelected() 148void InstallDlgImpl :: installSelected()
149{ 149{
150 if ( btnInstall->text() == "Close" ) 150 if ( btnInstall->text() == "Close" )
151 { 151 {
152 done( 1 ); 152 done( 1 );
153 return; 153 return;
154 } 154 }
155 155
156 btnInstall->setEnabled( false ); 156 btnInstall->setEnabled( false );
157 157
158 if ( pIpkg ) 158 if ( pIpkg )
159 { 159 {
160 output->setText( "" ); 160 output->setText( "" );
161 161
162 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 162 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
163 pIpkg->runIpkg(); 163 pIpkg->runIpkg();
164 } 164 }
165 else 165 else
166 { 166 {
167 output->setText( "" ); 167 output->setText( "" );
168 Destination *d = dataMgr->getDestination( destination->currentText() ); 168 vector<Destination>::iterator d = dataMgr->getDestination( destination->currentText() );
169 QString dest = d->getDestinationName(); 169 QString dest = d->getDestinationName();
170 QString destDir = d->getDestinationPath(); 170 QString destDir = d->getDestinationPath();
171 int instFlags = flags; 171 int instFlags = flags;
172 if ( d->linkToRoot() ) 172 if ( d->linkToRoot() )
173 instFlags |= MAKE_LINKS; 173 instFlags |= MAKE_LINKS;
174 174
175#ifdef QWS 175#ifdef QWS
176 // Save settings 176 // Save settings
177 Config cfg( "aqpkg" ); 177 Config cfg( "aqpkg" );
178 cfg.setGroup( "settings" ); 178 cfg.setGroup( "settings" );
179 cfg.writeEntry( "dest", dest ); 179 cfg.writeEntry( "dest", dest );
180#endif 180#endif
181 181
182 pIpkg = new Ipkg; 182 pIpkg = new Ipkg;
183 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 183 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
184 184
185 // First run through the remove list, then the install list then the upgrade list 185 // First run through the remove list, then the install list then the upgrade list
186 vector<InstallData>::iterator it; 186 vector<InstallData>::iterator it;
187 pIpkg->setOption( "remove" ); 187 pIpkg->setOption( "remove" );
188 for ( it = removeList.begin() ; it != removeList.end() ; ++it ) 188 for ( it = removeList.begin() ; it != removeList.end() ; ++it )
189 { 189 {
190 pIpkg->setDestination( it->destination->getDestinationName() ); 190 pIpkg->setDestination( it->destination->getDestinationName() );
191 pIpkg->setDestinationDir( it->destination->getDestinationPath() ); 191 pIpkg->setDestinationDir( it->destination->getDestinationPath() );
192 pIpkg->setPackage( it->packageName ); 192 pIpkg->setPackage( it->packageName );
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp
index 452eca3..8de3c48 100644
--- a/noncore/settings/aqpkg/ipkg.cpp
+++ b/noncore/settings/aqpkg/ipkg.cpp
@@ -1,42 +1,43 @@
1/*************************************************************************** 1/***************************************************************************
2 ipkg.cpp - description 2 ipkg.cpp - description
3 ------------------- 3 -------------------
4 begin : Sat Aug 31 2002 4 begin : Sat Aug 31 2002
5 copyright : (C) 2002 by Andy Qua 5 copyright : (C) 2002 by Andy Qua
6 email : andy.qua@blueyonder.co.uk 6 email : andy.qua@blueyonder.co.uk
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include <fstream> 18#include <fstream>
19#include <iostream>
19using namespace std; 20using namespace std;
20 21
21#include <stdio.h> 22#include <stdio.h>
22#include <unistd.h> 23#include <unistd.h>
23 24
24#ifdef QWS 25#ifdef QWS
25#include <qpe/qpeapplication.h> 26#include <qpe/qpeapplication.h>
26#else 27#else
27#include <qapplication.h> 28#include <qapplication.h>
28#endif 29#endif
29#include <qdir.h> 30#include <qdir.h>
30#include <qtextstream.h> 31#include <qtextstream.h>
31 32
32#include "utils.h" 33#include "utils.h"
33#include "ipkg.h" 34#include "ipkg.h"
34#include "global.h" 35#include "global.h"
35 36
36Ipkg :: Ipkg() 37Ipkg :: Ipkg()
37{ 38{
38} 39}
39 40
40Ipkg :: ~Ipkg() 41Ipkg :: ~Ipkg()
41{ 42{
42} 43}
diff --git a/noncore/settings/aqpkg/letterpushbutton.cpp b/noncore/settings/aqpkg/letterpushbutton.cpp
index afe25d8..ca96c6c 100644
--- a/noncore/settings/aqpkg/letterpushbutton.cpp
+++ b/noncore/settings/aqpkg/letterpushbutton.cpp
@@ -1,34 +1,34 @@
1/*************************************************************************** 1/***************************************************************************
2 letterpushbutton.cpp - description 2 letterpushbutton.cpp - description
3 ------------------- 3 -------------------
4 begin : Wed Oct 16 2002 4 begin : Wed Oct 16 2002
5 copyright : (C) 2002 by Andy Qua 5 copyright : (C) 2002 by Andy Qua
6 email : andy.qua@blueyonder.co.uk 6 email : andy.qua@blueyonder.co.uk
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include "letterpushbutton.h" 18#include "letterpushbutton.h"
19 19
20LetterPushButton :: LetterPushButton( const QString &text, QWidget *parent, const char *name=0 ) 20LetterPushButton :: LetterPushButton( const QString &text, QWidget *parent, const char *name )
21 : QPushButton( text, parent, name ) 21 : QPushButton( text, parent, name )
22{ 22{
23 connect( this, SIGNAL(released()), this, SLOT(released_emmitor()) ); 23 connect( this, SIGNAL(released()), this, SLOT(released_emmitor()) );
24} 24}
25 25
26LetterPushButton :: ~LetterPushButton() 26LetterPushButton :: ~LetterPushButton()
27{ 27{
28} 28}
29 29
30void LetterPushButton :: released_emmitor() 30void LetterPushButton :: released_emmitor()
31{ 31{
32 emit released( text() ); 32 emit released( text() );
33} 33}
34 34
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index 0141359..3ddc582 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -1,78 +1,79 @@
1/*************************************************************************** 1/***************************************************************************
2 mainwin.cpp - description 2 mainwin.cpp - description
3 ------------------- 3 -------------------
4 begin : Mon Aug 26 13:32:30 BST 2002 4 begin : Mon Aug 26 13:32:30 BST 2002
5 copyright : (C) 2002 by Andy Qua 5 copyright : (C) 2002 by Andy Qua
6 email : andy.qua@blueyonder.co.uk 6 email : andy.qua@blueyonder.co.uk
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include <iostream> 18#include <iostream>
19using namespace std;
19 20
20#include <qmenubar.h> 21#include <qmenubar.h>
21#include <qpopupmenu.h> 22#include <qpopupmenu.h>
22#include <qmessagebox.h> 23#include <qmessagebox.h>
23 24
24#include "mainwin.h" 25#include "mainwin.h"
25#include "datamgr.h" 26#include "datamgr.h"
26#include "networkpkgmgr.h" 27#include "networkpkgmgr.h"
27#include "settingsimpl.h" 28#include "settingsimpl.h"
28#include "helpwindow.h" 29#include "helpwindow.h"
29#include "utils.h" 30#include "utils.h"
30#include "global.h" 31#include "global.h"
31 32
32MainWindow :: MainWindow( QWidget *p, char *name ) 33MainWindow :: MainWindow( QWidget *p, char *name )
33 :QMainWindow( p, name ) 34 :QMainWindow( p, name )
34{ 35{
35#ifdef QWS 36#ifdef QWS
36 showMaximized(); 37 showMaximized();
37#endif 38#endif
38 39
39 setCaption( "AQPkg - Package Manager" ); 40 setCaption( "AQPkg - Package Manager" );
40 41
41 // Create our menu 42 // Create our menu
42 help = new QPopupMenu( this ); 43 help = new QPopupMenu( this );
43 help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_G ); 44 help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_G );
44 help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A ); 45 help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A );
45 46
46 settings = new QPopupMenu( this ); 47 settings = new QPopupMenu( this );
47 settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S ); 48 settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S );
48 49
49 edit = new QPopupMenu( this ); 50 edit = new QPopupMenu( this );
50 edit->insertItem( "&Find", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_I ); 51 edit->insertItem( "&Find", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_I );
51 edit->insertItem( "Find &Next", this, SLOT(repeatSearchForPackage()), Qt::CTRL+Qt::Key_N ); 52 edit->insertItem( "Find &Next", this, SLOT(repeatSearchForPackage()), Qt::CTRL+Qt::Key_N );
52 53
53 filter = new QPopupMenu( this ); 54 filter = new QPopupMenu( this );
54 mnuShowUninstalledPkgsId = filter->insertItem( "Show &Uninstalled Packages", this, SLOT(filterUninstalledPackages()), Qt::CTRL+Qt::Key_U ); 55 mnuShowUninstalledPkgsId = filter->insertItem( "Show &Non-Installed Packages", this, SLOT(filterUninstalledPackages()), Qt::CTRL+Qt::Key_U );
55 mnuShowInstalledPkgsId = filter->insertItem( "Show In&stalled Packages", this, SLOT(filterInstalledPackages()), Qt::CTRL+Qt::Key_S ); 56 mnuShowInstalledPkgsId = filter->insertItem( "Show In&stalled Packages", this, SLOT(filterInstalledPackages()), Qt::CTRL+Qt::Key_S );
56 mnuShowUpgradedPkgsId = filter->insertItem( "Show U&pdated Packages", this, SLOT(filterUpgradedPackages()), Qt::CTRL+Qt::Key_P ); 57 mnuShowUpgradedPkgsId = filter->insertItem( "Show U&pdated Packages", this, SLOT(filterUpgradedPackages()), Qt::CTRL+Qt::Key_P );
57 filter->insertSeparator(); 58 filter->insertSeparator();
58 mnuFilterByCategory = filter->insertItem( "Filter By &Category", this, SLOT(filterCategory()), Qt::CTRL+Qt::Key_C ); 59 mnuFilterByCategory = filter->insertItem( "Filter By &Category", this, SLOT(filterCategory()), Qt::CTRL+Qt::Key_C );
59 mnuSetFilterCategory = filter->insertItem( "Set Filter C&ategory", this, SLOT(setFilterCategory()), Qt::CTRL+Qt::Key_A ); 60 mnuSetFilterCategory = filter->insertItem( "Set Filter C&ategory", this, SLOT(setFilterCategory()), Qt::CTRL+Qt::Key_A );
60 61
61 // Create the main menu 62 // Create the main menu
62 menu = menuBar(); //new QMenuBar( this ); 63 menu = menuBar(); //new QMenuBar( this );
63 menu->insertItem( "&Settings", settings ); 64 menu->insertItem( "&Settings", settings );
64 menu->insertItem( "&Edit", edit ); 65 menu->insertItem( "&Edit", edit );
65 menu->insertItem( "&Filter", filter ); 66 menu->insertItem( "&Filter", filter );
66 menu->insertItem( "&Help", help ); 67 menu->insertItem( "&Help", help );
67 68
68 mgr = new DataManager(); 69 mgr = new DataManager();
69 mgr->loadServers(); 70 mgr->loadServers();
70 71
71 stack = new QWidgetStack( this ); 72 stack = new QWidgetStack( this );
72 73
73 networkPkgWindow = new NetworkPackageManager( mgr, stack ); 74 networkPkgWindow = new NetworkPackageManager( mgr, stack );
74 stack->addWidget( networkPkgWindow, 1 ); 75 stack->addWidget( networkPkgWindow, 1 );
75 76
76 setCentralWidget( stack ); 77 setCentralWidget( stack );
77 stack->raiseWidget( networkPkgWindow ); 78 stack->raiseWidget( networkPkgWindow );
78} 79}
@@ -185,25 +186,25 @@ void MainWindow :: filterUpgradedPackages()
185 filter->setItemChecked( mnuShowInstalledPkgsId, false ); 186 filter->setItemChecked( mnuShowInstalledPkgsId, false );
186 networkPkgWindow->showOnlyInstalledPackages( false ); 187 networkPkgWindow->showOnlyInstalledPackages( false );
187 188
188 networkPkgWindow->showUpgradedPackages( val ); 189 networkPkgWindow->showUpgradedPackages( val );
189} 190}
190 191
191void MainWindow :: setFilterCategory() 192void MainWindow :: setFilterCategory()
192{ 193{
193 if ( networkPkgWindow->setFilterCategory( ) ) 194 if ( networkPkgWindow->setFilterCategory( ) )
194 filter->setItemChecked( mnuFilterByCategory, true ); 195 filter->setItemChecked( mnuFilterByCategory, true );
195} 196}
196 197
197void MainWindow :: filterCategory() 198void MainWindow :: filterCategory()
198{ 199{
199 if ( filter->isItemChecked( mnuFilterByCategory ) ) 200 if ( filter->isItemChecked( mnuFilterByCategory ) )
200 { 201 {
201 networkPkgWindow->filterByCategory( false ); 202 networkPkgWindow->filterByCategory( false );
202 filter->setItemChecked( mnuFilterByCategory, false ); 203 filter->setItemChecked( mnuFilterByCategory, false );
203 } 204 }
204 else 205 else
205 { 206 {
206 if ( networkPkgWindow->filterByCategory( true ) ) 207 if ( networkPkgWindow->filterByCategory( true ) )
207 filter->setItemChecked( mnuFilterByCategory, true ); 208 filter->setItemChecked( mnuFilterByCategory, true );
208 } 209 }
209} \ No newline at end of file 210}
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index d9e62b6..79a380e 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -196,49 +196,49 @@ void NetworkPackageManager :: setupConnections()
196void NetworkPackageManager :: showProgressDialog( char *initialText ) 196void NetworkPackageManager :: showProgressDialog( char *initialText )
197{ 197{
198 if ( !progressDlg ) 198 if ( !progressDlg )
199 progressDlg = new ProgressDlg( this, "Progress", false ); 199 progressDlg = new ProgressDlg( this, "Progress", false );
200 progressDlg->setText( initialText ); 200 progressDlg->setText( initialText );
201 progressDlg->show(); 201 progressDlg->show();
202} 202}
203 203
204 204
205void NetworkPackageManager :: serverSelected( int ) 205void NetworkPackageManager :: serverSelected( int )
206{ 206{
207 packagesList->clear(); 207 packagesList->clear();
208 208
209 // display packages 209 // display packages
210 QString serverName = serversList->currentText(); 210 QString serverName = serversList->currentText();
211 currentlySelectedServer = serverName; 211 currentlySelectedServer = serverName;
212 212
213#ifdef QWS 213#ifdef QWS
214 // read download directory from config file 214 // read download directory from config file
215 Config cfg( "aqpkg" ); 215 Config cfg( "aqpkg" );
216 cfg.setGroup( "settings" ); 216 cfg.setGroup( "settings" );
217 cfg.writeEntry( "selectedServer", currentlySelectedServer ); 217 cfg.writeEntry( "selectedServer", currentlySelectedServer );
218#endif 218#endif
219 219
220 Server *s = dataMgr->getServer( serverName ); 220 vector<Server>::iterator s = dataMgr->getServer( serverName );
221 221
222 vector<Package> &list = s->getPackageList(); 222 vector<Package> &list = s->getPackageList();
223 vector<Package>::iterator it; 223 vector<Package>::iterator it;
224 for ( it = list.begin() ; it != list.end() ; ++it ) 224 for ( it = list.begin() ; it != list.end() ; ++it )
225 { 225 {
226 226
227 QString text = ""; 227 QString text = "";
228 228
229 // Apply show only uninstalled packages filter 229 // Apply show only uninstalled packages filter
230 if ( showUninstalledPkgs && it->isInstalled() ) 230 if ( showUninstalledPkgs && it->isInstalled() )
231 continue; 231 continue;
232 232
233 // Apply show only installed packages filter 233 // Apply show only installed packages filter
234 if ( showInstalledPkgs && !it->isInstalled() ) 234 if ( showInstalledPkgs && !it->isInstalled() )
235 continue; 235 continue;
236 236
237 // Apply show only new installed packages filter 237 // Apply show only new installed packages filter
238 if ( showUpgradedPkgs ) 238 if ( showUpgradedPkgs )
239 { 239 {
240 if ( !it->isInstalled() || 240 if ( !it->isInstalled() ||
241 compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 ) 241 compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 )
242 continue; 242 continue;
243 } 243 }
244 244
@@ -591,49 +591,49 @@ void NetworkPackageManager :: applyChanges()
591 // Finally let the main system update itself 591 // Finally let the main system update itself
592 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 592 QCopEnvelope e("QPE/System", "linkChanged(QString)");
593 QString lf = QString::null; 593 QString lf = QString::null;
594 e << lf; 594 e << lf;
595#endif 595#endif
596} 596}
597 597
598// decide what to do - either remove, upgrade or install 598// decide what to do - either remove, upgrade or install
599// Current rules: 599// Current rules:
600// If not installed - install 600// If not installed - install
601// If installed and different version available - upgrade 601// If installed and different version available - upgrade
602// If installed and version up to date - remove 602// If installed and version up to date - remove
603InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) 603InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item )
604{ 604{
605 QString name = item->text(); 605 QString name = item->text();
606 int pos = name.find( "*" ); 606 int pos = name.find( "*" );
607 name.truncate( pos ); 607 name.truncate( pos );
608 608
609 // if (there is a (installed), remove it 609 // if (there is a (installed), remove it
610 pos = name.find( "(installed)" ); 610 pos = name.find( "(installed)" );
611 if ( pos > 0 ) 611 if ( pos > 0 )
612 name.truncate( pos - 1 ); 612 name.truncate( pos - 1 );
613 613
614 // Get package 614 // Get package
615 Server *s = dataMgr->getServer( serversList->currentText() ); 615 vector<Server>::iterator s = dataMgr->getServer( serversList->currentText() );
616 Package *p = s->getPackage( name ); 616 Package *p = s->getPackage( name );
617 617
618 // If the package has a filename then it is a local file 618 // If the package has a filename then it is a local file
619 if ( p->isPackageStoredLocally() ) 619 if ( p->isPackageStoredLocally() )
620 name = p->getFilename(); 620 name = p->getFilename();
621 621
622 QString option; 622 QString option;
623 QString dest = "root"; 623 QString dest = "root";
624 if ( !p->isInstalled() ) 624 if ( !p->isInstalled() )
625 { 625 {
626 InstallData item; 626 InstallData item;
627 item.option = "I"; 627 item.option = "I";
628 item.packageName = name; 628 item.packageName = name;
629 return item; 629 return item;
630 } 630 }
631 else 631 else
632 { 632 {
633 InstallData item; 633 InstallData item;
634 item.option = "D"; 634 item.option = "D";
635 if ( !p->isPackageStoredLocally() ) 635 if ( !p->isPackageStoredLocally() )
636 item.packageName = p->getInstalledPackageName(); 636 item.packageName = p->getInstalledPackageName();
637 else 637 else
638 item.packageName = name; 638 item.packageName = name;
639 639
diff --git a/noncore/settings/aqpkg/server.cpp b/noncore/settings/aqpkg/server.cpp
index 58407d5..2cb0533 100644
--- a/noncore/settings/aqpkg/server.cpp
+++ b/noncore/settings/aqpkg/server.cpp
@@ -59,49 +59,49 @@ void Server :: cleanUp()
59 packageList.clear(); 59 packageList.clear();
60} 60}
61 61
62void Server :: readStatusFile( vector<Destination> &destList ) 62void Server :: readStatusFile( vector<Destination> &destList )
63{ 63{
64 cleanUp(); 64 cleanUp();
65 65
66 vector<Destination>::iterator dit; 66 vector<Destination>::iterator dit;
67 bool rootRead = false; 67 bool rootRead = false;
68 for ( dit = destList.begin() ; dit != destList.end() ; ++dit ) 68 for ( dit = destList.begin() ; dit != destList.end() ; ++dit )
69 { 69 {
70 bool installingToRoot = false; 70 bool installingToRoot = false;
71 71
72 QString path = dit->getDestinationPath(); 72 QString path = dit->getDestinationPath();
73 if ( path.right( 1 ) != "/" ) 73 if ( path.right( 1 ) != "/" )
74 path += "/"; 74 path += "/";
75 75
76 if ( path == "/" ) 76 if ( path == "/" )
77 { 77 {
78 rootRead = true; 78 rootRead = true;
79 installingToRoot = true; 79 installingToRoot = true;
80 } 80 }
81 81
82 packageFile = path + "usr/lib/ipkg/status"; 82 packageFile = path + "usr/lib/ipkg/status";
83 readPackageFile( 0, false, installingToRoot, dit ); 83 readPackageFile( 0, false, installingToRoot, &( *dit ) );
84 } 84 }
85 85
86 // Ensure that the root status file is read 86 // Ensure that the root status file is read
87 if ( !rootRead ) 87 if ( !rootRead )
88 { 88 {
89 cout << "Reading status file " << "/usr/lib/ipkg/status" << endl; 89 cout << "Reading status file " << "/usr/lib/ipkg/status" << endl;
90 packageFile = "/usr/lib/ipkg/status"; 90 packageFile = "/usr/lib/ipkg/status";
91 readPackageFile( 0, false, true ); 91 readPackageFile( 0, false, true );
92 } 92 }
93} 93}
94 94
95void Server :: readLocalIpks( Server *local ) 95void Server :: readLocalIpks( Server *local )
96{ 96{
97 cleanUp(); 97 cleanUp();
98 98
99#ifdef QWS 99#ifdef QWS
100 // First, get any local IPKGs in the documents area 100 // First, get any local IPKGs in the documents area
101 // Only applicable to Qtopie/Opie 101 // Only applicable to Qtopie/Opie
102 102
103 DocLnkSet files; 103 DocLnkSet files;
104 Global::findDocuments( &files, "application/ipkg" ); 104 Global::findDocuments( &files, "application/ipkg" );
105 105
106 // Now add the items to the list 106 // Now add the items to the list
107 QListIterator<DocLnk> it( files.children() ); 107 QListIterator<DocLnk> it( files.children() );
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp
index a18a178..9dd2206 100644
--- a/noncore/settings/aqpkg/settingsimpl.cpp
+++ b/noncore/settings/aqpkg/settingsimpl.cpp
@@ -1,42 +1,43 @@
1/*************************************************************************** 1/***************************************************************************
2 settingsimpl.cpp - description 2 settingsimpl.cpp - description
3 ------------------- 3 -------------------
4 begin : Thu Aug 29 2002 4 begin : Thu Aug 29 2002
5 copyright : (C) 2002 by Andy Qua 5 copyright : (C) 2002 by Andy Qua
6 email : andy.qua@blueyonder.co.uk 6 email : andy.qua@blueyonder.co.uk
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include <fstream> 18#include <fstream>
19#include <algorithm>
19using namespace std; 20using namespace std;
20 21
21#include <qlistbox.h> 22#include <qlistbox.h>
22#include <qlineedit.h> 23#include <qlineedit.h>
23#include <qpushbutton.h> 24#include <qpushbutton.h>
24#include <qtabwidget.h> 25#include <qtabwidget.h>
25#include <qcheckbox.h> 26#include <qcheckbox.h>
26 27
27#ifdef QWS 28#ifdef QWS
28#include <qpe/config.h> 29#include <qpe/config.h>
29#endif 30#endif
30 31
31#include "settingsimpl.h" 32#include "settingsimpl.h"
32 33
33#include "global.h" 34#include "global.h"
34 35
35SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) 36SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
36 : SettingsBase( parent, name, modal, fl ) 37 : SettingsBase( parent, name, modal, fl )
37{ 38{
38 dataMgr = dataManager; 39 dataMgr = dataManager;
39 40
40 setupData(); 41 setupData();
41 changed = false; 42 changed = false;
42 newserver = false; 43 newserver = false;
@@ -70,153 +71,153 @@ void SettingsImpl :: setupData()
70 continue; 71 continue;
71 72
72 servers->insertItem( it->getServerName() ); 73 servers->insertItem( it->getServerName() );
73 } 74 }
74 75
75 // add destinations 76 // add destinations
76 vector<Destination>::iterator it2; 77 vector<Destination>::iterator it2;
77 for ( it2 = dataMgr->getDestinationList().begin() ; it2 != dataMgr->getDestinationList().end() ; ++it2 ) 78 for ( it2 = dataMgr->getDestinationList().begin() ; it2 != dataMgr->getDestinationList().end() ; ++it2 )
78 destinations->insertItem( it2->getDestinationName() ); 79 destinations->insertItem( it2->getDestinationName() );
79 80
80#ifdef QWS 81#ifdef QWS
81 Config cfg( "aqpkg" ); 82 Config cfg( "aqpkg" );
82 cfg.setGroup( "settings" ); 83 cfg.setGroup( "settings" );
83 jumpTo->setChecked( cfg.readBoolEntry( "showJumpTo", "true" ) ); 84 jumpTo->setChecked( cfg.readBoolEntry( "showJumpTo", "true" ) );
84#else 85#else
85 jumpTo->setChecked( true ); 86 jumpTo->setChecked( true );
86#endif 87#endif
87} 88}
88 89
89//------------------ Servers tab ---------------------- 90//------------------ Servers tab ----------------------
90 91
91void SettingsImpl :: editServer( int sel ) 92void SettingsImpl :: editServer( int sel )
92{ 93{
93 currentSelectedServer = sel; 94 currentSelectedServer = sel;
94 Server *s = dataMgr->getServer( servers->currentText() ); 95 vector<Server>::iterator s = dataMgr->getServer( servers->currentText() );
95 serverName = s->getServerName(); 96 serverName = s->getServerName();
96 servername->setText( s->getServerName() ); 97 servername->setText( s->getServerName() );
97 serverurl->setText( s->getServerUrl() ); 98 serverurl->setText( s->getServerUrl() );
98 active->setChecked( s->isServerActive() ); 99 active->setChecked( s->isServerActive() );
99} 100}
100 101
101void SettingsImpl :: newServer() 102void SettingsImpl :: newServer()
102{ 103{
103 newserver = true; 104 newserver = true;
104 servername->setText( "" ); 105 servername->setText( "" );
105 serverurl->setText( "" ); 106 serverurl->setText( "" );
106 servername->setFocus(); 107 servername->setFocus();
107 active->setChecked( true ); 108 active->setChecked( true );
108} 109}
109 110
110void SettingsImpl :: removeServer() 111void SettingsImpl :: removeServer()
111{ 112{
112 changed = true; 113 changed = true;
113 Server *s = dataMgr->getServer( servers->currentText() ); 114 vector<Server>::iterator s = dataMgr->getServer( servers->currentText() );
114 dataMgr->getServerList().erase( s ); 115 dataMgr->getServerList().erase( s );
115 servers->removeItem( currentSelectedServer ); 116 servers->removeItem( currentSelectedServer );
116} 117}
117 118
118void SettingsImpl :: changeServerDetails() 119void SettingsImpl :: changeServerDetails()
119{ 120{
120 changed = true; 121 changed = true;
121 122
122 QString newName = servername->text(); 123 QString newName = servername->text();
123 if ( !newserver ) 124 if ( !newserver )
124 { 125 {
125 Server *s = dataMgr->getServer( serverName ); 126 vector<Server>::iterator s = dataMgr->getServer( servers->currentText() );
126 127
127 // Update url 128 // Update url
128 s->setServerUrl( serverurl->text() ); 129 s->setServerUrl( serverurl->text() );
129 s->setActive( active->isChecked() ); 130 s->setActive( active->isChecked() );
130 131
131 132
132 // Check if server name has changed, if it has then we need to replace the key in the map 133 // Check if server name has changed, if it has then we need to replace the key in the map
133 if ( serverName != newName ) 134 if ( serverName != newName )
134 { 135 {
135 // Update server name 136 // Update server name
136 s->setServerName( newName ); 137 s->setServerName( newName );
137 138
138 // See if this server is the active server 139 // See if this server is the active server
139 // if ( dataMgr->getActiveServer() == serverName ) 140 // if ( dataMgr->getActiveServer() == serverName )
140 // dataMgr->setActiveServer( newName ); 141 // dataMgr->setActiveServer( newName );
141 142
142 // Update list box 143 // Update list box
143 servers->changeItem( newName, currentSelectedServer ); 144 servers->changeItem( newName, currentSelectedServer );
144 } 145 }
145 } 146 }
146 else 147 else
147 { 148 {
148 Server s( newName, serverurl->text() ); 149 Server s( newName, serverurl->text() );
149 dataMgr->getServerList().push_back( Server( newName, serverurl->text() ) ); 150 dataMgr->getServerList().push_back( Server( newName, serverurl->text() ) );
150 dataMgr->getServerList().end()->setActive( active->isChecked() ); 151 dataMgr->getServerList().end()->setActive( active->isChecked() );
151 servers->insertItem( newName ); 152 servers->insertItem( newName );
152 servers->setCurrentItem( servers->count() ); 153 servers->setCurrentItem( servers->count() );
153 newserver = false; 154 newserver = false;
154 } 155 }
155} 156}
156 157
157//------------------ Destinations tab ---------------------- 158//------------------ Destinations tab ----------------------
158 159
159void SettingsImpl :: editDestination( int sel ) 160void SettingsImpl :: editDestination( int sel )
160{ 161{
161 currentSelectedDestination = sel; 162 currentSelectedDestination = sel;
162 Destination *d = dataMgr->getDestination( destinations->currentText() ); 163 vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() );
163 destinationName = d->getDestinationName(); 164 destinationName = d->getDestinationName();
164 destinationname->setText( d->getDestinationName() ); 165 destinationname->setText( d->getDestinationName() );
165 destinationurl->setText( d->getDestinationPath() ); 166 destinationurl->setText( d->getDestinationPath() );
166 linkToRoot->setChecked( d->linkToRoot() ); 167 linkToRoot->setChecked( d->linkToRoot() );
167} 168}
168 169
169void SettingsImpl :: newDestination() 170void SettingsImpl :: newDestination()
170{ 171{
171 newdestination = true; 172 newdestination = true;
172 destinationname->setText( "" ); 173 destinationname->setText( "" );
173 destinationurl->setText( "" ); 174 destinationurl->setText( "" );
174 destinationname->setFocus(); 175 destinationname->setFocus();
175 linkToRoot->setChecked( true ); 176 linkToRoot->setChecked( true );
176} 177}
177 178
178void SettingsImpl :: removeDestination() 179void SettingsImpl :: removeDestination()
179{ 180{
180 changed = true; 181 changed = true;
181 Destination *d = dataMgr->getDestination( destinations->currentText() ); 182 vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() );
182 dataMgr->getDestinationList().erase( d ); 183 dataMgr->getDestinationList().erase( d );
183 destinations->removeItem( currentSelectedDestination ); 184 destinations->removeItem( currentSelectedDestination );
184} 185}
185 186
186void SettingsImpl :: changeDestinationDetails() 187void SettingsImpl :: changeDestinationDetails()
187{ 188{
188 changed = true; 189 changed = true;
189 190
190#ifdef QWS 191#ifdef QWS
191 Config cfg( "aqpkg" ); 192 Config cfg( "aqpkg" );
192 cfg.setGroup( "destinations" ); 193 cfg.setGroup( "destinations" );
193#endif 194#endif
194 195
195 QString newName = destinationname->text(); 196 QString newName = destinationname->text();
196 if ( !newdestination ) 197 if ( !newdestination )
197 { 198 {
198 Destination *d = dataMgr->getDestination( destinationName ); 199 vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() );
199 200
200 // Update url 201 // Update url
201 d->setDestinationPath( destinationurl->text() ); 202 d->setDestinationPath( destinationurl->text() );
202 d->linkToRoot( linkToRoot->isChecked() ); 203 d->linkToRoot( linkToRoot->isChecked() );
203 204
204 // Check if server name has changed, if it has then we need to replace the key in the map 205 // Check if server name has changed, if it has then we need to replace the key in the map
205 if ( destinationName != newName ) 206 if ( destinationName != newName )
206 { 207 {
207 // Update server name 208 // Update server name
208 d->setDestinationName( newName ); 209 d->setDestinationName( newName );
209 210
210 // Update list box 211 // Update list box
211 destinations->changeItem( newName, currentSelectedDestination ); 212 destinations->changeItem( newName, currentSelectedDestination );
212 } 213 }
213#ifdef QWS 214#ifdef QWS
214 QString key = newName; 215 QString key = newName;
215 key += "_linkToRoot"; 216 key += "_linkToRoot";
216 int val = d->linkToRoot(); 217 int val = d->linkToRoot();
217 cfg.writeEntry( key, val ); 218 cfg.writeEntry( key, val );
218#endif 219#endif
219 } 220 }
220 else 221 else
221 { 222 {
222 dataMgr->getDestinationList().push_back( Destination( newName, destinationurl->text() ) ); 223 dataMgr->getDestinationList().push_back( Destination( newName, destinationurl->text() ) );