summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/installdlgimpl.cpp
Unidiff
Diffstat (limited to 'noncore/settings/aqpkg/installdlgimpl.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index e122064..a924daf 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -94,22 +94,19 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
94 updateList.push_back( item ); 94 updateList.push_back( item );
95 upgrade += " " + item.packageName + "\n"; 95 upgrade += " " + item.packageName + "\n";
96 } 96 }
97 } 97 }
98 98
99 output->setText( remove + install + upgrade ); 99 output->setText( remove + install + upgrade );
100
101 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
102} 100}
103 101
104InstallDlgImpl::InstallDlgImpl( QWidget *parent, const char *name, bool modal, WFlags fl ) 102InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl )
105 : InstallDlg( parent, name, modal, fl ) 103 : InstallDlg( parent, name, modal, fl )
106{ 104{
107 upgradePackages = true; 105 pIpkg = ipkg;
108 output->setText( "Upgrading installed packages" ); 106 output->setText( initialText );
109 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
110} 107}
111 108
112 109
113InstallDlgImpl::~InstallDlgImpl() 110InstallDlgImpl::~InstallDlgImpl()
114{ 111{
115} 112}
@@ -152,20 +149,18 @@ void InstallDlgImpl :: installSelected()
152 done( 1 ); 149 done( 1 );
153 return; 150 return;
154 } 151 }
155 152
156 btnInstall->setEnabled( false ); 153 btnInstall->setEnabled( false );
157 154
158 if ( upgradePackages ) 155 if ( pIpkg )
159 { 156 {
160 output->setText( "" ); 157 output->setText( "" );
161 158
162 Ipkg ipkg; 159 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
163 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 160 pIpkg->runIpkg();
164 ipkg.setOption( "upgrade" );
165 ipkg.runIpkg();
166 } 161 }
167 else 162 else
168 { 163 {
169 output->setText( "" ); 164 output->setText( "" );
170 Destination *d = dataMgr->getDestination( destination->currentText() ); 165 Destination *d = dataMgr->getDestination( destination->currentText() );
171 QString dest = d->getDestinationName(); 166 QString dest = d->getDestinationName();
@@ -178,53 +173,58 @@ void InstallDlgImpl :: installSelected()
178 // Save settings 173 // Save settings
179 Config cfg( "aqpkg" ); 174 Config cfg( "aqpkg" );
180 cfg.setGroup( "settings" ); 175 cfg.setGroup( "settings" );
181 cfg.writeEntry( "dest", dest ); 176 cfg.writeEntry( "dest", dest );
182#endif 177#endif
183 178
179 pIpkg = new Ipkg;
180 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
181
184 // First run through the remove list, then the install list then the upgrade list 182 // First run through the remove list, then the install list then the upgrade list
185 vector<InstallData>::iterator it; 183 vector<InstallData>::iterator it;
186 ipkg.setOption( "remove" ); 184 pIpkg->setOption( "remove" );
187 for ( it = removeList.begin() ; it != removeList.end() ; ++it ) 185 for ( it = removeList.begin() ; it != removeList.end() ; ++it )
188 { 186 {
189 ipkg.setDestination( it->destination->getDestinationName() ); 187 pIpkg->setDestination( it->destination->getDestinationName() );
190 ipkg.setDestinationDir( it->destination->getDestinationPath() ); 188 pIpkg->setDestinationDir( it->destination->getDestinationPath() );
191 ipkg.setPackage( it->packageName ); 189 pIpkg->setPackage( it->packageName );
192 190
193 int tmpFlags = flags; 191 int tmpFlags = flags;
194 if ( it->destination->linkToRoot() ) 192 if ( it->destination->linkToRoot() )
195 tmpFlags |= MAKE_LINKS; 193 tmpFlags |= MAKE_LINKS;
196 194
197 ipkg.setFlags( tmpFlags ); 195 pIpkg->setFlags( tmpFlags );
198 ipkg.runIpkg(); 196 pIpkg->runIpkg();
199 } 197 }
200 198
201 ipkg.setOption( "install" ); 199 pIpkg->setOption( "install" );
202 ipkg.setDestination( dest ); 200 pIpkg->setDestination( dest );
203 ipkg.setDestinationDir( destDir ); 201 pIpkg->setDestinationDir( destDir );
204 ipkg.setFlags( instFlags ); 202 pIpkg->setFlags( instFlags );
205 for ( it = installList.begin() ; it != installList.end() ; ++it ) 203 for ( it = installList.begin() ; it != installList.end() ; ++it )
206 { 204 {
207 ipkg.setPackage( it->packageName ); 205 pIpkg->setPackage( it->packageName );
208 ipkg.runIpkg(); 206 pIpkg->runIpkg();
209 } 207 }
210 208
211 flags |= FORCE_REINSTALL; 209 flags |= FORCE_REINSTALL;
212 ipkg.setOption( "reinstall" ); 210 pIpkg->setOption( "reinstall" );
213 for ( it = updateList.begin() ; it != updateList.end() ; ++it ) 211 for ( it = updateList.begin() ; it != updateList.end() ; ++it )
214 { 212 {
215 ipkg.setDestination( it->destination->getDestinationName() ); 213 pIpkg->setDestination( it->destination->getDestinationName() );
216 ipkg.setDestinationDir( it->destination->getDestinationPath() ); 214 pIpkg->setDestinationDir( it->destination->getDestinationPath() );
217 ipkg.setPackage( it->packageName ); 215 pIpkg->setPackage( it->packageName );
218 216
219 int tmpFlags = flags; 217 int tmpFlags = flags;
220 if ( it->destination->linkToRoot() && it->recreateLinks ) 218 if ( it->destination->linkToRoot() && it->recreateLinks )
221 tmpFlags |= MAKE_LINKS; 219 tmpFlags |= MAKE_LINKS;
222 ipkg.setFlags( tmpFlags ); 220 pIpkg->setFlags( tmpFlags );
223 ipkg.runIpkg(); 221 pIpkg->runIpkg();
224 } 222 }
223
224 delete pIpkg;
225 } 225 }
226 226
227 btnInstall->setEnabled( true ); 227 btnInstall->setEnabled( true );
228 btnInstall->setText( tr( "Close" ) ); 228 btnInstall->setText( tr( "Close" ) );
229} 229}
230 230