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 | |||
@@ -29,13 +29,13 @@ | |||
29 | #include "datamgr.h" | 29 | #include "datamgr.h" |
30 | #include "instoptionsimpl.h" | 30 | #include "instoptionsimpl.h" |
31 | #include "destination.h" | 31 | #include "destination.h" |
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; |
39 | dataMgr = dataManager; | 39 | dataMgr = dataManager; |
40 | vector<Destination>::iterator dit; | 40 | vector<Destination>::iterator dit; |
41 | 41 | ||
@@ -43,13 +43,14 @@ InstallDlgImpl::InstallDlgImpl( vector<QString> &packageList, DataManager *dataM | |||
43 | #ifdef QWS | 43 | #ifdef QWS |
44 | Config cfg( "aqpkg" ); | 44 | Config cfg( "aqpkg" ); |
45 | cfg.setGroup( "settings" ); | 45 | cfg.setGroup( "settings" ); |
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 |
53 | 54 | ||
54 | // Output text is read only | 55 | // Output text is read only |
55 | output->setReadOnly( true ); | 56 | output->setReadOnly( true ); |
@@ -67,34 +68,34 @@ InstallDlgImpl::InstallDlgImpl( vector<QString> &packageList, DataManager *dataM | |||
67 | if ( dit->getDestinationName() == defaultDest ) | 68 | if ( dit->getDestinationName() == defaultDest ) |
68 | defIndex = i; | 69 | defIndex = i; |
69 | } | 70 | } |
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 | ||
98 | output->setText( remove + install + upgrade ); | 99 | output->setText( remove + install + upgrade ); |
99 | 100 | ||
100 | connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); | 101 | connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); |
@@ -133,14 +134,12 @@ void InstallDlgImpl :: optionsSelected() | |||
133 | if ( opt.forceReinstall->isChecked() ) | 134 | if ( opt.forceReinstall->isChecked() ) |
134 | flags |= FORCE_REINSTALL; | 135 | flags |= FORCE_REINSTALL; |
135 | if ( opt.forceRemove->isChecked() ) | 136 | if ( opt.forceRemove->isChecked() ) |
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" ); |
144 | cfg.setGroup( "settings" ); | 143 | cfg.setGroup( "settings" ); |
145 | cfg.writeEntry( "installFlags", flags ); | 144 | cfg.writeEntry( "installFlags", flags ); |
146 | #endif | 145 | #endif |
@@ -168,44 +167,66 @@ void InstallDlgImpl :: installSelected() | |||
168 | else | 167 | else |
169 | { | 168 | { |
170 | output->setText( "" ); | 169 | output->setText( "" ); |
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 |
177 | Config cfg( "aqpkg" ); | 179 | Config cfg( "aqpkg" ); |
178 | cfg.setGroup( "settings" ); | 180 | cfg.setGroup( "settings" ); |
179 | cfg.writeEntry( "dest", dest ); | 181 | cfg.writeEntry( "dest", dest ); |
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 | } |
209 | 230 | ||
210 | btnInstall->setEnabled( true ); | 231 | btnInstall->setEnabled( true ); |
211 | btnInstall->setText( tr( "Close" ) ); | 232 | btnInstall->setText( tr( "Close" ) ); |