-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 86 |
1 files changed, 54 insertions, 32 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index d4f751c..b92a245 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp | |||
@@ -36,4 +36,5 @@ InstallDlgImpl::InstallDlgImpl( vector<QString> &packageList, DataManager *dataM | |||
36 | : InstallDlg( parent, name, modal, fl ) | 36 | : InstallDlg( parent, name, modal, fl ) |
37 | { | 37 | { |
38 | upgradePackages = false; | ||
38 | dataMgr = dataManager; | 39 | dataMgr = dataManager; |
39 | vector<Destination>::iterator dit; | 40 | vector<Destination>::iterator dit; |
@@ -100,4 +101,13 @@ InstallDlgImpl::InstallDlgImpl( vector<QString> &packageList, DataManager *dataM | |||
100 | } | 101 | } |
101 | 102 | ||
103 | InstallDlgImpl::InstallDlgImpl( QWidget *parent, const char *name, bool modal, WFlags fl ) | ||
104 | : InstallDlg( parent, name, modal, fl ) | ||
105 | { | ||
106 | upgradePackages = true; | ||
107 | output->setText( "Upgrading installed packages" ); | ||
108 | connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); | ||
109 | } | ||
110 | |||
111 | |||
102 | InstallDlgImpl::~InstallDlgImpl() | 112 | InstallDlgImpl::~InstallDlgImpl() |
103 | { | 113 | { |
@@ -147,41 +157,53 @@ void InstallDlgImpl :: installSelected() | |||
147 | btnInstall->setEnabled( false ); | 157 | btnInstall->setEnabled( false ); |
148 | 158 | ||
149 | output->setText( "" ); | 159 | if ( upgradePackages ) |
150 | Destination *d = dataMgr->getDestination( destination->currentText() ); | ||
151 | QString dest = d->getDestinationName(); | ||
152 | QString destDir = d->getDestinationPath(); | ||
153 | |||
154 | #ifdef QWS | ||
155 | // Save settings | ||
156 | Config cfg( "aqpkg" ); | ||
157 | cfg.setGroup( "settings" ); | ||
158 | cfg.writeEntry( "dest", dest ); | ||
159 | #endif | ||
160 | |||
161 | // First run through the remove list, then the install list then the upgrade list | ||
162 | vector<QString>::iterator it; | ||
163 | ipkg.setOption( "remove" ); | ||
164 | ipkg.setDestination( dest ); | ||
165 | ipkg.setDestinationDir( destDir ); | ||
166 | ipkg.setFlags( flags ); | ||
167 | for ( it = removeList.begin() ; it != removeList.end() ; ++it ) | ||
168 | { | 160 | { |
169 | ipkg.setPackage( *it ); | 161 | output->setText( "" ); |
162 | |||
163 | Ipkg ipkg; | ||
164 | connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); | ||
165 | ipkg.setOption( "upgrade" ); | ||
170 | ipkg.runIpkg(); | 166 | ipkg.runIpkg(); |
171 | } | 167 | } |
172 | 168 | else | |
173 | ipkg.setOption( "install" ); | ||
174 | for ( it = installList.begin() ; it != installList.end() ; ++it ) | ||
175 | { | 169 | { |
176 | ipkg.setPackage( *it ); | 170 | output->setText( "" ); |
177 | ipkg.runIpkg(); | 171 | Destination *d = dataMgr->getDestination( destination->currentText() ); |
178 | } | 172 | QString dest = d->getDestinationName(); |
173 | QString destDir = d->getDestinationPath(); | ||
179 | 174 | ||
180 | flags |= FORCE_REINSTALL; | 175 | #ifdef QWS |
181 | ipkg.setFlags( flags ); | 176 | // Save settings |
182 | for ( it = updateList.begin() ; it != updateList.end() ; ++it ) | 177 | Config cfg( "aqpkg" ); |
183 | { | 178 | cfg.setGroup( "settings" ); |
184 | ipkg.setPackage( *it ); | 179 | cfg.writeEntry( "dest", dest ); |
185 | ipkg.runIpkg(); | 180 | #endif |
181 | |||
182 | // First run through the remove list, then the install list then the upgrade list | ||
183 | vector<QString>::iterator it; | ||
184 | ipkg.setOption( "remove" ); | ||
185 | ipkg.setDestination( dest ); | ||
186 | ipkg.setDestinationDir( destDir ); | ||
187 | ipkg.setFlags( flags ); | ||
188 | for ( it = removeList.begin() ; it != removeList.end() ; ++it ) | ||
189 | { | ||
190 | ipkg.setPackage( *it ); | ||
191 | ipkg.runIpkg(); | ||
192 | } | ||
193 | |||
194 | ipkg.setOption( "install" ); | ||
195 | for ( it = installList.begin() ; it != installList.end() ; ++it ) | ||
196 | { | ||
197 | ipkg.setPackage( *it ); | ||
198 | ipkg.runIpkg(); | ||
199 | } | ||
200 | |||
201 | flags |= FORCE_REINSTALL; | ||
202 | ipkg.setFlags( flags ); | ||
203 | for ( it = updateList.begin() ; it != updateList.end() ; ++it ) | ||
204 | { | ||
205 | ipkg.setPackage( *it ); | ||
206 | ipkg.runIpkg(); | ||
207 | } | ||
186 | } | 208 | } |
187 | 209 | ||