summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp23
-rw-r--r--noncore/unsupported/oipkg/mainwindow.h4
-rw-r--r--noncore/unsupported/oipkg/pksettings.h1
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp75
-rw-r--r--noncore/unsupported/oipkg/pmipkg.h11
-rw-r--r--noncore/unsupported/oipkg/settings.h5
6 files changed, 98 insertions, 21 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index 54ee115..c803ca0 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -69,49 +69,49 @@ 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 );
popupMenu = new QPopupMenu( this );
contextMenu = new QPopupMenu( this );
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( "Commit" ),
+ 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 );
detailsAction = new QAction( tr( "Details" ),
Resource::loadIconSet( "find" ),
QString::null, 0, this, 0 );
connect( detailsAction, SIGNAL( activated() ),
this , SLOT( showDetails() ) );
detailsAction->addTo( toolBar );
detailsAction->addTo( srvMenu );
@@ -150,78 +150,78 @@ void MainWindow::makeMenu()
// 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 );
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( "Filter" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 );
-// connect( a, SIGNAL( activated() ), this, SLOT( filterList() ) );
-// a->addTo( findBar );
-// a->addTo( edit );
+
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 );
-
}
MainWindow::~MainWindow()
{
}
void MainWindow::runIpkg()
{
ipkg->commit( packageList );
- updateList(); //to remove
+// updateList(); //to remove
}
void MainWindow::updateList()
{
+ QTimer *t = new QTimer( this );
+ connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) );
+ t->start( 0, false );
packageList.clear();
ipkg->update();
getList();
+ t->stop();
}
void MainWindow::getList()
{
packageList.update();
displayList();
}
void MainWindow::filterList()
{
QString f = "";
if ( findAction->isOn() ) f = findEdit->text();
packageList.filterPackages( f );
}
void MainWindow::displayList()
{
filterList();
listViewPackages->clear();
Package *pack = packageList.first();
while( pack )
{
if ( pack && (pack->name() != "") )
listViewPackages->insertItem( new PackageListItem( listViewPackages, pack ) );
@@ -325,24 +325,33 @@ void MainWindow::setCurrent( QListViewItem* p )
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::rotateUpdateIcon()
+{
+ pvDebug(2, "MainWindow::rotateUpdateIcon");
+ if ( updateIcon )
+ updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) );
+ else
+ updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) );
+ updateIcon = !updateIcon;
+}
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h
index 0c1e474..892d5e8 100644
--- a/noncore/unsupported/oipkg/mainwindow.h
+++ b/noncore/unsupported/oipkg/mainwindow.h
@@ -1,29 +1,30 @@
#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 "pkdesc.h"
class QComboBox;
class QPEToolBar;
class QLineEdit;
class QListView;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
~MainWindow();
protected slots:
void runIpkg();
@@ -48,27 +49,30 @@ public slots:
private:
void makeMenu();
void setSections();
void setSubSections();
PmIpkg* ipkg;
PackageManagerSettings *settings;
PackageDetails* details;
PackageList packageList;
Package *activePackage;
QAction *runAction;
QAction *detailsAction;
QAction *updateAction;
QAction *findAction;
QAction *sectionAction;
QListView *listViewPackages;
QPopupMenu *contextMenu;
QPEToolBar *findBar;
QLineEdit *findEdit;
QPEToolBar *sectionBar;
QComboBox *section;
QComboBox *subsection;
QPopupMenu *popupMenu;
+ bool updateIcon;
+private slots:
+ void rotateUpdateIcon();
};
#endif
diff --git a/noncore/unsupported/oipkg/pksettings.h b/noncore/unsupported/oipkg/pksettings.h
index cda352a..2982f1c 100644
--- a/noncore/unsupported/oipkg/pksettings.h
+++ b/noncore/unsupported/oipkg/pksettings.h
@@ -1,46 +1,45 @@
#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 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 newServer();
void editServer(int);
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index b23b9ea..eae73ad 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -22,48 +22,56 @@
#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)
{
pvDebug(2,"PmIpkg::runIpkg "+args);
+
+ //to make script ipkg happy
+ pvDebug(2, "cd "+settings->getDestinationUrl()+"/tmp/ipkg");
+ if (!QDir::setCurrent(settings->getDestinationUrl()+"/tmp/ipkg"))
+ {
+ QDir instDir = QDir(settings->getDestinationUrl()+"/tmp/ipkg");
+ instDir.mkdir(settings->getDestinationUrl()+"/tmp/ipkg");
+ }
#ifdef PROC
QStringList cmd = "/usr/bin/ipkg ";
#endif
#ifdef SYSTEM
QString cmd = "/usr/bin/ipkg ";
#endif
cmd += " -dest "+settings->getDestinationName();
cmd += " -force-defaults ";
out( "<hr><br>Starting to "+ args+"<br>\n");
cmd += args;
out( "running:<br>\n"+cmd+"<br>\n" );
int r = 0;
#ifdef PROC
QString o = "start";
Process ipkg( cmd );
QString description;
ipkg.exec("",o);
out( o );
#endif
#ifdef SYSTEM
QString redirect = "/tmp/oipkg.pipe";
cmd += " | tee "+redirect+" 2>&1";
pvDebug(2, "running >"+cmd+"<");
@@ -132,131 +140,178 @@ void PmIpkg::processLinkDir( QString file, QString dest )
QFileInfo *fi;
while ( (fi=it.current()) )
{
// out( "<b>"+fi->absFilePath()+"</b>" );
processLinkDir( fi->absFilePath(), dest );
++it;
}
} 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 );
symlink( instFile, linkFile );
}
}
void PmIpkg::commit( PackageList pl )
{
show( false );
runwindow->outPut->setText("");
out( "<h1>"+tr("Todo")+"</h1>\n");
+ to_install.clear();
+ to_remove.clear();
+ int sizecount = 0;
QString rem="<b>To remove:</b><br>\n";
QString inst="<b>To install:</b><br>\n";;
for( Package *pack = pl.first();pack ; (pack = pl.next()) )
{
if ( pack && (pack->name() != "") && pack)
{
if ( pack->toInstall() )
{
+ #ifndef NEWLIST
to_install.append( pack->name() );
+ #endif
+ #ifdef NEWLIST
+ to_install.append( pack );
+ sizecount += pack->size().toInt();
+ #endif
inst += pack->name()+"<br>";
}
if ( pack->toRemove() )
{
+ #ifndef NEWLIST
to_remove.append( pack->name() );
+ #endif
+ #ifdef NEWLIST
+ to_remove.append( pack );
+ sizecount += 1;
+ #endif
rem += pack->name()+"<br>";
}
}
}
out("<p>"+inst+"</p>"+"<p>"+rem+"</p><hl>");
qDebug("to remove=%i; to install=%i",to_remove.count(),to_install.count());
+ runwindow->progress->setTotalSteps( sizecount );
+
connect( runwindow->doItButton, SIGNAL( clicked() ),
SLOT( doIt() ) );
connect( runwindow->installButton, SIGNAL( clicked() ),
this, SLOT( install() ) );
connect( runwindow->removeButton, SIGNAL( clicked() ),
this, SLOT( remove() ) );
connect( runwindow->cancelButton, SIGNAL( clicked() ),
runwindow, SLOT( close() ) );
runwindow->exec();
// ##### 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;
return;
}
void PmIpkg::doIt()
{
remove();
install();
}
void PmIpkg::remove()
{
if ( to_remove.count() == 0 ) return;
show( true );
out("<hr><hr><b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br>");
- for (QStringList::ConstIterator it=to_remove.begin(); it!=to_remove.end(); ++it)
- {
+
+ #ifndef NEWLIST
+ for (QStringList::ConstIterator it=to_remove.begin(); it!=to_remove.end(); ++it)
+ {
if ( runIpkg("remove " + *it) == 0)
{
}else{
out("<b>"+tr("Error while removing")+"</b>"+*it);
}
}
+#endif
+ #ifdef NEWLIST
+ for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
+ {
+ if ( runIpkg("remove " + it->name()) == 0)
+ {
+ runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress());
+ it->processed();
+ runwindow->progress->setProgress( 1 );
+ }else{
+ out("<b>"+tr("Error while removing")+"</b>"+it->name());
+ }
+ }
+#endif
}
void PmIpkg::install()
{
if ( to_install.count() == 0 ) return;
show( true );
- out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"<b><br>");
- if ( to_install.count() )
+ out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>");
+ #ifndef NEWLIST
for (QStringList::ConstIterator it=to_install.begin(); it!=to_install.end(); ++it)
{
if ( runIpkg("install " + *it) == 0 )
- {
+ {
if ( settings->createLinks() )
makeLinks( *it );
}else{
out("<b>"+tr("Error while installing")+"</b>"+*it);
}
}
-
+#endif
+ #ifdef NEWLIST
+ for (Package *it=to_install.first(); it != 0; it=to_install.next() )
+ {
+ if ( runIpkg("install " + it->name()) == 0 )
+ {
+ runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress());
+ if ( settings->createLinks() )
+ makeLinks( it->name() );
+ it->processed();
+ }else{
+ out("<b>"+tr("Error while installing")+"</b>"+it->name());
+ }
+ }
+#endif
}
void PmIpkg::linkDestination( const QString msg, const QByteArray dest )
// add 3rd package parameter
{
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;
// }
}
void PmIpkg::update()
{
show( false );
runIpkg( "update" );
runwindow->close();
}
@@ -269,29 +324,29 @@ void PmIpkg::out( QString o )
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->show();
- else
- runwindow->progress->show();
+// if ( b )
+ runwindow->progress->hide();
+// else
+// runwindow->progress->show();
}
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h
index 8718f49..2692017 100644
--- a/noncore/unsupported/oipkg/pmipkg.h
+++ b/noncore/unsupported/oipkg/pmipkg.h
@@ -1,48 +1,55 @@
#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 NEWLIST
+class Package;
class PmIpkg : public QObject
{
Q_OBJECT
public:
PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 );
~PmIpkg();
void commit( PackageList );
void update();
PackageList* getPackageList();
void showButtons(bool b=true);
void show( bool buttons=true );
private:
PackageManagerSettings* settings;
RunWindow *runwindow;
+#ifndef NEWLIST
QStringList to_remove;
QStringList to_install;
+#endif
+#ifdef NEWLIST
+ QList<Package> to_remove;
+ QList<Package> to_install;
+#endif
bool runwindowopen;
void makeLinks(QString);
void processLinkDir( QString, QString );
int runIpkg(const QString& args);
void out( QString );
public slots:
void doIt();
void install();
void remove();
void linkDestination( const QString, const QByteArray );
};
#endif
diff --git a/noncore/unsupported/oipkg/settings.h b/noncore/unsupported/oipkg/settings.h
index d4b1072..5df522b 100644
--- a/noncore/unsupported/oipkg/settings.h
+++ b/noncore/unsupported/oipkg/settings.h
@@ -1,45 +1,48 @@
#ifndef PACKAGEMANAGERSETTINGS_H
#define PACKAGEMANAGERSETTINGS_H
#include "pksettingsbase.h"
#include <qintdict.h>
-class PackageManagerSettings : private PackageManagerSettingsBase
+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();
+ /** No descriptions */
+ QComboBox getActiveDestinationCombo();
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();