summaryrefslogtreecommitdiff
Unidiff
Diffstat (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
@@ -36,40 +36,38 @@ DataManager::DataManager()
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)
@@ -147,17 +145,12 @@ void DataManager :: loadServers()
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();
@@ -168,15 +161,15 @@ void DataManager :: reloadServerData( )
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;
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
@@ -35,23 +35,23 @@ using namespace std;
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
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
@@ -15,13 +15,13 @@
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
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
@@ -162,13 +162,13 @@ void InstallDlgImpl :: installSelected()
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
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
@@ -13,12 +13,13 @@
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
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
@@ -14,13 +14,13 @@
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()
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
@@ -13,12 +13,13 @@
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"
@@ -48,13 +49,13 @@ MainWindow :: MainWindow( QWidget *p, char *name )
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
@@ -203,7 +204,7 @@ void MainWindow :: filterCategory()
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
@@ -214,13 +214,13 @@ void NetworkPackageManager :: serverSelected( int )
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
@@ -609,13 +609,13 @@ InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item )
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
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
@@ -77,13 +77,13 @@ void Server :: readStatusFile( vector<Destination> &destList )
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;
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
@@ -13,12 +13,13 @@
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>
@@ -88,13 +89,13 @@ void SettingsImpl :: setupData()
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
@@ -106,26 +107,26 @@ void SettingsImpl :: newServer()
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
@@ -156,13 +157,13 @@ void SettingsImpl :: changeServerDetails()
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
@@ -174,15 +175,15 @@ void SettingsImpl :: newDestination()
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;
@@ -192,13 +193,13 @@ void SettingsImpl :: changeDestinationDetails()
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