author | tille <tille> | 2002-05-08 17:36:13 (UTC) |
---|---|---|
committer | tille <tille> | 2002-05-08 17:36:13 (UTC) |
commit | 4216d2833503440d25ee40683cd563f379f125a6 (patch) (side-by-side diff) | |
tree | 54a7a5a88e0cb4ae0064197141717ebdd98d204d | |
parent | 8a293a84b7119bab0b84b5241c665ff5892faffc (diff) | |
download | opie-4216d2833503440d25ee40683cd563f379f125a6.zip opie-4216d2833503440d25ee40683cd563f379f125a6.tar.gz opie-4216d2833503440d25ee40683cd563f379f125a6.tar.bz2 |
fixed runwindow open on cancel
-rw-r--r-- | noncore/unsupported/oipkg/installdialog.cpp | 3 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/installdialog.h | 5 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 44 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 2 |
4 files changed, 30 insertions, 24 deletions
diff --git a/noncore/unsupported/oipkg/installdialog.cpp b/noncore/unsupported/oipkg/installdialog.cpp index 72f436a..a2c9702 100644 --- a/noncore/unsupported/oipkg/installdialog.cpp +++ b/noncore/unsupported/oipkg/installdialog.cpp @@ -62,24 +62,27 @@ InstallDialog::InstallDialog( PackageManagerSettings* s, QWidget* parent, const GroupBoxOptionsLayout->addWidget( _force_reinstall, 1, 0 ); _force_remove = new QCheckBox( GroupBoxOptions, "_force_remove" ); QFont _force_remove_font( _force_remove->font() ); _force_remove_font.setPointSize( 8 ); _force_remove->setFont( _force_remove_font ); _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); GroupBoxOptionsLayout->addWidget( _force_remove, 2, 0 ); InstallDialogLayout->addWidget( GroupBoxOptions, 1, 0 ); + toRemoveItem = new QCheckListItem( ListViewPackages, QObject::tr("To remove") ); + toInstallItem = new QCheckListItem( ListViewPackages, QObject::tr("To install") ); + } /* * Destroys the object and frees any allocated resources */ InstallDialog::~InstallDialog() { // no need to delete child widgets, Qt does it all for us } /* * Main event handler. Reimplemented to handle application diff --git a/noncore/unsupported/oipkg/installdialog.h b/noncore/unsupported/oipkg/installdialog.h index f2164ac..5af2c35 100644 --- a/noncore/unsupported/oipkg/installdialog.h +++ b/noncore/unsupported/oipkg/installdialog.h @@ -16,31 +16,32 @@ class QVBoxLayout; class QHBoxLayout; class QGridLayout; class QCheckBox; class QGroupBox; class QListView; class QListViewItem; class InstallDialog : public QDialog { Q_OBJECT -public: - InstallDialog( PackageManagerSettings* s, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); +public: InstallDialog( PackageManagerSettings* s, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~InstallDialog(); PackageListView* ListViewPackages; QGroupBox* GroupBoxOptions; QCheckBox* _force_depends; QCheckBox* _force_reinstall; QCheckBox* _force_remove; + QCheckListItem *toRemoveItem; + QCheckListItem *toInstallItem; protected: QGridLayout* InstallDialogLayout; QGridLayout* GroupBoxOptionsLayout; bool event( QEvent* ); private: PackageManagerSettings* settings; }; #endif // INSTALLDIALOG_H diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 75f93cf..f2852c3 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp @@ -206,113 +206,115 @@ void PmIpkg::loadList( PackageList *pl ) if ( pack->toInstall() ) to_install.append( pack ); if ( pack->toRemove() ) to_remove.append( pack ); } } } void PmIpkg::commit() { int sizecount = 0; installDialog = new InstallDialog(settings,0,0,true); - QCheckListItem *toRemoveItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To remove") ); - QCheckListItem *toInstallItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To install") ); - toRemoveItem->setOpen( true ); - toInstallItem->setOpen( true ); + installDialog->toRemoveItem->setOpen( true ); + installDialog->toInstallItem->setOpen( true ); for (uint i=0; i < to_remove.count(); i++) { sizecount += 1; - toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); + installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); } for (uint i=0; i < to_install.count(); i++) { sizecount += to_install.at(i)->size().toInt(); - toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); + installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); } runwindow->progress->setTotalSteps(sizecount); qDebug("Install size %i",sizecount); installDialog->showMaximized(); installDialog->show(); - if ( installDialog->exec() ) doIt(); - installDialog->close(); + if ( installDialog->exec() ) + { + doIt(); runwindow->showMaximized(); runwindow->show(); + } + installDialog->close(); out(tr("\nAll done.")); } void PmIpkg::doIt() { runwindow->progress->setProgress(0); show(); remove(); install(); } void PmIpkg::remove() { if ( to_remove.count() == 0 ) return; out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); QStringList *fileList; for (uint i=0; i < to_remove.count(); i++) { if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); - if ( runIpkg("remove " + to_remove.at(i)->name(), to_remove.at(i)->dest() )) + if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) { runwindow->progress->setProgress( 1 ); linkOpp = removeLink; - if ( to_remove.at(i)->link() ) - { - out( "\nremoving links\n" ); - out( "for package "+to_remove.at(i)->name()+" in "+to_remove.at(i)->dest()+"\n" ); - processFileList( fileList, to_remove.at(i)->dest() ); - } to_remove.at(i)->processed(); to_remove.take( i ); + out("\n\n"); }else{ out(tr("Error while removing")+to_remove.at(i)->name()+"\n"); } + if ( to_remove.at(i)->link() ) + { + out( "\nremoving links\n" ); + out( "for package "+to_remove.at(i)->name()+" in "+to_remove.at(i)->dest()+"\n" ); + processFileList( fileList, to_remove.at(i)->dest() ); + } if ( to_remove.at(i)->link() )delete fileList; } to_remove.clear(); out("\n"); } void PmIpkg::install() { if ( to_install.count() == 0 ) return; out(tr("Installing")+"\n"+tr("please wait")+"\n"); for (uint i=0; i < to_install.count(); i++) { if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) { runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); + to_install.at(i)->processed(); + to_install.take( i ); + out("\n\n"); + }else{ + out(tr("Error while installing")+to_install.at(i)->name()+"\n"); + } linkOpp = createLink; if ( to_install.at(i)->link() ) { out( "\ncreating links\n" ); out( "for package "+to_install.at(i)->name()+" in "+to_install.at(i)->dest()+"\n" ); makeLinks( to_install.at(i) ); } - to_install.at(i)->processed(); - to_install.take( i ); - out("\n\n"); - }else{ - out(tr("Error while installing")+to_install.at(i)->name()+"\n"); - } } out("\n"); to_install.clear(); } void PmIpkg::createLinks( const QString &dest ) { pvDebug(2,"PmIpkg::createLinks "+dest); linkOpp=createLink; QString url = settings->getDestinationUrlByName( dest ); url = url==""?dest:url; processLinkDir( "/opt", url ); diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index f8ac39a..c543304 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h @@ -39,25 +39,25 @@ public slots: void removeLinks( const QString &dest ); private: PackageManagerSettings* settings; RunWindow *runwindow; InstallDialog *installDialog; QList<Package> to_remove; QList<Package> to_install; QString fileNameToInstall; QCheckBox *_force_reinstall; QCheckBox *_force_remove; QCheckBox *_force_depends; - void startDialog(); +// void startDialog(); void makeLinks(Package*); void linkPackage( QString, QString ); void processLinkDir( QString , QString ); bool runIpkg(const QString& args, const QString& dest="" ); void out( QString ); QStringList* getList( QString, QString ); void processFileList( QStringList*, QString ); }; #endif |