author | tille <tille> | 2002-05-12 12:07:14 (UTC) |
---|---|---|
committer | tille <tille> | 2002-05-12 12:07:14 (UTC) |
commit | 06e723cc7942af2691828e7fdc6a6ec47b44edab (patch) (side-by-side diff) | |
tree | f96bd547911c4fdc2aa8db95bd6175ebae02b027 | |
parent | 026a99ad2360a9abc2964cbdc3b71b49adcd66e6 (diff) | |
download | opie-06e723cc7942af2691828e7fdc6a6ec47b44edab.zip opie-06e723cc7942af2691828e7fdc6a6ec47b44edab.tar.gz opie-06e723cc7942af2691828e7fdc6a6ec47b44edab.tar.bz2 |
fixed crash when remove dest
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 10 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 8 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettings.cpp | 6 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/settings.cpp | 4 |
5 files changed, 20 insertions, 10 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 19a1420..a23c900 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp @@ -28,69 +28,69 @@ #include "pksettingsbase.h" #include "utils.h" #include "packagelistitem.h" MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : QMainWindow( parent, name, f ) { setCaption( tr("Package Manager") ); settings = new PackageManagerSettings(this,0,TRUE); listViewPackages = new PackageListView( this,"listViewPackages",settings ); setCentralWidget( listViewPackages ); listViewPackages->addList( tr("feeds"), &packageListServers ); listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); listViewPackages->addList( tr("documents"), &packageListDocLnk ); // wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); // wait = new QMessageBox(this); // wait->setText(tr("Please wait")); ipkg = new PmIpkg( settings, this ); // settings->setIpkg( ipkg ); packageListServers.setSettings( settings ); packageListSearch.setSettings( settings ); packageListDocLnk.setSettings( settings ); pvDebug(9,"packageListServers.update"); packageListServers.update(); pvDebug(9,"packageListDocLnk.update"); packageListDocLnk.update(); pvDebug(9,"makeMenu"); makeMenu(); makeChannel(); //opie is hardcoded default ;) - pvDebug(9,"section->setCurrentItem"); - for (int i=0;i<section->count();i++) - if (section->text(i)=="opie") - section->setCurrentItem(i); - sectionChanged(); +// pvDebug(9,"section->setCurrentItem"); +// for (int i=0;i<section->count();i++) +// if (section->text(i)=="opie") +// section->setCurrentItem(i); +// sectionChanged(); connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); connect( settings->removeLinksButton, SIGNAL( clicked()), SLOT(removeLinks()) ); connect( settings->createLinksButton, SIGNAL( clicked()), SLOT(createLinks()) ); pvDebug(9,"displayList"); displayList(); } void MainWindow::makeMenu() { QPEToolBar *toolBar = new QPEToolBar( this ); QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); QPopupMenu *srvMenu = new QPopupMenu( menuBar ); QPopupMenu *viewMenu = new QPopupMenu( menuBar ); QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); setToolBarsMovable( false ); toolBar->setHorizontalStretchable( true ); menuBar->insertItem( tr( "Package" ), srvMenu ); menuBar->insertItem( tr( "View" ), viewMenu ); menuBar->insertItem( tr( "Settings" ), cfgMenu ); // menuBar->insertItem( tr( "Sections" ), sectMenu ); QLabel *spacer; // spacer = new QLabel( "", toolBar ); diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index c947c64..4542e42 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp @@ -5,64 +5,65 @@ #include <qfile.h> #include <qtextstream.h> #include <stdlib.h> #include <unistd.h> #include "debug.h" //Package::~Package() //{ //} Package::Package( PackageManagerSettings *s ) { init(s); } void Package::init( PackageManagerSettings *s ) { settings = s; _size = ""; _section = ""; _subsection = ""; _shortDesc = ""; _desc = ""; _name = ""; _toProcess = false; _useFileName = false; _old = false; _status = ""; _dest = settings->getDestinationName(); _link = settings->createLinks(); _versions=0; + _version=""; } Package::Package( QStringList pack, PackageManagerSettings *s ) { init(s); parsePackage( pack ); } Package::Package( QString n, PackageManagerSettings *s ) { init(s); if ( !QFile::exists( n ) ) { _name = QString( n ); }else{ parseIpkgFile( n ); _useFileName = true; _fileName = QString( n ); } } Package::Package( Package *pi ) { init(pi->settings); copyValues( pi ); } void Package::setValue( QString n, QString t ) { if ( n == "Package" ) { @@ -206,65 +207,70 @@ QString Package::sizeUnits() bool Package::toProcess() { return _toProcess; } bool Package::toRemove() { if ( _toProcess && installed() ) return true; else return false; } bool Package::toInstall() { if ( _toProcess && !installed() ) return true; else return false; } void Package::toggleProcess() { _toProcess = ! _toProcess; } void Package::copyValues( Package* pack ) { if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size ); if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section ); if (_subsection.isEmpty()&& !pack->_subsection.isEmpty()) _subsection = QString( pack->_subsection ); if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc ); if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc ); if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name ); - if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status ); + if (_dest.isEmpty() && !pack->_dest.isEmpty()) _dest= QString( pack->_dest ); + if (_displayName.isEmpty()&& !pack->_displayName.isEmpty()) _displayName = QString( pack->_displayName ); + if (_fileName.isEmpty() && !pack->_fileName.isEmpty()) _fileName = QString( pack->_fileName ); + if (_version.isEmpty() && !pack->_version.isEmpty()) _version = QString( pack->_version ); + if (_values.isEmpty() && !pack->_values.isEmpty())_values = QDict<QString>( pack->_values ); + if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status ); } QString Package::section() { return _section; } void Package::setSection( QString s) { int i = s.find("/"); if ( i > 0 ) { _section = s.left(i); _subsection = s.mid(i+1); }else{ _section = s; _subsection = ""; } } QString Package::subSection() { return _subsection; } void Package::parsePackage( QStringList pack ) { if ( pack.isEmpty() ) return; int count = pack.count(); for( int i = 0; i < count; i++ ) { QString line = pack[i]; diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp index 24c7beb..09975b0 100644 --- a/noncore/unsupported/oipkg/pksettings.cpp +++ b/noncore/unsupported/oipkg/pksettings.cpp @@ -140,70 +140,71 @@ void PackageManagerSettings::editDestination(int i) // removeLinksButton->setEnabled(TRUE); } destinationname->setText( destinations->text(i) ); destinationurl->setText( *destinationurlDic[i] ); editeddestination = i; connect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); changed = true; } void PackageManagerSettings::removeServer() { disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); servername->setText(servers->text(editedserver)); serverurl->setText(*serverurlDic[editedserver]); disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); servers->removeItem(editedserver); activeServers->removeItem(editedserver); connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); servername->setEnabled(FALSE); serverurl->setEnabled(FALSE); changed = true; } void PackageManagerSettings::removeDestination() { disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); - destinationname->setText(destinations->text(editedserver)); - destinationurl->setText(*destinationurlDic[editedserver]); + destinationname->setText(""); + destinationurl->setText(""); disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); destinations->removeItem(editeddestination); activeDestination->removeItem(editeddestination); activeLinkDestination->removeItem(editeddestination); + editeddestination=0; connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); destinationname->setEnabled(FALSE); destinationurl->setEnabled(FALSE); changed = true; } void PackageManagerSettings::serverNameChanged(const QString& t) { disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); servers->changeItem( t, editedserver ); activeServers->changeItem( t, editedserver ); connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); changed = true; serverChanged = true; } void PackageManagerSettings::destNameChanged(const QString& t) { disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); destinations->changeItem( t, editeddestination ); activeDestination->changeItem( t, editeddestination ); activeLinkDestination->changeItem( t, editeddestination ); connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); changed = true; } void PackageManagerSettings::serverUrlChanged(const QString& t) { serverurlDic.replace(editedserver, new QString(t)); changed = true; serverChanged = true; } @@ -325,64 +326,65 @@ void PackageManagerSettings::writeCurrentInstallationSetting() cfg.writeEntry( "link", CheckBoxLink->isChecked() ); cfg.writeEntry( "dest", getDestinationName() ); cfg.writeEntry( "linkdest" , getLinkDestinationName() ); QStringList sers = getActiveServers(); int srvc = 0; for ( QStringList::Iterator it = sers.begin(); it != sers.end(); ++it ) { cfg.writeEntry( "server_" + QString::number(srvc++), *it ); } cfg.writeEntry( "server_count", srvc ); } void PackageManagerSettings::renameInstallationSetting() { settingName->setEditable( true ); changed = true; } void PackageManagerSettings::installationSettingSetName(const QString &name) { settingName->changeItem( name, settingName->currentItem() ); changed = true; } bool PackageManagerSettings::readIpkgConfig(const QString& conffile) { QFile conf(conffile); changed = false; if ( conf.open(IO_ReadOnly) ) { QTextStream s(&conf); servers->clear(); activeServers->clear(); + destinations->clear(); activeDestination->clear(); activeLinkDestination->clear(); serverurlDic.clear(); destinationurlDic.clear(); ipkg_old=0; int currentserver=0; while ( !s.atEnd() ) { QString l = s.readLine(); QStringList token = QStringList::split(' ', l); if ( token[0] == "src" || token[0] == "#src" ) { currentserver=servers->count(); serverurlDic.insert(servers->count(),new QString(token[2])); int a = token[0] == "src" ? 1 : 0; int i = servers->count(); servers->insertItem(token[1]); activeServers->insertItem( token[1] ); activeServers->setSelected(i,a); } else if ( token[0] == "dest" ) { currentserver=destinations->count(); destinationurlDic.insert(destinations->count(),new QString(token[2])); destinations->insertItem(token[1]); activeDestination->insertItem( token[1] ); activeLinkDestination->insertItem( token[1] ); } else if ( token[0] == "option" ) { // ### somehow need to use the settings from netsetup // if ( token[1] == "http_proxy" ) // http->setText(token[2]); // else if ( token[1] == "ftp_proxy" ) // ftp->setText(token[2]); // else if ( token[1] == "proxy_username" ) // username->setText(token[2]); diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 6ef6d19..0401a5b 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp @@ -239,66 +239,68 @@ void PmIpkg::commit() 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)->installName(), to_remove.at(i)->dest() )) { runwindow->progress->setProgress( 1 ); linkOpp = removeLink; to_remove.at(i)->processed(); + pvDebug(4,"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 ); out("\n"); }else{ 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(); 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++) { 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 ); diff --git a/noncore/unsupported/oipkg/settings.cpp b/noncore/unsupported/oipkg/settings.cpp index 8f91995..85daa98 100644 --- a/noncore/unsupported/oipkg/settings.cpp +++ b/noncore/unsupported/oipkg/settings.cpp @@ -152,70 +152,70 @@ void PackageManagerSettings::removeDestination() void PackageManagerSettings::serverNameChanged(const QString& t) { disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); servers->changeItem( t, editedserver ); activeServers->changeItem( t, editedserver ); connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); } void PackageManagerSettings::destNameChanged(const QString& t) { disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); destinations->changeItem( t, editeddestination ); activeDestination->changeItem( t, editeddestination ); activeLinkDestination->changeItem( t, editeddestination ); connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); } void PackageManagerSettings::serverUrlChanged(const QString& t) { serverurlDic.replace(editedserver, new QString(t)); } void PackageManagerSettings::destUrlChanged(const QString& t) { destinationurlDic.replace(editeddestination, new QString(t)); } void PackageManagerSettings::writeIpkgConfig(const QString& conffile) { QFile conf(conffile); if ( ! conf.open(IO_WriteOnly) ) return; QTextStream s(&conf); - s << "# Written by qpie Package Manager\n"; + s << "# "+tr("Written by Opie Package Manager")+"\n"; for (int i=0; i<(int)activeServers->count(); i++) { QString url = serverurlDic[i] ? *serverurlDic[i] : QString("???"); if ( !activeServers->isSelected(i) ) - s << "#"; + s << "#"; s << "src " << activeServers->text(i) << " " << url << "\n"; } for (int i=0; i<(int)destinations->count(); i++) { QString url = destinationurlDic[i] ? *destinationurlDic[i] : QString("???"); s << "dest " << destinations->text(i) << " " << url << "\n"; } conf.close(); } void PackageManagerSettings::readInstallationSettings() { Config cfg( "oipkg", Config::User ); cfg.setGroup( "Settings" ); installationSettingsCount = cfg.readNumEntry( "count", -1 ); currentSetting = cfg.readNumEntry( "current", 0 ); for (int i = 0; i < installationSettingsCount; i++) { cfg.setGroup( "Setting_" + QString::number(i) ); settingName->insertItem( cfg.readEntry( "name", "???" ), i ); }; readInstallationSetting( currentSetting ); } void PackageManagerSettings::removeInstallationSetting() { settingName->removeItem( settingName->currentItem() ); Config cfg( "oipkg", Config::User ); cfg.setGroup( "Setting_" + QString::number( installationSettingsCount ) ); |