author | tille <tille> | 2002-07-06 15:26:04 (UTC) |
---|---|---|
committer | tille <tille> | 2002-07-06 15:26:04 (UTC) |
commit | 7fcf35f1632134cc9f0b3d38949864df3df59c4c (patch) (side-by-side diff) | |
tree | 1c3ef72622877e4d9b59fd73880fa8ffe7936897 | |
parent | 76685f88ebcfd475c2d3c6d8c69271883053b09f (diff) | |
download | opie-7fcf35f1632134cc9f0b3d38949864df3df59c4c.zip opie-7fcf35f1632134cc9f0b3d38949864df3df59c4c.tar.gz opie-7fcf35f1632134cc9f0b3d38949864df3df59c4c.tar.bz2 |
cmd line dialog
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 4 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 10 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 2 |
3 files changed, 11 insertions, 5 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 53db477..d1be8d0 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp @@ -23,65 +23,65 @@ #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 <qpushbutton.h> #include <qlayout.h> #include "pksettingsbase.h" #include "utils.h" #include "packagelistitem.h" MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : QMainWindow( parent, name, f ) // packageListServers( QObject(parent), name ), // packageListSearch( parent, name ), // packageListDocLnk( parent, name ) { setCaption( tr("Package Manager") ); settings = new PackageManagerSettings(this,0,TRUE); listViewPackages = new PackageListView( this,"listViewPackages",settings ); setCentralWidget( listViewPackages ); listViewPackages->addList( tr("feeds"), &packageListServers ); - listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); + listViewPackages->addList( tr("ipkgfind&killefiz"), &packageListSearch ); listViewPackages->addList( tr("documents"), &packageListDocLnk ); ipkg = new PmIpkg( settings, this ); packageListServers.setSettings( settings ); packageListSearch.setSettings( settings ); packageListDocLnk.setSettings( settings ); pvDebug(9,"packageListServers.update"); packageListServers.update(); pvDebug(9,"packageListDocLnk.update"); packageListDocLnk.update(); pvDebug(9,"makeMenu"); makeMenu(); makeChannel(); 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()) ); pvDebug(9,"displayList"); displayList(); } void MainWindow::makeMenu() { QPEToolBar *toolBar = new QPEToolBar( this ); QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); QPopupMenu *srvMenu = new QPopupMenu( menuBar ); @@ -163,65 +163,65 @@ void MainWindow::makeMenu() 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 ); // sectionBar->setStretchableWidget( section ); //FIND findBar = new QPEToolBar(this); addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); label = new QLabel( tr("Filter: "), findBar ); // label->setBackgroundMode( PaletteForeground ); 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( "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 = new QLabel( tr("Search: "), searchBar ); // label->setBackgroundMode( PaletteForeground ); 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->setBackgroundMode( PaletteForeground ); destBar->setHorizontalStretchable( TRUE ); destination = new QComboBox( false, destBar ); destination->insertStringList( settings->getDestinationNames() ); setComboName(destination,settings->getDestinationName()); connect( destination, SIGNAL(activated(int)), settings, SLOT(activeDestinationChange(int)) ); spacer = new QLabel( " ", destBar ); diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index d29036b..71e9b88 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp @@ -1,74 +1,74 @@ /*************************************************************************** * * * 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. * * * ***************************************************************************/ // (c) 2002 Patrick S. Vogt <tille@handhelds.org> #include "pmipkg.h" #include "pksettings.h" #include "package.h" #include "packagelistitem.h" #include <opie/oprocess.h> #include <qpe/resource.h> #include <qpe/config.h> #include <qpe/stringutil.h> #include <qpe/qpeapplication.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 <qmessagebox.h> #include <qprogressbar.h> #include <qpushbutton.h> #include <qlayout.h> #include <stdlib.h> #include <unistd.h> #include "mainwindow.h" //#define OPROCESS PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) - : QObject ( p ) + : QObject ( p ), shellWarning(true) { settings = s; runwindow = new RunWindow( p, name, true, f ); #ifdef OPROCESS ipkgProcess = new OProcess(); connect ( ipkgProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), this, SLOT(getIpkgOutput(OProcess*,char*,int))); connect ( ipkgProcess, SIGNAL(receivedStderr(OProcess*,char*,int)), this, SLOT(getIpkgOutput(OProcess*,char*,int))); installDialog = 0; #endif } PmIpkg::~PmIpkg() { #ifdef OPROCESS delete ipkgProcess; #endif } bool PmIpkg::runIpkg(const QString& args, const QString& dest ) { bool ret=false; QDir::setCurrent("/tmp"); QString cmd = "/usr/bin/ipkg "; #ifdef OPROCESS ipkgProcess->kill(); ipkgProcess->clearArguments(); *ipkgProcess << "/usr/bin/ipkg "; cmd = ""; #endif @@ -127,64 +127,70 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest ) while ( ipkgProcess->isRunning() ) { out("."); pvDebug(7,"wait for oprocess to terminate"); qApp->processEvents(); }; #else qApp->processEvents(); FILE *fp; char line[130]; QString lineStr, lineStrOld; sleep(1); cmd +=" 2>&1"; fp = popen( (const char *) cmd, "r"); if ( fp == NULL ) { qDebug("Could not execute '" + cmd + "'! err=%d", fp); out("\nError while executing "+ cmd+"\n\n"); ret = false; } else { while ( fgets( line, sizeof line, fp) != NULL) { lineStr = line; lineStr=lineStr.left(lineStr.length()-1); //Configuring opie-oipkg...Done if (lineStr.contains("Done")) ret = true; if (lineStr!=lineStrOld) out(lineStr); lineStrOld = lineStr; qApp->processEvents(); } } pclose(fp); + if (!ret && shellWarning) + { + shellWarning = false; + QMessageBox::critical( runwindow, tr("install failure"), + tr("<p>Did you start me from the command line?</p>")); + } #endif //out( "Finished!"); pvDebug(2,QString(ret?"success\n":"failure\n")); return ret; } void PmIpkg::makeLinks(Package *pack) { pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); QString pn = pack->name(); linkPackage( pack->packageName(), 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 packFileDir = dest+"/"+statusDir+"/info/"+packFileName+".list"; QFile f( packFileDir ); qDebug("Try to open %s", packFileDir.latin1()); if ( ! f.open(IO_ReadOnly) ) { out( "Could not open:\n"+packFileDir ); f.close(); packFileDir = "/"+statusDir+"/info/"+packFileName+".list"; f.setName( packFileDir ); diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index 28bc5dd..662800a 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h @@ -9,66 +9,66 @@ // (c) 2002 Patrick S. Vogt <tille@handhelds.org> #ifndef PMIPKG_H #define PMIPKG_H #include <opie/oprocess.h> #include <qobject.h> #include <qlist.h> #include <qstring.h> #include <qwidget.h> #include "pksettings.h" #include "runwindow.h" #include "packagelist.h" #include "installdialog.h" #include "debug.h" #define createLink 0 #define removeLink 1 class Package; class PmIpkg : public QObject { Q_OBJECT public: PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); ~PmIpkg(); int linkOpp; void loadList( PackageList* ); void commit(); void update(); void show(); - /** No descriptions */ void clearLists(); 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 slots: void getIpkgOutput(OProcess *proc, char *buffer, int buflen); private: + bool shellWarning; OProcess *ipkgProcess; PackageManagerSettings* settings; RunWindow *runwindow; InstallDialog *installDialog; QList<Package> to_remove; QList<Package> to_install; void makeLinks(Package*); void linkPackage( QString, QString ); void processLinkDir( QString , QString ); bool runIpkg(const QString& args, const QString& dest="" ); void out( QString ); QStringList* getList( QString, QString ); void processFileList( QStringList*, QString ); }; #endif |