Diffstat (limited to 'noncore/unsupported/oipkg/pmipkg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 96 |
1 files changed, 32 insertions, 64 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index be9d6da..fd8279b 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -57,13 +57,13 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
57 | 57 | ||
58 | cmd += " -force-defaults "; | 58 | cmd += " -force-defaults "; |
59 | 59 | ||
60 | if (_force_depends) | 60 | if (installDialog->_force_depends) |
61 | { | 61 | { |
62 | if (_force_depends->isChecked()) | 62 | if (installDialog->_force_depends->isChecked()) |
63 | cmd += " -force-depends "; | 63 | cmd += " -force-depends "; |
64 | if (_force_reinstall->isChecked()) | 64 | if (installDialog->_force_reinstall->isChecked()) |
65 | cmd += " -force-reinstall "; | 65 | cmd += " -force-reinstall "; |
66 | if (_force_remove->isChecked()) | 66 | if (installDialog->_force_remove->isChecked()) |
67 | cmd += " -force-removal-of-essential-packages "; | 67 | cmd += " -force-removal-of-essential-packages "; |
68 | } | 68 | } |
69 | 69 | ||
@@ -173,20 +173,17 @@ void PmIpkg::processLinkDir( QString file, QString dest ) | |||
173 | QDir destDir( destFile ); | 173 | QDir destDir( destFile ); |
174 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); | 174 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); |
175 | QDir d( file ); | 175 | QDir d( file ); |
176 | d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 176 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
177 | const QFileInfoList *list = d.entryInfoList(); | 177 | const QFileInfoList *list = d.entryInfoList(); |
178 | QFileInfoListIterator it( *list ); | 178 | QFileInfoListIterator it( *list ); |
179 | QFileInfo *fi; | 179 | QFileInfo *fi; |
180 | qDebug( "while %i",list->count()); | ||
180 | while ( (fi=it.current()) ) | 181 | while ( (fi=it.current()) ) |
181 | { | 182 | { |
183 | pvDebug(4, "processLinkDir "+fi->absFilePath()); | ||
182 | processLinkDir( fi->absFilePath(), dest ); | 184 | processLinkDir( fi->absFilePath(), dest ); |
183 | ++it; | 185 | ++it; |
184 | } | 186 | } |
185 | // if (linkOpp==removeLink) | ||
186 | // { | ||
187 | // pvDebug(2,"remove destDir "+ destFile ); | ||
188 | // destDir.remove( destFile, true ); | ||
189 | // } | ||
190 | } else | 187 | } else |
191 | if ( fileInfo.isFile() ) | 188 | if ( fileInfo.isFile() ) |
192 | { | 189 | { |
@@ -201,10 +198,12 @@ void PmIpkg::processLinkDir( QString file, QString dest ) | |||
201 | const char *linkFile = strdup( (destFile).ascii()); | 198 | const char *linkFile = strdup( (destFile).ascii()); |
202 | if( linkOpp==removeLink ) | 199 | if( linkOpp==removeLink ) |
203 | { | 200 | { |
204 | pvDebug(4,"removing "+destFile+" no "+file); | ||
205 | QFileInfo toRemoveLink( destFile ); | 201 | QFileInfo toRemoveLink( destFile ); |
206 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) | 202 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) |
203 | { | ||
204 | pvDebug(4,"removing "+destFile+" no "+file); | ||
207 | unlink( linkFile ); | 205 | unlink( linkFile ); |
206 | } | ||
208 | } | 207 | } |
209 | } | 208 | } |
210 | } | 209 | } |
@@ -223,12 +222,9 @@ void PmIpkg::loadList( PackageList pl ) | |||
223 | } | 222 | } |
224 | } | 223 | } |
225 | 224 | ||
226 | void PmIpkg::commit( PackageList pl ) | 225 | void PmIpkg::commit() |
227 | { | 226 | { |
228 | int sizecount = 0; | 227 | int sizecount = 0; |
229 | // QString rem="<b>"+tr("To remove:")+"</b><br>\n"; | ||
230 | // QString inst="<b>"+tr("To install:")+"</b><br>\n"; | ||
231 | loadList(pl); | ||
232 | for (uint i=0; i < to_remove.count(); i++) | 228 | for (uint i=0; i < to_remove.count(); i++) |
233 | sizecount += 1; | 229 | sizecount += 1; |
234 | for (uint i=0; i < to_install.count(); i++) | 230 | for (uint i=0; i < to_install.count(); i++) |
@@ -239,57 +235,26 @@ void PmIpkg::commit( PackageList pl ) | |||
239 | 235 | ||
240 | void PmIpkg::startDialog() | 236 | void PmIpkg::startDialog() |
241 | { | 237 | { |
242 | installDialog = new QDialog(0,0,true); | 238 | installDialog = new InstallDialog(settings,0,0,true); |
243 | QGridLayout *RunWindowLayout = new QGridLayout( installDialog ); | 239 | QCheckListItem *toRemoveItem; |
244 | RunWindowLayout->setSpacing( 2 ); | 240 | toRemoveItem= new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To remove") ); |
245 | RunWindowLayout->setMargin( 2 ); | 241 | toRemoveItem->setOpen( true ); |
246 | 242 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | |
247 | PackageListView *plv = new PackageListView(installDialog, "install",settings); | 243 | { |
248 | plv->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding, plv->sizePolicy().mayShrinkVertically()) ); | 244 | toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, it,settings) ); |
249 | RunWindowLayout->addWidget( plv, 1, 0 ); | 245 | } |
250 | QCheckListItem *toRemoveItem; | 246 | QCheckListItem *toInstallItem; |
251 | toRemoveItem= new QCheckListItem( plv, QObject::tr("To remove") ); | 247 | toInstallItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To install") ); |
252 | toRemoveItem->setOpen( true ); | 248 | toInstallItem->setOpen( true ); |
253 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | 249 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) |
254 | { | 250 | { |
255 | toRemoveItem->insertItem( new PackageListItem(plv, it,settings) ); | 251 | toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, it,settings) ); |
256 | } | 252 | } |
257 | QCheckListItem *toInstallItem; | ||
258 | toInstallItem = new QCheckListItem( plv, QObject::tr("To install") ); | ||
259 | toInstallItem->setOpen( true ); | ||
260 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | ||
261 | { | ||
262 | toInstallItem->insertItem( new PackageListItem(plv, it,settings) ); | ||
263 | } | ||
264 | |||
265 | QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" ); | ||
266 | GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().mayShrinkVertically() ) ); | ||
267 | GroupBox1->setTitle( tr( "Ipkg options" ) ); | ||
268 | GroupBox1->setColumnLayout(0, Qt::Vertical ); | ||
269 | GroupBox1->layout()->setSpacing( 0 ); | ||
270 | GroupBox1->layout()->setMargin( 0 ); | ||
271 | QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); | ||
272 | GroupBox1Layout->setAlignment( Qt::AlignTop ); | ||
273 | GroupBox1Layout->setSpacing( 3 ); | ||
274 | GroupBox1Layout->setMargin( 3 ); | ||
275 | _force_depends = new QCheckBox( GroupBox1, "_force_depends" ); | ||
276 | _force_depends->setText( tr( "-force-depends" ) ); | ||
277 | _force_depends->setAutoResize( TRUE ); | ||
278 | _force_depends->setChecked(true); | ||
279 | GroupBox1Layout->addWidget( _force_depends, 0, 0 ); | ||
280 | _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" ); | ||
281 | _force_reinstall->setText( tr( "-force-reinstall" ) ); | ||
282 | _force_reinstall->setAutoResize( TRUE ); | ||
283 | GroupBox1Layout->addWidget( _force_reinstall, 1, 0 ); | ||
284 | _force_remove = new QCheckBox( GroupBox1, "_force_remove" ); | ||
285 | _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); | ||
286 | _force_remove->setAutoResize( TRUE ); | ||
287 | GroupBox1Layout->addWidget( _force_remove, 1, 0 ); | ||
288 | RunWindowLayout->addWidget( GroupBox1 , 3, 0 ); | ||
289 | installDialog->showMaximized(); | 253 | installDialog->showMaximized(); |
290 | if ( installDialog->exec() ) doIt(); | 254 | if ( installDialog->exec() ) doIt(); |
291 | installDialog->close(); | 255 | installDialog->close(); |
292 | out(tr("<b>All done.</b>")); | 256 | out(tr("<b>All done.</b>")); |
257 | to_install.clear(); | ||
293 | } | 258 | } |
294 | 259 | ||
295 | void PmIpkg::doIt() | 260 | void PmIpkg::doIt() |
@@ -357,6 +322,7 @@ void PmIpkg::install() | |||
357 | } | 322 | } |
358 | } | 323 | } |
359 | out("<br>"); | 324 | out("<br>"); |
325 | to_install.clear(); | ||
360 | } | 326 | } |
361 | 327 | ||
362 | void PmIpkg::createLinks( const QString &dest ) | 328 | void PmIpkg::createLinks( const QString &dest ) |
@@ -365,7 +331,8 @@ void PmIpkg::createLinks( const QString &dest ) | |||
365 | linkOpp=createLink; | 331 | linkOpp=createLink; |
366 | QString url = settings->getDestinationUrlByName( dest ); | 332 | QString url = settings->getDestinationUrlByName( dest ); |
367 | url = url==""?dest:url; | 333 | url = url==""?dest:url; |
368 | processLinkDir( "/", url ); | 334 | processLinkDir( "/opt", url ); |
335 | processLinkDir( "/usr", url ); | ||
369 | } | 336 | } |
370 | 337 | ||
371 | void PmIpkg::removeLinks( const QString &dest ) | 338 | void PmIpkg::removeLinks( const QString &dest ) |
@@ -374,7 +341,8 @@ void PmIpkg::removeLinks( const QString &dest ) | |||
374 | linkOpp=removeLink; | 341 | linkOpp=removeLink; |
375 | QString url = settings->getDestinationUrlByName( dest ); | 342 | QString url = settings->getDestinationUrlByName( dest ); |
376 | url = url==""?dest:url; | 343 | url = url==""?dest:url; |
377 | processLinkDir( "/", url ); | 344 | processLinkDir( "/opt", url ); |
345 | processLinkDir( "/usr", url ); | ||
378 | } | 346 | } |
379 | 347 | ||
380 | void PmIpkg::update() | 348 | void PmIpkg::update() |