author | andyq <andyq> | 2002-10-17 22:58:36 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-10-17 22:58:36 (UTC) |
commit | cd48ed3935f1baa6392afee5764d0927abcf62cc (patch) (unidiff) | |
tree | 54423b7242c59457ded23ce0dd1e89ce05b630b1 /noncore/settings/aqpkg/installdlgimpl.cpp | |
parent | 4ce3fb5c10a50aece4ef8a78d07ed116ad754c27 (diff) | |
download | opie-cd48ed3935f1baa6392afee5764d0927abcf62cc.zip opie-cd48ed3935f1baa6392afee5764d0927abcf62cc.tar.gz opie-cd48ed3935f1baa6392afee5764d0927abcf62cc.tar.bz2 |
Changed so that installings/removing and upgrading from/to multiple destinations
works better
Diffstat (limited to 'noncore/settings/aqpkg/installdlgimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 67 |
1 files changed, 44 insertions, 23 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 | |||
@@ -32,7 +32,7 @@ | |||
32 | #include "installdlgimpl.h" | 32 | #include "installdlgimpl.h" |
33 | #include "global.h" | 33 | #include "global.h" |
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 ) |
37 | { | 37 | { |
38 | upgradePackages = false; | 38 | upgradePackages = false; |
@@ -46,7 +46,8 @@ InstallDlgImpl::InstallDlgImpl( vector<QString> &packageList, DataManager *dataM | |||
46 | defaultDest = cfg.readEntry( "dest", "root" ); | 46 | defaultDest = cfg.readEntry( "dest", "root" ); |
47 | 47 | ||
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 |
51 | flags = 0; | 52 | flags = 0; |
52 | #endif | 53 | #endif |
@@ -70,28 +71,28 @@ InstallDlgImpl::InstallDlgImpl( vector<QString> &packageList, DataManager *dataM | |||
70 | 71 | ||
71 | destination->setCurrentItem( defIndex ); | 72 | destination->setCurrentItem( defIndex ); |
72 | 73 | ||
73 | vector<QString>::iterator it; | 74 | vector<InstallData>::iterator it; |
74 | // setup package data | 75 | // setup package data |
75 | QString remove = "Remove\n"; | 76 | QString remove = "Remove\n"; |
76 | QString install = "\nInstall\n"; | 77 | QString install = "\nInstall\n"; |
77 | QString upgrade = "\nUpgrade\n"; | 78 | QString upgrade = "\nUpgrade\n"; |
78 | for ( it = packageList.begin() ; it != packageList.end() ; ++it ) | 79 | for ( it = packageList.begin() ; it != packageList.end() ; ++it ) |
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 | } |
96 | } | 97 | } |
97 | 98 | ||
@@ -136,8 +137,6 @@ void InstallDlgImpl :: optionsSelected() | |||
136 | flags |= FORCE_REMOVE; | 137 | flags |= FORCE_REMOVE; |
137 | if ( opt.forceOverwrite->isChecked() ) | 138 | if ( opt.forceOverwrite->isChecked() ) |
138 | flags |= FORCE_OVERWRITE; | 139 | flags |= FORCE_OVERWRITE; |
139 | if ( opt.makeLinks->isChecked() ) | ||
140 | flags |= MAKE_LINKS; | ||
141 | 140 | ||
142 | #ifdef QWS | 141 | #ifdef QWS |
143 | Config cfg( "aqpkg" ); | 142 | Config cfg( "aqpkg" ); |
@@ -171,6 +170,9 @@ void InstallDlgImpl :: installSelected() | |||
171 | Destination *d = dataMgr->getDestination( destination->currentText() ); | 170 | Destination *d = dataMgr->getDestination( destination->currentText() ); |
172 | QString dest = d->getDestinationName(); | 171 | QString dest = d->getDestinationName(); |
173 | QString destDir = d->getDestinationPath(); | 172 | QString destDir = d->getDestinationPath(); |
173 | int instFlags = 0; | ||
174 | if ( d->linkToRoot() ) | ||
175 | instFlags = MAKE_LINKS; | ||
174 | 176 | ||
175 | #ifdef QWS | 177 | #ifdef QWS |
176 | // Save settings | 178 | // Save settings |
@@ -180,29 +182,48 @@ void InstallDlgImpl :: installSelected() | |||
180 | #endif | 182 | #endif |
181 | 183 | ||
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(); |
192 | } | 201 | } |
193 | 202 | ||
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(); |
199 | } | 211 | } |
200 | 212 | ||
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(); |
207 | } | 228 | } |
208 | } | 229 | } |