-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 14 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.h | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettings.cpp | 0 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 24 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 1 |
5 files changed, 30 insertions, 11 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 6bf9a7a..c95f482 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp @@ -1,69 +1,75 @@ // adadpted form qpe/qipkg #include "mainwindow.h" #include <qpe/qpemenubar.h> #include <qpe/qpemessagebox.h> #include <qpe/resource.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 <qlineedit.h> #include <qtabwidget.h> #include <qcombobox.h> +#include <qmessagebox.h> #include <qlayout.h> #include "pksettingsbase.h" #include "packagelistitem.h" + MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : QMainWindow( parent, name, f ) { 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() ) ); ipkg = new PmIpkg( settings, this ); packageList.setSettings( settings ); getList(); setSections(); setSubSections(); 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 ); @@ -165,88 +171,96 @@ void MainWindow::makeMenu() 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 Config cfg( "oipkg", Config::User ); cfg.setGroup( "Setting_" + QString::number( setting ) ); CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); findShow(bool b) sectionShow(bool b) #endif } MainWindow::~MainWindow() { } void MainWindow::runIpkg() { 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(); 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(); } void MainWindow::filterList() { + wait->show(); QString f = ""; if ( findAction->isOn() ) f = findEdit->text(); packageList.filterPackages( f ); + wait->hide(); } void MainWindow::displayList() { + 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) ), diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h index bcb0cc9..a713d00 100644 --- a/noncore/unsupported/oipkg/mainwindow.h +++ b/noncore/unsupported/oipkg/mainwindow.h @@ -1,76 +1,78 @@ #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 MainWindow : public QMainWindow { Q_OBJECT public: MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); ~MainWindow(); 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 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; PackageListView *listViewPackages; QPEToolBar *findBar; QLineEdit *findEdit; QPEToolBar *sectionBar; QComboBox *section; QComboBox *subsection; + QMessageBox *wait; private slots: void rotateUpdateIcon(); }; #endif diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp index f84a9c4..be01837 100644 --- a/noncore/unsupported/oipkg/pksettings.cpp +++ b/noncore/unsupported/oipkg/pksettings.cpp diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index f0992f5..ecc97b2 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp @@ -173,162 +173,164 @@ 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() { - QDialog *d = new QDialog(); - QGridLayout *RunWindowLayout = new QGridLayout( d ); + 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(d, "install",settings); + PackageListView *plv = new PackageListView(installDialog, "install",settings); RunWindowLayout->addWidget( plv, 1, 0 ); for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) { plv->insertItem( new PackageListItem(plv, it,settings) ); } for (Package *it=to_install.first(); it != 0; it=to_install.next() ) { plv->insertItem( new PackageListItem(plv, it,settings) ); } - QPushButton *doItButton = new QPushButton( d, "doItButton" ); + 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( d, "installButton" ); + 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( d, "removeButton" ); + 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( d, "cancelButton" ); + 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() ), - d, SLOT( close() ) ); - d->showMaximized(); - d->exec(); - // d->close(); + installDialog, SLOT( close() ) ); + installDialog->showMaximized(); + if ( installDialog->exec() ) doIt(); + installDialog->close(); } void PmIpkg::doIt() { 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>"); 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()); } } } 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>"); 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()); if ( it->link() ) makeLinks( it ); it->processed(); }else{ out("<b>"+tr("Error while installing")+"</b>"+it->name()); } } } void PmIpkg::linkDestination( const QString msg, const QByteArray 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; // } } diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index f70283e..c5e6255 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h @@ -1,51 +1,52 @@ #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" 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; + QDialog *installDialog; QList<Package> to_remove; QList<Package> to_install; bool runwindowopen; QString fileNameToInstall; void startDialog(); void makeLinks(Package*); void linkPackage( QString, QString ); void processLinkDir( QString, QString ); int runIpkg(const QString& args, const QString& dest="" ); void out( QString ); public slots: void doIt(); void install(); void remove(); void installFile(const QString &fileName); void linkDestination( const QString, const QByteArray ); }; #endif |