-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 67 | ||||
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.h | 17 | ||||
-rw-r--r-- | noncore/settings/aqpkg/ipkg.cpp | 23 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 88 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.h | 4 |
5 files changed, 136 insertions, 63 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index b92a245..bbb0be75 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp | |||
@@ -34,3 +34,3 @@ | |||
34 | 34 | ||
35 | InstallDlgImpl::InstallDlgImpl( vector<QString> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) | 35 | InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) |
36 | : InstallDlg( parent, name, modal, fl ) | 36 | : InstallDlg( parent, name, modal, fl ) |
@@ -48,3 +48,4 @@ InstallDlgImpl::InstallDlgImpl( vector<QString> &packageList, DataManager *dataM | |||
48 | // Grab flags - Turn MAKE_LINKS on by default (if no flags found) | 48 | // Grab flags - Turn MAKE_LINKS on by default (if no flags found) |
49 | flags = cfg.readNumEntry( "installFlags", MAKE_LINKS ); | 49 | // flags = cfg.readNumEntry( "installFlags", MAKE_LINKS ); |
50 | flags = 0; | ||
50 | #else | 51 | #else |
@@ -72,3 +73,3 @@ InstallDlgImpl::InstallDlgImpl( vector<QString> &packageList, DataManager *dataM | |||
72 | 73 | ||
73 | vector<QString>::iterator it; | 74 | vector<InstallData>::iterator it; |
74 | // setup package data | 75 | // setup package data |
@@ -79,17 +80,17 @@ InstallDlgImpl::InstallDlgImpl( vector<QString> &packageList, DataManager *dataM | |||
79 | { | 80 | { |
80 | QString name = *it; | 81 | InstallData item = *it; |
81 | if ( name.startsWith( "I" ) ) | 82 | if ( item.option == "I" ) |
82 | { | 83 | { |
83 | installList.push_back( name.mid(1) ); | 84 | installList.push_back( item ); |
84 | install += " " + name.mid(1) + "\n"; | 85 | install += " " + item.packageName + "\n"; |
85 | } | 86 | } |
86 | else if ( name.startsWith( "D" ) ) | 87 | else if ( item.option == "D" ) |
87 | { | 88 | { |
88 | removeList.push_back( name.mid(1) ); | 89 | removeList.push_back( item ); |
89 | remove += " " + name.mid(1) + "\n"; | 90 | remove += " " + item.packageName + "\n"; |
90 | } | 91 | } |
91 | else if ( name.startsWith( "U" ) ) | 92 | else if ( item.option == "U" ) |
92 | { | 93 | { |
93 | updateList.push_back( name.mid(1) ); | 94 | updateList.push_back( item ); |
94 | upgrade += " " + name.mid(1) + "\n"; | 95 | upgrade += " " + item.packageName + "\n"; |
95 | } | 96 | } |
@@ -138,4 +139,2 @@ void InstallDlgImpl :: optionsSelected() | |||
138 | flags |= FORCE_OVERWRITE; | 139 | flags |= FORCE_OVERWRITE; |
139 | if ( opt.makeLinks->isChecked() ) | ||
140 | flags |= MAKE_LINKS; | ||
141 | 140 | ||
@@ -173,2 +172,5 @@ void InstallDlgImpl :: installSelected() | |||
173 | QString destDir = d->getDestinationPath(); | 172 | QString destDir = d->getDestinationPath(); |
173 | int instFlags = 0; | ||
174 | if ( d->linkToRoot() ) | ||
175 | instFlags = MAKE_LINKS; | ||
174 | 176 | ||
@@ -182,10 +184,17 @@ void InstallDlgImpl :: installSelected() | |||
182 | // First run through the remove list, then the install list then the upgrade list | 184 | // First run through the remove list, then the install list then the upgrade list |
183 | vector<QString>::iterator it; | 185 | vector<InstallData>::iterator it; |
184 | ipkg.setOption( "remove" ); | 186 | ipkg.setOption( "remove" ); |
185 | ipkg.setDestination( dest ); | ||
186 | ipkg.setDestinationDir( destDir ); | ||
187 | ipkg.setFlags( flags ); | ||
188 | for ( it = removeList.begin() ; it != removeList.end() ; ++it ) | 187 | for ( it = removeList.begin() ; it != removeList.end() ; ++it ) |
189 | { | 188 | { |
190 | ipkg.setPackage( *it ); | 189 | ipkg.setDestination( it->destination->getDestinationName() ); |
190 | ipkg.setDestinationDir( it->destination->getDestinationPath() ); | ||
191 | ipkg.setPackage( it->packageName ); | ||
192 | |||
193 | int tmpFlags = flags; | ||
194 | if ( it->destination->linkToRoot() ) | ||
195 | tmpFlags |= MAKE_LINKS; | ||
196 | else | ||
197 | tmpFlags ^= MAKE_LINKS; | ||
198 | |||
199 | ipkg.setFlags( tmpFlags ); | ||
191 | ipkg.runIpkg(); | 200 | ipkg.runIpkg(); |
@@ -194,5 +203,8 @@ void InstallDlgImpl :: installSelected() | |||
194 | ipkg.setOption( "install" ); | 203 | ipkg.setOption( "install" ); |
204 | ipkg.setDestination( dest ); | ||
205 | ipkg.setDestinationDir( destDir ); | ||
206 | ipkg.setFlags( instFlags ); | ||
195 | for ( it = installList.begin() ; it != installList.end() ; ++it ) | 207 | for ( it = installList.begin() ; it != installList.end() ; ++it ) |
196 | { | 208 | { |
197 | ipkg.setPackage( *it ); | 209 | ipkg.setPackage( it->packageName ); |
198 | ipkg.runIpkg(); | 210 | ipkg.runIpkg(); |
@@ -201,6 +213,15 @@ void InstallDlgImpl :: installSelected() | |||
201 | flags |= FORCE_REINSTALL; | 213 | flags |= FORCE_REINSTALL; |
202 | ipkg.setFlags( flags ); | 214 | ipkg.setOption( "reinstall" ); |
203 | for ( it = updateList.begin() ; it != updateList.end() ; ++it ) | 215 | for ( it = updateList.begin() ; it != updateList.end() ; ++it ) |
204 | { | 216 | { |
205 | ipkg.setPackage( *it ); | 217 | ipkg.setDestination( it->destination->getDestinationName() ); |
218 | ipkg.setDestinationDir( it->destination->getDestinationPath() ); | ||
219 | ipkg.setPackage( it->packageName ); | ||
220 | |||
221 | int tmpFlags = flags; | ||
222 | if ( it->destination->linkToRoot() && it->recreateLinks ) | ||
223 | tmpFlags |= MAKE_LINKS; | ||
224 | else | ||
225 | tmpFlags ^= MAKE_LINKS; | ||
226 | ipkg.setFlags( tmpFlags ); | ||
206 | ipkg.runIpkg(); | 227 | ipkg.runIpkg(); |
diff --git a/noncore/settings/aqpkg/installdlgimpl.h b/noncore/settings/aqpkg/installdlgimpl.h index 8b05c52..3a5d8b8 100644 --- a/noncore/settings/aqpkg/installdlgimpl.h +++ b/noncore/settings/aqpkg/installdlgimpl.h | |||
@@ -27,2 +27,11 @@ using namespace std; | |||
27 | 27 | ||
28 | class InstallData | ||
29 | { | ||
30 | public: | ||
31 | QString option; // I - install, D - delete, U - upgrade | ||
32 | QString packageName; | ||
33 | Destination *destination; | ||
34 | bool recreateLinks; | ||
35 | }; | ||
36 | |||
28 | class InstallDlgImpl : public InstallDlg | 37 | class InstallDlgImpl : public InstallDlg |
@@ -30,3 +39,3 @@ class InstallDlgImpl : public InstallDlg | |||
30 | public: | 39 | public: |
31 | InstallDlgImpl( vector<QString> &packageList, DataManager *dataManager, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); | 40 | InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); |
32 | InstallDlgImpl( QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); | 41 | InstallDlgImpl( QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); |
@@ -41,5 +50,5 @@ private: | |||
41 | DataManager *dataMgr; | 50 | DataManager *dataMgr; |
42 | vector<QString> installList; | 51 | vector<InstallData> installList; |
43 | vector<QString> removeList; | 52 | vector<InstallData> removeList; |
44 | vector<QString> updateList; | 53 | vector<InstallData> updateList; |
45 | int flags; | 54 | int flags; |
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp index 6d0edad..02d4258 100644 --- a/noncore/settings/aqpkg/ipkg.cpp +++ b/noncore/settings/aqpkg/ipkg.cpp | |||
@@ -43,3 +43,3 @@ Ipkg :: ~Ipkg() | |||
43 | 43 | ||
44 | // Option is what we are going to do - install, upgrade, download | 44 | // Option is what we are going to do - install, upgrade, download, reinstall |
45 | // package is the package name to install - either a fully qualified path and ipk | 45 | // package is the package name to install - either a fully qualified path and ipk |
@@ -91,3 +91,2 @@ bool Ipkg :: runIpkg( ) | |||
91 | } | 91 | } |
92 | |||
93 | } | 92 | } |
@@ -99,3 +98,7 @@ bool Ipkg :: runIpkg( ) | |||
99 | 98 | ||
100 | cmd += " " + option; | 99 | |
100 | if ( option == "reinstall" ) | ||
101 | cmd += " install"; | ||
102 | else | ||
103 | cmd += " " + option; | ||
101 | if ( option != "upgrade" ) | 104 | if ( option != "upgrade" ) |
@@ -104,2 +107,5 @@ bool Ipkg :: runIpkg( ) | |||
104 | 107 | ||
108 | |||
109 | emit outputText( QString( "Dealing with package " ) + package ); | ||
110 | |||
105 | qApp->processEvents(); | 111 | qApp->processEvents(); |
@@ -108,3 +114,3 @@ bool Ipkg :: runIpkg( ) | |||
108 | // create the links | 114 | // create the links |
109 | if ( option == "remove" ) | 115 | if ( option == "remove" || option == "reinstall" ) |
110 | { | 116 | { |
@@ -127,3 +133,3 @@ bool Ipkg :: runIpkg( ) | |||
127 | 133 | ||
128 | if ( option == "install" ) | 134 | if ( option == "install" || option == "reinstall" ) |
129 | { | 135 | { |
@@ -155,2 +161,3 @@ bool Ipkg :: runIpkg( ) | |||
155 | emit outputText( QString( "Finished - status=" ) + (ret ? "success" : "failure") ); | 161 | emit outputText( QString( "Finished - status=" ) + (ret ? "success" : "failure") ); |
162 | emit outputText( "" ); | ||
156 | return ret; | 163 | return ret; |
@@ -184,3 +191,3 @@ int Ipkg :: executeIpkgCommand( QString &cmd, const QString option ) | |||
184 | //See if we're finished | 191 | //See if we're finished |
185 | if ( option == "install" ) | 192 | if ( option == "install" || option == "reinstall" ) |
186 | { | 193 | { |
@@ -244,3 +251,3 @@ QStringList* Ipkg :: getList( const QString &packageFilename, const QString &des | |||
244 | 251 | ||
245 | cout << "Try to open " << packageFileDir.latin1() << endl; | 252 | cout << "Try to open " << packageFileDir << endl; |
246 | if ( !f.open(IO_ReadOnly) ) | 253 | if ( !f.open(IO_ReadOnly) ) |
@@ -248,3 +255,3 @@ QStringList* Ipkg :: getList( const QString &packageFilename, const QString &des | |||
248 | // Couldn't open from dest, try from / | 255 | // Couldn't open from dest, try from / |
249 | // cout << "Could not open:" << packageFileDir << endl; | 256 | cout << "Could not open:" << packageFileDir << endl; |
250 | f.close(); | 257 | f.close(); |
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp index 6f528a1..ed5bf75 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.cpp +++ b/noncore/settings/aqpkg/networkpkgmgr.cpp | |||
@@ -206,2 +206,20 @@ void NetworkPackageManager :: serverSelected( int ) | |||
206 | QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); | 206 | QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); |
207 | |||
208 | if ( it->isInstalled() ) | ||
209 | { | ||
210 | QString destName = ""; | ||
211 | if ( it->getLocalPackage() ) | ||
212 | { | ||
213 | if ( it->getLocalPackage()->getInstalledTo() ) | ||
214 | destName = it->getLocalPackage()->getInstalledTo()->getDestinationName(); | ||
215 | } | ||
216 | else | ||
217 | { | ||
218 | if ( it->getInstalledTo() ) | ||
219 | destName = it->getInstalledTo()->getDestinationName(); | ||
220 | } | ||
221 | if ( destName != "" ) | ||
222 | new QCheckListItem( item, QString( "Installed To - " ) + destName ); | ||
223 | } | ||
224 | |||
207 | if ( !it->isPackageStoredLocally() ) | 225 | if ( !it->isPackageStoredLocally() ) |
@@ -257,16 +275,9 @@ void NetworkPackageManager :: updateServer() | |||
257 | 275 | ||
258 | // if ( serverName == LOCAL_SERVER ) | 276 | QString option = "update"; |
259 | // ; | 277 | QString dummy = ""; |
260 | // else if ( serverName == LOCAL_IPKGS ) | 278 | Ipkg ipkg; |
261 | // ; | 279 | connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); |
262 | // else | 280 | ipkg.setOption( option ); |
263 | { | 281 | |
264 | QString option = "update"; | 282 | ipkg.runIpkg( ); |
265 | QString dummy = ""; | ||
266 | Ipkg ipkg; | ||
267 | connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); | ||
268 | ipkg.setOption( option ); | ||
269 | |||
270 | ipkg.runIpkg( ); | ||
271 | } | ||
272 | 283 | ||
@@ -396,3 +407,3 @@ void NetworkPackageManager :: applyChanges() | |||
396 | { | 407 | { |
397 | // Disable buttons to stop silly people clicking lots on them :) | 408 | stickyOption = ""; |
398 | 409 | ||
@@ -404,3 +415,3 @@ void NetworkPackageManager :: applyChanges() | |||
404 | 415 | ||
405 | vector<QString> workingPackages; | 416 | vector<InstallData> workingPackages; |
406 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); | 417 | for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); |
@@ -411,4 +422,4 @@ void NetworkPackageManager :: applyChanges() | |||
411 | { | 422 | { |
412 | QString p = dealWithItem( item ); | 423 | InstallData data = dealWithItem( item ); |
413 | workingPackages.push_back( p ); | 424 | workingPackages.push_back( data ); |
414 | } | 425 | } |
@@ -439,3 +450,3 @@ void NetworkPackageManager :: applyChanges() | |||
439 | // If installed and version up to date - remove | 450 | // If installed and version up to date - remove |
440 | QString NetworkPackageManager :: dealWithItem( QCheckListItem *item ) | 451 | InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item ) |
441 | { | 452 | { |
@@ -460,6 +471,21 @@ QString NetworkPackageManager :: dealWithItem( QCheckListItem *item ) | |||
460 | if ( !p->isInstalled() ) | 471 | if ( !p->isInstalled() ) |
461 | return QString( "I" ) + name; | 472 | { |
473 | InstallData item; | ||
474 | item.option = "I"; | ||
475 | item.packageName = name; | ||
476 | return item; | ||
477 | } | ||
462 | else | 478 | else |
463 | { | 479 | { |
464 | if ( p->getVersion() == p->getInstalledVersion() ) | 480 | InstallData item; |
481 | item.option = "D"; | ||
482 | item.packageName = name; | ||
483 | if ( p->getInstalledTo() ) | ||
484 | item.destination = p->getInstalledTo(); | ||
485 | else | ||
486 | item.destination = p->getLocalPackage()->getInstalledTo(); | ||
487 | |||
488 | // Sticky option not implemented yet, but will eventually allow | ||
489 | // the user to say something like 'remove all' | ||
490 | if ( stickyOption == "" ) | ||
465 | { | 491 | { |
@@ -471,14 +497,22 @@ QString NetworkPackageManager :: dealWithItem( QCheckListItem *item ) | |||
471 | case 0: // Try again or Enter | 497 | case 0: // Try again or Enter |
472 | return QString( "D" ) + name; | 498 | item.option = "D"; |
473 | break; | 499 | break; |
474 | case 1: // Quit or Escape | 500 | case 1: // Quit or Escape |
475 | return QString( "U" ) + name; | 501 | item.option = "U"; |
476 | break; | 502 | break; |
477 | } | 503 | } |
478 | |||
479 | // User hit cancel (on dlg - assume remove) | ||
480 | return QString( "D" ) + name; | ||
481 | } | 504 | } |
482 | else | 505 | else |
483 | return QString( "U" ) + name; | 506 | { |
507 | // item.option = stickyOption; | ||
508 | } | ||
509 | |||
510 | // Check if we are reinstalling the same version | ||
511 | if ( p->getVersion() != p->getInstalledVersion() ) | ||
512 | item.recreateLinks = true; | ||
513 | else | ||
514 | item.recreateLinks = false; | ||
515 | |||
516 | // User hit cancel (on dlg - assume remove) | ||
517 | return item; | ||
484 | } | 518 | } |
diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h index 0ae64a6..7efa42c 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.h +++ b/noncore/settings/aqpkg/networkpkgmgr.h | |||
@@ -28,2 +28,3 @@ | |||
28 | #include "progressdlg.h" | 28 | #include "progressdlg.h" |
29 | class InstallData; | ||
29 | 30 | ||
@@ -61,3 +62,4 @@ private: | |||
61 | void showProgressDialog( char *initialText ); | 62 | void showProgressDialog( char *initialText ); |
62 | QString dealWithItem( QCheckListItem *item ); | 63 | InstallData dealWithItem( QCheckListItem *item ); |
64 | QString stickyOption; | ||
63 | 65 | ||