author | tille <tille> | 2002-05-12 12:49:58 (UTC) |
---|---|---|
committer | tille <tille> | 2002-05-12 12:49:58 (UTC) |
commit | 98229e01acc37562671b546a8aa955415a0f5843 (patch) (side-by-side diff) | |
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 @@ -253,16 +253,17 @@ MainWindow::~MainWindow() void MainWindow::runIpkg() { packageListServers.allPackages(); ipkg->loadList( &packageListSearch ); ipkg->loadList( &packageListDocLnk ); ipkg->loadList( &packageListServers ); ipkg->commit(); + ipkg->clearLists(); // ##### If we looked in the list of files, we could send out accurate // ##### messages. But we don't bother yet, and just do an "all". QCopEnvelope e("QPE/System", "linkChanged(QString)"); QString lf = QString::null; e << lf; displayList(); } @@ -415,39 +416,25 @@ void MainWindow::rotateUpdateIcon() else updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); updateIcon = !updateIcon; } void MainWindow::setDocument(const QString &fileName) { - installFile(fileName); - // ##### If we looked in the list of files, we could send out accurate - // ##### messages. But we don't bother yet, and just do an "all". - QCopEnvelope e("QPE/System", "linkChanged(QString)"); - QString lf = QString::null; - e << lf; - // displayList(); - exit; -} - -void MainWindow::installFile(const QString &fileName) -{ - pvDebug(3, "MainWindow::installFile "+fileName); if ( !QFile::exists( fileName ) ) return; ipkg->installFile( fileName ); - // ##### If we looked in the list of files, we could send out accurate - // ##### messages. But we don't bother yet, and just do an "all". QCopEnvelope e("QPE/System", "linkChanged(QString)"); QString lf = QString::null; e << lf; - displayList(); + exit; } + void MainWindow::makeChannel() { channel = new QCopChannel( "QPE/Application/oipkg", this ); connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); } 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 @@ -59,17 +59,16 @@ public slots: void receive (const QCString &, const QByteArray &); void setDocument (const QString &); void remotePackageQuery(); private: void makeMenu(); void setSections(); void setSubSections(); - void installFile(const QString &); bool updateIcon; PmIpkg* ipkg; PackageManagerSettings *settings; PackageListLocal packageListServers; PackageListRemote packageListSearch; PackageListDocLnk packageListDocLnk; PackageListView *listViewPackages; 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 @@ -236,16 +236,17 @@ void PmIpkg::commit() installDialog->show(); if ( installDialog->exec() ) { doIt(); runwindow->showMaximized(); runwindow->show(); } installDialog->close(); + delete installDialog; out(tr("\nAll done.")); } void PmIpkg::doIt() { runwindow->progress->setProgress(0); show(); remove(); @@ -263,25 +264,25 @@ void PmIpkg::remove() 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)->installName(), to_remove.at(i)->dest() )) { runwindow->progress->setProgress( 1 ); linkOpp = removeLink; to_remove.at(i)->processed(); - pvDebug(4,"link "+QString::number(i)); + pvDebug(3,"link "+QString::number(i)); if ( to_remove.at(i)->link() ) processFileList( fileList, to_remove.at(i)->dest() ); - pvDebug(4,"take "+QString::number(i)); - to_remove.take( i ); + //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count())); + //if ( to_remove.at(i) ) to_remove.take( i ); out("\n"); }else{ - out(tr("Error while removing")+to_remove.at(i)->name()+"\n"); + out(tr("Error while removing ")+to_remove.at(i)->name()+"\n"); if ( to_remove.at(i)->link() ) processFileList( fileList, to_remove.at(i)->dest() ); } if ( to_remove.at(i)->link() ) processFileList( fileList, to_remove.at(i)->dest() ); if ( to_remove.at(i)->link() )delete fileList; } to_remove.clear(); @@ -298,17 +299,17 @@ void PmIpkg::install() qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug 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(); linkOpp = createLink; if ( to_install.at(i)->link() ) makeLinks( to_install.at(i) ); - to_install.take( i ); + // to_install.take( i ); out("\n"); }else{ out(tr("Error while installing")+to_install.at(i)->name()+"\n"); linkOpp = createLink; if ( to_install.at(i)->link() ) makeLinks( to_install.at(i) ); } } @@ -355,21 +356,16 @@ void PmIpkg::out( QString o ) void PmIpkg::show() { if (!runwindow->isVisible()) { runwindow->showMaximized(); runwindow->show(); } runwindow->outPut->setText(""); -// showButtons(b); -// if ( !b ) -// runwindow->progress->hide(); -// else -// runwindow->progress->show(); } void PmIpkg::installFile(const QString &fileName, const QString &dest) { to_install.clear(); to_remove.clear(); pvDebug( 2,"PmIpkg::installFile "+ fileName); @@ -388,8 +384,14 @@ void PmIpkg::removeFile(const QString &fileName, const QString &dest) pvDebug( 2,"PmIpkg::removeFile "+ fileName); Package *p = new Package(fileName,settings); if ( dest!="") p->setDest( dest ); to_remove.append( p ); commit(); delete p; } + +void PmIpkg::clearLists() +{ + to_remove.clear(); + to_install.clear(); +} 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 @@ -23,16 +23,18 @@ public: PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); ~PmIpkg(); int linkOpp; void loadList( PackageList* ); void commit(); void update(); void show(); + /** No descriptions */ + void clearLists(); public slots: void doIt(); void install(); void remove(); void installFile(const QString &fileName, const QString &dest=""); void removeFile(const QString &fileName, const QString &dest=""); void createLinks( const QString &dest ); |