-rw-r--r-- | noncore/unsupported/oipkg/TODO | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/installdialog.cpp | 104 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/installdialog.h | 46 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 5 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/oipkg.pro | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistremote.cpp | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettings.cpp | 11 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettings.h | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 96 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 7 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/settings.h | 1 |
11 files changed, 202 insertions, 75 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO index 1aa9e6b..b1ae6e3 100644 --- a/noncore/unsupported/oipkg/TODO +++ b/noncore/unsupported/oipkg/TODO @@ -1,14 +1,14 @@ * Settings Class * tr() ;) * Dialog to display ipkg output live * parse "to install" and "to remove" from status * install local file dialog * qcop * error handling * manage links * dependency checking * create dest if it does not exist * allow reinstalling * different types of filters and searches i.e. name, desc, files etc -* get packages from doclnk
\ No newline at end of file +* mark packages from doclnk and ipkgfind installed if installed
\ No newline at end of file diff --git a/noncore/unsupported/oipkg/installdialog.cpp b/noncore/unsupported/oipkg/installdialog.cpp new file mode 100644 index 0000000..72f436a --- a/dev/null +++ b/noncore/unsupported/oipkg/installdialog.cpp @@ -0,0 +1,104 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'installdialog.ui' +** +** Created: Thu May 2 22:19:02 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "installdialog.h" + +#include <qcheckbox.h> +#include <qgroupbox.h> +#include <qheader.h> +#include <qlistview.h> +#include <qpushbutton.h> +#include <qlayout.h> +#include <qvariant.h> +#include <qtooltip.h> +#include <qwhatsthis.h> + + +InstallDialog::InstallDialog( PackageManagerSettings* s, QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + settings = s; + if ( !name ) + setName( "InstallDialog" ); + resize( 223, 269 ); + setCaption( tr( "Install" ) ); + InstallDialogLayout = new QGridLayout( this ); + InstallDialogLayout->setSpacing( 2 ); + InstallDialogLayout->setMargin( 2 ); + + ListViewPackages = new PackageListView( this,"listViewPackages",settings ); + + InstallDialogLayout->addWidget( ListViewPackages, 0, 0 ); + + GroupBoxOptions = new QGroupBox( this, "GroupBoxOptions" ); + GroupBoxOptions->setTitle( tr( "Ipkg options" ) ); + GroupBoxOptions->setColumnLayout(0, Qt::Vertical ); + GroupBoxOptions->layout()->setSpacing( 0 ); + GroupBoxOptions->layout()->setMargin( 0 ); + GroupBoxOptionsLayout = new QGridLayout( GroupBoxOptions->layout() ); + GroupBoxOptionsLayout->setAlignment( Qt::AlignTop ); + GroupBoxOptionsLayout->setSpacing( 2 ); + GroupBoxOptionsLayout->setMargin( 2 ); + + _force_depends = new QCheckBox( GroupBoxOptions, "_force_depends" ); + QFont _force_depends_font( _force_depends->font() ); + _force_depends_font.setPointSize( 8 ); + _force_depends->setFont( _force_depends_font ); + _force_depends->setText( tr( "-force-depends" ) ); + //_force_depends->setChecked( true ); + + GroupBoxOptionsLayout->addWidget( _force_depends, 0, 0 ); + + _force_reinstall = new QCheckBox( GroupBoxOptions, "_force_reinstall" ); + QFont _force_reinstall_font( _force_reinstall->font() ); + _force_reinstall_font.setPointSize( 8 ); + _force_reinstall->setFont( _force_reinstall_font ); + _force_reinstall->setText( tr( "-force-reinstall" ) ); + + 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 ); +} + +/* + * 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 + * font changes + */ +bool InstallDialog::event( QEvent* ev ) +{ + bool ret = QDialog::event( ev ); + if ( ev->type() == QEvent::ApplicationFontChange ) { + QFont _force_depends_font( _force_depends->font() ); + _force_depends_font.setPointSize( 8 ); + _force_depends->setFont( _force_depends_font ); + QFont _force_reinstall_font( _force_reinstall->font() ); + _force_reinstall_font.setPointSize( 8 ); + _force_reinstall->setFont( _force_reinstall_font ); + QFont _force_remove_font( _force_remove->font() ); + _force_remove_font.setPointSize( 8 ); + _force_remove->setFont( _force_remove_font ); + } + return ret; +} + diff --git a/noncore/unsupported/oipkg/installdialog.h b/noncore/unsupported/oipkg/installdialog.h new file mode 100644 index 0000000..f2164ac --- a/dev/null +++ b/noncore/unsupported/oipkg/installdialog.h @@ -0,0 +1,46 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'installdialog.ui' +** +** Created: Thu May 2 22:19:01 2002 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef INSTALLDIALOG_H +#define INSTALLDIALOG_H + +#include "pksettings.h" +#include "packagelistview.h" +#include <qvariant.h> +#include <qdialog.h> +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 ); + ~InstallDialog(); + + PackageListView* ListViewPackages; + QGroupBox* GroupBoxOptions; + QCheckBox* _force_depends; + QCheckBox* _force_reinstall; + QCheckBox* _force_remove; + +protected: + QGridLayout* InstallDialogLayout; + QGridLayout* GroupBoxOptionsLayout; + bool event( QEvent* ); +private: + PackageManagerSettings* settings; +}; + +#endif // INSTALLDIALOG_H diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index b668660..259a789 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp @@ -223,47 +223,50 @@ void MainWindow::makeMenu() destBar->setStretchableWidget( CheckBoxLink ); destAction->setToggleAction( true ); // destAction->addTo( viewMenu ); // configure the menus Config cfg( "oipkg", Config::User ); cfg.setGroup( "gui" ); findShow( cfg.readBoolEntry( "findBar", true ) ); searchShow( cfg.readBoolEntry( "searchBar", true ) ); sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); destShow( cfg.readBoolEntry( "destBar", false ) ); } MainWindow::~MainWindow() { + pvDebug(7,"MainWindow::~MainWindow "); Config cfg( "oipkg", Config::User ); cfg.setGroup( "gui" ); cfg.writeEntry( "findBar", !findBar->isHidden() ); cfg.writeEntry( "searchBar", !searchBar->isHidden() ); cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); cfg.writeEntry( "destBar", !destBar->isHidden() ); + pvDebug(7,"MainWindow::~MainWindow "); } void MainWindow::runIpkg() { packageListServers.allPackages(); ipkg->loadList( packageListSearch ); ipkg->loadList( packageListDocLnk ); - ipkg->commit( packageListServers ); + ipkg->loadList( packageListServers ); + ipkg->commit(); // ##### 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(); } void MainWindow::updateList() { // wait->show(); QTimer *t = new QTimer( this ); connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); t->start( 0, false ); packageListServers.clear(); packageListSearch.clear(); diff --git a/noncore/unsupported/oipkg/oipkg.pro b/noncore/unsupported/oipkg/oipkg.pro index 6ee1963..9e2f5f8 100644 --- a/noncore/unsupported/oipkg/oipkg.pro +++ b/noncore/unsupported/oipkg/oipkg.pro @@ -1,34 +1,36 @@ DESTDIR = $(OPIEDIR)/bin TEMPLATE = app #CONFIG = qt warn_on release CONFIG = qt warn_on debug HEADERS = mainwindow.h \ pksettings.h \ pmipkg.h \ packagelistdoclnk.h \ + installdialog.h \ utils.h \ packagelistitem.h \ packagelistremote.h \ packagelist.h \ packagelistlocal.h \ packagelistview.h \ package.h SOURCES = main.cpp \ mainwindow.cpp \ utils.cpp \ packagelistdoclnk.cpp \ packagelistview.cpp \ + installdialog.cpp \ packagelistremote.cpp \ packagelistlocal.cpp \ pksettings.cpp \ pmipkg.cpp \ packagelistitem.cpp \ packagelist.cpp \ package.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/ioclude LIBS += -lqpe INTERFACES = runwindow.ui \ pksettingsbase.ui TARGET = oipkg diff --git a/noncore/unsupported/oipkg/packagelistremote.cpp b/noncore/unsupported/oipkg/packagelistremote.cpp index 1ec7292..3c6ede7 100644 --- a/noncore/unsupported/oipkg/packagelistremote.cpp +++ b/noncore/unsupported/oipkg/packagelistremote.cpp @@ -28,20 +28,20 @@ void PackageListRemote::query(QString s) void PackageListRemote::update() { pvDebug(2,"PackageListRemote::update"); int r=0; QString cmd = "wget"; QString redirect = "/tmp/oipkg.query"; // use file for output cmd += " --output-document="+redirect; //http://ipkgfind.handhelds.org/packages.phtml?format=pda&query=ipkg&searchtype=package§ion= QString server="http://ipkgfind.handhelds.org/"; cmd += " \""+server+"/packages.phtml"; cmd += "?format=pda&searchtype=package§ion="; cmd += "&query="+searchString; cmd += "\""; - pvDebug(2,"search :"+cmd); + pvDebug(4,"search :"+cmd); r = system(cmd.latin1()); readFileEntries( redirect ); } diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp index 7e2ef10..24c7beb 100644 --- a/noncore/unsupported/oipkg/pksettings.cpp +++ b/noncore/unsupported/oipkg/pksettings.cpp @@ -45,32 +45,33 @@ PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* na // connect( CheckBoxLink, SIGNAL(toggled(bool)), // activeLinkDestination, SLOT(setEnabled(bool)) ); connect( settingName, SIGNAL(activated(int)), this, SLOT(installationSettingChange(int)) ); connect( settingName, SIGNAL(textChanged(const QString &)), this, SLOT(installationSettingSetName(const QString &)) ); connect( newsetting, SIGNAL(clicked()), this, SLOT(newInstallationSetting()) ); connect( renamesetting, SIGNAL(clicked()), this, SLOT(renameInstallationSetting()) ); connect( removesetting, SIGNAL(clicked()), this, SLOT(removeInstallationSetting()) ); servername->setEnabled(FALSE); serverurl->setEnabled(FALSE); serverurlDic.setAutoDelete(TRUE); destinationname->setEnabled(FALSE); destinationurl->setEnabled(FALSE); destinationurlDic.setAutoDelete(TRUE); readSettings(); activeLinkDestination->hide(); + serverChanged = false; } PackageManagerSettings::~PackageManagerSettings() { } void PackageManagerSettings::newServer() { int i = servers->count(); if ( servername->isEnabled() || serverurl->text().isEmpty() ) { serverurlDic.insert(i,new QString("http://")); servers->insertItem(tr("New")); activeServers->insertItem(tr("New")); } else { // allows one-level undo @@ -106,49 +107,50 @@ void PackageManagerSettings::newDestination() void PackageManagerSettings::editServer(int i) { if ( servername->isEnabled() ) { disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); } else { servername->setEnabled(TRUE); serverurl->setEnabled(TRUE); } servername->setText( servers->text(i) ); serverurl->setText( *serverurlDic[i] ); editedserver = i; - + serverChanged = true; connect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); connect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); changed = true; } void PackageManagerSettings::editDestination(int i) { if ( destinationname->isEnabled() ) { disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); } else { destinationname->setEnabled(TRUE); destinationurl->setEnabled(TRUE); - createLinksButton->setEnabled(TRUE); - removeLinksButton->setEnabled(TRUE); + //since it does not work anyway +// createLinksButton->setEnabled(TRUE); +// 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&)) ); @@ -171,51 +173,52 @@ void PackageManagerSettings::removeDestination() destinationurl->setText(*destinationurlDic[editedserver]); disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); destinations->removeItem(editeddestination); activeDestination->removeItem(editeddestination); activeLinkDestination->removeItem(editeddestination); 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 ); - changed = true; 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; } void PackageManagerSettings::destUrlChanged(const QString& t) { destinationurlDic.replace(editeddestination, new QString(t)); changed = true; } 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"; for (int i=0; i<(int)activeServers->count(); i++) { diff --git a/noncore/unsupported/oipkg/pksettings.h b/noncore/unsupported/oipkg/pksettings.h index 1632d4a..dcc1e3a 100644 --- a/noncore/unsupported/oipkg/pksettings.h +++ b/noncore/unsupported/oipkg/pksettings.h @@ -51,24 +51,25 @@ public slots: void removeInstallationSetting(); void renameInstallationSetting(); void activeServerChanged(); signals: // void doCreateLinks( QString dest ); // void doRemoveLinks( QString dest ); private: QIntDict<QString> serverurlDic; QIntDict<QString> destinationurlDic; int ipkg_old; int editedserver; int editeddestination; int currentSetting; int installationSettingsCount; bool changed; + bool serverChanged; bool readIpkgConfig(const QString&); void writeIpkgConfig(const QString&); void writeSettings(); void readSettings(); }; #endif 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 @@ -44,39 +44,39 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) pvDebug(2,"PmIpkg::runIpkg "+args); #ifdef PROC QStringList cmd = "/usr/bin/ipkg "; #endif #ifdef SYSTEM QString cmd = "/usr/bin/ipkg "; #endif pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); if ( dest == "" ) cmd += " -dest "+settings->getDestinationName(); else cmd += " -dest "+ dest; cmd += " -force-defaults "; - if (_force_depends) + if (installDialog->_force_depends) { - if (_force_depends->isChecked()) + if (installDialog->_force_depends->isChecked()) cmd += " -force-depends "; - if (_force_reinstall->isChecked()) + if (installDialog->_force_reinstall->isChecked()) cmd += " -force-reinstall "; - if (_force_remove->isChecked()) + if (installDialog->_force_remove->isChecked()) cmd += " -force-removal-of-essential-packages "; } out( "<hr><br>Starting to "+ args+"<br>\n"); cmd += args; int r = 0; #ifdef PROC QString o = "start"; Process *ipkg = new Process( cmd ); out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); QString description; ipkg->exec("",o); // out( o ); #endif #ifdef SYSTEM out( "running:<br>\n"+cmd+"<br>\n" ); @@ -160,149 +160,114 @@ void PmIpkg::processFileList( QStringList *fileList, QString d ) void PmIpkg::processLinkDir( QString file, QString dest ) { pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); if ( dest == "???" || dest == "" ) return; QString destFile = file; file = dest+"/"+file; if (file == dest) return; QFileInfo fileInfo( file ); if ( fileInfo.isDir() ) { pvDebug(4, "process dir "+file); QDir destDir( destFile ); if (linkOpp==createLink) destDir.mkdir( destFile, true ); QDir d( file ); - d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); +// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); const QFileInfoList *list = d.entryInfoList(); QFileInfoListIterator it( *list ); QFileInfo *fi; + qDebug( "while %i",list->count()); while ( (fi=it.current()) ) { + pvDebug(4, "processLinkDir "+fi->absFilePath()); processLinkDir( fi->absFilePath(), dest ); ++it; } -// if (linkOpp==removeLink) -// { -// pvDebug(2,"remove destDir "+ destFile ); -// destDir.remove( destFile, true ); -// } } else if ( fileInfo.isFile() ) { const char *instFile = strdup( (file).ascii() ); const char *linkFile = strdup( (destFile).ascii()); if( linkOpp==createLink ) { pvDebug(4, "linking: "+file+" -> "+destFile ); symlink( instFile, linkFile ); } } else { const char *linkFile = strdup( (destFile).ascii()); if( linkOpp==removeLink ) { - pvDebug(4,"removing "+destFile+" no "+file); QFileInfo toRemoveLink( destFile ); if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) + { + pvDebug(4,"removing "+destFile+" no "+file); unlink( linkFile ); + } } } } void PmIpkg::loadList( PackageList pl ) { for( Package *pack = pl.first();pack ; (pack = pl.next()) ) { if ( pack && (pack->name() != "") && pack) { if ( pack->toInstall() ) to_install.append( pack ); if ( pack->toRemove() ) to_remove.append( pack ); } } } -void PmIpkg::commit( PackageList pl ) +void PmIpkg::commit() { int sizecount = 0; -// QString rem="<b>"+tr("To remove:")+"</b><br>\n"; -// QString inst="<b>"+tr("To install:")+"</b><br>\n"; - loadList(pl); for (uint i=0; i < to_remove.count(); i++) sizecount += 1; for (uint i=0; i < to_install.count(); i++) sizecount += to_install.at(i)->size().toInt(); runwindow->progress->setTotalSteps(sizecount); startDialog(); } void PmIpkg::startDialog() { - installDialog = new QDialog(0,0,true); - QGridLayout *RunWindowLayout = new QGridLayout( installDialog ); - RunWindowLayout->setSpacing( 2 ); - RunWindowLayout->setMargin( 2 ); - - PackageListView *plv = new PackageListView(installDialog, "install",settings); - plv->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding, plv->sizePolicy().mayShrinkVertically()) ); - RunWindowLayout->addWidget( plv, 1, 0 ); - QCheckListItem *toRemoveItem; - toRemoveItem= new QCheckListItem( plv, QObject::tr("To remove") ); - toRemoveItem->setOpen( true ); - for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) - { - toRemoveItem->insertItem( new PackageListItem(plv, it,settings) ); - } - QCheckListItem *toInstallItem; - toInstallItem = new QCheckListItem( plv, QObject::tr("To install") ); - toInstallItem->setOpen( true ); - for (Package *it=to_install.first(); it != 0; it=to_install.next() ) - { - toInstallItem->insertItem( new PackageListItem(plv, it,settings) ); - } - - QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" ); - GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().mayShrinkVertically() ) ); - GroupBox1->setTitle( tr( "Ipkg options" ) ); - GroupBox1->setColumnLayout(0, Qt::Vertical ); - GroupBox1->layout()->setSpacing( 0 ); - GroupBox1->layout()->setMargin( 0 ); - QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); - GroupBox1Layout->setAlignment( Qt::AlignTop ); - GroupBox1Layout->setSpacing( 3 ); - GroupBox1Layout->setMargin( 3 ); - _force_depends = new QCheckBox( GroupBox1, "_force_depends" ); - _force_depends->setText( tr( "-force-depends" ) ); - _force_depends->setAutoResize( TRUE ); - _force_depends->setChecked(true); - GroupBox1Layout->addWidget( _force_depends, 0, 0 ); - _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" ); - _force_reinstall->setText( tr( "-force-reinstall" ) ); - _force_reinstall->setAutoResize( TRUE ); - GroupBox1Layout->addWidget( _force_reinstall, 1, 0 ); - _force_remove = new QCheckBox( GroupBox1, "_force_remove" ); - _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); - _force_remove->setAutoResize( TRUE ); - GroupBox1Layout->addWidget( _force_remove, 1, 0 ); - RunWindowLayout->addWidget( GroupBox1 , 3, 0 ); + installDialog = new InstallDialog(settings,0,0,true); + QCheckListItem *toRemoveItem; + toRemoveItem= new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To remove") ); + toRemoveItem->setOpen( true ); + for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) + { + toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, it,settings) ); + } + QCheckListItem *toInstallItem; + toInstallItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To install") ); + toInstallItem->setOpen( true ); + for (Package *it=to_install.first(); it != 0; it=to_install.next() ) + { + toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, it,settings) ); + } installDialog->showMaximized(); if ( installDialog->exec() ) doIt(); installDialog->close(); out(tr("<b>All done.</b>")); + to_install.clear(); } void PmIpkg::doIt() { show( true ); remove(); install(); } void PmIpkg::remove() { if ( to_remove.count() == 0 ) return; out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>"); @@ -344,50 +309,53 @@ void PmIpkg::install() runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); linkOpp = createLink; if ( it->link() ) { out( "<br>creating links<br>" ); out( "for package "+it->name()+" in "+it->dest()+"<br>" ); makeLinks( it ); } it->processed(); // to_install.take( it->name() ); out("<br><hr>"); }else{ out("<b>"+tr("Error while installing")+"</b><hr>"+it->name()); } } out("<br>"); + 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( "/", url ); + processLinkDir( "/opt", url ); + processLinkDir( "/usr", url ); } void PmIpkg::removeLinks( const QString &dest ) { pvDebug(2,"PmIpkg::removeLinks "+dest); linkOpp=removeLink; QString url = settings->getDestinationUrlByName( dest ); url = url==""?dest:url; - processLinkDir( "/", url ); + processLinkDir( "/opt", url ); + processLinkDir( "/usr", url ); } void PmIpkg::update() { show( false ); runIpkg( "update" ); runwindow->close(); } void PmIpkg::out( QString o ) { runwindow->outPut->append(o); //runwindow->outPut->setCursorPosition(0, runwindow->outPut->contentsHeight()); // runwindow->outPut->setText( runwindow->outPut->text()+o ); runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); } diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index 3799969..d2490e8 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h @@ -1,64 +1,63 @@ #ifndef PMIPKG_H #define PMIPKG_H #include <qobject.h> #include <qlist.h> #include <qstring.h> #include <qwidget.h> #include "pksettings.h" #include "runwindow.h" #include "packagelist.h" +#include "installdialog.h" #include "debug.h" #define createLink 0 #define removeLink 1 class Package; class PmIpkg : public QObject { Q_OBJECT public: PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); ~PmIpkg(); int linkOpp; void loadList( PackageList ); - void commit( PackageList ); + void commit(); void update(); void showButtons(bool b=true); void show( bool buttons=true ); 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 ); void removeLinks( const QString &dest ); private: -// int sizecount; PackageManagerSettings* settings; RunWindow *runwindow; - QDialog *installDialog; + InstallDialog *installDialog; QList<Package> to_remove; QList<Package> to_install; -// bool runwindowopen; QString fileNameToInstall; QCheckBox *_force_reinstall; QCheckBox *_force_remove; QCheckBox *_force_depends; void startDialog(); void makeLinks(Package*); void linkPackage( QString, QString ); void processLinkDir( QString , QString ); int runIpkg(const QString& args, const QString& dest="" ); void out( QString ); QStringList* getList( QString, QString ); void processFileList( QStringList*, QString ); }; diff --git a/noncore/unsupported/oipkg/settings.h b/noncore/unsupported/oipkg/settings.h index bab7a4f..f01cb69 100644 --- a/noncore/unsupported/oipkg/settings.h +++ b/noncore/unsupported/oipkg/settings.h @@ -42,25 +42,26 @@ public slots: void destNameChanged(const QString&); void destUrlChanged(const QString&); void installationSettingChange(int); void newInstallationSetting(); void removeInstallationSetting(); void renameInstallationSetting(); private: QIntDict<QString> serverurlDic; QIntDict<QString> destinationurlDic; int ipkg_old; int editedserver; int editeddestination; int currentSetting; int installationSettingsCount; bool changed; + bool serverChanged; bool readIpkgConfig(const QString&); void writeIpkgConfig(const QString&); void writeSettings(); void readSettings(); }; #endif |