author | tille <tille> | 2002-05-12 12:49:58 (UTC) |
---|---|---|
committer | tille <tille> | 2002-05-12 12:49:58 (UTC) |
commit | 98229e01acc37562671b546a8aa955415a0f5843 (patch) (unidiff) | |
tree | 5e08cfe4b8526591d636c8e7ada5374ecc29a828 | |
parent | c1cc5edca5d6d71350f841892fb7828f7be9ed9f (diff) | |
download | opie-98229e01acc37562671b546a8aa955415a0f5843.zip opie-98229e01acc37562671b546a8aa955415a0f5843.tar.gz opie-98229e01acc37562671b546a8aa955415a0f5843.tar.bz2 |
fixed install/remove segfault
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 19 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.h | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 22 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 2 |
4 files changed, 17 insertions, 27 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index a23c900..1c56aae 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -229,64 +229,65 @@ void MainWindow::makeMenu() | |||
229 | destBar->setStretchableWidget( CheckBoxLink ); | 229 | destBar->setStretchableWidget( CheckBoxLink ); |
230 | destAction->setToggleAction( true ); | 230 | destAction->setToggleAction( true ); |
231 | // destAction->addTo( viewMenu ); | 231 | // destAction->addTo( viewMenu ); |
232 | 232 | ||
233 | // configure the menus | 233 | // configure the menus |
234 | Config cfg( "oipkg", Config::User ); | 234 | Config cfg( "oipkg", Config::User ); |
235 | cfg.setGroup( "gui" ); | 235 | cfg.setGroup( "gui" ); |
236 | 236 | ||
237 | findShow( cfg.readBoolEntry( "findBar", true ) ); | 237 | findShow( cfg.readBoolEntry( "findBar", true ) ); |
238 | searchShow( cfg.readBoolEntry( "searchBar", true ) ); | 238 | searchShow( cfg.readBoolEntry( "searchBar", true ) ); |
239 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); | 239 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); |
240 | destShow( cfg.readBoolEntry( "destBar", false ) ); | 240 | destShow( cfg.readBoolEntry( "destBar", false ) ); |
241 | } | 241 | } |
242 | 242 | ||
243 | MainWindow::~MainWindow() | 243 | MainWindow::~MainWindow() |
244 | { | 244 | { |
245 | Config cfg( "oipkg", Config::User ); | 245 | Config cfg( "oipkg", Config::User ); |
246 | cfg.setGroup( "gui" ); | 246 | cfg.setGroup( "gui" ); |
247 | cfg.writeEntry( "findBar", !findBar->isHidden() ); | 247 | cfg.writeEntry( "findBar", !findBar->isHidden() ); |
248 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); | 248 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); |
249 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); | 249 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); |
250 | cfg.writeEntry( "destBar", !destBar->isHidden() ); | 250 | cfg.writeEntry( "destBar", !destBar->isHidden() ); |
251 | 251 | ||
252 | } | 252 | } |
253 | 253 | ||
254 | void MainWindow::runIpkg() | 254 | void MainWindow::runIpkg() |
255 | { | 255 | { |
256 | packageListServers.allPackages(); | 256 | packageListServers.allPackages(); |
257 | ipkg->loadList( &packageListSearch ); | 257 | ipkg->loadList( &packageListSearch ); |
258 | ipkg->loadList( &packageListDocLnk ); | 258 | ipkg->loadList( &packageListDocLnk ); |
259 | ipkg->loadList( &packageListServers ); | 259 | ipkg->loadList( &packageListServers ); |
260 | ipkg->commit(); | 260 | ipkg->commit(); |
261 | ipkg->clearLists(); | ||
261 | // ##### If we looked in the list of files, we could send out accurate | 262 | // ##### If we looked in the list of files, we could send out accurate |
262 | // ##### messages. But we don't bother yet, and just do an "all". | 263 | // ##### messages. But we don't bother yet, and just do an "all". |
263 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 264 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
264 | QString lf = QString::null; | 265 | QString lf = QString::null; |
265 | e << lf; | 266 | e << lf; |
266 | displayList(); | 267 | displayList(); |
267 | } | 268 | } |
268 | 269 | ||
269 | void MainWindow::updateList() | 270 | void MainWindow::updateList() |
270 | { | 271 | { |
271 | //wait->show(); | 272 | //wait->show(); |
272 | QTimer *t = new QTimer( this ); | 273 | QTimer *t = new QTimer( this ); |
273 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); | 274 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); |
274 | t->start( 0, false ); | 275 | t->start( 0, false ); |
275 | packageListServers.clear(); | 276 | packageListServers.clear(); |
276 | packageListSearch.clear(); | 277 | packageListSearch.clear(); |
277 | packageListDocLnk.clear(); | 278 | packageListDocLnk.clear(); |
278 | ipkg->update(); | 279 | ipkg->update(); |
279 | packageListServers.update(); | 280 | packageListServers.update(); |
280 | packageListSearch.update(); | 281 | packageListSearch.update(); |
281 | packageListDocLnk.update(); | 282 | packageListDocLnk.update(); |
282 | t->stop(); | 283 | t->stop(); |
283 | // wait->hide(); | 284 | // wait->hide(); |
284 | } | 285 | } |
285 | 286 | ||
286 | void MainWindow::filterList() | 287 | void MainWindow::filterList() |
287 | { | 288 | { |
288 | //wait->show(); | 289 | //wait->show(); |
289 | QString f = ""; | 290 | QString f = ""; |
290 | if ( findAction->isOn() ) f = findEdit->text(); | 291 | if ( findAction->isOn() ) f = findEdit->text(); |
291 | packageListServers.filterPackages( f ); | 292 | packageListServers.filterPackages( f ); |
292 | //wait->hide(); | 293 | //wait->hide(); |
@@ -391,87 +392,73 @@ void MainWindow::searchShow(bool b) | |||
391 | 392 | ||
392 | void MainWindow::searchClose() | 393 | void MainWindow::searchClose() |
393 | { | 394 | { |
394 | searchAction->setOn( false ); | 395 | searchAction->setOn( false ); |
395 | } | 396 | } |
396 | 397 | ||
397 | 398 | ||
398 | void MainWindow::destShow(bool b) | 399 | void MainWindow::destShow(bool b) |
399 | { | 400 | { |
400 | if (b) destBar->show(); | 401 | if (b) destBar->show(); |
401 | else destBar->hide(); | 402 | else destBar->hide(); |
402 | destAction->setOn( b ); | 403 | destAction->setOn( b ); |
403 | } | 404 | } |
404 | 405 | ||
405 | void MainWindow::destClose() | 406 | void MainWindow::destClose() |
406 | { | 407 | { |
407 | destAction->setOn( false ); | 408 | destAction->setOn( false ); |
408 | } | 409 | } |
409 | 410 | ||
410 | void MainWindow::rotateUpdateIcon() | 411 | void MainWindow::rotateUpdateIcon() |
411 | { | 412 | { |
412 | pvDebug(2, "MainWindow::rotateUpdateIcon"); | 413 | pvDebug(2, "MainWindow::rotateUpdateIcon"); |
413 | if ( updateIcon ) | 414 | if ( updateIcon ) |
414 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); | 415 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); |
415 | else | 416 | else |
416 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); | 417 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); |
417 | updateIcon = !updateIcon; | 418 | updateIcon = !updateIcon; |
418 | } | 419 | } |
419 | 420 | ||
420 | 421 | ||
421 | void MainWindow::setDocument(const QString &fileName) | 422 | void MainWindow::setDocument(const QString &fileName) |
422 | { | 423 | { |
423 | installFile(fileName); | ||
424 | // ##### If we looked in the list of files, we could send out accurate | ||
425 | // ##### messages. But we don't bother yet, and just do an "all". | ||
426 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | ||
427 | QString lf = QString::null; | ||
428 | e << lf; | ||
429 | // displayList(); | ||
430 | exit; | ||
431 | } | ||
432 | |||
433 | void MainWindow::installFile(const QString &fileName) | ||
434 | { | ||
435 | pvDebug(3, "MainWindow::installFile "+fileName); | ||
436 | if ( !QFile::exists( fileName ) ) return; | 424 | if ( !QFile::exists( fileName ) ) return; |
437 | ipkg->installFile( fileName ); | 425 | ipkg->installFile( fileName ); |
438 | // ##### If we looked in the list of files, we could send out accurate | ||
439 | // ##### messages. But we don't bother yet, and just do an "all". | ||
440 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 426 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
441 | QString lf = QString::null; | 427 | QString lf = QString::null; |
442 | e << lf; | 428 | e << lf; |
443 | displayList(); | 429 | exit; |
444 | } | 430 | } |
445 | 431 | ||
432 | |||
446 | void MainWindow::makeChannel() | 433 | void MainWindow::makeChannel() |
447 | { | 434 | { |
448 | channel = new QCopChannel( "QPE/Application/oipkg", this ); | 435 | channel = new QCopChannel( "QPE/Application/oipkg", this ); |
449 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 436 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
450 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 437 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
451 | } | 438 | } |
452 | 439 | ||
453 | 440 | ||
454 | 441 | ||
455 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) | 442 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) |
456 | { | 443 | { |
457 | pvDebug(3, "QCop "+msg+" "+QCString(arg)); | 444 | pvDebug(3, "QCop "+msg+" "+QCString(arg)); |
458 | if ( msg == "installFile(QString)" ) | 445 | if ( msg == "installFile(QString)" ) |
459 | { | 446 | { |
460 | ipkg->installFile( QString(arg) ); | 447 | ipkg->installFile( QString(arg) ); |
461 | }else if( msg == "removeFile(QString)" ) | 448 | }else if( msg == "removeFile(QString)" ) |
462 | { | 449 | { |
463 | ipkg->removeFile( QString(arg) ); | 450 | ipkg->removeFile( QString(arg) ); |
464 | }else if( msg == "createLinks(QString)" ) | 451 | }else if( msg == "createLinks(QString)" ) |
465 | { | 452 | { |
466 | ipkg->createLinks( QString(arg) ); | 453 | ipkg->createLinks( QString(arg) ); |
467 | }else if( msg == "removeLinks(QString)" ) | 454 | }else if( msg == "removeLinks(QString)" ) |
468 | { | 455 | { |
469 | ipkg->removeLinks( QString(arg) ); | 456 | ipkg->removeLinks( QString(arg) ); |
470 | }else{ | 457 | }else{ |
471 | pvDebug(2,"Huh what do ya want") | 458 | pvDebug(2,"Huh what do ya want") |
472 | } | 459 | } |
473 | } | 460 | } |
474 | 461 | ||
475 | 462 | ||
476 | void MainWindow::createLinks() | 463 | void MainWindow::createLinks() |
477 | { | 464 | { |
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h index 7c93dad..ce3e761 100644 --- a/noncore/unsupported/oipkg/mainwindow.h +++ b/noncore/unsupported/oipkg/mainwindow.h | |||
@@ -35,64 +35,63 @@ public: | |||
35 | QCopChannel *channel; | 35 | QCopChannel *channel; |
36 | 36 | ||
37 | protected slots: | 37 | protected slots: |
38 | void runIpkg(); | 38 | void runIpkg(); |
39 | void updateList(); | 39 | void updateList(); |
40 | void displayList(); | 40 | void displayList(); |
41 | void subSectionChanged(); | 41 | void subSectionChanged(); |
42 | void sectionChanged(); | 42 | void sectionChanged(); |
43 | void showSettings(); | 43 | void showSettings(); |
44 | void showSettingsSrv(); | 44 | void showSettingsSrv(); |
45 | void showSettingsDst(); | 45 | void showSettingsDst(); |
46 | 46 | ||
47 | public slots: | 47 | public slots: |
48 | void sectionClose(); | 48 | void sectionClose(); |
49 | void sectionShow(bool); | 49 | void sectionShow(bool); |
50 | void findClose(); | 50 | void findClose(); |
51 | void findShow(bool); | 51 | void findShow(bool); |
52 | void searchClose(); | 52 | void searchClose(); |
53 | void searchShow(bool); | 53 | void searchShow(bool); |
54 | void destClose(); | 54 | void destClose(); |
55 | void destShow(bool); | 55 | void destShow(bool); |
56 | void filterList(); | 56 | void filterList(); |
57 | void createLinks(); | 57 | void createLinks(); |
58 | void removeLinks(); | 58 | void removeLinks(); |
59 | void receive (const QCString &, const QByteArray &); | 59 | void receive (const QCString &, const QByteArray &); |
60 | void setDocument (const QString &); | 60 | void setDocument (const QString &); |
61 | void remotePackageQuery(); | 61 | void remotePackageQuery(); |
62 | 62 | ||
63 | private: | 63 | private: |
64 | void makeMenu(); | 64 | void makeMenu(); |
65 | void setSections(); | 65 | void setSections(); |
66 | void setSubSections(); | 66 | void setSubSections(); |
67 | void installFile(const QString &); | ||
68 | bool updateIcon; | 67 | bool updateIcon; |
69 | 68 | ||
70 | PmIpkg* ipkg; | 69 | PmIpkg* ipkg; |
71 | PackageManagerSettings *settings; | 70 | PackageManagerSettings *settings; |
72 | PackageListLocal packageListServers; | 71 | PackageListLocal packageListServers; |
73 | PackageListRemote packageListSearch; | 72 | PackageListRemote packageListSearch; |
74 | PackageListDocLnk packageListDocLnk; | 73 | PackageListDocLnk packageListDocLnk; |
75 | PackageListView *listViewPackages; | 74 | PackageListView *listViewPackages; |
76 | QAction *runAction; | 75 | QAction *runAction; |
77 | QAction *updateAction; | 76 | QAction *updateAction; |
78 | QAction *findAction; | 77 | QAction *findAction; |
79 | QPEToolBar *findBar; | 78 | QPEToolBar *findBar; |
80 | QLineEdit *findEdit; | 79 | QLineEdit *findEdit; |
81 | QAction *searchAction; | 80 | QAction *searchAction; |
82 | QAction *searchCommit; | 81 | QAction *searchCommit; |
83 | QPEToolBar *searchBar; | 82 | QPEToolBar *searchBar; |
84 | QLineEdit *searchEdit; | 83 | QLineEdit *searchEdit; |
85 | QAction *sectionAction; | 84 | QAction *sectionAction; |
86 | QPEToolBar *sectionBar; | 85 | QPEToolBar *sectionBar; |
87 | QComboBox *section; | 86 | QComboBox *section; |
88 | QComboBox *subsection; | 87 | QComboBox *subsection; |
89 | QAction *destAction; | 88 | QAction *destAction; |
90 | QPEToolBar *destBar; | 89 | QPEToolBar *destBar; |
91 | QComboBox *destination; | 90 | QComboBox *destination; |
92 | QCheckBox* CheckBoxLink; | 91 | QCheckBox* CheckBoxLink; |
93 | // QMessageBox *wait; | 92 | // QMessageBox *wait; |
94 | private slots: | 93 | private slots: |
95 | void rotateUpdateIcon(); | 94 | void rotateUpdateIcon(); |
96 | }; | 95 | }; |
97 | 96 | ||
98 | #endif | 97 | #endif |
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 0401a5b..30777c2 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -212,184 +212,186 @@ void PmIpkg::loadList( PackageList *pl ) | |||
212 | to_remove.append( pack ); | 212 | to_remove.append( pack ); |
213 | } | 213 | } |
214 | } | 214 | } |
215 | } | 215 | } |
216 | 216 | ||
217 | void PmIpkg::commit() | 217 | void PmIpkg::commit() |
218 | { | 218 | { |
219 | int sizecount = 0; | 219 | int sizecount = 0; |
220 | installDialog = new InstallDialog(settings,0,0,true); | 220 | installDialog = new InstallDialog(settings,0,0,true); |
221 | installDialog->toRemoveItem->setOpen( true ); | 221 | installDialog->toRemoveItem->setOpen( true ); |
222 | installDialog->toInstallItem->setOpen( true ); | 222 | installDialog->toInstallItem->setOpen( true ); |
223 | for (uint i=0; i < to_remove.count(); i++) | 223 | for (uint i=0; i < to_remove.count(); i++) |
224 | { | 224 | { |
225 | sizecount += 1; | 225 | sizecount += 1; |
226 | installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); | 226 | installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); |
227 | } | 227 | } |
228 | for (uint i=0; i < to_install.count(); i++) | 228 | for (uint i=0; i < to_install.count(); i++) |
229 | { | 229 | { |
230 | sizecount += to_install.at(i)->size().toInt(); | 230 | sizecount += to_install.at(i)->size().toInt(); |
231 | installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); | 231 | installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); |
232 | } | 232 | } |
233 | runwindow->progress->setTotalSteps(sizecount); | 233 | runwindow->progress->setTotalSteps(sizecount); |
234 | qDebug("Install size %i",sizecount); | 234 | qDebug("Install size %i",sizecount); |
235 | installDialog->showMaximized(); | 235 | installDialog->showMaximized(); |
236 | installDialog->show(); | 236 | installDialog->show(); |
237 | if ( installDialog->exec() ) | 237 | if ( installDialog->exec() ) |
238 | { | 238 | { |
239 | doIt(); | 239 | doIt(); |
240 | runwindow->showMaximized(); | 240 | runwindow->showMaximized(); |
241 | runwindow->show(); | 241 | runwindow->show(); |
242 | } | 242 | } |
243 | installDialog->close(); | 243 | installDialog->close(); |
244 | delete installDialog; | ||
244 | out(tr("\nAll done.")); | 245 | out(tr("\nAll done.")); |
245 | } | 246 | } |
246 | 247 | ||
247 | void PmIpkg::doIt() | 248 | void PmIpkg::doIt() |
248 | { | 249 | { |
249 | runwindow->progress->setProgress(0); | 250 | runwindow->progress->setProgress(0); |
250 | show(); | 251 | show(); |
251 | remove(); | 252 | remove(); |
252 | install(); | 253 | install(); |
253 | } | 254 | } |
254 | 255 | ||
255 | 256 | ||
256 | void PmIpkg::remove() | 257 | void PmIpkg::remove() |
257 | { | 258 | { |
258 | if ( to_remove.count() == 0 ) return; | 259 | if ( to_remove.count() == 0 ) return; |
259 | 260 | ||
260 | out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); | 261 | out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); |
261 | 262 | ||
262 | QStringList *fileList; | 263 | QStringList *fileList; |
263 | for (uint i=0; i < to_remove.count(); i++) | 264 | for (uint i=0; i < to_remove.count(); i++) |
264 | { | 265 | { |
265 | if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); | 266 | if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); |
266 | if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) | 267 | if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) |
267 | { | 268 | { |
268 | runwindow->progress->setProgress( 1 ); | 269 | runwindow->progress->setProgress( 1 ); |
269 | linkOpp = removeLink; | 270 | linkOpp = removeLink; |
270 | to_remove.at(i)->processed(); | 271 | to_remove.at(i)->processed(); |
271 | pvDebug(4,"link "+QString::number(i)); | 272 | pvDebug(3,"link "+QString::number(i)); |
272 | if ( to_remove.at(i)->link() ) | 273 | if ( to_remove.at(i)->link() ) |
273 | processFileList( fileList, to_remove.at(i)->dest() ); | 274 | processFileList( fileList, to_remove.at(i)->dest() ); |
274 | pvDebug(4,"take "+QString::number(i)); | 275 | //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count())); |
275 | to_remove.take( i ); | 276 | //if ( to_remove.at(i) ) to_remove.take( i ); |
276 | 277 | ||
277 | out("\n"); | 278 | out("\n"); |
278 | }else{ | 279 | }else{ |
279 | out(tr("Error while removing")+to_remove.at(i)->name()+"\n"); | 280 | out(tr("Error while removing ")+to_remove.at(i)->name()+"\n"); |
280 | if ( to_remove.at(i)->link() ) | 281 | if ( to_remove.at(i)->link() ) |
281 | processFileList( fileList, to_remove.at(i)->dest() ); | 282 | processFileList( fileList, to_remove.at(i)->dest() ); |
282 | } | 283 | } |
283 | if ( to_remove.at(i)->link() ) | 284 | if ( to_remove.at(i)->link() ) |
284 | processFileList( fileList, to_remove.at(i)->dest() ); | 285 | processFileList( fileList, to_remove.at(i)->dest() ); |
285 | if ( to_remove.at(i)->link() )delete fileList; | 286 | if ( to_remove.at(i)->link() )delete fileList; |
286 | } | 287 | } |
287 | to_remove.clear(); | 288 | to_remove.clear(); |
288 | out("\n"); | 289 | out("\n"); |
289 | } | 290 | } |
290 | 291 | ||
291 | 292 | ||
292 | void PmIpkg::install() | 293 | void PmIpkg::install() |
293 | { | 294 | { |
294 | if ( to_install.count() == 0 ) return; | 295 | if ( to_install.count() == 0 ) return; |
295 | out(tr("Installing")+"\n"+tr("please wait")+"\n"); | 296 | out(tr("Installing")+"\n"+tr("please wait")+"\n"); |
296 | for (uint i=0; i < to_install.count(); i++) | 297 | for (uint i=0; i < to_install.count(); i++) |
297 | { | 298 | { |
298 | qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug | 299 | qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug |
299 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) | 300 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) |
300 | { | 301 | { |
301 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); | 302 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); |
302 | to_install.at(i)->processed(); | 303 | to_install.at(i)->processed(); |
303 | linkOpp = createLink; | 304 | linkOpp = createLink; |
304 | if ( to_install.at(i)->link() ) | 305 | if ( to_install.at(i)->link() ) |
305 | makeLinks( to_install.at(i) ); | 306 | makeLinks( to_install.at(i) ); |
306 | to_install.take( i ); | 307 | // to_install.take( i ); |
307 | out("\n"); | 308 | out("\n"); |
308 | }else{ | 309 | }else{ |
309 | out(tr("Error while installing")+to_install.at(i)->name()+"\n"); | 310 | out(tr("Error while installing")+to_install.at(i)->name()+"\n"); |
310 | linkOpp = createLink; | 311 | linkOpp = createLink; |
311 | if ( to_install.at(i)->link() ) | 312 | if ( to_install.at(i)->link() ) |
312 | makeLinks( to_install.at(i) ); | 313 | makeLinks( to_install.at(i) ); |
313 | } | 314 | } |
314 | } | 315 | } |
315 | out("\n"); | 316 | out("\n"); |
316 | to_install.clear(); | 317 | to_install.clear(); |
317 | } | 318 | } |
318 | 319 | ||
319 | void PmIpkg::createLinks( const QString &dest ) | 320 | void PmIpkg::createLinks( const QString &dest ) |
320 | { | 321 | { |
321 | pvDebug(2,"PmIpkg::createLinks "+dest); | 322 | pvDebug(2,"PmIpkg::createLinks "+dest); |
322 | linkOpp=createLink; | 323 | linkOpp=createLink; |
323 | QString url = settings->getDestinationUrlByName( dest ); | 324 | QString url = settings->getDestinationUrlByName( dest ); |
324 | url = url==""?dest:url; | 325 | url = url==""?dest:url; |
325 | processLinkDir( "/opt", url ); | 326 | processLinkDir( "/opt", url ); |
326 | processLinkDir( "/usr", url ); | 327 | processLinkDir( "/usr", url ); |
327 | } | 328 | } |
328 | 329 | ||
329 | void PmIpkg::removeLinks( const QString &dest ) | 330 | void PmIpkg::removeLinks( const QString &dest ) |
330 | { | 331 | { |
331 | pvDebug(2,"PmIpkg::removeLinks "+dest); | 332 | pvDebug(2,"PmIpkg::removeLinks "+dest); |
332 | linkOpp=removeLink; | 333 | linkOpp=removeLink; |
333 | QString url = settings->getDestinationUrlByName( dest ); | 334 | QString url = settings->getDestinationUrlByName( dest ); |
334 | url = url==""?dest:url; | 335 | url = url==""?dest:url; |
335 | processLinkDir( "/opt", url ); | 336 | processLinkDir( "/opt", url ); |
336 | processLinkDir( "/usr", url ); | 337 | processLinkDir( "/usr", url ); |
337 | } | 338 | } |
338 | 339 | ||
339 | void PmIpkg::update() | 340 | void PmIpkg::update() |
340 | { | 341 | { |
341 | show(); | 342 | show(); |
342 | runIpkg( "update" ); | 343 | runIpkg( "update" ); |
343 | runwindow->close(); | 344 | runwindow->close(); |
344 | } | 345 | } |
345 | 346 | ||
346 | void PmIpkg::out( QString o ) | 347 | void PmIpkg::out( QString o ) |
347 | { | 348 | { |
348 | runwindow->outPut->append(o); | 349 | runwindow->outPut->append(o); |
349 | runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE); | 350 | runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE); |
350 | } | 351 | } |
351 | 352 | ||
352 | 353 | ||
353 | 354 | ||
354 | 355 | ||
355 | void PmIpkg::show() | 356 | void PmIpkg::show() |
356 | { | 357 | { |
357 | if (!runwindow->isVisible()) | 358 | if (!runwindow->isVisible()) |
358 | { | 359 | { |
359 | runwindow->showMaximized(); | 360 | runwindow->showMaximized(); |
360 | runwindow->show(); | 361 | runwindow->show(); |
361 | } | 362 | } |
362 | runwindow->outPut->setText(""); | 363 | runwindow->outPut->setText(""); |
363 | //showButtons(b); | ||
364 | //if ( !b ) | ||
365 | // runwindow->progress->hide(); | ||
366 | // else | ||
367 | // runwindow->progress->show(); | ||
368 | } | 364 | } |
369 | 365 | ||
370 | void PmIpkg::installFile(const QString &fileName, const QString &dest) | 366 | void PmIpkg::installFile(const QString &fileName, const QString &dest) |
371 | { | 367 | { |
372 | 368 | ||
373 | to_install.clear(); | 369 | to_install.clear(); |
374 | to_remove.clear(); | 370 | to_remove.clear(); |
375 | pvDebug( 2,"PmIpkg::installFile "+ fileName); | 371 | pvDebug( 2,"PmIpkg::installFile "+ fileName); |
376 | Package *p = new Package(fileName,settings); | 372 | Package *p = new Package(fileName,settings); |
377 | if ( dest!="") p->setDest( dest ); | 373 | if ( dest!="") p->setDest( dest ); |
378 | to_install.append( p ); | 374 | to_install.append( p ); |
379 | commit(); | 375 | commit(); |
380 | delete p; | 376 | delete p; |
381 | } | 377 | } |
382 | 378 | ||
383 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) | 379 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) |
384 | { | 380 | { |
385 | 381 | ||
386 | to_install.clear(); | 382 | to_install.clear(); |
387 | to_remove.clear(); | 383 | to_remove.clear(); |
388 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); | 384 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); |
389 | Package *p = new Package(fileName,settings); | 385 | Package *p = new Package(fileName,settings); |
390 | if ( dest!="") p->setDest( dest ); | 386 | if ( dest!="") p->setDest( dest ); |
391 | to_remove.append( p ); | 387 | to_remove.append( p ); |
392 | commit(); | 388 | commit(); |
393 | delete p; | 389 | delete p; |
394 | } | 390 | } |
395 | 391 | ||
392 | |||
393 | void PmIpkg::clearLists() | ||
394 | { | ||
395 | to_remove.clear(); | ||
396 | to_install.clear(); | ||
397 | } | ||
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index c543304..d53a74d 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h | |||
@@ -1,62 +1,64 @@ | |||
1 | #ifndef PMIPKG_H | 1 | #ifndef PMIPKG_H |
2 | #define PMIPKG_H | 2 | #define PMIPKG_H |
3 | 3 | ||
4 | 4 | ||
5 | #include <qobject.h> | 5 | #include <qobject.h> |
6 | #include <qlist.h> | 6 | #include <qlist.h> |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | #include <qwidget.h> | 8 | #include <qwidget.h> |
9 | #include "pksettings.h" | 9 | #include "pksettings.h" |
10 | #include "runwindow.h" | 10 | #include "runwindow.h" |
11 | #include "packagelist.h" | 11 | #include "packagelist.h" |
12 | #include "installdialog.h" | 12 | #include "installdialog.h" |
13 | #include "debug.h" | 13 | #include "debug.h" |
14 | 14 | ||
15 | #define createLink 0 | 15 | #define createLink 0 |
16 | #define removeLink 1 | 16 | #define removeLink 1 |
17 | 17 | ||
18 | class Package; | 18 | class Package; |
19 | class PmIpkg : public QObject | 19 | class PmIpkg : public QObject |
20 | { | 20 | { |
21 | Q_OBJECT | 21 | Q_OBJECT |
22 | public: | 22 | public: |
23 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); | 23 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); |
24 | ~PmIpkg(); | 24 | ~PmIpkg(); |
25 | 25 | ||
26 | int linkOpp; | 26 | int linkOpp; |
27 | void loadList( PackageList* ); | 27 | void loadList( PackageList* ); |
28 | void commit(); | 28 | void commit(); |
29 | void update(); | 29 | void update(); |
30 | void show(); | 30 | void show(); |
31 | /** No descriptions */ | ||
32 | void clearLists(); | ||
31 | 33 | ||
32 | public slots: | 34 | public slots: |
33 | void doIt(); | 35 | void doIt(); |
34 | void install(); | 36 | void install(); |
35 | void remove(); | 37 | void remove(); |
36 | void installFile(const QString &fileName, const QString &dest=""); | 38 | void installFile(const QString &fileName, const QString &dest=""); |
37 | void removeFile(const QString &fileName, const QString &dest=""); | 39 | void removeFile(const QString &fileName, const QString &dest=""); |
38 | void createLinks( const QString &dest ); | 40 | void createLinks( const QString &dest ); |
39 | void removeLinks( const QString &dest ); | 41 | void removeLinks( const QString &dest ); |
40 | 42 | ||
41 | private: | 43 | private: |
42 | PackageManagerSettings* settings; | 44 | PackageManagerSettings* settings; |
43 | RunWindow *runwindow; | 45 | RunWindow *runwindow; |
44 | InstallDialog *installDialog; | 46 | InstallDialog *installDialog; |
45 | QList<Package> to_remove; | 47 | QList<Package> to_remove; |
46 | QList<Package> to_install; | 48 | QList<Package> to_install; |
47 | QString fileNameToInstall; | 49 | QString fileNameToInstall; |
48 | QCheckBox *_force_reinstall; | 50 | QCheckBox *_force_reinstall; |
49 | QCheckBox *_force_remove; | 51 | QCheckBox *_force_remove; |
50 | QCheckBox *_force_depends; | 52 | QCheckBox *_force_depends; |
51 | // void startDialog(); | 53 | // void startDialog(); |
52 | void makeLinks(Package*); | 54 | void makeLinks(Package*); |
53 | void linkPackage( QString, QString ); | 55 | void linkPackage( QString, QString ); |
54 | void processLinkDir( QString , QString ); | 56 | void processLinkDir( QString , QString ); |
55 | bool runIpkg(const QString& args, const QString& dest="" ); | 57 | bool runIpkg(const QString& args, const QString& dest="" ); |
56 | void out( QString ); | 58 | void out( QString ); |
57 | QStringList* getList( QString, QString ); | 59 | QStringList* getList( QString, QString ); |
58 | void processFileList( QStringList*, QString ); | 60 | void processFileList( QStringList*, QString ); |
59 | 61 | ||
60 | 62 | ||
61 | }; | 63 | }; |
62 | 64 | ||