summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/TODO4
-rw-r--r--noncore/unsupported/oipkg/debug.h2
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp159
-rw-r--r--noncore/unsupported/oipkg/mainwindow.h12
-rw-r--r--noncore/unsupported/oipkg/oipkg.pro2
-rw-r--r--noncore/unsupported/oipkg/package.cpp47
-rw-r--r--noncore/unsupported/oipkg/package.h4
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.cpp33
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.h1
-rw-r--r--noncore/unsupported/oipkg/packagelistview.cpp20
-rw-r--r--noncore/unsupported/oipkg/packagelistview.h2
-rw-r--r--noncore/unsupported/oipkg/pkdesc.ui96
-rw-r--r--noncore/unsupported/oipkg/pksettings.cpp45
-rw-r--r--noncore/unsupported/oipkg/pksettings.h4
-rw-r--r--noncore/unsupported/oipkg/pksettingsbase.ui23
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp276
-rw-r--r--noncore/unsupported/oipkg/pmipkg.h28
-rw-r--r--noncore/unsupported/oipkg/settings.cpp5
-rw-r--r--noncore/unsupported/oipkg/settings.h32
-rw-r--r--noncore/unsupported/oipkg/utils.cpp27
-rw-r--r--noncore/unsupported/oipkg/utils.h18
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,11 +1,9 @@
-* setDocument function
* Settings Class
* tr() ;)
* Dialog to display ipkg output live
* parse "to install" and "to remove" from status
-* install local file
+* install local file dialog
* qcop
* error handling
* manage links
* 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
@@ -1,21 +1,21 @@
#ifndef _DEBUG_H_
#define _DEBUG_H_
#include <stdio.h>
extern int debugLevel;
#define HACK
#define NEWLAYOUT
#define pvDebug(I, S) \
if ( debugLevel < 3 ) \
{ \
if ( I <= debugLevel ) qDebug(S);\
}else{\
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);\
}
#endif \ No newline at end of file
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
@@ -1,371 +1,422 @@
// adadpted form qpe/qipkg
#include "mainwindow.h"
#include <qpe/qpemenubar.h>
#include <qpe/qpemessagebox.h>
#include <qpe/resource.h>
+#include <qpe/config.h>
#include <qpe/qpetoolbar.h>
#include <qpe/qcopenvelope_qws.h>
#include <qaction.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qtoolbutton.h>
#include <qstring.h>
#include <qlabel.h>
#include <qfile.h>
#include <qlistview.h>
#include <qtextview.h>
+#include <qcheckbox.h>
#include <qlineedit.h>
#include <qtabwidget.h>
#include <qcombobox.h>
#include <qmessagebox.h>
#include <qlayout.h>
#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 );
- 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();
}
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 = new QLabel( "", toolBar );
spacer->setBackgroundColor( toolBar->backgroundColor() );
toolBar->setStretchableWidget( spacer );
runAction = new QAction( tr( "Apply" ),
Resource::loadPixmap( "oipkg/install" ),
QString::null, 0, this, 0 );
connect( runAction, SIGNAL( activated() ),
this, SLOT( runIpkg() ) );
runAction->addTo( toolBar );
runAction->addTo( srvMenu );
srvMenu->insertSeparator ();
updateAction = new QAction( tr( "Update" ),
Resource::loadIconSet( "oipkg/update" ),
QString::null, 0, this, 0 );
connect( updateAction, SIGNAL( activated() ),
this , SLOT( updateList() ) );
updateAction->addTo( toolBar );
updateAction->addTo( srvMenu );
-// would we use for find
-// detailsAction = new QAction( tr( "Details" ),
+// could we use for find
+// detailsAction = new QAction( tr( "Find" ),
// Resource::loadIconSet( "find" ),
// QString::null, 0, this, 0 );
// connect( detailsAction, SIGNAL( activated() ),
-// this , SLOT( showDetails() ) );
+// this , SLOT( showFind() ) );
// detailsAction->addTo( toolBar );
-// detailsAction->addTo( srvMenu );
QAction *cfgact;
cfgact = new QAction( tr( "Setups" ),
- // Resource::loadIconSet( "" ),
QString::null, 0, this, 0 );
connect( cfgact, SIGNAL( activated() ),
SLOT( showSettings() ) );
cfgact->addTo( cfgMenu );
cfgact = new QAction( tr( "Servers" ),
- // Resource::loadIconSet( "" ),
QString::null, 0, this, 0 );
connect( cfgact, SIGNAL( activated() ),
SLOT( showSettingsSrv() ) );
cfgact->addTo( cfgMenu );
cfgact = new QAction( tr( "Destinations" ),
- // Resource::loadIconSet( "" ),
QString::null, 0, this, 0 );
connect( cfgact, SIGNAL( activated() ),
SLOT( showSettingsDst() ) );
cfgact->addTo( cfgMenu );
QAction *a;
sectionBar = new QPEToolBar( this );
addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE );
sectionBar->setHorizontalStretchable( true );
QLabel *label = new QLabel( tr("Section: "), sectionBar );
label->setBackgroundColor( sectionBar->backgroundColor() );
sectionBar->setStretchableWidget( label );
section = new QComboBox( false, sectionBar );
-// section->setBackgroundMode( PaletteBackground );
label = new QLabel( " / ", sectionBar );
label->setBackgroundColor( sectionBar->backgroundColor() );
subsection = new QComboBox( false, sectionBar );
-
a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) );
a->addTo( sectionBar );
+ setSections();
+ setSubSections();
+
sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 );
connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) );
sectionAction->setToggleAction( true );
- sectionAction->setOn( true );
sectionAction->addTo( viewMenu );
findBar = new QPEToolBar(this);
addToolBar( findBar, "Search", QMainWindow::Top, TRUE );
label = new QLabel( tr("Filter: "), findBar );
label->setBackgroundColor( findBar->backgroundColor() );
findBar->setHorizontalStretchable( TRUE );
findEdit = new QLineEdit( findBar, "findEdit" );
findBar->setStretchableWidget( findEdit );
connect( findEdit, SIGNAL( textChanged( const QString & ) ),
this, SLOT( displayList() ) );
+ 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 );
connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
a->addTo( findBar );
findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 );
connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) );
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 ) );
}
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() );
+
}
void MainWindow::runIpkg()
{
+ packageList.allPackages();
ipkg->commit( packageList );
// ##### 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();
+// wait->show();
QTimer *t = new QTimer( this );
connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) );
t->start( 0, false );
packageList.clear();
ipkg->update();
- getList();
- t->stop();
- wait->hide();
-
-}
-
-void MainWindow::getList()
-{
- wait->show();
packageList.update();
- displayList();
- wait->hide();
+ t->stop();
+// wait->hide();
}
void MainWindow::filterList()
{
- wait->show();
+// wait->show();
QString f = "";
if ( findAction->isOn() ) f = findEdit->text();
packageList.filterPackages( f );
- wait->hide();
+// wait->hide();
}
void MainWindow::displayList()
{
- wait->hide();
+// wait->hide();
filterList();
listViewPackages->clear();
Package *pack = packageList.first();
while( pack )
{
if ( pack && (pack->name() != "") )
listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) );
pack = packageList.next();
}
}
void MainWindow::sectionChanged()
{
disconnect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
disconnect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
subsection->clear();
packageList.setSection( section->currentText() );
setSubSections();
connect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
connect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
displayList();
}
void MainWindow::subSectionChanged()
{
disconnect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
disconnect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
packageList.setSubSection( subsection->currentText() );
connect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
connect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
displayList();
}
void MainWindow::setSections()
{
section->clear();
section->insertStringList( packageList.getSections() );
}
void MainWindow::setSubSections()
{
subsection->clear();
subsection->insertStringList( packageList.getSubSections() );
}
void MainWindow::showSettings()
{
if ( settings->showDialog( 0 ) )
updateList();
}
void MainWindow::showSettingsSrv()
{
if ( settings->showDialog( 1 ) )
updateList();
}
void MainWindow::showSettingsDst()
{
if ( settings->showDialog( 2 ) )
updateList();
}
void MainWindow::sectionShow(bool b)
{
if (b) sectionBar->show();
else sectionBar->hide();
sectionAction->setOn( b );
}
void MainWindow::sectionClose()
{
sectionAction->setOn( false );
}
void MainWindow::findShow(bool b)
{
if (b) findBar->show();
else findBar->hide();
findAction->setOn( b );
}
void MainWindow::findClose()
{
findAction->setOn( false );
}
+void MainWindow::destShow(bool b)
+{
+ if (b) destBar->show();
+ else destBar->hide();
+ destAction->setOn( b );
+}
+
+void MainWindow::destClose()
+{
+ destAction->setOn( false );
+}
+
void MainWindow::rotateUpdateIcon()
{
pvDebug(2, "MainWindow::rotateUpdateIcon");
if ( updateIcon )
updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) );
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();
}
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();
}
+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")
}
} \ No newline at end of file
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
@@ -1,78 +1,84 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <qmainwindow.h>
#include <qaction.h>
#include <qtimer.h>
#include <qpopupmenu.h>
#include "packagelist.h"
#include "pmipkg.h"
#include "pksettings.h"
#include "packagelistview.h"
class QComboBox;
class QPEToolBar;
class QLineEdit;
class PackageListItem;
class QCopChannel;
class QMessageBox;
+class QCheckBox;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
~MainWindow();
+ void makeChannel();
QCopChannel *channel;
protected slots:
void runIpkg();
- void getList();
void updateList();
void displayList();
void subSectionChanged();
void sectionChanged();
void showSettings();
void showSettingsSrv();
void showSettingsDst();
public slots:
void sectionClose();
void sectionShow(bool);
void findClose();
void findShow(bool);
+ void destClose();
+ void destShow(bool);
void filterList();
void receive (const QCString &, const QByteArray &);
void setDocument (const QString &);
private:
void makeMenu();
void setSections();
void setSubSections();
void installFile(const QString &);
bool updateIcon;
PmIpkg* ipkg;
PackageManagerSettings *settings;
PackageList packageList;
QAction *runAction;
- QAction *detailsAction;
QAction *updateAction;
QAction *findAction;
QAction *sectionAction;
+ QAction *destAction;
PackageListView *listViewPackages;
QPEToolBar *findBar;
QLineEdit *findEdit;
QPEToolBar *sectionBar;
QComboBox *section;
QComboBox *subsection;
- QMessageBox *wait;
+ QPEToolBar *destBar;
+ QComboBox *destination;
+ QCheckBox* CheckBoxLink;
+// QMessageBox *wait;
private slots:
void rotateUpdateIcon();
};
#endif
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
@@ -1,26 +1,28 @@
DESTDIR = $(OPIEDIR)/bin
TEMPLATE = app
#CONFIG = qt warn_on release
CONFIG = qt warn_on debug
HEADERS = mainwindow.h \
pksettings.h \
pmipkg.h \
+ utils.h \
packagelistitem.h \
packagelist.h \
packagelistview.h \
package.h
SOURCES = main.cpp \
mainwindow.cpp \
+ utils.cpp \
packagelistview.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/package.cpp b/noncore/unsupported/oipkg/package.cpp
index 5f0e5fa..0499e19 100644
--- a/noncore/unsupported/oipkg/package.cpp
+++ b/noncore/unsupported/oipkg/package.cpp
@@ -1,251 +1,258 @@
#include "package.h"
#include <qpe/process.h>
#include <qpe/stringutil.h>
#include <qfile.h>
#include <qtextstream.h>
#include <stdlib.h>
#include <unistd.h>
#include "debug.h"
-Package::~Package()
-{
-}
+//Package::~Package()
+//{
+//}
Package::Package( PackageManagerSettings *s )
{
init(s);
}
void Package::init( PackageManagerSettings *s )
{
settings = s;
_size = "";
_section = "";
_subsection = "";
_shortDesc = "";
_desc = "";
_name = "";
_toProcess = false;
_status = "";
_dest = settings->getDestinationName();
_link = settings->createLinks();
}
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 );
_toProcess = true;
_packageName = QString( n );
}
}
Package::Package( Package *pi )
{
init(pi->settings);
copyValues( pi );
}
void Package::setValue( QString n, QString t )
{
- if ( n == "Status" && installed() ) return;
if ( n == "Package" )
{
_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")
{
}else if ( n == "Filename")
{
}else if ( n == "Size")
{
}else if ( n == "MD5Sum")
{
}
if ( n == "Description")
{
setDesc( t );
}
if ( n == "Status")
{
if ( installed() ) return;
_status = t;
}
if ( t == "Essential")
{
}
};
QString Package::name()
{
return _name;
}
bool Package::installed()
{
return _status.contains("installed");
}
void Package::setDesc( QString s )
{
_desc = s;
_shortDesc = s.left( s.find("\n") );
}
QString Package::desc()
{
return _desc;
}
QString Package::shortDesc()
{
return _shortDesc;
}
QString Package::size()
{
return _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()
{
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 );
}
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];
int sep = line.find( QRegExp(":[\t ]+") );
if ( sep >= 0 )
{
QString tag = line.left(sep);
QString value = line.mid(sep+2).simplifyWhiteSpace();
setValue( tag, value );
}else{
}
}
return;
}
QString Package::details()
{
QString status;
Process ipkg_status(QStringList() << "ipkg" << "info" << name() );
QString description;
if ( ipkg_status.exec("",status) )
{
QStringList lines = QStringList::split('\n',status,TRUE);
for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) {
QString line = *it;
if ( line == " ." )
{
description.append("<p>");
} else
if ( line[0] == ' ' || line[0] == '\t' )
{
// continuation
description.append(" ");
description.append(Qtopia::escapeString(line));
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
@@ -1,70 +1,70 @@
#ifndef PK_ITEM_H
#define PK_ITEM_H
#include <qstring.h>
#include <qlistview.h>
#include <qpainter.h>
#include <qpixmap.h>
#include <qdict.h>
#include <qobject.h>
#include "pksettings.h"
class Package //: public QObject
{
// Q_OBJECT
public:
Package(PackageManagerSettings *);
- ~Package();
+ // ~Package();
Package( QStringList, PackageManagerSettings * );
Package( QString, PackageManagerSettings * );
Package( Package* );
void setValue( QString, QString );
void copyValues( Package* );
QString name() ;
bool installed();
void setDesc( QString );
QString shortDesc();
QString desc();
QString size();
+ QString sizeUnits();
void setSection( QString );
QString section();
QString subSection();
QString details();
bool toProcess();
bool toInstall();
bool toRemove();
void processed();
QString dest();
void setDest( QString d );
void setOn();
bool link();
void setLink(bool);
void parseIpkgFile( QString );;
public slots:
- /** No descriptions */
QString getPackageName();
void toggleProcess();
private:
PackageManagerSettings *settings;
QString _packageName;
QString _name;
bool _toProcess;
bool _link;
QString _status;
QString _size;
QString _section;
QString _subsection;
QString _shortDesc;
QString _desc;
QString _dest;
void parsePackage( QStringList );
void init(PackageManagerSettings *);
};
#endif
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
@@ -1,139 +1,122 @@
#include "packagelistitem.h"
#include <qpe/resource.h>
#include <qobject.h>
#include "debug.h"
static QPixmap *pm_uninstalled=0;
static QPixmap *pm_installed=0;
static QPixmap *pm_uninstall=0;
static QPixmap *pm_install=0;
PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s)
: QCheckListItem(lv,pi->name(),CheckBox)
{
package = pi;
settings = s;
setExpandable( true );
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() );
item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() );
destItem = new QCheckListItem( this, "" );
linkItem = new QCheckListItem( this, "" );
displayDetails();
-#endif
- if (!pm_uninstalled) {
+ if (!pm_uninstalled)
+ {
pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled"));
pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed"));
pm_install = new QPixmap(Resource::loadPixmap("oipkg/install"));
pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall"));
}
-#ifndef NEWLAYOUT
- setText(1, package->shortDesc() );
- setText(2, package->size() );
-#endif
}
void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg,
int column, int width, int alignment )
{
if ( !p )
return;
p->fillRect( 0, 0, width, height(),
isSelected()? cg.highlight() : cg.base() );
if ( column != 0 ) {
// The rest is text
QListViewItem::paintCell( p, cg, column, width, alignment );
return;
}
QListView *lv = listView();
if ( !lv )
return;
int marg = lv->itemMargin();
int r = marg;
QPixmap pm = statePixmap();
p->drawPixmap(marg,(height()-pm.height())/2,pm);
r += pm.width()+1;
p->translate( r, 0 );
QListViewItem::paintCell( p, cg, column, width - r, alignment );
}
void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg,
const QRect & r )
{
// Skip QCheckListItem
// (makes you wonder what we're getting from QCheckListItem)
QListViewItem::paintFocus(p,cg,r);
}
QPixmap PackageListItem::statePixmap() const
{
bool installed = package->installed();
if ( !package->toProcess() ) {
if ( !installed )
return *pm_uninstalled;
else
return *pm_installed;
} else {
if ( !installed )
return *pm_install;
else
return *pm_uninstall;
}
}
QString PackageListItem::key( int column, bool ascending ) const
{
if ( column == 2 ) {
QString t = text(2);
double bytes=t.toDouble();
if ( t.contains('M') ) bytes*=1024*1024;
else if ( t.contains('K') || t.contains('k') ) bytes*=1024;
if ( !ascending ) bytes=999999999-bytes;
return QString().sprintf("%09d",(int)bytes);
} else {
return QListViewItem::key(column,ascending);
}
}
void PackageListItem::setOn( bool b )
{
QCheckListItem::setOn( b );
package->toggleProcess();
-// if ( b )
-// {
-// if ((package->dest()).isEmpty)
-// package->setDest( settings->getDestinationName() );
-// }else{
-// package->setDest( QObject::tr("not installed"));
-// }
package->setLink( settings->createLinks() );
displayDetails();
}
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")) );
destItem->setText( 0, QObject::tr("Destination: ")+package->dest() );
repaint();
}
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
@@ -1,37 +1,38 @@
#ifndef PK_LISTITEM_H
#define PK_LISTITEM_H
#include "package.h"
#include <qstring.h>
#include <qlistview.h>
#include <qpainter.h>
#include <qpixmap.h>
#include <qdict.h>
#include "pksettings.h"
class PackageListItem
: public QCheckListItem
{
public:
PackageListItem(QListView*, Package*, PackageManagerSettings*);
void paintCell( QPainter*, const QColorGroup&, int, int, int );
void paintFocus( QPainter*, const QColorGroup&, const QRect& );
QPixmap statePixmap() const;
QString key( int, bool ) const;
Package* getPackage() { return package; } ;
QString getName() { return package->name(); } ;
bool isInstalled(){ return package->installed(); };
virtual void setOn ( bool );
void displayDetails();
private:
+ QCheckListItem *nameItem;
QCheckListItem *destItem;
QCheckListItem *linkItem;
PackageManagerSettings *settings;
Package *package;
};
#endif
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
@@ -1,91 +1,107 @@
/***************************************************************************
packagelistview.cpp - description
-------------------
begin : Sat Apr 27 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 "packagelistview.h"
#include <qpopupmenu.h>
#include <qaction.h>
#include "packagelistitem.h"
#include "pksettings.h"
PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s)
: QListView(p,n)
{
settings = s;
popupMenu = new QPopupMenu( this );
destsMenu = new QPopupMenu( popupMenu );
popupTimer = new QTimer( this );
setSelectionMode(QListView::NoSelection);
addColumn( tr("Package") );
setRootIsDecorated( true );
connect( popupTimer, SIGNAL(timeout()),
this, SLOT(showPopup()) );
connect( this, SIGNAL( pressed( QListViewItem* ) ),
this, SLOT( setCurrent( QListViewItem* ) ) );
connect( this, SIGNAL( clicked( QListViewItem* ) ),
this, SLOT( stopTimer( QListViewItem* ) ) );
}
//PackageListView::~PackageListView()
//{
//}
void PackageListView::setCurrent( QListViewItem* p )
{
if ( !p ) return;
activePackageListItem = (PackageListItem*)p;
activePackage = activePackageListItem->getPackage();
- pvDebug(5, "start timer");
+ if (!activePackage) return;
popupTimer->start( 750, true );
}
void PackageListView::showPopup()
{
popupMenu->clear();
destsMenu->clear();
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++ )
{
popupAction = new QAction( dests[i], QString::null, 0, this, 0 );
popupAction->addTo( destsMenu );
+ if ( dests[i] == ad && activePackage->toInstall() )
+ {
+ popupAction->setToggleAction( true );
+ popupAction->setOn(true);
+ };
}
connect( destsMenu, SIGNAL( activated( int ) ),
this, SLOT( changePackageDest( int ) ) );
+ }else{
+// popupActcat setOn( activePackage->toProcess() );
+ }
popupMenu->popup( QCursor::pos() );
}
void PackageListView::stopTimer( QListViewItem* )
{
- pvDebug( 5, "stop timer" );
popupTimer->stop();
}
void PackageListView::changePackageDest( int i )
{
activePackage->setDest( destsMenu->text(i) );
activePackage->setOn();
activePackage->setLink( settings->createLinks() );
activePackageListItem->displayDetails();
}
+
+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
@@ -1,53 +1,55 @@
/***************************************************************************
packagelistview.h - description
-------------------
begin : Sat Apr 27 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. *
* *
***************************************************************************/
#ifndef PACKAGELISTVIEW_H
#define PACKAGELISTVIEW_H
#include <qlistview.h>
#include <qaction.h>
#include <qtimer.h>
#include <qwidget.h>
#include <qpopupmenu.h>
#include "debug.h"
class PackageListItem;
class Package;
class PackageManagerSettings;
class PackageListView : public QListView
{
Q_OBJECT
public:
PackageListView(QWidget*, const char*, PackageManagerSettings*);
// ~PackageListView();
QTimer *popupTimer;
private:
PackageManagerSettings *settings;
Package *activePackage;
PackageListItem *activePackageListItem;
QPopupMenu *popupMenu;
QPopupMenu *destsMenu;
public slots:
void showPopup();
void changePackageDest( int );
void setCurrent( QListViewItem* );
void stopTimer( QListViewItem* );
+ /** No descriptions */
+ void toggleProcess();
};
#endif
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
@@ -1,511 +1,542 @@
#include "pksettings.h"
#include <qpe/process.h>
#include <qpe/resource.h>
#include <qpe/stringutil.h>
#include <qpe/qpeapplication.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/applnk.h>
#include <qpe/config.h>
#include <qprogressbar.h>
#include <qcombobox.h>
#include <qdict.h>
#include <qfile.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qlistview.h>
#include <qlistbox.h>
#include <qcheckbox.h>
#include <qmessagebox.h>
#include <qpainter.h>
#include <qpixmap.h>
#include <qregexp.h>
#include <qstring.h>
#include <qobject.h>
#include <qtextstream.h>
#include <qtextview.h>
#include <qtoolbutton.h>
#include <qtabwidget.h>
#include <stdlib.h>
#include <unistd.h>
#include "debug.h"
+//#include "utils.h"
PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl )
: PackageManagerSettingsBase( parent, name, fl )
{
connect( newserver, SIGNAL(clicked()), this, SLOT(newServer()) );
connect( removeserver, SIGNAL(clicked()), this, SLOT(removeServer()) );
connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) );
connect( newdestination, SIGNAL(clicked()), this, SLOT(newDestination()) );
connect( removedestination, SIGNAL(clicked()), this, SLOT(removeDestination()) );
connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) );
// 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();
}
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
serverurlDic.insert(i,new QString(serverurl->text()));
servers->insertItem(servername->text());
activeServers->insertItem(servername->text());
}
+ changed = true;
servers->setSelected(i,TRUE);
editServer(i);
+ changed = true;
}
void PackageManagerSettings::newDestination()
{
int i = destinations->count();
if ( destinationname->isEnabled() || destinationurl->text().isEmpty() ) {
destinationurlDic.insert(i,new QString("/"));
destinations->insertItem(tr("New"));
activeDestination->insertItem(tr("New"));
activeLinkDestination->insertItem(tr("New"));
} else {
// allows one-level undo
destinationurlDic.insert(i,new QString(destinationurl->text()));
destinations->insertItem(destinationname->text());
activeDestination->insertItem(destinationname->text());
activeLinkDestination->insertItem(destinationname->text());
}
destinations->setSelected(i,TRUE);
editDestination(i);
+ changed = true;
}
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;
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);
}
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]);
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;
}
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;
}
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++)
{
QString url = serverurlDic[i] ? *serverurlDic[i] : QString("???");
if ( !activeServers->isSelected(i) )
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 );// o should be -1
for (int i = 0; i < installationSettingsCount; i++)
{
cfg.setGroup( "Setting_" + QString::number(i) );
settingName->insertItem( cfg.readEntry( "name", "???" ), i );
};
readInstallationSetting( currentSetting );
}
/**
* remove from conf file
*/
void PackageManagerSettings::removeInstallationSetting()
{
settingName->removeItem( settingName->currentItem() );
Config cfg( "oipkg", Config::User );
cfg.setGroup( "Setting_" + QString::number( installationSettingsCount ) );
cfg.clearGroup();
installationSettingsCount--;
changed = true;
settingName->setEditable( false );
}
/**
* write to confgile
*/
void PackageManagerSettings::newInstallationSetting()
{
installationSettingsCount++;
settingName->insertItem( "New", installationSettingsCount );
settingName->setCurrentItem( installationSettingsCount );
settingName->setEditable( true );
changed = true;
}
void PackageManagerSettings::installationSettingChange(int cs)
{
writeCurrentInstallationSetting();
currentSetting = cs;
readInstallationSetting( cs );
+ changed = true;
}
void PackageManagerSettings::writeInstallationSettings()
{
- if ( ! changed ) return ;
{
Config cfg( "oipkg", Config::User );
cfg.setGroup( "Settings" );
cfg.writeEntry( "count", installationSettingsCount );
cfg.writeEntry( "current", currentSetting );
}
writeCurrentInstallationSetting();
}
void PackageManagerSettings::readInstallationSetting(int setting)
{
if ( setting < 0 ) return;
Config cfg( "oipkg", Config::User );
cfg.setGroup( "Setting_" + QString::number( setting ) );
- CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) );
+ CheckBoxLink->setChecked( cfg.readBoolEntry( "link", true ) );
QString dest = cfg.readEntry( "dest" );
QString linkdest = cfg.readEntry( "linkdest" );
pvDebug(3, "dest="+dest);
pvDebug(3, "linkdest="+linkdest);
-
for ( int i = 0; i < activeDestination->count(); i++)
{
if ( activeDestination->text( i ) == dest )
activeDestination->setCurrentItem( i );
if ( activeLinkDestination->text( i ) == linkdest )
activeLinkDestination->setCurrentItem( i );
}
}
void PackageManagerSettings::writeCurrentInstallationSetting()
{
Config cfg( "oipkg", Config::User );
- changed = false;
cfg.setGroup( "Setting_" + QString::number(currentSetting) );
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();
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]);
// else if ( token[1] == "proxy_password" )
// password->setText(token[2]);
} else {
// Old style?
int eq = l.find('=');
if ( eq >= 0 ) {
QString v = l.mid(eq+1).stripWhiteSpace();
if ( v[0] == '"' || v[0] == '\'' ) {
int cl=v.find(v[0],1);
if ( cl >= 0 )
v = v.mid(1,cl-1);
}
if ( l.left(12) == "IPKG_SOURCE=" ) {
ipkg_old=1;
currentserver=servers->count();
serverurlDic.insert(servers->count(),new QString(v));
servers->insertItem(v);
} else if ( l.left(13) == "#IPKG_SOURCE=" ) {
serverurlDic.insert(servers->count(),new QString(v));
servers->insertItem(v);
} else if ( l.left(10) == "IPKG_ROOT=" ) {
// ### no UI
// } else if ( l.left(20) == "IPKG_PROXY_USERNAME=" ) {
// username->setText(v);
// } else if ( l.left(20) == "IPKG_PROXY_PASSWORD=" ) {
// password->setText(v);
// } else if ( l.left(16) == "IPKG_PROXY_HTTP=" ) {
// http->setText(v);
// } else if ( l.left(16) == "IPKG_PROXY_FTP=" ) {
// ftp->setText(v);
}
}
}
}
if ( ipkg_old ) {
servers->setSelectionMode(QListBox::Single);
servers->setSelected(currentserver,TRUE);
}
return TRUE;
} else {
return FALSE;
}
}
/**
* read from config file(s)
*/
void PackageManagerSettings::readSettings()
{
readIpkgConfig("/etc/ipkg.conf");
readInstallationSettings();
}
void PackageManagerSettings::writeSettings()
{
- writeIpkgConfig("/etc/ipkg.conf");
+ if ( changed ) writeIpkgConfig("/etc/ipkg.conf");
writeInstallationSettings();
}
/** shows the setting dialog */
bool PackageManagerSettings::showDialog( int i )
{
TabWidget->setCurrentPage( i );
showMaximized();
bool ret = exec();
if ( ret ) writeSettings();
else readSettings();
- return ret;
+ return (changed && ret);
}
/** Returns the installation destination */
QString PackageManagerSettings::getDestinationName()
{
return activeDestination->currentText();
}
/** Returns the link destination */
QString PackageManagerSettings::getLinkDestinationName()
{
return activeLinkDestination->currentText();
}
/** Returns the URL of the active destination */
QString PackageManagerSettings::getDestinationUrl()
{
int dnr = activeDestination->currentItem();
return *destinationurlDic.find(dnr);
}
/** Should oipkg create links form install destination to link destination */
bool PackageManagerSettings::createLinks()
{
return CheckBoxLink->isChecked();
}
/** get the servers that are active */
QStringList PackageManagerSettings::getActiveServers()
{
QStringList sl;
for (int i=0; i<(int)activeServers->count(); i++)
{
if ( activeServers->isSelected(i) )
sl += activeServers->text(i);
}
return sl;
}
+ QStringList PackageManagerSettings::getServers()
+{
+ QStringList sl;
+ for (int i=0; i<(int)activeServers->count(); i++)
+ {
+ sl += activeServers->text(i);
+ }
+ return sl;
+}
/** returns the destination listed in ipkg.conf */
QStringList PackageManagerSettings::getDestinationUrls()
{
QStringList sl;
for (int i=0; i<(int)destinations->count(); i++)
{
sl += *destinationurlDic[i];
}
return sl;
}
/** returns the destination listed in ipkg.conf */
QString PackageManagerSettings::getDestinationUrlByName(QString n)
{
QStringList sl;
for (int i=0; i<(int)destinations->count(); i++)
{
if ( n == destinations->text(i)) return*destinationurlDic[i];
}
return "";
}
/** returns the destination listed in ipkg.conf */
QStringList PackageManagerSettings::getDestinationNames()
{
QStringList sl;
for (int i=0; i<(int)destinations->count(); i++)
{
sl += destinations->text(i);
}
return sl;
}
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
@@ -1,64 +1,68 @@
#ifndef PACKAGEMANAGERSETTINGS_H
#define PACKAGEMANAGERSETTINGS_H
#include "pksettingsbase.h"
#include <qintdict.h>
class PackageManagerSettings : private PackageManagerSettingsBase
{
// Q_OBJECT
public:
PackageManagerSettings( QWidget* , const char* , WFlags );
~PackageManagerSettings();
bool showDialog( int ) ;
QString getDestinationUrl();
QString getDestinationName();
QString getLinkDestinationName();
bool createLinks();
+ QStringList getServers();
QStringList getActiveServers();
QStringList getDestinationUrls();
QStringList getDestinationNames();
QString getDestinationUrlByName(QString);
+ /** No descriptions */
+ QComboBox* getDestCombo();
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:
void writeInstallationSettings();
void readInstallationSettings();
void writeCurrentInstallationSetting();
void readInstallationSetting(int);
void installationSettingSetName(const QString &);
void newServer();
void editServer(int);
void removeDestination();
void newDestination();
void editDestination(int);
void linkEnabled(bool);
void removeServer();
void serverNameChanged(const QString&);
void serverUrlChanged(const QString&);
void destNameChanged(const QString&);
void destUrlChanged(const QString&);
void installationSettingChange(int);
void newInstallationSetting();
void removeInstallationSetting();
void renameInstallationSetting();
+ void activeServerChanged();
};
#endif
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
@@ -1,275 +1,275 @@
<!DOCTYPE UI><UI>
<class>PackageManagerSettingsBase</class>
<widget>
<class>QDialog</class>
<property stdset="1">
<name>name</name>
<cstring>Form4</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>349</width>
+ <width>345</width>
<height>454</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Package Servers</string>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>3</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>3</number>
</property>
<widget row="0" column="0" >
<class>QTabWidget</class>
<property stdset="1">
<name>name</name>
<cstring>TabWidget</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<widget>
<class>QWidget</class>
<property stdset="1">
<name>name</name>
<cstring>tab</cstring>
</property>
<attribute>
<name>title</name>
<string>Settings</string>
</attribute>
<grid>
<property stdset="1">
<name>margin</name>
<number>3</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>3</number>
</property>
<widget row="0" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout3_2</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>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>Settings</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Installation Setups</string>
</property>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer2_2_2</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</hbox>
</widget>
<widget row="5" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout8</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>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Install destination:</string>
</property>
</widget>
<widget>
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
<cstring>activeDestination</cstring>
</property>
</widget>
</hbox>
</widget>
<widget row="6" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout9</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>QCheckBox</class>
<property stdset="1">
<name>name</name>
<cstring>CheckBoxLink</cstring>
</property>
<property stdset="1">
<name>text</name>
- <string>Link Destination: root</string>
+ <string>Link to root destination</string>
</property>
</widget>
<widget>
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
<cstring>activeLinkDestination</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>false</bool>
</property>
</widget>
</hbox>
</widget>
<widget row="3" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout13</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>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Used servers:</string>
</property>
</widget>
<spacer>
<property>
<name>name</name>
<cstring>Spacer4</cstring>
</property>
<property stdset="1">
<name>orientation</name>
<enum>Horizontal</enum>
</property>
<property stdset="1">
<name>sizeType</name>
<enum>Expanding</enum>
</property>
<property>
<name>sizeHint</name>
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</hbox>
</widget>
<widget row="4" column="0" >
<class>QListBox</class>
<property stdset="1">
<name>name</name>
<cstring>activeServers</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>selectionMode</name>
<enum>Multi</enum>
</property>
</widget>
<widget row="1" column="0" >
<class>QComboBox</class>
<property stdset="1">
<name>name</name>
<cstring>settingName</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>focusPolicy</name>
<enum>NoFocus</enum>
</property>
<property stdset="1">
<name>editable</name>
<bool>false</bool>
@@ -625,114 +625,133 @@
</property>
<property stdset="1">
<name>text</name>
<string>New</string>
</property>
<property stdset="1">
<name>autoDefault</name>
<bool>false</bool>
</property>
</widget>
<widget>
<class>QPushButton</class>
<property stdset="1">
<name>name</name>
<cstring>removedestination</cstring>
</property>
<property stdset="1">
<name>enabled</name>
<bool>true</bool>
</property>
<property stdset="1">
<name>text</name>
<string>Remove</string>
</property>
<property stdset="1">
<name>autoDefault</name>
<bool>false</bool>
</property>
</widget>
</hbox>
</widget>
<widget row="3" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout11</cstring>
</property>
<property>
<name>layoutMargin</name>
</property>
<property>
<name>layoutSpacing</name>
</property>
<grid>
<property stdset="1">
<name>margin</name>
<number>3</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>3</number>
</property>
<widget row="1" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_3_2_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>URL:</string>
</property>
</widget>
<widget row="0" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>destinationname</cstring>
</property>
</widget>
<widget row="1" column="1" >
<class>QLineEdit</class>
<property stdset="1">
<name>name</name>
<cstring>destinationurl</cstring>
</property>
</widget>
<widget row="0" column="0" >
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabel1_3_2</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Name:</string>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
</widget>
</grid>
</widget>
<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&amp;)</slot>
<slot access="public">destUrlChanged(const QString&amp;)</slot>
<slot access="public">editDestination(int)</slot>
<slot access="public">editServer(int)</slot>
<slot access="public">installationSettingChange(int)</slot>
<slot access="public">installationSettingSetName(const QString &amp;)</slot>
<slot access="public">linkEnabled(bool)</slot>
<slot access="public">newDestination()</slot>
<slot access="public">newInstallationSetting()</slot>
<slot access="public">newServer()</slot>
+ <slot access="public">activeServerChanged()</slot>
<slot access="public">removeDestination()</slot>
<slot access="public">removeInstallationSetting()</slot>
<slot access="public">removeServer()</slot>
<slot access="public">renameInstallationSetting()</slot>
<slot access="public">serverNameChanged(const QString&amp;)</slot>
<slot access="public">serverUrlChanged(const QString&amp;)</slot>
</connections>
</UI>
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
@@ -1,388 +1,460 @@
#include "pmipkg.h"
#include "pksettings.h"
#include "package.h"
#include "packagelistitem.h"
#include <qpe/process.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/stringutil.h>
#include <qdir.h>
#include <qfile.h>
+#include <qgroupbox.h>
#include <qmultilineedit.h>
#include <qstring.h>
#include <qcheckbox.h>
#include <qtextstream.h>
#include <qtextview.h>
#include <qprogressbar.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <stdlib.h>
#include <unistd.h>
#include "mainwindow.h"
PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f )
: QObject ( p )
{
settings = s;
runwindowopen = false;
runwindow = new RunWindow( p, name, true, f );
}
PmIpkg::~PmIpkg()
{
}
//#define PROC
#define SYSTEM
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 (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 ";
+ }
out( "<hr><br>Starting to "+ args+"<br>\n");
cmd += args;
int r = 0;
#ifdef PROC
QString o = "start";
Process *ipkg = new Process( "ls");//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" );
QString redirect = "/tmp/oipkg.pipe";
cmd += " 2>&1 | tee "+redirect+" 2>&1";
pvDebug(2, "running >"+cmd+"<");
r = system(cmd.latin1());
QFile f( redirect );
QString line;
QString oldLine;
while ( ! f.open(IO_ReadOnly) ) {};
- // {
QTextStream t( &f );
- // QString fp;
while ( !t.eof() )
{
line = t.readLine();
if ( line != oldLine )
{
out( line +"<br>" );
oldLine = line;
}
}
-// }
f.close();
out( "Finished!<br>");
#endif
return r;
}
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;
{
Config cfg( "oipkg", Config::User );
cfg.setGroup( "Common" );
QString statusDir = cfg.readEntry( "statusDir", "" );
}
- 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 );
if ( ! f.open(IO_ReadOnly) )
{
+ 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 )
{
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;
file = dest+"/"+file;
if (file == dest) return;
QFileInfo fileInfo( file );
if ( fileInfo.isDir() )
{
QDir destDir( destFile );
- destDir.mkdir( destFile, true );
+ if (linkOpp==createLink) destDir.mkdir( destFile, true );
QDir d( file );
d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
while ( (fi=it.current()) )
{
- // out( "<b>"+fi->absFilePath()+"</b>" );
+ pvDebug(4, "process dir "+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());
-// 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 );
+ }
+ }
}
void PmIpkg::commit( PackageList pl )
{
int sizecount = 0;
to_install.clear();
to_remove.clear();
QString rem="<b>"+tr("To remove:")+"</b><br>\n";
QString inst="<b>"+tr("To install:")+"</b><br>\n";
- pl.allPackages();
for( Package *pack = pl.first();pack ; (pack = pl.next()) )
{
if ( pack && (pack->name() != "") && pack)
{
if ( pack->toInstall() )
{
to_install.append( pack );
sizecount += pack->size().toInt();
inst += pack->name()+"\t("+tr("on ")+pack->dest()+")<br>";
}
if ( pack->toRemove() )
{
to_remove.append( pack );
sizecount += 1;
rem += pack->name()+"<br>";
}
}
}
startDialog();
}
void PmIpkg::startDialog()
{
installDialog = new QDialog(0,0,true);
QGridLayout *RunWindowLayout = new QGridLayout( installDialog );
RunWindowLayout->setSpacing( 2 );
RunWindowLayout->setMargin( 2 );
- 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();
if ( installDialog->exec() ) doIt();
installDialog->close();
+ out(tr("<b>All done.</b>"));
}
void PmIpkg::doIt()
{
+ show( true );
remove();
install();
}
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>");
}
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() )
{
if ( runIpkg("install " + it->getPackageName(), it->dest() ) == 0 )
{
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 );
}
void PmIpkg::update()
{
show( false );
runIpkg( "update" );
runwindow->close();
}
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());
}
void PmIpkg::showButtons(bool b)
{
if ( b )
{
runwindow->cancelButton->hide();
runwindow->doItButton->hide();
runwindow->removeButton->hide();
runwindow->installButton->hide();
}else{
runwindow->cancelButton->show();
runwindow->doItButton->show();
runwindow->removeButton->show();
runwindow->installButton->show();
}
}
void PmIpkg::show(bool b)
{
if (!runwindow->isVisible())
runwindow->showMaximized();
showButtons(b);
if ( !b )
runwindow->progress->hide();
else
runwindow->progress->show();
}
-void PmIpkg::installFile(const QString &fileName)
+void PmIpkg::installFile(const QString &fileName, const QString &dest)
{
to_install.clear();
to_remove.clear();
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
@@ -1,52 +1,64 @@
#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 "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 commit( PackageList );
void update();
- PackageList* getPackageList();
+ // PackageList* getPackageList();
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:
PackageManagerSettings* settings;
RunWindow *runwindow;
QDialog *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 );
+
-public slots:
- void doIt();
- void install();
- void remove();
- void installFile(const QString &fileName);
- void linkDestination( const QString, const QByteArray );
};
#endif
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
@@ -341,96 +341,101 @@ bool PackageManagerSettings::readIpkgConfig(const QString& conffile)
if ( l.left(12) == "IPKG_SOURCE=" ) {
ipkg_old=1;
currentserver=servers->count();
serverurlDic.insert(servers->count(),new QString(v));
servers->insertItem(v);
} else if ( l.left(13) == "#IPKG_SOURCE=" ) {
serverurlDic.insert(servers->count(),new QString(v));
servers->insertItem(v);
} else if ( l.left(10) == "IPKG_ROOT=" ) {
}
}
}
}
if ( ipkg_old ) {
servers->setSelectionMode(QListBox::Single);
servers->setSelected(currentserver,TRUE);
}
return TRUE;
} else {
return FALSE;
}
}
void PackageManagerSettings::readSettings()
{
readIpkgConfig("/etc/ipkg.conf");
readInstallationSettings();
}
void PackageManagerSettings::writeSettings()
{
writeIpkgConfig("/etc/ipkg.conf");
writeInstallationSettings();
}
bool PackageManagerSettings::showDialog( int i )
{
TabWidget->setCurrentPage( i );
showMaximized();
bool ret = exec();
if ( ret ) writeSettings();
else readSettings();
return ret;
}
QString PackageManagerSettings::getDestinationName()
{
return activeDestination->currentText();
}
QString PackageManagerSettings::getLinkDestinationName()
{
return activeLinkDestination->currentText();
}
/** Returns the URL of the active destination */
QString PackageManagerSettings::getDestinationUrl()
{
int dnr = activeDestination->currentItem();
return *destinationurlDic.find(dnr);
}
/** Should oipkg create links form install destination to link destination */
bool PackageManagerSettings::createLinks()
{
return CheckBoxLink->isChecked();
}
/** get the servers that are active */
QStringList PackageManagerSettings::getActiveServers()
{
QStringList sl;
for (int i=0; i<(int)activeServers->count(); i++)
{
if ( activeServers->isSelected(i) )
sl += activeServers->text(i);
}
return sl;
}
/** returns the destination listed in ipkg.conf */
QStringList PackageManagerSettings::getDestinationUrls()
{
QStringList sl;
for (int i=0; i<(int)destinations->count(); i++)
{
sl += *destinationurlDic[i];
}
return sl;
}
void PackageManagerSettings::linkEnabled( bool b )
{
activeLinkDestination->setEnabled( 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
@@ -1,63 +1,63 @@
#ifndef PACKAGEMANAGERSETTINGS_H
#define PACKAGEMANAGERSETTINGS_H
#include "pksettingsbase.h"
#include <qintdict.h>
class PackageManagerSettings : public PackageManagerSettingsBase
//class PackageManagerSettings : private PackageManagerSettingsBase
{
// Q_OBJECT
public:
PackageManagerSettings( QWidget* , const char* , WFlags );
~PackageManagerSettings();
bool showDialog( int ) ;
QString getDestinationUrl();
QString getDestinationName();
QString getLinkDestinationName();
bool createLinks();
QStringList getActiveServers();
QStringList getDestinationUrls();
-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:
void writeInstallationSettings();
void readInstallationSettings();
void writeCurrentInstallationSetting();
void readInstallationSetting(int);
void installationSettingSetName(const QString &);
-
+ void activeDestinationChange(int)
void newServer();
void editServer(int);
void removeDestination();
void newDestination();
void editDestination(int);
void linkEnabled(bool);
void removeServer();
void serverNameChanged(const QString&);
void serverUrlChanged(const QString&);
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 readIpkgConfig(const QString&);
+ void writeIpkgConfig(const QString&);
+ void writeSettings();
+ void readSettings();
};
#endif
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