summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/global.h2
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp20
-rw-r--r--noncore/settings/aqpkg/server.cpp8
3 files changed, 23 insertions, 7 deletions
diff --git a/noncore/settings/aqpkg/global.h b/noncore/settings/aqpkg/global.h
index 96ab46c..a4363b4 100644
--- a/noncore/settings/aqpkg/global.h
+++ b/noncore/settings/aqpkg/global.h
@@ -1,53 +1,53 @@
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 0.7" 21#define VERSION_TEXT "AQPkg Version 0.8"
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
46#else 46#else
47 47
48// Running QT on a X86 linux box 48// Running QT on a X86 linux box
49#define IPKG_CONF "/home/andy/projects/aqpkg/aqpkg/data/ipkg.conf" 49#define IPKG_CONF "/home/andy/projects/aqpkg/aqpkg/data/ipkg.conf"
50#define ROOT "/home/andy/projects/aqpkg/aqpkg/data/root" 50#define ROOT "/home/andy/projects/aqpkg/aqpkg/data/root"
51#define IPKG_DIR "/home/andy/projects/aqpkg/aqpkg/data/" 51#define IPKG_DIR "/home/andy/projects/aqpkg/aqpkg/data/"
52 52
53#endif 53#endif
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 3d06aef..dee834e 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -485,94 +485,104 @@ void NetworkPackageManager :: applyChanges()
485 // Reload data 485 // Reload data
486 dataMgr->reloadServerData(); 486 dataMgr->reloadServerData();
487 serverSelected(-1); 487 serverSelected(-1);
488 488
489#ifdef QWS 489#ifdef QWS
490 // Finally let the main system update itself 490 // Finally let the main system update itself
491 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 491 QCopEnvelope e("QPE/System", "linkChanged(QString)");
492 QString lf = QString::null; 492 QString lf = QString::null;
493 e << lf; 493 e << lf;
494#endif 494#endif
495} 495}
496 496
497// decide what to do - either remove, upgrade or install 497// decide what to do - either remove, upgrade or install
498// Current rules: 498// Current rules:
499// If not installed - install 499// If not installed - install
500// If installed and different version available - upgrade 500// If installed and different version available - upgrade
501// If installed and version up to date - remove 501// If installed and version up to date - remove
502InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) 502InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item )
503{ 503{
504 QString name = item->text(); 504 QString name = item->text();
505 int pos = name.find( "*" ); 505 int pos = name.find( "*" );
506 name.truncate( pos ); 506 name.truncate( pos );
507 507
508 // if (there is a (installed), remove it 508 // if (there is a (installed), remove it
509 pos = name.find( "(installed)" ); 509 pos = name.find( "(installed)" );
510 if ( pos > 0 ) 510 if ( pos > 0 )
511 name.truncate( pos - 1 ); 511 name.truncate( pos - 1 );
512 512
513 // Get package 513 // Get package
514 Server *s = dataMgr->getServer( serversList->currentText() ); 514 Server *s = dataMgr->getServer( serversList->currentText() );
515 Package *p = s->getPackage( name ); 515 Package *p = s->getPackage( name );
516 516
517 // If the package has a filename then it is a local file 517 // If the package has a filename then it is a local file
518 if ( p->isPackageStoredLocally() ) 518 if ( p->isPackageStoredLocally() )
519 name = p->getFilename(); 519 name = p->getFilename();
520
520 QString option; 521 QString option;
521 QString dest = "root"; 522 QString dest = "root";
522 if ( !p->isInstalled() ) 523 if ( !p->isInstalled() )
523 { 524 {
524 InstallData item; 525 InstallData item;
525 item.option = "I"; 526 item.option = "I";
526 item.packageName = name; 527 item.packageName = name;
527 return item; 528 return item;
528 } 529 }
529 else 530 else
530 { 531 {
531 InstallData item; 532 InstallData item;
532 item.option = "D"; 533 item.option = "D";
533 item.packageName = p->getInstalledPackageName(); 534 if ( !p->isPackageStoredLocally() )
535 item.packageName = p->getInstalledPackageName();
536 else
537 item.packageName = name;
538
534 if ( p->getInstalledTo() ) 539 if ( p->getInstalledTo() )
535 { 540 {
536 item.destination = p->getInstalledTo(); 541 item.destination = p->getInstalledTo();
537 cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; 542 cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl;
538 cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; 543 cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl;
539 } 544 }
540 else 545 else
541 { 546 {
542 item.destination = p->getLocalPackage()->getInstalledTo(); 547 item.destination = p->getLocalPackage()->getInstalledTo();
543 } 548 }
544 549
545 // Now see if version is newer or not 550 // Now see if version is newer or not
546 int val = compareVersions( p->getInstalledVersion(), p->getVersion() ); 551 int val = compareVersions( p->getInstalledVersion(), p->getVersion() );
552
553 // If the version requested is older and user selected a local ipk file, then reinstall the file
554 if ( p->isPackageStoredLocally() && val == -1 )
555 val = 0;
556
547 if ( val == -2 ) 557 if ( val == -2 )
548 { 558 {
549 // Error - should handle 559 // Error - should handle
550 } 560 }
551 else if ( val == -1 ) 561 else if ( val == -1 )
552 { 562 {
553 // Version available is older - remove only 563 // Version available is older - remove only
554 item.option = "D"; 564 item.option = "D";
555 } 565 }
556 else 566 else
557 { 567 {
558 QString caption; 568 QString caption;
559 QString text; 569 QString text;
560 QString secondButton; 570 QString secondButton;
561 QString secondOption; 571 QString secondOption;
562 if ( val == 0 ) 572 if ( val == 0 )
563 { 573 {
564 // Version available is the same - option to remove or reinstall 574 // Version available is the same - option to remove or reinstall
565 caption = "Do you wish to remove or reinstall\n%s?"; 575 caption = "Do you wish to remove or reinstall\n%s?";
566 text = "Remove or ReInstall"; 576 text = "Remove or ReInstall";
567 secondButton = "ReInstall"; 577 secondButton = "ReInstall";
568 secondOption = "R"; 578 secondOption = "R";
569 } 579 }
570 else if ( val == 1 ) 580 else if ( val == 1 )
571 { 581 {
572 // Version available is newer - option to remove or upgrade 582 // Version available is newer - option to remove or upgrade
573 caption = "Do you wish to remove or upgrade\n%s?"; 583 caption = "Do you wish to remove or upgrade\n%s?";
574 text = "Remove or Upgrade"; 584 text = "Remove or Upgrade";
575 secondButton = "Upgrade"; 585 secondButton = "Upgrade";
576 secondOption = "U"; 586 secondOption = "U";
577 } 587 }
578 588
diff --git a/noncore/settings/aqpkg/server.cpp b/noncore/settings/aqpkg/server.cpp
index 8bca892..539ebf0 100644
--- a/noncore/settings/aqpkg/server.cpp
+++ b/noncore/settings/aqpkg/server.cpp
@@ -81,65 +81,66 @@ void Server :: readStatusFile( vector<Destination> &destList )
81 readPackageFile( 0, false, installingToRoot, dit ); 81 readPackageFile( 0, false, installingToRoot, dit );
82 } 82 }
83 83
84 // Ensure that the root status file is read 84 // Ensure that the root status file is read
85 if ( !rootRead ) 85 if ( !rootRead )
86 { 86 {
87 cout << "Reading status file " << "/usr/lib/ipkg/status" << endl; 87 cout << "Reading status file " << "/usr/lib/ipkg/status" << endl;
88 packageFile = "/usr/lib/ipkg/status"; 88 packageFile = "/usr/lib/ipkg/status";
89 readPackageFile( 0, false, true ); 89 readPackageFile( 0, false, true );
90 } 90 }
91} 91}
92 92
93void Server :: readLocalIpks( Server *local ) 93void Server :: readLocalIpks( Server *local )
94{ 94{
95 cleanUp(); 95 cleanUp();
96 96
97#ifdef QWS 97#ifdef QWS
98 // First, get any local IPKGs in the documents area 98 // First, get any local IPKGs in the documents area
99 // Only applicable to Qtopie/Opie 99 // Only applicable to Qtopie/Opie
100 100
101 DocLnkSet files; 101 DocLnkSet files;
102 Global::findDocuments( &files, "application/ipkg" ); 102 Global::findDocuments( &files, "application/ipkg" );
103 103
104 // Now add the items to the list 104 // Now add the items to the list
105 QListIterator<DocLnk> it( files.children() ); 105 QListIterator<DocLnk> it( files.children() );
106 106
107 for ( ; it.current() ; ++it ) 107 for ( ; it.current() ; ++it )
108 { 108 {
109 // OK, we have a local IPK file, I think the standard naming conventions 109 // OK, we have a local IPK file, I think the standard naming conventions
110 // for these are packagename_version_arm.ipk 110 // for these are packagename_version_arm.ipk
111 QString file = (*it)->file(); 111 QString file = (*it)->file();
112 112
113 QString packageName = Utils::getPackageNameFromIpkFilename( file ); 113 // Changed to display the filename (excluding the path)
114 QString packageName = Utils::getFilenameFromIpkFilename( file );
114 QString ver = Utils::getPackageVersionFromIpkFilename( file ); 115 QString ver = Utils::getPackageVersionFromIpkFilename( file );
115 packageList.push_back( Package( packageName ) ); 116 packageList.push_back( Package( packageName ) );
116 packageList.back().setVersion( ver ); 117 packageList.back().setVersion( ver );
117 packageList.back().setFilename( file ); 118 packageList.back().setFilename( file );
118 packageList.back().setPackageStoredLocally( true ); 119 packageList.back().setPackageStoredLocally( true );
119 120
120 } 121 }
121#else 122#else
122 QString names[] = { "advancedfm_0.9.1-20020811_arm.ipk", "libopie_0.9.1-20020811_arm.ipk", "libopieobex_0.9.1-20020811.1_arm.ipk", "opie-addressbook_0.9.1-20020811_arm.ipk" }; 123 QString names[] = { "advancedfm_0.9.1-20020811_arm.ipk", "libopie_0.9.1-20020811_arm.ipk", "libopieobex_0.9.1-20020811.1_arm.ipk", "opie-addressbook_0.9.1-20020811_arm.ipk" };
123 for ( int i = 0 ; i < 4 ; ++i ) 124 for ( int i = 0 ; i < 4 ; ++i )
124 { 125 {
125 // OK, we have a local IPK file, I think the standard naming conventions 126 // OK, we have a local IPK file, I think the standard naming conventions
126 // for these are packagename_version_arm.ipk 127 // for these are packagename_version_arm.ipk
127 QString file = names[i]; 128 QString file = names[i];
128 int p = file.find( "_" ); 129 int p = file.find( "_" );
129 QString tmp = file.mid( 0, p ); 130 QString tmp = file.mid( 0, p );
130 packageList.push_back( Package( tmp ) ); 131 packageList.push_back( Package( tmp ) );
131 int p2 = file.find( "_", p+1 ); 132 int p2 = file.find( "_", p+1 );
132 tmp = file.mid( p+1, p2-(p+1) ); 133 tmp = file.mid( p+1, p2-(p+1) );
133 packageList.back().setVersion( tmp ); 134 packageList.back().setVersion( tmp );
134 packageList.back().setPackageStoredLocally( true ); 135 packageList.back().setPackageStoredLocally( true );
135 } 136 }
136#endif 137#endif
137 138
138 // build local packages 139 // build local packages
139 buildLocalPackages( local ); 140 buildLocalPackages( local );
140} 141}
141 142
142void Server :: readPackageFile( Server *local, bool clearAll, bool installingToRoot, Destination *dest ) 143void Server :: readPackageFile( Server *local, bool clearAll, bool installingToRoot, Destination *dest )
143{ 144{
144 ifstream in( packageFile ); 145 ifstream in( packageFile );
145 if ( !in.is_open() ) 146 if ( !in.is_open() )
@@ -198,64 +199,69 @@ void Server :: readPackageFile( Server *local, bool clearAll, bool installingToR
198 else if ( key == "Status" ) 199 else if ( key == "Status" )
199 { 200 {
200 if ( currPackage ) 201 if ( currPackage )
201 currPackage->setStatus( value ); 202 currPackage->setStatus( value );
202 } 203 }
203 else if ( key == "Description" ) 204 else if ( key == "Description" )
204 { 205 {
205 if ( currPackage ) 206 if ( currPackage )
206 currPackage->setDescription( value ); 207 currPackage->setDescription( value );
207 } 208 }
208 else if ( key == "Filename" ) 209 else if ( key == "Filename" )
209 { 210 {
210 if ( currPackage ) 211 if ( currPackage )
211 currPackage->setFilename( value ); 212 currPackage->setFilename( value );
212 } 213 }
213 else if ( key == "" ) 214 else if ( key == "" )
214 { 215 {
215 newPackage = true; 216 newPackage = true;
216 } 217 }
217 } while ( !in.eof() ); 218 } while ( !in.eof() );
218 219
219 in.close(); 220 in.close();
220 221
221 // build local packages 222 // build local packages
222 buildLocalPackages( local ); 223 buildLocalPackages( local );
223} 224}
224 225
225void Server :: buildLocalPackages( Server *local ) 226void Server :: buildLocalPackages( Server *local )
226{ 227{
227 for ( unsigned int i = 0 ; i < packageList.size() ; ++i ) 228 for ( unsigned int i = 0 ; i < packageList.size() ; ++i )
228 { 229 {
229 QString name = packageList[i].getPackageName(); 230 QString name = packageList[i].getPackageName();
231
232 // If the package name is an ipk name, then convert the filename to a package name
233 if ( name.find( ".ipk" ) != -1 )
234 name = Utils::getPackageNameFromIpkFilename( packageList[i].getFilename() );
235
230 if ( local ) 236 if ( local )
231 packageList[i].setLocalPackage( local->getPackage( name ) ); 237 packageList[i].setLocalPackage( local->getPackage( name ) );
232 else 238 else
233 packageList[i].setLocalPackage( 0 ); 239 packageList[i].setLocalPackage( 0 );
234 } 240 }
235 241
236} 242}
237 243
238Package *Server :: getPackage( QString &name ) 244Package *Server :: getPackage( QString &name )
239{ 245{
240 return getPackage( (const char *)name ); 246 return getPackage( (const char *)name );
241} 247}
242 248
243Package *Server :: getPackage( const char *name ) 249Package *Server :: getPackage( const char *name )
244{ 250{
245 Package *ret = 0; 251 Package *ret = 0;
246 252
247 for ( unsigned int i = 0 ; i < packageList.size() && ret == 0; ++i ) 253 for ( unsigned int i = 0 ; i < packageList.size() && ret == 0; ++i )
248 { 254 {
249 if ( packageList[i].getPackageName() == name ) 255 if ( packageList[i].getPackageName() == name )
250 ret = &packageList[i]; 256 ret = &packageList[i];
251 } 257 }
252 258
253 return ret; 259 return ret;
254} 260}
255 261
256QString Server :: toString() 262QString Server :: toString()
257{ 263{
258 QString ret = "Server\n name - " + serverName + 264 QString ret = "Server\n name - " + serverName +
259 "\n url - " + serverUrl + 265 "\n url - " + serverUrl +
260 "\n"; 266 "\n";
261 267