21 files changed, 499 insertions, 341 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO index 3fc84e5..790766c 100644 --- a/noncore/unsupported/oipkg/TODO +++ b/noncore/unsupported/oipkg/TODO @@ -1,2 +1 @@ -* setDocument function * Settings Class @@ -5,3 +4,3 @@ * parse "to install" and "to remove" from status -* install local file +* install local file dialog * qcop @@ -10,2 +9 @@ * dependency checking -* ipkg options in runwindow
\ No newline at end of file diff --git a/noncore/unsupported/oipkg/debug.h b/noncore/unsupported/oipkg/debug.h index 973d96c..206dea5 100644 --- a/noncore/unsupported/oipkg/debug.h +++ b/noncore/unsupported/oipkg/debug.h @@ -17,3 +17,3 @@ if ( debugLevel < 3 ) \ if ( I <= debugLevel ) \ - qDebug("# %s \t\t(Level: %i)\n",QString(S).latin1(),I);\ + qDebug("#%s:%i: %s \t\t(Level: %i)",__FILE__,__LINE__,QString(S).latin1(),I);\ } diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index c95f482..ca1e5e8 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp @@ -8,2 +8,3 @@ #include <qpe/resource.h> +#include <qpe/config.h> #include <qpe/qpetoolbar.h> @@ -19,2 +20,3 @@ #include <qtextview.h> +#include <qcheckbox.h> #include <qlineedit.h> @@ -26,2 +28,3 @@ #include "pksettingsbase.h" +#include "utils.h" #include "packagelistitem.h" @@ -32,29 +35,23 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : { + setCaption( tr("Package Manager") ); settings = new PackageManagerSettings(this,0,TRUE); listViewPackages = new PackageListView( this,"listViewPackages",settings ); - ipkg = new PmIpkg( settings, this ); - setCentralWidget( listViewPackages ); - setCaption( tr("Package Manager") ); // 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")); - - channel = new QCopChannel( "QPE/Application/oipkg", this ); - connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), - this, SLOT(receive(const QCString&, const QByteArray&)) ); - - makeMenu(); - - connect( section, SIGNAL( activated(int) ), - this, SLOT( sectionChanged() ) ); - connect( subsection, SIGNAL(activated(int) ), - this, SLOT( subSectionChanged() ) ); - +// wait = new QMessageBox(this); +// wait->setText(tr("Please wait")); ipkg = new PmIpkg( settings, this ); packageList.setSettings( settings ); - getList(); - setSections(); - setSubSections(); + packageList.update(); + makeMenu(); + makeChannel(); + //opie is hardcoded default ;) + 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()) ); displayList(); @@ -102,4 +99,4 @@ void MainWindow::makeMenu() -// would we use for find -// detailsAction = new QAction( tr( "Details" ), +// could we use for find +// detailsAction = new QAction( tr( "Find" ), // Resource::loadIconSet( "find" ), @@ -107,5 +104,4 @@ void MainWindow::makeMenu() // connect( detailsAction, SIGNAL( activated() ), -// this , SLOT( showDetails() ) ); +// this , SLOT( showFind() ) ); // detailsAction->addTo( toolBar ); -// detailsAction->addTo( srvMenu ); @@ -114,3 +110,2 @@ void MainWindow::makeMenu() cfgact = new QAction( tr( "Setups" ), - // Resource::loadIconSet( "" ), QString::null, 0, this, 0 ); @@ -121,3 +116,2 @@ void MainWindow::makeMenu() cfgact = new QAction( tr( "Servers" ), - // Resource::loadIconSet( "" ), QString::null, 0, this, 0 ); @@ -127,3 +121,2 @@ void MainWindow::makeMenu() cfgact = new QAction( tr( "Destinations" ), - // Resource::loadIconSet( "" ), QString::null, 0, this, 0 ); @@ -142,3 +135,2 @@ void MainWindow::makeMenu() section = new QComboBox( false, sectionBar ); -// section->setBackgroundMode( PaletteBackground ); label = new QLabel( " / ", sectionBar ); @@ -146,3 +138,2 @@ void MainWindow::makeMenu() subsection = new QComboBox( false, sectionBar ); - a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); @@ -151,2 +142,5 @@ void MainWindow::makeMenu() + setSections(); + setSubSections(); + sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); @@ -154,3 +148,2 @@ void MainWindow::makeMenu() sectionAction->setToggleAction( true ); - sectionAction->setOn( true ); sectionAction->addTo( viewMenu ); @@ -167,2 +160,5 @@ void MainWindow::makeMenu() + a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); + connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); + a->addTo( findBar ); a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); @@ -173,12 +169,37 @@ void MainWindow::makeMenu() findAction->setToggleAction( true ); - findAction->setOn( true ); findAction->addTo( viewMenu ); - #ifdef NEW + destBar = new QPEToolBar(this); + addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); + label = new QLabel( tr("Destination: "), destBar ); + label->setBackgroundColor( destBar->backgroundColor() ); + destBar->setHorizontalStretchable( TRUE ); + destination = new QComboBox( false, destBar ); + destination->insertStringList( settings->getDestinationNames() ); + setComboName(destination,settings->getDestinationName()); +// connect( destination, SIGNAL(activated(int)), +// SLOT(activeDestinationChange(int)) ); + spacer = new QLabel( " ", destBar ); + spacer->setBackgroundColor( destBar->backgroundColor() ); + CheckBoxLink = new QCheckBox( tr("Link"), destBar); + CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); + CheckBoxLink->setChecked( settings->createLinks() ); +// connect( CheckBoxLink, SIGNAL(toggled(bool)), +// settings, SLOT(linkEnabled(bool)) ); + destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); + connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); + a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); + connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); + a->addTo( destBar ); + destBar->setStretchableWidget( CheckBoxLink ); + destAction->setToggleAction( true ); + // destAction->addTo( viewMenu ); + + // configure the menus Config cfg( "oipkg", Config::User ); - cfg.setGroup( "Setting_" + QString::number( setting ) ); - CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); - findShow(bool b) - sectionShow(bool b) - #endif + cfg.setGroup( "gui" ); + + findShow( cfg.readBoolEntry( "findBar", true ) ); + sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); + destShow( cfg.readBoolEntry( "destBar", false ) ); } @@ -187,2 +208,8 @@ MainWindow::~MainWindow() { + Config cfg( "oipkg", Config::User ); + cfg.setGroup( "gui" ); + cfg.writeEntry( "findBar", !findBar->isHidden() ); + cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); + cfg.writeEntry( "destBar", !destBar->isHidden() ); + } @@ -191,2 +218,3 @@ void MainWindow::runIpkg() { + packageList.allPackages(); ipkg->commit( packageList ); @@ -202,3 +230,3 @@ void MainWindow::updateList() { - wait->show(); +// wait->show(); QTimer *t = new QTimer( this ); @@ -208,14 +236,5 @@ void MainWindow::updateList() ipkg->update(); - getList(); - t->stop(); - wait->hide(); - -} - -void MainWindow::getList() -{ - wait->show(); packageList.update(); - displayList(); - wait->hide(); + t->stop(); +// wait->hide(); } @@ -224,3 +243,3 @@ void MainWindow::filterList() { - wait->show(); +// wait->show(); QString f = ""; @@ -228,3 +247,3 @@ void MainWindow::filterList() packageList.filterPackages( f ); - wait->hide(); +// wait->hide(); } @@ -233,3 +252,3 @@ void MainWindow::displayList() { - wait->hide(); +// wait->hide(); filterList(); @@ -328,2 +347,14 @@ void MainWindow::findClose() +void MainWindow::destShow(bool b) +{ + if (b) destBar->show(); + else destBar->hide(); + destAction->setOn( b ); +} + +void MainWindow::destClose() +{ + destAction->setOn( false ); +} + void MainWindow::rotateUpdateIcon() @@ -363,8 +394,28 @@ void MainWindow::installFile(const QString &fileName) +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&)) ); +} + + + void MainWindow::receive(const QCString &msg, const QByteArray &arg) { - pvDebug(3, "QCop "+msg); + pvDebug(3, "QCop "+msg+" "+QCString(arg)); if ( msg == "installFile(QString)" ) { - installFile( QString(arg) ); + ipkg->installFile( QString(arg) ); + }else if( msg == "removeFile(QString)" ) + { + ipkg->removeFile( QString(arg) ); + }else if( msg == "createLinks(QString)" ) + { + ipkg->createLinks( QString(arg) ); + }else if( msg == "removeLinks(QString)" ) + { + ipkg->removeLinks( QString(arg) ); + }else{ + pvDebug(2,"Huh what do ya want") } diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h index a713d00..7615b09 100644 --- a/noncore/unsupported/oipkg/mainwindow.h +++ b/noncore/unsupported/oipkg/mainwindow.h @@ -19,2 +19,3 @@ class QCopChannel; class QMessageBox; +class QCheckBox; @@ -28,2 +29,3 @@ public: ~MainWindow(); + void makeChannel(); @@ -33,3 +35,2 @@ protected slots: void runIpkg(); - void getList(); void updateList(); @@ -47,2 +48,4 @@ public slots: void findShow(bool); + void destClose(); + void destShow(bool); void filterList(); @@ -62,3 +65,2 @@ private: QAction *runAction; - QAction *detailsAction; QAction *updateAction; @@ -66,2 +68,3 @@ private: QAction *sectionAction; + QAction *destAction; PackageListView *listViewPackages; @@ -72,3 +75,6 @@ private: QComboBox *subsection; - QMessageBox *wait; + QPEToolBar *destBar; + QComboBox *destination; + QCheckBox* CheckBoxLink; +// QMessageBox *wait; private slots: diff --git a/noncore/unsupported/oipkg/oipkg.pro b/noncore/unsupported/oipkg/oipkg.pro index 1f7a70d..c5d3b3d 100644 --- a/noncore/unsupported/oipkg/oipkg.pro +++ b/noncore/unsupported/oipkg/oipkg.pro @@ -7,2 +7,3 @@ HEADERS = mainwindow.h \ pmipkg.h \ + utils.h \ packagelistitem.h \ @@ -13,2 +14,3 @@ SOURCES = main.cpp \ mainwindow.cpp \ + utils.cpp \ packagelistview.cpp \ diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 5f0e5fa..0499e19 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp @@ -11,5 +11,5 @@ -Package::~Package() -{ -} +//Package::~Package() +//{ +//} @@ -63,3 +63,2 @@ void Package::setValue( QString n, QString t ) { - if ( n == "Status" && installed() ) return; if ( n == "Package" ) @@ -67,32 +66,24 @@ void Package::setValue( QString n, QString t ) _name = QString( t ); - } - if ( n == "Installed-Size" ) + }else if ( n == "Installed-Size" ) { _size = t; - } - if ( n == "Priority") + }else if ( n == "Priority") { - } - if ( n == "Section") + }else if ( n == "Section") { setSection( t ); - } - if ( n == "Maintainer") + }else if ( n == "Maintainer") { - } - if ( n == "Architecture") + }else if ( n == "Architecture") { - } - if ( n == "Version") + }else if ( n == "Version") { - } - if ( n == "Pre-Depends") + }else if ( n == "Pre-Depends") { - } - if ( n == "Depends") + }else if ( n == "Depends") { @@ -155,2 +146,18 @@ QString Package::size() +QString Package::sizeUnits() +{ + int i = _size.toInt(); + int c = 0; + QString ret; + QStringList unit; + unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;) + while (i > 1) + { + ret=QString::number(i)+" "+unit[c]; + c++; + i /= 1024; + } + return ret; +} + bool Package::toProcess() diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h index 31b0010..49bb3bf 100644 --- a/noncore/unsupported/oipkg/package.h +++ b/noncore/unsupported/oipkg/package.h @@ -17,3 +17,3 @@ class Package //: public QObject Package(PackageManagerSettings *); - ~Package(); + // ~Package(); Package( QStringList, PackageManagerSettings * ); @@ -32,2 +32,3 @@ class Package //: public QObject QString size(); + QString sizeUnits(); void setSection( QString ); @@ -47,3 +48,2 @@ class Package //: public QObject public slots: - /** No descriptions */ QString getPackageName(); diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp index 149ba35..0c7c928 100644 --- a/noncore/unsupported/oipkg/packagelistitem.cpp +++ b/noncore/unsupported/oipkg/packagelistitem.cpp @@ -19,14 +19,3 @@ PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSetti QCheckListItem *item; -#ifndef NEWLAYOUT - item = new QCheckListItem( this, QObject::tr("Name") ); - item->setText(1,pi->name()); - item = new QCheckListItem( this, QObject::tr("Description") ); - item->setText(1,pi->desc()+"\ntest multi\nline"); - item = new QCheckListItem( this, QObject::tr("Size") ); - item->setText(1,pi->size()); - item = new QCheckListItem( this, QObject::tr("Destination") ); - item->setText(1,pi->getDest()); -#endif -#ifdef NEWLAYOUT - item = new QCheckListItem( this, QObject::tr("Name: ")+pi->name() ); + nameItem = new QCheckListItem( this, "" ); item = new QCheckListItem( this, QObject::tr("Description: ")+pi->desc() ); @@ -36,5 +25,5 @@ PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSetti displayDetails(); -#endif - if (!pm_uninstalled) { + if (!pm_uninstalled) + { pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); @@ -44,6 +33,2 @@ PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSetti } -#ifndef NEWLAYOUT - setText(1, package->shortDesc() ); - setText(2, package->size() ); -#endif } @@ -122,9 +107,2 @@ void PackageListItem::setOn( bool b ) package->toggleProcess(); -// if ( b ) -// { -// if ((package->dest()).isEmpty) -// package->setDest( settings->getDestinationName() ); -// }else{ -// package->setDest( QObject::tr("not installed")); -// } package->setLink( settings->createLinks() ); @@ -135,2 +113,7 @@ void PackageListItem::displayDetails() { + QString sod = " ("+package->sizeUnits(); + sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest()); + sod += ")"; + setText(0, package->name()+sod ); + nameItem->setText( 0, QObject::tr("Name: ")+package->name()); linkItem->setText( 0, QObject::tr("Link: ")+QString(package->link()?QObject::tr("Yes"):QObject::tr("No")) ); diff --git a/noncore/unsupported/oipkg/packagelistitem.h b/noncore/unsupported/oipkg/packagelistitem.h index f695432..54d9f9e 100644 --- a/noncore/unsupported/oipkg/packagelistitem.h +++ b/noncore/unsupported/oipkg/packagelistitem.h @@ -29,2 +29,3 @@ public: private: + QCheckListItem *nameItem; QCheckListItem *destItem; diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp index 693ea6a..2915ac6 100644 --- a/noncore/unsupported/oipkg/packagelistview.cpp +++ b/noncore/unsupported/oipkg/packagelistview.cpp @@ -54,3 +54,3 @@ void PackageListView::setCurrent( QListViewItem* p ) activePackage = activePackageListItem->getPackage(); - pvDebug(5, "start timer"); + if (!activePackage) return; popupTimer->start( 750, true ); @@ -65,4 +65,7 @@ void PackageListView::showPopup() QAction *popupAction; + if ( !activePackage->installed() ) + { popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); QStringList dests = settings->getDestinationNames(); + QString ad = settings->getDestinationName(); for (uint i = 0; i < dests.count(); i++ ) @@ -71,2 +74,7 @@ void PackageListView::showPopup() popupAction->addTo( destsMenu ); + if ( dests[i] == ad && activePackage->toInstall() ) + { + popupAction->setToggleAction( true ); + popupAction->setOn(true); + }; } @@ -74,2 +82,5 @@ void PackageListView::showPopup() this, SLOT( changePackageDest( int ) ) ); + }else{ +// popupActcat setOn( activePackage->toProcess() ); + } popupMenu->popup( QCursor::pos() ); @@ -79,3 +90,2 @@ void PackageListView::stopTimer( QListViewItem* ) { - pvDebug( 5, "stop timer" ); popupTimer->stop(); @@ -91 +101,7 @@ void PackageListView::changePackageDest( int i ) } + +void PackageListView::toggleProcess() +{ + activePackage->toggleProcess() ; + activePackageListItem->displayDetails(); +} diff --git a/noncore/unsupported/oipkg/packagelistview.h b/noncore/unsupported/oipkg/packagelistview.h index 15e200b..a3db0d0 100644 --- a/noncore/unsupported/oipkg/packagelistview.h +++ b/noncore/unsupported/oipkg/packagelistview.h @@ -50,2 +50,4 @@ public slots: void stopTimer( QListViewItem* ); + /** No descriptions */ + void toggleProcess(); }; diff --git a/noncore/unsupported/oipkg/pkdesc.ui b/noncore/unsupported/oipkg/pkdesc.ui deleted file mode 100644 index 494d3d6..0000000 --- a/noncore/unsupported/oipkg/pkdesc.ui +++ b/dev/null @@ -1,96 +0,0 @@ -<!DOCTYPE UI><UI> -<class>PackageDetails</class> -<widget> - <class>QDialog</class> - <property stdset="1"> - <name>name</name> - <cstring>Form7</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>0</x> - <y>0</y> - <width>221</width> - <height>291</height> - </rect> - </property> - <property stdset="1"> - <name>caption</name> - <string>(pkgname)</string> - </property> - <property> - <name>layoutMargin</name> - </property> - <property> - <name>layoutSpacing</name> - </property> - <vbox> - <property stdset="1"> - <name>margin</name> - <number>6</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>3</number> - </property> - <widget> - <class>QTextView</class> - <property stdset="1"> - <name>name</name> - <cstring>description</cstring> - </property> - </widget> - <widget> - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout4</cstring> - </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QToolButton</class> - <property stdset="1"> - <name>name</name> - <cstring>install</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Install</string> - </property> - </widget> - <widget> - <class>QToolButton</class> - <property stdset="1"> - <name>name</name> - <cstring>remove</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Remove</string> - </property> - </widget> - <widget> - <class>QToolButton</class> - <property stdset="1"> - <name>name</name> - <cstring>ignore</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Ignore</string> - </property> - </widget> - </hbox> - </widget> - </vbox> -</widget> -</UI> diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp index be01837..6c8dc2a 100644 --- a/noncore/unsupported/oipkg/pksettings.cpp +++ b/noncore/unsupported/oipkg/pksettings.cpp @@ -33,2 +33,3 @@ #include "debug.h" +//#include "utils.h" @@ -58,2 +59,3 @@ PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* na readSettings(); + activeLinkDestination->hide(); } @@ -78,4 +80,6 @@ void PackageManagerSettings::newServer() } + changed = true; servers->setSelected(i,TRUE); editServer(i); + changed = true; } @@ -99,2 +103,3 @@ void PackageManagerSettings::newDestination() editDestination(i); + changed = true; } @@ -119,2 +124,3 @@ void PackageManagerSettings::editServer(int i) connect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); + changed = true; } @@ -139,2 +145,3 @@ void PackageManagerSettings::editDestination(int i) connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); + changed = true; } @@ -153,2 +160,3 @@ void PackageManagerSettings::removeServer() serverurl->setEnabled(FALSE); + changed = true; } @@ -168,2 +176,3 @@ void PackageManagerSettings::removeDestination() destinationurl->setEnabled(FALSE); + changed = true; } @@ -175,3 +184,5 @@ void PackageManagerSettings::serverNameChanged(const QString& t) activeServers->changeItem( t, editedserver ); + changed = true; connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); + changed = true; } @@ -185,2 +196,3 @@ void PackageManagerSettings::destNameChanged(const QString& t) connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); + changed = true; } @@ -190,2 +202,3 @@ void PackageManagerSettings::serverUrlChanged(const QString& t) serverurlDic.replace(editedserver, new QString(t)); + changed = true; } @@ -195,2 +208,3 @@ void PackageManagerSettings::destUrlChanged(const QString& t) destinationurlDic.replace(editeddestination, new QString(t)); + changed = true; } @@ -267,2 +281,3 @@ void PackageManagerSettings::installationSettingChange(int cs) readInstallationSetting( cs ); + changed = true; } @@ -271,3 +286,2 @@ void PackageManagerSettings::writeInstallationSettings() { - if ( ! changed ) return ; { @@ -287,3 +301,3 @@ void PackageManagerSettings::readInstallationSetting(int setting) cfg.setGroup( "Setting_" + QString::number( setting ) ); - CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); + CheckBoxLink->setChecked( cfg.readBoolEntry( "link", true ) ); QString dest = cfg.readEntry( "dest" ); @@ -292,3 +306,2 @@ void PackageManagerSettings::readInstallationSetting(int setting) pvDebug(3, "linkdest="+linkdest); - for ( int i = 0; i < activeDestination->count(); i++) @@ -305,3 +318,2 @@ void PackageManagerSettings::writeCurrentInstallationSetting() Config cfg( "oipkg", Config::User ); - changed = false; cfg.setGroup( "Setting_" + QString::number(currentSetting) ); @@ -334,2 +346,3 @@ bool PackageManagerSettings::readIpkgConfig(const QString& conffile) QFile conf(conffile); + changed = false; if ( conf.open(IO_ReadOnly) ) { @@ -426,3 +439,3 @@ void PackageManagerSettings::writeSettings() { - writeIpkgConfig("/etc/ipkg.conf"); + if ( changed ) writeIpkgConfig("/etc/ipkg.conf"); writeInstallationSettings(); @@ -437,3 +450,3 @@ bool PackageManagerSettings::showDialog( int i ) else readSettings(); - return ret; + return (changed && ret); } @@ -471,2 +484,11 @@ QStringList PackageManagerSettings::getActiveServers() } + QStringList PackageManagerSettings::getServers() +{ + QStringList sl; + for (int i=0; i<(int)activeServers->count(); i++) + { + sl += activeServers->text(i); + } + return sl; +} @@ -508,4 +530,13 @@ void PackageManagerSettings::linkEnabled( bool b ) { - changed = true; activeLinkDestination->setEnabled( b ); } + +void PackageManagerSettings::activeServerChanged() +{ + changed = true; +} + +QComboBox* PackageManagerSettings::getDestCombo() +{ + return new QComboBox(activeDestination); +} diff --git a/noncore/unsupported/oipkg/pksettings.h b/noncore/unsupported/oipkg/pksettings.h index 11ba55c..fbb3b99 100644 --- a/noncore/unsupported/oipkg/pksettings.h +++ b/noncore/unsupported/oipkg/pksettings.h @@ -19,2 +19,3 @@ public: bool createLinks(); + QStringList getServers(); QStringList getActiveServers(); @@ -23,2 +24,4 @@ public: QString getDestinationUrlByName(QString); + /** No descriptions */ + QComboBox* getDestCombo(); @@ -61,2 +64,3 @@ public slots: void renameInstallationSetting(); + void activeServerChanged(); }; diff --git a/noncore/unsupported/oipkg/pksettingsbase.ui b/noncore/unsupported/oipkg/pksettingsbase.ui index 196a89f..fd6d208 100644 --- a/noncore/unsupported/oipkg/pksettingsbase.ui +++ b/noncore/unsupported/oipkg/pksettingsbase.ui @@ -13,3 +13,3 @@ <y>0</y> - <width>349</width> + <width>345</width> <height>454</height> @@ -178,3 +178,3 @@ <name>text</name> - <string>Link Destination: root</string> + <string>Link to root destination</string> </property> @@ -720,2 +720,20 @@ <connections> + <connection> + <sender>activeServers</sender> + <signal>pressed(QListBoxItem*)</signal> + <receiver>Form4</receiver> + <slot>activeServerChanged()</slot> + </connection> + <connection> + <sender>activeServers</sender> + <signal>selectionChanged(QListBoxItem*)</signal> + <receiver>Form4</receiver> + <slot>activeServerChanged()</slot> + </connection> + <connection> + <sender>activeServers</sender> + <signal>pressed(QListBoxItem*)</signal> + <receiver>Form4</receiver> + <slot>activeServerChanged()</slot> + </connection> <slot access="public">destNameChanged(const QString&)</slot> @@ -730,2 +748,3 @@ <slot access="public">newServer()</slot> + <slot access="public">activeServerChanged()</slot> <slot access="public">removeDestination()</slot> diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index ecc97b2..9f6429a 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp @@ -11,2 +11,3 @@ #include <qfile.h> +#include <qgroupbox.h> #include <qmultilineedit.h> @@ -59,4 +60,11 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) -// if (runwindow->forcedepends->isChecked()) -// cmd += " -force-depends "; + if (_force_depends) + { + if (_force_depends->isChecked()) + cmd += " -force-depends "; + if (_force_reinstall->isChecked()) + cmd += " -force-reinstall "; + if (_force_remove->isChecked()) + cmd += " -force-removal-of-essential-packages "; + } @@ -83,5 +91,3 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) while ( ! f.open(IO_ReadOnly) ) {}; - // { QTextStream t( &f ); - // QString fp; while ( !t.eof() ) @@ -95,3 +101,2 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) } -// } f.close(); @@ -106,4 +111,10 @@ void PmIpkg::makeLinks(Package *pack) pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); - QString dest = settings->getDestinationUrlByName( pack->dest() ); - if (dest == "/" ) return; + linkPackage( pack->name(), pack->dest() ); +} + +QStringList* PmIpkg::getList( QString packFileName, QString d ) +{ + QString dest = settings->getDestinationUrlByName( d ); + dest = dest==""?d:dest; + if (dest == "/" ) return 0; { @@ -113,8 +124,3 @@ void PmIpkg::makeLinks(Package *pack) } - QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list"; - linkPackage( fn, dest ); -} - -void PmIpkg::linkPackage( QString packFileName, QString dest ) -{ + packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; QFile f( packFileName ); @@ -122,17 +128,34 @@ void PmIpkg::linkPackage( QString packFileName, QString dest ) { + pvDebug(1," Panik! Could not open"); out( "<b>Panik!</b> Could not open:<br>"+packFileName ); - return; - }; - out( "<br>creating links<br>" ); - out("for package "+packFileName+" in "+dest+"<br>"); + return (QStringList*)0; + } + QStringList *fileList = new QStringList(); QTextStream t( &f ); - QString fp; while ( !t.eof() ) { - fp = t.readLine(); - processLinkDir( fp, dest ); + *fileList += t.readLine(); } - f.close(); + return fileList; } +void PmIpkg::linkPackage( QString packFileName, QString dest ) +{ + QStringList *fileList = getList( packFileName, dest ); + processFileList( fileList, dest ); + delete fileList; +} + +void PmIpkg::processFileList( QStringList *fileList, QString d ) +{ + if (!fileList) return; + for (uint i=0; i < fileList->count(); i++) + { + QString dest = settings->getDestinationUrlByName( d ); + dest = dest==""?d:dest; + processLinkDir( (*fileList)[i], dest ); + } +} + + void PmIpkg::processLinkDir( QString file, QString dest ) @@ -140,3 +163,5 @@ void PmIpkg::processLinkDir( QString file, QString dest ) pvDebug( 7,"PmIpkg::processLinkDir "+file+" to "+ dest); - if ( dest == "???" ) return; + if (linkOpp==createLink) pvDebug( 2,"opp: createLink"); + if (linkOpp==removeLink) pvDebug( 2,"opp:removeLink"); + if ( dest == "???" || dest == "" ) return; QString destFile = file; @@ -148,3 +173,3 @@ void PmIpkg::processLinkDir( QString file, QString dest ) QDir destDir( destFile ); - destDir.mkdir( destFile, true ); + if (linkOpp==createLink) destDir.mkdir( destFile, true ); QDir d( file ); @@ -156,3 +181,3 @@ void PmIpkg::processLinkDir( QString file, QString dest ) { - // out( "<b>"+fi->absFilePath()+"</b>" ); + pvDebug(4, "process dir "+fi->absFilePath()); processLinkDir( fi->absFilePath(), dest ); @@ -160,2 +185,7 @@ void PmIpkg::processLinkDir( QString file, QString dest ) } +// if (linkOpp==removeLink) +// { +// pvDebug(2,"remove destDir "+ destFile ); +// destDir.remove( destFile, true ); +// } } else @@ -165,6 +195,17 @@ void PmIpkg::processLinkDir( QString file, QString dest ) const char *linkFile = strdup( (destFile).ascii()); -// out( "linking: "+file+" -> "+destFile ); - qDebug( "linking: %s -> %s", instFile, linkFile ); + 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() ) + unlink( linkFile ); + } + } } @@ -178,3 +219,2 @@ void PmIpkg::commit( PackageList pl ) QString inst="<b>"+tr("To install:")+"</b><br>\n"; - pl.allPackages(); for( Package *pack = pl.first();pack ; (pack = pl.next()) ) @@ -209,59 +249,53 @@ void PmIpkg::startDialog() - QHBoxLayout *buttons = new QHBoxLayout; - buttons->setSpacing( 6 ); - buttons->setMargin( 0 ); - 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() ) { - plv->insertItem( new PackageListItem(plv, it,settings) ); + 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() ) { - plv->insertItem( new PackageListItem(plv, it,settings) ); - } - QPushButton *doItButton = new QPushButton( installDialog, "doItButton" ); - doItButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, doItButton->sizePolicy().hasHeightForWidth() ) ); - QFont doItButton_font( doItButton->font() ); - doItButton_font.setPointSize( 8 ); - doItButton->setFont( doItButton_font ); - doItButton->setText( tr( "Do all " ) ); - doItButton->setAutoResize( FALSE ); - buttons->addWidget( doItButton ); - - QPushButton *installButton = new QPushButton( installDialog, "installButton" ); - QFont installButton_font( installButton->font() ); - installButton_font.setPointSize( 8 ); - installButton->setFont( installButton_font ); - installButton->setText( tr( "Install" ) ); - installButton->setAutoResize( TRUE ); - buttons->addWidget( installButton ); - - QPushButton *removeButton = new QPushButton( installDialog, "removeButton" ); - QFont removeButton_font( removeButton->font() ); - removeButton_font.setPointSize( 7 ); - removeButton->setFont( removeButton_font ); - removeButton->setText( tr( "Remove" ) ); - removeButton->setAutoResize( TRUE ); - buttons->addWidget( removeButton ); - - QPushButton *cancelButton = new QPushButton( installDialog, "cancelButton" ); - QFont cancelButton_font( cancelButton->font() ); - cancelButton_font.setPointSize( 8 ); - cancelButton->setFont( cancelButton_font ); - cancelButton->setText( tr( "Cancel" ) ); - cancelButton->setAutoResize( TRUE ); - buttons->addWidget( cancelButton ); - - RunWindowLayout->addLayout( buttons, 3, 0 ); - - connect( doItButton, SIGNAL( clicked() ), - this, SLOT( doIt() ) ); - connect( installButton, SIGNAL( clicked() ), - this, SLOT( install() ) ); - connect( removeButton, SIGNAL( clicked() ), - this, SLOT( remove() ) ); - connect( cancelButton, SIGNAL( clicked() ), - installDialog, SLOT( close() ) ); + toInstallItem->insertItem( new PackageListItem(plv, it,settings) ); + } + + QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" ); + GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().hasHeightForWidth() ) ); + 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 ); + 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 ); + +// connect( doItButton, SIGNAL( clicked() ), +// this, SLOT( doIt() ) ); +// connect( installButton, SIGNAL( clicked() ), +// this, SLOT( install() ) ); +// connect( removeButton, SIGNAL( clicked() ), +// this, SLOT( remove() ) ); +// connect( cancelButton, SIGNAL( clicked() ), +// installDialog, SLOT( close() ) ); installDialog->showMaximized(); @@ -269,2 +303,3 @@ void PmIpkg::startDialog() installDialog->close(); + out(tr("<b>All done.</b>")); } @@ -273,2 +308,3 @@ void PmIpkg::doIt() { + show( true ); remove(); @@ -281,18 +317,28 @@ void PmIpkg::remove() if ( to_remove.count() == 0 ) return; - installDialog->close(); - show( true ); - out("<hr><hr><b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br>"); + out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>"); + QStringList *fileList; for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) { + if ( it->link() )fileList = getList( it->name(), it->dest() ); if ( runIpkg("remove " + it->name()) == 0) { - runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); + runwindow->progress->setProgress( 1 + runwindow->progress->progress() ); + linkOpp = removeLink; + if ( it->link() ) + { + out( "<br>removing links<br>" ); + out( "for package "+it->name()+" in "+it->dest()+"<br>" ); + processFileList( fileList, it->dest() ); + } it->processed(); - runwindow->progress->setProgress( 1 ); + out("<br><hr>"); }else{ - out("<b>"+tr("Error while removing")+"</b>"+it->name()); + out("<b>"+tr("Error while removing")+"</b><hr>"+it->name()); } + pvDebug(2,"delete File List"); + if ( it->link() )delete fileList; } + out("<br>"); } @@ -303,5 +349,3 @@ void PmIpkg::install() if ( to_install.count() == 0 ) return; - installDialog->close(); - show( true ); - out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); + out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); for (Package *it=to_install.first(); it != 0; it=to_install.next() ) @@ -312,24 +356,34 @@ 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(); + out("<br><hr>"); }else{ - out("<b>"+tr("Error while installing")+"</b>"+it->name()); + out("<b>"+tr("Error while installing")+"</b><hr>"+it->name()); } } + out("<br>"); } -void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) +void PmIpkg::createLinks( const QString &dest ) { - qDebug("msg="+msg+" -- "+QString(dest) ); -// QDir d( src ); -// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); -//// if (! d.exists() ) return; -// const QFileInfoList *list = d.entryInfoList(); -// QFileInfoListIterator it( *list ); -// QFileInfo *fi; -// while ( (fi=it.current()) ) { -// processLinkDir( fi->absFilePath(), dest ); -// ++it; -// } + pvDebug(2,"PmIpkg::createLinks "+dest); + linkOpp=createLink; + QString url = settings->getDestinationUrlByName( dest ); + url = url==""?dest:url; + processLinkDir( "/", 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 ); } @@ -345,3 +399,5 @@ void PmIpkg::out( QString o ) { - runwindow->outPut->setText( runwindow->outPut->text()+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()); @@ -378,3 +434,3 @@ void PmIpkg::show(bool b) -void PmIpkg::installFile(const QString &fileName) +void PmIpkg::installFile(const QString &fileName, const QString &dest) { @@ -384,4 +440,20 @@ void PmIpkg::installFile(const QString &fileName) pvDebug( 2,"PmIpkg::installFile "+ fileName); - to_install.append( new Package(fileName,settings) ); + Package *p = new Package(fileName,settings); + if ( dest!="") p->setDest( dest ); + to_install.append( p ); + startDialog(); + delete p; +} + +void PmIpkg::removeFile(const QString &fileName, const QString &dest) +{ + + to_install.clear(); + to_remove.clear(); + pvDebug( 2,"PmIpkg::removeFile "+ fileName); + Package *p = new Package(fileName,settings); + if ( dest!="") p->setDest( dest ); + to_remove.append( p ); startDialog(); + delete p; } diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index c5e6255..0625032 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h @@ -13,2 +13,5 @@ +#define createLink 0 +#define removeLink 1 + class Package; @@ -21,5 +24,6 @@ public: + int linkOpp; void commit( PackageList ); void update(); - PackageList* getPackageList(); + // PackageList* getPackageList(); void showButtons(bool b=true); @@ -27,2 +31,11 @@ public: +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: @@ -35,3 +48,5 @@ private: QString fileNameToInstall; - + QCheckBox *_force_reinstall; + QCheckBox *_force_remove; + QCheckBox *_force_depends; void startDialog(); @@ -42,9 +57,6 @@ private: void out( QString ); + QStringList* getList( QString, QString ); + void processFileList( QStringList*, QString ); + -public slots: - void doIt(); - void install(); - void remove(); - void installFile(const QString &fileName); - void linkDestination( const QString, const QByteArray ); }; diff --git a/noncore/unsupported/oipkg/settings.cpp b/noncore/unsupported/oipkg/settings.cpp index 2b324be..8f91995 100644 --- a/noncore/unsupported/oipkg/settings.cpp +++ b/noncore/unsupported/oipkg/settings.cpp @@ -436 +436,6 @@ void PackageManagerSettings::linkEnabled( bool b ) } + +void PackageManagerSettings::activeDestinationChange(int i) +{ + activeLinkDestination->setCurrentItem( i ); +}
\ No newline at end of file diff --git a/noncore/unsupported/oipkg/settings.h b/noncore/unsupported/oipkg/settings.h index cf6e614..e2072f1 100644 --- a/noncore/unsupported/oipkg/settings.h +++ b/noncore/unsupported/oipkg/settings.h @@ -23,17 +23,2 @@ public: -private: - QIntDict<QString> serverurlDic; - QIntDict<QString> destinationurlDic; - int ipkg_old; - int editedserver; - int editeddestination; - int currentSetting; - int installationSettingsCount; - bool changed; - - bool readIpkgConfig(const QString&); - void writeIpkgConfig(const QString&); - void writeSettings(); - void readSettings(); - public slots: @@ -44,3 +29,3 @@ public slots: void installationSettingSetName(const QString &); - + void activeDestinationChange(int) void newServer(); @@ -60,2 +45,17 @@ public slots: void renameInstallationSetting(); + +private: + QIntDict<QString> serverurlDic; + QIntDict<QString> destinationurlDic; + int ipkg_old; + int editedserver; + int editeddestination; + int currentSetting; + int installationSettingsCount; + bool changed; + + bool readIpkgConfig(const QString&); + void writeIpkgConfig(const QString&); + void writeSettings(); + void readSettings(); }; diff --git a/noncore/unsupported/oipkg/utils.cpp b/noncore/unsupported/oipkg/utils.cpp new file mode 100644 index 0000000..13b17fb --- a/dev/null +++ b/noncore/unsupported/oipkg/utils.cpp @@ -0,0 +1,27 @@ +/*************************************************************************** + utils.cpp - description + ------------------- + begin : Sun Apr 28 2002 + copyright : (C) 2002 by tille + email : tille@handhelds.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include <qcombobox.h> +#include <qstring.h> +#include "utils.h" + +void setComboName( QComboBox* combo, QString s) +{ + for ( int i = 0; i < combo->count(); i++) + if ( combo->text( i ) == s ) + combo->setCurrentItem( i ); +}
\ No newline at end of file diff --git a/noncore/unsupported/oipkg/utils.h b/noncore/unsupported/oipkg/utils.h new file mode 100644 index 0000000..bb033c5 --- a/dev/null +++ b/noncore/unsupported/oipkg/utils.h @@ -0,0 +1,18 @@ +/*************************************************************************** + utils.h - description + ------------------- + begin : Sun Apr 28 2002 + copyright : (C) 2002 by tille + email : tille@handhelds.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +void setComboName( QComboBox*, QString );
\ No newline at end of file |