summaryrefslogtreecommitdiff
authortille <tille>2002-05-01 14:00:09 (UTC)
committer tille <tille>2002-05-01 14:00:09 (UTC)
commite729a9bdd9f37f4bd610d10122f002a0540c93ed (patch) (side-by-side diff)
treea23696d8742a36b57256281dc7e2f7848407be61
parent7e5615473c1d103db66f42ae60bf9ed57d52566c (diff)
downloadopie-e729a9bdd9f37f4bd610d10122f002a0540c93ed.zip
opie-e729a9bdd9f37f4bd610d10122f002a0540c93ed.tar.gz
opie-e729a9bdd9f37f4bd610d10122f002a0540c93ed.tar.bz2
added ipkgfind remote query
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/TODO5
-rw-r--r--noncore/unsupported/oipkg/debug.h2
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp109
-rw-r--r--noncore/unsupported/oipkg/mainwindow.h22
-rw-r--r--noncore/unsupported/oipkg/oipkg.pro4
-rw-r--r--noncore/unsupported/oipkg/package.cpp24
-rw-r--r--noncore/unsupported/oipkg/package.h10
-rw-r--r--noncore/unsupported/oipkg/packagelist.cpp87
-rw-r--r--noncore/unsupported/oipkg/packagelist.h20
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.cpp11
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.h2
-rw-r--r--noncore/unsupported/oipkg/packagelistlocal.cpp66
-rw-r--r--noncore/unsupported/oipkg/packagelistlocal.h30
-rw-r--r--noncore/unsupported/oipkg/packagelistremote.cpp47
-rw-r--r--noncore/unsupported/oipkg/packagelistremote.h19
-rw-r--r--noncore/unsupported/oipkg/packagelistview.cpp17
-rw-r--r--noncore/unsupported/oipkg/packagelistview.h1
-rw-r--r--noncore/unsupported/oipkg/pkfind.ui51
-rw-r--r--noncore/unsupported/oipkg/pksettings.cpp22
-rw-r--r--noncore/unsupported/oipkg/pksettings.h42
-rw-r--r--noncore/unsupported/oipkg/pksettingsbase.ui137
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp52
-rw-r--r--noncore/unsupported/oipkg/pmipkg.h2
-rw-r--r--noncore/unsupported/oipkg/settings.h4
24 files changed, 552 insertions, 234 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO
index 790766c..fc2e8a4 100644
--- a/noncore/unsupported/oipkg/TODO
+++ b/noncore/unsupported/oipkg/TODO
@@ -2,8 +2,13 @@
* tr() ;)
* Dialog to display ipkg output live
* parse "to install" and "to remove" from status
* install local file dialog
* qcop
* error handling
* manage links
* dependency checking
+* create dest if it does not exist
+* allow reinstalling
+* handle different versions
+* different types of filters and searches
+ i.e. name, desc, files etc \ No newline at end of file
diff --git a/noncore/unsupported/oipkg/debug.h b/noncore/unsupported/oipkg/debug.h
index 206dea5..d20a5eb 100644
--- a/noncore/unsupported/oipkg/debug.h
+++ b/noncore/unsupported/oipkg/debug.h
@@ -1,17 +1,17 @@
#ifndef _DEBUG_H_
#define _DEBUG_H_
#include <stdio.h>
extern int debugLevel;
#define HACK
-
+#define PACKAGELISTLOCAL
#define NEWLAYOUT
#define pvDebug(I, S) \
if ( debugLevel < 3 ) \
{ \
if ( I <= debugLevel ) qDebug(S);\
}else{\
if ( I <= debugLevel ) \
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index ca1e5e8..06828e0 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -18,16 +18,17 @@
#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 <qpushbutton.h>
#include <qlayout.h>
#include "pksettingsbase.h"
#include "utils.h"
#include "packagelistitem.h"
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
@@ -37,28 +38,38 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
settings = new PackageManagerSettings(this,0,TRUE);
listViewPackages = new PackageListView( this,"listViewPackages",settings );
setCentralWidget( listViewPackages );
// wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton);
// wait = new QMessageBox(this);
// wait->setText(tr("Please wait"));
ipkg = new PmIpkg( settings, this );
+// settings->setIpkg( ipkg );
packageList.setSettings( settings );
+ packageListSearch.setSettings( settings );
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()) );
+
+ connect( settings->removeLinksButton, SIGNAL( clicked()),
+ SLOT(removeLinks()) );
+ connect( settings->createLinksButton, SIGNAL( clicked()),
+ SLOT(createLinks()) );
+
+// rootLocal = new QCheckListItem(listViewPackages,tr("local"));
+// rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind"));
displayList();
}
void MainWindow::makeMenu()
{
QPEToolBar *toolBar = new QPEToolBar( this );
QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
@@ -92,24 +103,16 @@ void MainWindow::makeMenu()
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 );
-// could we use for find
-// detailsAction = new QAction( tr( "Find" ),
-// Resource::loadIconSet( "find" ),
-// QString::null, 0, this, 0 );
-// connect( detailsAction, SIGNAL( activated() ),
-// this , SLOT( showFind() ) );
-// detailsAction->addTo( toolBar );
-
QAction *cfgact;
cfgact = new QAction( tr( "Setups" ),
QString::null, 0, this, 0 );
connect( cfgact, SIGNAL( activated() ),
SLOT( showSettings() ) );
cfgact->addTo( cfgMenu );
@@ -121,107 +124,134 @@ void MainWindow::makeMenu()
cfgact = new QAction( tr( "Destinations" ),
QString::null, 0, this, 0 );
connect( cfgact, SIGNAL( activated() ),
SLOT( showSettingsDst() ) );
cfgact->addTo( cfgMenu );
QAction *a;
+ // SECTIONS
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 );
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->addTo( viewMenu );
+ //FIND
findBar = new QPEToolBar(this);
- addToolBar( findBar, "Search", QMainWindow::Top, TRUE );
+ addToolBar( findBar, "Filter", 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 );
+ findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 );
connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) );
findAction->setToggleAction( true );
findAction->addTo( viewMenu );
+ //SEARCH
+ searchBar = new QPEToolBar(this);
+ addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
+ label = new QLabel( tr("ipkgfind: "), searchBar );
+ label->setBackgroundColor( searchBar->backgroundColor() );
+ searchBar->setHorizontalStretchable( TRUE );
+ searchEdit = new QLineEdit( searchBar, "seachEdit" );
+ searchBar->setStretchableWidget( searchEdit );
+// connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
+// this, SLOT( displayList() ) );
+ a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
+ connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) );
+ a->addTo( searchBar );
+ searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
+ connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) );
+ searchCommit->addTo( searchBar );
+ a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
+ connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) );
+ a->addTo( searchBar );
+ searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 );
+ connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) );
+ searchAction->setToggleAction( true );
+ searchAction->addTo( viewMenu );
+
+ //DEST
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)) );
+ connect( destination, SIGNAL(activated(int)),
+ settings, 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)) );
+ 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( "gui" );
findShow( cfg.readBoolEntry( "findBar", true ) );
+ searchShow( cfg.readBoolEntry( "searchBar", 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( "searchBar", !searchBar->isHidden() );
cfg.writeEntry( "sectionBar", !sectionBar->isHidden() );
cfg.writeEntry( "destBar", !destBar->isHidden() );
}
void MainWindow::runIpkg()
{
packageList.allPackages();
+ ipkg->loadList( packageListSearch );
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();
}
@@ -249,22 +279,31 @@ void MainWindow::filterList()
}
void MainWindow::displayList()
{
// wait->hide();
filterList();
listViewPackages->clear();
Package *pack = packageList.first();
+ PackageListItem *item;
+
+ QCheckListItem *rootLocal = new QCheckListItem(listViewPackages,tr("local"));
+ QCheckListItem *rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind"));
while( pack )
{
- if ( pack && (pack->name() != "") )
- listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) );
+ item = new PackageListItem( rootLocal, pack, settings );
pack = packageList.next();
}
+ pack = packageListSearch.first();
+ while( pack )
+ {
+ item = new PackageListItem( rootSearch, pack, settings );
+ pack = packageListSearch.next();
+ }
}
void MainWindow::sectionChanged()
{
disconnect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
disconnect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
@@ -340,16 +379,29 @@ void MainWindow::findShow(bool b)
findAction->setOn( b );
}
void MainWindow::findClose()
{
findAction->setOn( false );
}
+void MainWindow::searchShow(bool b)
+{
+ if (b) searchBar->show();
+ else searchBar->hide();
+ searchAction->setOn( b );
+}
+
+void MainWindow::searchClose()
+{
+ searchAction->setOn( false );
+}
+
+
void MainWindow::destShow(bool b)
{
if (b) destBar->show();
else destBar->hide();
destAction->setOn( b );
}
void MainWindow::destClose()
@@ -415,8 +467,27 @@ void MainWindow::receive(const QCString &msg, const QByteArray &arg)
ipkg->createLinks( QString(arg) );
}else if( msg == "removeLinks(QString)" )
{
ipkg->removeLinks( QString(arg) );
}else{
pvDebug(2,"Huh what do ya want")
}
}
+
+
+void MainWindow::createLinks()
+{
+ pvDebug(2,"creating links...");
+ ipkg->createLinks( settings->destinationurl->text() );
+}
+
+void MainWindow::removeLinks()
+{
+ pvDebug(2,"removing links...");
+ ipkg->removeLinks( settings->destinationurl->text() );
+}
+
+void MainWindow::remotePackageQuery()
+{
+ packageListSearch.query( searchEdit->text() );
+ displayList();
+}
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h
index 7615b09..4a73b78 100644
--- a/noncore/unsupported/oipkg/mainwindow.h
+++ b/noncore/unsupported/oipkg/mainwindow.h
@@ -2,16 +2,18 @@
#define MAINWINDOW_H
#include <qmainwindow.h>
#include <qaction.h>
#include <qtimer.h>
#include <qpopupmenu.h>
#include "packagelist.h"
+#include "packagelistremote.h"
+#include "packagelistlocal.h"
#include "pmipkg.h"
#include "pksettings.h"
#include "packagelistview.h"
class QComboBox;
class QPEToolBar;
class QLineEdit;
class PackageListItem;
@@ -41,43 +43,55 @@ protected slots:
void showSettingsSrv();
void showSettingsDst();
public slots:
void sectionClose();
void sectionShow(bool);
void findClose();
void findShow(bool);
+ void searchClose();
+ void searchShow(bool);
void destClose();
void destShow(bool);
void filterList();
+ void createLinks();
+ void removeLinks();
void receive (const QCString &, const QByteArray &);
void setDocument (const QString &);
+ void remotePackageQuery();
private:
void makeMenu();
void setSections();
void setSubSections();
void installFile(const QString &);
bool updateIcon;
PmIpkg* ipkg;
PackageManagerSettings *settings;
- PackageList packageList;
+ PackageListLocal packageList;
+ PackageListRemote packageListSearch;
+ PackageListView *listViewPackages;
+// QCheckListItem* rootSearch;
+// QCheckListItem* rootLocal;
QAction *runAction;
QAction *updateAction;
QAction *findAction;
- QAction *sectionAction;
- QAction *destAction;
- PackageListView *listViewPackages;
QPEToolBar *findBar;
QLineEdit *findEdit;
+ QAction *searchAction;
+ QAction *searchCommit;
+ QPEToolBar *searchBar;
+ QLineEdit *searchEdit;
+ QAction *sectionAction;
QPEToolBar *sectionBar;
QComboBox *section;
QComboBox *subsection;
+ QAction *destAction;
QPEToolBar *destBar;
QComboBox *destination;
QCheckBox* CheckBoxLink;
// QMessageBox *wait;
private slots:
void rotateUpdateIcon();
};
diff --git a/noncore/unsupported/oipkg/oipkg.pro b/noncore/unsupported/oipkg/oipkg.pro
index c5d3b3d..98f92c8 100644
--- a/noncore/unsupported/oipkg/oipkg.pro
+++ b/noncore/unsupported/oipkg/oipkg.pro
@@ -2,23 +2,27 @@ 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 \
+ packagelistremote.h \
packagelist.h \
+ packagelistlocal.h \
packagelistview.h \
package.h
SOURCES = main.cpp \
mainwindow.cpp \
utils.cpp \
packagelistview.cpp \
+ packagelistremote.cpp \
+ packagelistlocal.cpp \
pksettings.cpp \
pmipkg.cpp \
packagelistitem.cpp \
packagelist.cpp \
package.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/ioclude
LIBS += -lqpe
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp
index 0499e19..6bb53a9 100644
--- a/noncore/unsupported/oipkg/package.cpp
+++ b/noncore/unsupported/oipkg/package.cpp
@@ -23,16 +23,17 @@ void Package::init( PackageManagerSettings *s )
settings = s;
_size = "";
_section = "";
_subsection = "";
_shortDesc = "";
_desc = "";
_name = "";
_toProcess = false;
+ _useFileName = false;
_status = "";
_dest = settings->getDestinationName();
_link = settings->createLinks();
}
Package::Package( QStringList pack, PackageManagerSettings *s )
{
init(s);
@@ -43,17 +44,18 @@ Package::Package( QString n, PackageManagerSettings *s )
{
init(s);
if ( !QFile::exists( n ) )
{
_name = QString( n );
}else{
parseIpkgFile( n );
_toProcess = true;
- _packageName = QString( n );
+ _useFileName = true;
+ _fileName = QString( n );
}
}
Package::Package( Package *pi )
{
init(pi->settings);
copyValues( pi );
}
@@ -85,17 +87,17 @@ void Package::setValue( QString n, QString t )
}else if ( n == "Pre-Depends")
{
}else if ( n == "Depends")
{
}else if ( n == "Filename")
{
-
+ _fileName = t;
}else if ( n == "Size")
{
}else if ( n == "MD5Sum")
{
}
if ( n == "Description")
@@ -113,16 +115,23 @@ void Package::setValue( QString n, QString t )
}
};
QString Package::name()
{
return _name;
}
+
+QString Package::installName()
+{
+ if (_useFileName) return _fileName;
+ else return _name;
+}
+
bool Package::installed()
{
return _status.contains("installed");
}
void Package::setDesc( QString s )
{
_desc = s;
@@ -326,13 +335,18 @@ void Package::parseIpkgFile( QString file)
pack << t.readLine();
}
f.close();
parsePackage( pack );
}
}
-QString Package::getPackageName()
+//QString Package::getPackageName()
+//{
+// if ( _packageName.isEmpty() ) return _name;
+// else return _packageName;
+//}
+
+void Package::instalFromFile(bool iff)
{
- if ( _packageName.isEmpty() ) return _name;
- else return _packageName;
+ _useFileName = iff;
}
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h
index 49bb3bf..4618c3a 100644
--- a/noncore/unsupported/oipkg/package.h
+++ b/noncore/unsupported/oipkg/package.h
@@ -19,16 +19,17 @@ class Package //: public QObject
Package( QStringList, PackageManagerSettings * );
Package( QString, PackageManagerSettings * );
Package( Package* );
void setValue( QString, QString );
void copyValues( Package* );
QString name() ;
+ QString installName() ;
bool installed();
void setDesc( QString );
QString shortDesc();
QString desc();
QString size();
QString sizeUnits();
void setSection( QString );
@@ -39,32 +40,35 @@ class Package //: public QObject
bool toInstall();
bool toRemove();
void processed();
QString dest();
void setDest( QString d );
void setOn();
bool link();
void setLink(bool);
- void parseIpkgFile( QString );;
+ void parseIpkgFile( QString );
+ void instalFromFile(bool iff=true);
public slots:
- QString getPackageName();
+// QString getPackageName();
void toggleProcess();
private:
PackageManagerSettings *settings;
- QString _packageName;
+// QString _packageName;
QString _name;
+ QString _fileName;
bool _toProcess;
bool _link;
QString _status;
QString _size;
QString _section;
QString _subsection;
QString _shortDesc;
QString _desc;
QString _dest;
+ bool _useFileName;
void parsePackage( QStringList );
void init(PackageManagerSettings *);
};
#endif
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp
index 035ec81..b892b30 100644
--- a/noncore/unsupported/oipkg/packagelist.cpp
+++ b/noncore/unsupported/oipkg/packagelist.cpp
@@ -1,35 +1,21 @@
#include "packagelist.h"
#include <assert.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qtextstream.h>
-#include <qpe/config.h>
#include "debug.h"
PackageList::PackageList()
: packageIter( packageList )
{
empty=true;
- {
- Config cfg( "oipkg", Config::User );
- cfg.setGroup( "Common" );
- statusDir = cfg.readEntry( "statusDir", "" );
- listsDir = cfg.readEntry( "listsDir", "" );
- if ( statusDir=="" || ! QFileInfo(statusDir+"/status").isFile() )
- {
- statusDir="/usr/lib/ipkg/";
- listsDir="/usr/lib/ipkg/lists/";
- cfg.writeEntry( "statusDir", statusDir );
- cfg.writeEntry( "listsDir", listsDir );
- }
- }
sections << "All";
subSections.insert("All", new QStringList() );
QStringList *ss = subSections["All"];
*ss << "All";
aktSection = "All";
aktSubSection = "All";
}
@@ -140,81 +126,46 @@ void PackageList::updateSections( Package* pack )
QStringList *subsecs = subSections[s];
*subsecs += ss;
if ( !subSections["All"] ) subSections.insert( "All", new QStringList() );
subsecs = subSections["All"];
*subsecs += ss;
}
-
-/** No descriptions */
-void PackageList::parseStatus()
-{
- QStringList dests = settings->getDestinationUrls();
- QStringList destnames = settings->getDestinationNames();
- QStringList::Iterator name = destnames.begin();
- for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir )
- {
- pvDebug( 2,"Status: "+*dir+statusDir+"/status");
- readFileEntries( *dir+statusDir+"/status", *name );
- ++name;
- };
-}
-
-void PackageList::parseList()
-{
- QStringList srvs = settings->getActiveServers();
-
- for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it )
- {
- pvDebug( 2, "List: "+listsDir+"/"+*it);
- readFileEntries( listsDir+"/"+*it, "" );
- }
-}
-
void PackageList::readFileEntries( QString filename, QString dest )
{
+ pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest);
QStringList packEntry;
QFile f( filename );
if ( !f.open(IO_ReadOnly) ) return;
QTextStream *statusStream = new QTextStream( &f );
while ( !statusStream ->eof() )
- {
- QString line = statusStream->readLine();
- if ( line.find(QRegExp("[\n\t ]*")) || line == "" )
- {
- //end of package
- if ( ! packEntry.isEmpty() )
- {
- Package *p = new Package( packEntry, settings );
- p->setDest( dest );
- if ( p )
- {
- insertPackage( p );
- packEntry.clear();
- }
- }
- }else{
- packEntry << line;
- };
+ {
+ QString line = statusStream->readLine();
+ if ( line.find(QRegExp("[\n\t ]*")) || line == "" )
+ {
+ //end of package
+ if ( ! packEntry.isEmpty() )
+ {
+ Package *p = new Package( packEntry, settings );
+ p->setDest( dest );
+ if ( p )
+ {
+ insertPackage( p );
+ packEntry.clear();
+ }
+ }
+ }else{
+ packEntry << line;
+ };
}
return;
}
-
-void PackageList::update()
-{
- pvDebug( 2, "parseStatus");
- parseStatus();
- pvDebug( 2, "parseList");
- parseList();
- pvDebug( 2, "finished parsing");
-}
-
void PackageList::setSettings( PackageManagerSettings *s )
{
settings = s;
}
Package* PackageList::getByName( QString n )
{
origPackageList[n];
diff --git a/noncore/unsupported/oipkg/packagelist.h b/noncore/unsupported/oipkg/packagelist.h
index 7c326ca..acea3b9 100644
--- a/noncore/unsupported/oipkg/packagelist.h
+++ b/noncore/unsupported/oipkg/packagelist.h
@@ -1,70 +1,58 @@
#ifndef PACKAGELIST_H
#define PACKAGELIST_H
#include <qdict.h>
#include "package.h"
#include "pksettings.h"
#include "debug.h"
-#define HACK
-#ifdef HACK
- static QString listsDir="/usr/lib/ipkg/";
- static QString statusDir="/usr/lib/ipkg/";
-#endif
-
class PackageList //:QObject
{
// Q_OBJECT
public:
// static QString all = QObject::tr("All");
PackageList();
PackageList( PackageManagerSettings* );
- ~PackageList();
+ virtual ~PackageList();
void insertPackage( Package* );
Package* find( QString );
Package* next();
Package* first();
QStringList getSections();
QStringList getSubSections();
void setSettings( PackageManagerSettings* );
void filterPackages( QString );
Package* getByName( QString );
void clear();
void allPackages();
public slots:
void setSection(QString);
void setSubSection(QString);
- void update();
+ // virtual void update();
-private:
+protected:
int currentPackage;
int packageCount;
PackageManagerSettings *settings;
QDict<Package> packageList;
QDict<Package> origPackageList;
QDictIterator<Package> packageIter;
bool empty;
-#ifndef HACK
- QString listsDir;
- QString statusDir;
-#endif
QString aktSection;
QString aktSubSection;
QStringList sections;
QDict<QStringList> subSections;
QDict<bool> sectionsDict;
void updateSections( Package* );
- void parseStatus();
- void parseList();
- void readFileEntries( QString file, QString dest );
+ void readFileEntries( QString file, QString dest="" );
};
#endif
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp
index 0c7c928..b7af9a6 100644
--- a/noncore/unsupported/oipkg/packagelistitem.cpp
+++ b/noncore/unsupported/oipkg/packagelistitem.cpp
@@ -8,16 +8,27 @@
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)
{
+ init(pi,s);
+}
+
+PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s)
+ : QCheckListItem(lvi,pi->name(),CheckBox)
+{
+ init(pi,s);
+}
+
+void PackageListItem::init( Package *pi, PackageManagerSettings *s)
+{
package = pi;
settings = s;
setExpandable( true );
QCheckListItem *item;
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, "" );
diff --git a/noncore/unsupported/oipkg/packagelistitem.h b/noncore/unsupported/oipkg/packagelistitem.h
index 54d9f9e..b128f0d 100644
--- a/noncore/unsupported/oipkg/packagelistitem.h
+++ b/noncore/unsupported/oipkg/packagelistitem.h
@@ -10,28 +10,30 @@
#include <qdict.h>
#include "pksettings.h"
class PackageListItem
: public QCheckListItem
{
public:
+ PackageListItem(QListViewItem*, Package*, PackageManagerSettings*);
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:
+ void init(Package*, PackageManagerSettings*);
QCheckListItem *nameItem;
QCheckListItem *destItem;
QCheckListItem *linkItem;
PackageManagerSettings *settings;
Package *package;
};
diff --git a/noncore/unsupported/oipkg/packagelistlocal.cpp b/noncore/unsupported/oipkg/packagelistlocal.cpp
new file mode 100644
index 0000000..6d931c8
--- a/dev/null
+++ b/noncore/unsupported/oipkg/packagelistlocal.cpp
@@ -0,0 +1,66 @@
+#include <qpe/config.h>
+#include <qfile.h>
+#include <qfileinfo.h>
+#include <qtextstream.h>
+#include <qstringlist.h>
+#include "packagelistlocal.h"
+
+PackageListLocal::PackageListLocal()
+ : PackageList()
+{
+ Config cfg( "oipkg", Config::User );
+ cfg.setGroup( "Common" );
+ statusDir = cfg.readEntry( "statusDir", "" );
+ listsDir = cfg.readEntry( "listsDir", "" );
+ if ( statusDir=="" || ! QFileInfo(statusDir+"/status").isFile() )
+ {
+ statusDir="/usr/lib/ipkg/";
+ listsDir="/usr/lib/ipkg/lists/";
+ cfg.writeEntry( "statusDir", statusDir );
+ cfg.writeEntry( "listsDir", listsDir );
+ }
+}
+
+PackageListLocal::PackageListLocal(PackageManagerSettings* s)
+ : PackageList(s)
+{
+ PackageListLocal();
+}
+
+PackageListLocal::~PackageListLocal()
+{
+}
+
+void PackageListLocal::parseStatus()
+{
+ QStringList dests = settings->getDestinationUrls();
+ QStringList destnames = settings->getDestinationNames();
+ QStringList::Iterator name = destnames.begin();
+ for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir )
+ {
+ pvDebug( 2,"Status: "+*dir+statusDir+"/status");
+ readFileEntries( *dir+statusDir+"/status", *name );
+ ++name;
+ };
+}
+
+void PackageListLocal::parseList()
+{
+ QStringList srvs = settings->getActiveServers();
+
+ for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it )
+ {
+ pvDebug( 2, "List: "+listsDir+"/"+*it);
+ readFileEntries( listsDir+"/"+*it );
+ }
+}
+
+
+void PackageListLocal::update()
+{
+ pvDebug( 2, "parseStatus");
+ parseStatus();
+ pvDebug( 2, "parseList");
+ parseList();
+ pvDebug( 2, "finished parsing");
+}
diff --git a/noncore/unsupported/oipkg/packagelistlocal.h b/noncore/unsupported/oipkg/packagelistlocal.h
new file mode 100644
index 0000000..887126b
--- a/dev/null
+++ b/noncore/unsupported/oipkg/packagelistlocal.h
@@ -0,0 +1,30 @@
+#ifndef PACKAGELISTLOCAL_H
+#define PACKAGELISTLOCAL_H
+
+#include "packagelist.h"
+
+
+#define HACK
+#ifdef HACK
+ static QString listsDir="/usr/lib/ipkg/";
+ static QString statusDir="/usr/lib/ipkg/";
+#endif
+
+class PackageListLocal : public PackageList {
+public:
+ PackageListLocal();
+ PackageListLocal( PackageManagerSettings* );
+ virtual ~PackageListLocal();
+
+public slots:
+ void update();
+private:
+#ifndef HACK
+ QString listsDir;
+ QString statusDir;
+#endif
+ void parseStatus();
+ void parseList();
+};
+
+#endif
diff --git a/noncore/unsupported/oipkg/packagelistremote.cpp b/noncore/unsupported/oipkg/packagelistremote.cpp
new file mode 100644
index 0000000..721d4a6
--- a/dev/null
+++ b/noncore/unsupported/oipkg/packagelistremote.cpp
@@ -0,0 +1,47 @@
+
+#include "packagelistremote.h"
+
+#include <qstring.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+PackageListRemote::PackageListRemote(PackageManagerSettings* s)
+ : PackageList(s)
+{
+ PackageListRemote();
+}
+
+PackageListRemote::PackageListRemote()
+ : PackageList()
+{
+}
+
+PackageListRemote::~PackageListRemote()
+{
+}
+
+void PackageListRemote::query(QString s)
+{
+ int r=0;
+ QString cmd = "wget";
+ QString redirect = "/tmp/oipkg.query";
+
+ // use file for output
+ cmd += " --output-document="+redirect;
+//http://ipkgfind.handhelds.org/packages.phtml?format=pda&query=ipkg&searchtype=package&section=
+ QString server="http://ipkgfind.handhelds.org/";
+ cmd += " \""+server+"/packages.phtml";
+ cmd += "?format=pda&searchtype=package&section=";
+ cmd += "&query="+s;
+ cmd += "\"";
+
+ pvDebug(2,"search :"+cmd);
+ r = system(cmd.latin1());
+ readFileEntries( redirect );
+
+}
+
+void PackageListRemote::update()
+{
+ pvDebug(2,"PackageListRemote::update\ndoing nothing ");
+}
diff --git a/noncore/unsupported/oipkg/packagelistremote.h b/noncore/unsupported/oipkg/packagelistremote.h
new file mode 100644
index 0000000..147da1e
--- a/dev/null
+++ b/noncore/unsupported/oipkg/packagelistremote.h
@@ -0,0 +1,19 @@
+#ifndef PACKAGELISTREMOTE_H
+#define PACKAGELISTREMOTE_H
+
+#include "packagelist.h"
+#include "package.h"
+#include "pksettings.h"
+#include "debug.h"
+
+class PackageListRemote : public PackageList {
+public:
+ PackageListRemote();
+ PackageListRemote( PackageManagerSettings* s);
+ virtual ~PackageListRemote();
+ void query(QString);
+public slots:
+ void update();
+};
+
+#endif
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp
index 2915ac6..610a0e1 100644
--- a/noncore/unsupported/oipkg/packagelistview.cpp
+++ b/noncore/unsupported/oipkg/packagelistview.cpp
@@ -1,25 +1,8 @@
-/***************************************************************************
- 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"
diff --git a/noncore/unsupported/oipkg/packagelistview.h b/noncore/unsupported/oipkg/packagelistview.h
index a3db0d0..d371a34 100644
--- a/noncore/unsupported/oipkg/packagelistview.h
+++ b/noncore/unsupported/oipkg/packagelistview.h
@@ -43,13 +43,12 @@ private:
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/pkfind.ui b/noncore/unsupported/oipkg/pkfind.ui
deleted file mode 100644
index 7a24c00..0000000
--- a/noncore/unsupported/oipkg/pkfind.ui
+++ b/dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE UI><UI>
-<class>Search</class>
-<widget>
- <class>QDialog</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Form5</cstring>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>0</x>
- <y>0</y>
- <width>196</width>
- <height>55</height>
- </rect>
- </property>
- <property stdset="1">
- <name>caption</name>
- <string>Search Packages</string>
- </property>
- <hbox>
- <property stdset="1">
- <name>margin</name>
- <number>11</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>6</number>
- </property>
- <widget>
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>TextLabel4</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Find:</string>
- </property>
- </widget>
- <widget>
- <class>QLineEdit</class>
- <property stdset="1">
- <name>name</name>
- <cstring>pattern</cstring>
- </property>
- </widget>
- </hbox>
-</widget>
-</UI>
diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp
index 6c8dc2a..7e2ef10 100644
--- a/noncore/unsupported/oipkg/pksettings.cpp
+++ b/noncore/unsupported/oipkg/pksettings.cpp
@@ -129,16 +129,18 @@ void PackageManagerSettings::editServer(int i)
void PackageManagerSettings::editDestination(int i)
{
if ( destinationname->isEnabled() ) {
disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) );
disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) );
} else {
destinationname->setEnabled(TRUE);
destinationurl->setEnabled(TRUE);
+ createLinksButton->setEnabled(TRUE);
+ removeLinksButton->setEnabled(TRUE);
}
destinationname->setText( destinations->text(i) );
destinationurl->setText( *destinationurlDic[i] );
editeddestination = i;
connect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) );
@@ -523,20 +525,40 @@ QStringList PackageManagerSettings::getDestinationNames()
sl += destinations->text(i);
}
return sl;
}
void PackageManagerSettings::linkEnabled( bool b )
{
+ pvDebug(2,"PackageManagerSettings::linkEnabled "+QString(b?"yes":"no"));
activeLinkDestination->setEnabled( b );
}
void PackageManagerSettings::activeServerChanged()
{
changed = true;
}
QComboBox* PackageManagerSettings::getDestCombo()
{
return new QComboBox(activeDestination);
}
+
+void PackageManagerSettings::createLinksToDest()
+{
+ pvDebug(2,"creating links...");
+// emit doCreateLinks( destinationurl->text() );
+// ipkg->createLinks( destinationurl );
+}
+
+void PackageManagerSettings::removeLinksToDest()
+{
+ pvDebug(2,"removing links...");
+// emit doRemoveLinks( destinationurl->text() );
+// ipkg->removeLinks( destinationurl );
+}
+
+//void PackageManagerSettings::setIpkg( PmIpkg* i )
+//{
+// ipkg = i;
+//}
diff --git a/noncore/unsupported/oipkg/pksettings.h b/noncore/unsupported/oipkg/pksettings.h
index fbb3b99..1632d4a 100644
--- a/noncore/unsupported/oipkg/pksettings.h
+++ b/noncore/unsupported/oipkg/pksettings.h
@@ -1,68 +1,74 @@
#ifndef PACKAGEMANAGERSETTINGS_H
#define PACKAGEMANAGERSETTINGS_H
#include "pksettingsbase.h"
+//#include "pmipkg.h"
#include <qintdict.h>
+#include <qobject.h>
-class PackageManagerSettings : private PackageManagerSettingsBase
+class PackageManagerSettings : public 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();
+// void setIpkg( PmIpkg* );
public slots:
void writeInstallationSettings();
void readInstallationSettings();
void writeCurrentInstallationSetting();
void readInstallationSetting(int);
void installationSettingSetName(const QString &);
-
+ void removeLinksToDest();
+ void createLinksToDest();
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();
+signals:
+// void doCreateLinks( QString dest );
+// void doRemoveLinks( QString dest );
+
+private:
+ QIntDict<QString> serverurlDic;
+ QIntDict<QString> destinationurlDic;
+ int ipkg_old;
+ int editedserver;
+ int editeddestination;
+ int currentSetting;
+ int installationSettingsCount;
+ bool changed;
+
+ bool readIpkgConfig(const QString&);
+ void writeIpkgConfig(const QString&);
+ void writeSettings();
+ void readSettings();
};
#endif
diff --git a/noncore/unsupported/oipkg/pksettingsbase.ui b/noncore/unsupported/oipkg/pksettingsbase.ui
index fd6d208..5b83248 100644
--- a/noncore/unsupported/oipkg/pksettingsbase.ui
+++ b/noncore/unsupported/oipkg/pksettingsbase.ui
@@ -6,17 +6,17 @@
<name>name</name>
<cstring>Form4</cstring>
</property>
<property stdset="1">
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>345</width>
+ <width>337</width>
<height>454</height>
</rect>
</property>
<property stdset="1">
<name>caption</name>
<string>Package Servers</string>
</property>
<property>
@@ -527,21 +527,21 @@
</property>
<attribute>
<name>title</name>
<string>Destinations</string>
</attribute>
<grid>
<property stdset="1">
<name>margin</name>
- <number>3</number>
+ <number>2</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>3</number>
+ <number>2</number>
</property>
<widget row="0" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout3</cstring>
</property>
<hbox>
@@ -707,16 +707,131 @@
</property>
<property stdset="1">
<name>text</name>
<string>Name:</string>
</property>
</widget>
</grid>
</widget>
+ <widget row="4" column="0" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout11</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>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>createLinksButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>link to /</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>removeLinksButton</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Remove links</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget row="5" column="0" >
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox1</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string></string>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout12</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>CheckBoxvolatile</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>volatile</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>removeable</cstring>
+ </property>
+ <property stdset="1">
+ <name>enabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>removeable</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+ </widget>
</grid>
</widget>
</widget>
</grid>
</widget>
<connections>
<connection>
<sender>activeServers</sender>
@@ -731,27 +846,41 @@
<slot>activeServerChanged()</slot>
</connection>
<connection>
<sender>activeServers</sender>
<signal>pressed(QListBoxItem*)</signal>
<receiver>Form4</receiver>
<slot>activeServerChanged()</slot>
</connection>
+ <connection>
+ <sender>createLinksButton</sender>
+ <signal>clicked()</signal>
+ <receiver>Form4</receiver>
+ <slot>createLinksToDest()</slot>
+ </connection>
+ <connection>
+ <sender>removeLinksButton</sender>
+ <signal>clicked()</signal>
+ <receiver>Form4</receiver>
+ <slot>removeLinksToDest()</slot>
+ </connection>
+ <slot access="public">activeServerChanged()</slot>
+ <slot access="public">createLinksToDest()</slot>
<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">removeLinksToDest()</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 9f6429a..fe200f5 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -205,44 +205,41 @@ void PmIpkg::processLinkDir( QString file, QString dest )
pvDebug(4,"removing "+destFile+" no "+file);
QFileInfo toRemoveLink( destFile );
if ( !QFile::exists( file ) && toRemoveLink.isSymLink() )
unlink( linkFile );
}
}
}
-void PmIpkg::commit( PackageList pl )
+void PmIpkg::loadList( 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";
for( Package *pack = pl.first();pack ; (pack = pl.next()) )
- {
- if ( pack && (pack->name() != "") && pack)
- {
- if ( pack->toInstall() )
- {
+ {
+ 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() )
- {
+ if ( pack->toRemove() )
to_remove.append( pack );
- sizecount += 1;
- rem += pack->name()+"<br>";
- }
- }
- }
+ }
+ }
+}
+void PmIpkg::commit( PackageList pl )
+{
+ sizecount = 0;
+ QString rem="<b>"+tr("To remove:")+"</b><br>\n";
+ QString inst="<b>"+tr("To install:")+"</b><br>\n";
+ loadList(pl);
+ for (uint i=0; i < to_remove.count(); i++)
+ sizecount += 1;
+ for (uint i=0; i < to_install.count(); i++)
+ sizecount += to_install.at(i)->size().toInt();
startDialog();
-
}
void PmIpkg::startDialog()
{
installDialog = new QDialog(0,0,true);
QGridLayout *RunWindowLayout = new QGridLayout( installDialog );
RunWindowLayout->setSpacing( 2 );
RunWindowLayout->setMargin( 2 );
@@ -261,29 +258,29 @@ void PmIpkg::startDialog()
toInstallItem = new QCheckListItem( plv, QObject::tr("To install") );
toInstallItem->setOpen( true );
for (Package *it=to_install.first(); it != 0; it=to_install.next() )
{
toInstallItem->insertItem( new PackageListItem(plv, it,settings) );
}
QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" );
- GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().hasHeightForWidth() ) );
+ GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().mayShrinkVertically() ) );
GroupBox1->setTitle( tr( "Ipkg options" ) );
GroupBox1->setColumnLayout(0, Qt::Vertical );
GroupBox1->layout()->setSpacing( 0 );
GroupBox1->layout()->setMargin( 0 );
QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
GroupBox1Layout->setAlignment( Qt::AlignTop );
GroupBox1Layout->setSpacing( 3 );
GroupBox1Layout->setMargin( 3 );
-
_force_depends = new QCheckBox( GroupBox1, "_force_depends" );
_force_depends->setText( tr( "-force-depends" ) );
_force_depends->setAutoResize( TRUE );
+ _force_depends->setChecked(true);
GroupBox1Layout->addWidget( _force_depends, 0, 0 );
_force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" );
_force_reinstall->setText( tr( "-force-reinstall" ) );
_force_reinstall->setAutoResize( TRUE );
GroupBox1Layout->addWidget( _force_reinstall, 1, 0 );
_force_remove = new QCheckBox( GroupBox1, "_force_remove" );
_force_remove->setText( tr( "-force-removal-of-essential-packages" ) );
_force_remove->setAutoResize( TRUE );
@@ -314,30 +311,31 @@ void PmIpkg::doIt()
void PmIpkg::remove()
{
if ( to_remove.count() == 0 ) return;
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() )
- {
+ 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( 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();
+
out("<br><hr>");
}else{
out("<b>"+tr("Error while removing")+"</b><hr>"+it->name());
}
pvDebug(2,"delete File List");
if ( it->link() )delete fileList;
}
out("<br>");
@@ -346,17 +344,17 @@ void PmIpkg::remove()
void PmIpkg::install()
{
if ( to_install.count() == 0 ) return;
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 )
+ if ( runIpkg("install " + it->installName(), 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 );
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h
index 0625032..2b89023 100644
--- a/noncore/unsupported/oipkg/pmipkg.h
+++ b/noncore/unsupported/oipkg/pmipkg.h
@@ -18,32 +18,34 @@ class Package;
class PmIpkg : public QObject
{
Q_OBJECT
public:
PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 );
~PmIpkg();
int linkOpp;
+ void loadList( PackageList );
void commit( PackageList );
void update();
// 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:
+ int sizecount;
PackageManagerSettings* settings;
RunWindow *runwindow;
QDialog *installDialog;
QList<Package> to_remove;
QList<Package> to_install;
bool runwindowopen;
QString fileNameToInstall;
QCheckBox *_force_reinstall;
diff --git a/noncore/unsupported/oipkg/settings.h b/noncore/unsupported/oipkg/settings.h
index e2072f1..3be4334 100644
--- a/noncore/unsupported/oipkg/settings.h
+++ b/noncore/unsupported/oipkg/settings.h
@@ -56,8 +56,12 @@ private:
bool readIpkgConfig(const QString&);
void writeIpkgConfig(const QString&);
void writeSettings();
void readSettings();
};
#endif
+ /** No descriptions */
+ void createLinks();
+ /** No descriptions */
+ void removeLinks();