Diffstat (limited to 'noncore/unsupported/oipkg/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 87 |
1 files changed, 74 insertions, 13 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index c803ca0..25ca889 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp @@ -9,2 +9,3 @@ #include <qpe/qpetoolbar.h> +#include <qpe/qcopenvelope_qws.h> #include <qaction.h> @@ -31,2 +32,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : listViewPackages = new QListView( this,0,0 ); + listViewPackages->setSelectionMode(QListView::NoSelection); setCentralWidget( listViewPackages ); @@ -34,3 +36,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : makeMenu(); - +#ifdef NEWLAYOUT + listViewPackages->addColumn( tr("Package") ); + listViewPackages->setRootIsDecorated( true ); +#endif +#ifndef NEWLAYOUT QFontMetrics fm = fontMetrics(); @@ -40,3 +46,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : int w2 = fm.width("00000")+4; - int w1 = wlw-w2-w0-20; + int w1 = wlw-w2-w0-24; listViewPackages->addColumn( tr("Package"), w0 ); @@ -48,3 +54,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : listViewPackages->setSelectionMode( QListView::Multi ); - +#endif connect( section, SIGNAL( activated(int) ), @@ -55,2 +61,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : this, SLOT( setCurrent( QListViewItem* ) ) ); + connect( listViewPackages, SIGNAL( clicked( QListViewItem* ) ), + this, SLOT( stopTimer( QListViewItem* ) ) ); + + popupMenu = new QPopupMenu( this ); @@ -77,4 +87,5 @@ void MainWindow::makeMenu() popupMenu = new QPopupMenu( this ); - - contextMenu = new QPopupMenu( this ); + destsMenu = new QPopupMenu( popupMenu ); + popupTimer = new QTimer( this ); + connect( popupTimer, SIGNAL(timeout()), this, SLOT(showPopup()) ); @@ -182,2 +193,10 @@ void MainWindow::makeMenu() 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 } @@ -191,3 +210,8 @@ void MainWindow::runIpkg() ipkg->commit( packageList ); -// updateList(); //to remove + // ##### 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(); } @@ -226,3 +250,3 @@ void MainWindow::displayList() if ( pack && (pack->name() != "") ) - listViewPackages->insertItem( new PackageListItem( listViewPackages, pack ) ); + listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) ); pack = packageList.next(); @@ -293,3 +317,2 @@ void MainWindow::showDetails() { - if ( activePackage ) return; if ( details ) @@ -302,3 +325,7 @@ void MainWindow::showDetails() } - + if ( !activePackage ) + { + details->description->setText(tr("no package selected")); + details->description->setText(tr("errmm...<br>...not working?")); + }else{ details->setCaption("Package: " + activePackage->name()); @@ -307,2 +334,3 @@ void MainWindow::showDetails() details->remove->setEnabled(activePackage->installed()); + } details->showMaximized(); @@ -318,6 +346,7 @@ void MainWindow::setCurrent( QListViewItem* p ) { - pvDebug(2, "MainWindow::setCurrent "); - return; - pvDebug(2, "name "+((Package*)p)->name()); - activePackage = (Package*)p; + if ( !p ) return; + activePackageListItem = (PackageListItem*)p; + activePackage = activePackageListItem->getPackage(); + pvDebug(5, "start timer"); + popupTimer->start( 750, true ); } @@ -357 +386,33 @@ void MainWindow::rotateUpdateIcon() } + +void MainWindow::showPopup() +{ + popupMenu->clear(); + destsMenu->clear(); + + QAction *popupAction; + popupMenu->insertItem( tr("Install to"), destsMenu ); + QStringList dests = settings->getDestinationNames(); + for (uint i = 0; i < dests.count(); i++ ) + { + popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); + popupAction->addTo( destsMenu ); + } + connect( destsMenu, SIGNAL( activated( int ) ), + this, SLOT( changePackageDest( int ) ) ); + popupMenu->popup( QCursor::pos() ); +} + +void MainWindow::changePackageDest( int i ) +{ + activePackage->setDest( destsMenu->text(i) ); + activePackage->setOn(); + activePackage->setLink( settings->createLinks() ); + activePackageListItem->displayDetails(); +} + +void MainWindow::stopTimer( QListViewItem* ) +{ + pvDebug( 5, "stop timer" ); + popupTimer->stop(); +} |