Diffstat (limited to 'noncore/unsupported/oipkg/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 165 |
1 files changed, 108 insertions, 57 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index c95f482..ca1e5e8 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp @@ -8,2 +8,3 @@ #include <qpe/resource.h> +#include <qpe/config.h> #include <qpe/qpetoolbar.h> @@ -19,2 +20,3 @@ #include <qtextview.h> +#include <qcheckbox.h> #include <qlineedit.h> @@ -26,2 +28,3 @@ #include "pksettingsbase.h" +#include "utils.h" #include "packagelistitem.h" @@ -32,29 +35,23 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : { + setCaption( tr("Package Manager") ); settings = new PackageManagerSettings(this,0,TRUE); listViewPackages = new PackageListView( this,"listViewPackages",settings ); - ipkg = new PmIpkg( settings, this ); - setCentralWidget( listViewPackages ); - setCaption( tr("Package Manager") ); // wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); - wait = new QMessageBox(this); - wait->setText(tr("Please wait")); - - channel = new QCopChannel( "QPE/Application/oipkg", this ); - connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), - this, SLOT(receive(const QCString&, const QByteArray&)) ); - - makeMenu(); - - connect( section, SIGNAL( activated(int) ), - this, SLOT( sectionChanged() ) ); - connect( subsection, SIGNAL(activated(int) ), - this, SLOT( subSectionChanged() ) ); - +// wait = new QMessageBox(this); +// wait->setText(tr("Please wait")); ipkg = new PmIpkg( settings, this ); packageList.setSettings( settings ); - getList(); - setSections(); - setSubSections(); + packageList.update(); + makeMenu(); + makeChannel(); + //opie is hardcoded default ;) + for (int i=0;i<section->count();i++) + if (section->text(i)=="opie") + section->setCurrentItem(i); + sectionChanged(); + + connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); + connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); displayList(); @@ -102,4 +99,4 @@ void MainWindow::makeMenu() -// would we use for find -// detailsAction = new QAction( tr( "Details" ), +// could we use for find +// detailsAction = new QAction( tr( "Find" ), // Resource::loadIconSet( "find" ), @@ -107,5 +104,4 @@ void MainWindow::makeMenu() // connect( detailsAction, SIGNAL( activated() ), -// this , SLOT( showDetails() ) ); +// this , SLOT( showFind() ) ); // detailsAction->addTo( toolBar ); -// detailsAction->addTo( srvMenu ); @@ -114,3 +110,2 @@ void MainWindow::makeMenu() cfgact = new QAction( tr( "Setups" ), - // Resource::loadIconSet( "" ), QString::null, 0, this, 0 ); @@ -121,3 +116,2 @@ void MainWindow::makeMenu() cfgact = new QAction( tr( "Servers" ), - // Resource::loadIconSet( "" ), QString::null, 0, this, 0 ); @@ -127,3 +121,2 @@ void MainWindow::makeMenu() cfgact = new QAction( tr( "Destinations" ), - // Resource::loadIconSet( "" ), QString::null, 0, this, 0 ); @@ -133,3 +126,3 @@ void MainWindow::makeMenu() - QAction *a; + QAction *a; @@ -142,3 +135,2 @@ void MainWindow::makeMenu() section = new QComboBox( false, sectionBar ); -// section->setBackgroundMode( PaletteBackground ); label = new QLabel( " / ", sectionBar ); @@ -146,3 +138,2 @@ void MainWindow::makeMenu() subsection = new QComboBox( false, sectionBar ); - a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); @@ -151,2 +142,5 @@ void MainWindow::makeMenu() + setSections(); + setSubSections(); + sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); @@ -154,3 +148,2 @@ void MainWindow::makeMenu() sectionAction->setToggleAction( true ); - sectionAction->setOn( true ); sectionAction->addTo( viewMenu ); @@ -167,2 +160,5 @@ void MainWindow::makeMenu() + 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 ); @@ -173,12 +169,37 @@ void MainWindow::makeMenu() findAction->setToggleAction( true ); - findAction->setOn( true ); findAction->addTo( viewMenu ); - #ifdef NEW + destBar = new QPEToolBar(this); + addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); + label = new QLabel( tr("Destination: "), destBar ); + label->setBackgroundColor( destBar->backgroundColor() ); + destBar->setHorizontalStretchable( TRUE ); + destination = new QComboBox( false, destBar ); + destination->insertStringList( settings->getDestinationNames() ); + setComboName(destination,settings->getDestinationName()); +// connect( destination, SIGNAL(activated(int)), +// SLOT(activeDestinationChange(int)) ); + spacer = new QLabel( " ", destBar ); + spacer->setBackgroundColor( destBar->backgroundColor() ); + CheckBoxLink = new QCheckBox( tr("Link"), destBar); + CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); + CheckBoxLink->setChecked( settings->createLinks() ); +// connect( CheckBoxLink, SIGNAL(toggled(bool)), +// settings, SLOT(linkEnabled(bool)) ); + destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); + connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); + a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); + connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); + a->addTo( destBar ); + destBar->setStretchableWidget( CheckBoxLink ); + destAction->setToggleAction( true ); + // destAction->addTo( viewMenu ); + + // configure the menus Config cfg( "oipkg", Config::User ); - cfg.setGroup( "Setting_" + QString::number( setting ) ); - CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); - findShow(bool b) - sectionShow(bool b) - #endif + cfg.setGroup( "gui" ); + + findShow( cfg.readBoolEntry( "findBar", true ) ); + sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); + destShow( cfg.readBoolEntry( "destBar", false ) ); } @@ -187,2 +208,8 @@ MainWindow::~MainWindow() { + Config cfg( "oipkg", Config::User ); + cfg.setGroup( "gui" ); + cfg.writeEntry( "findBar", !findBar->isHidden() ); + cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); + cfg.writeEntry( "destBar", !destBar->isHidden() ); + } @@ -191,2 +218,3 @@ void MainWindow::runIpkg() { + packageList.allPackages(); ipkg->commit( packageList ); @@ -202,3 +230,3 @@ void MainWindow::updateList() { - wait->show(); +// wait->show(); QTimer *t = new QTimer( this ); @@ -208,14 +236,5 @@ void MainWindow::updateList() ipkg->update(); - getList(); - t->stop(); - wait->hide(); - -} - -void MainWindow::getList() -{ - wait->show(); packageList.update(); - displayList(); - wait->hide(); + t->stop(); +// wait->hide(); } @@ -224,3 +243,3 @@ void MainWindow::filterList() { - wait->show(); +// wait->show(); QString f = ""; @@ -228,3 +247,3 @@ void MainWindow::filterList() packageList.filterPackages( f ); - wait->hide(); +// wait->hide(); } @@ -233,3 +252,3 @@ void MainWindow::displayList() { - wait->hide(); +// wait->hide(); filterList(); @@ -328,2 +347,14 @@ void MainWindow::findClose() +void MainWindow::destShow(bool b) +{ + if (b) destBar->show(); + else destBar->hide(); + destAction->setOn( b ); +} + +void MainWindow::destClose() +{ + destAction->setOn( false ); +} + void MainWindow::rotateUpdateIcon() @@ -363,9 +394,29 @@ void MainWindow::installFile(const QString &fileName) +void MainWindow::makeChannel() +{ + channel = new QCopChannel( "QPE/Application/oipkg", this ); + connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), + this, SLOT(receive(const QCString&, const QByteArray&)) ); +} + + + void MainWindow::receive(const QCString &msg, const QByteArray &arg) { - pvDebug(3, "QCop "+msg); + pvDebug(3, "QCop "+msg+" "+QCString(arg)); if ( msg == "installFile(QString)" ) { - installFile( QString(arg) ); - } -}
\ No newline at end of file + ipkg->installFile( QString(arg) ); + }else if( msg == "removeFile(QString)" ) + { + ipkg->removeFile( QString(arg) ); + }else if( msg == "createLinks(QString)" ) + { + ipkg->createLinks( QString(arg) ); + }else if( msg == "removeLinks(QString)" ) + { + ipkg->removeLinks( QString(arg) ); + }else{ + pvDebug(2,"Huh what do ya want") + } +} |