author | tille <tille> | 2002-04-27 21:02:53 (UTC) |
---|---|---|
committer | tille <tille> | 2002-04-27 21:02:53 (UTC) |
commit | 69e271e44d23befc74a96a98708ddb6ec754a4b6 (patch) (side-by-side diff) | |
tree | 6f8300d8858d2c7659eb90066b58b302a2863e43 /noncore/unsupported/oipkg/mainwindow.cpp | |
parent | acdc33336307e48ac7089b146006fe7b36e321a5 (diff) | |
download | opie-69e271e44d23befc74a96a98708ddb6ec754a4b6.zip opie-69e271e44d23befc74a96a98708ddb6ec754a4b6.tar.gz opie-69e271e44d23befc74a96a98708ddb6ec754a4b6.tar.bz2 |
setDocument working and some changes in install gui
Diffstat (limited to 'noncore/unsupported/oipkg/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 145 |
1 files changed, 33 insertions, 112 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index e3abf36..6bf9a7a 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp @@ -16,2 +16,3 @@ #include <qlabel.h> +#include <qfile.h> #include <qlistview.h> @@ -29,7 +30,8 @@ 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 ); - listViewPackages = new QListView( this,0,0 ); - listViewPackages->setSelectionMode(QListView::NoSelection); setCentralWidget( listViewPackages ); + setCaption( tr("Package Manager") ); @@ -40,21 +42,3 @@ 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(); - int wlw = width()*2; - int w0 = fm.width(tr("Package"))+30; - // int w0 = fm.width(tr("Package"))+30; - int w2 = fm.width("00000")+4; - int w1 = wlw-w2-w0-24; - listViewPackages->addColumn( tr("Package"), w0 ); - listViewPackages->addColumn( tr("Description"), w1 ); - listViewPackages->addColumn( tr("Size"), w2 ); - listViewPackages->setColumnWidthMode(0,QListView::Manual); - listViewPackages->setColumnWidthMode(1,QListView::Manual); - listViewPackages->setColumnWidthMode(2,QListView::Manual); - listViewPackages->setSelectionMode( QListView::Multi ); -#endif + connect( section, SIGNAL( activated(int) ), @@ -63,10 +47,2 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : this, SLOT( subSectionChanged() ) ); - connect( listViewPackages, SIGNAL( pressed( QListViewItem* ) ), - this, SLOT( setCurrent( QListViewItem* ) ) ); - connect( listViewPackages, SIGNAL( clicked( QListViewItem* ) ), - this, SLOT( stopTimer( QListViewItem* ) ) ); - - popupMenu = new QPopupMenu( this ); - - settings = new PackageManagerSettings(this,0,TRUE); @@ -90,7 +66,2 @@ void MainWindow::makeMenu() - popupMenu = new QPopupMenu( this ); - destsMenu = new QPopupMenu( popupMenu ); - popupTimer = new QTimer( this ); - connect( popupTimer, SIGNAL(timeout()), this, SLOT(showPopup()) ); - setToolBarsMovable( false ); @@ -125,9 +96,10 @@ void MainWindow::makeMenu() - 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 ); +// would we use for find +// 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 ); @@ -318,41 +290,2 @@ void MainWindow::showSettingsDst() - -void MainWindow::showDetails() -{ - if ( details ) - { - details = new PackageDetails( this ); - connect( details->install, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); - connect( details->remove, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); - connect( details->ignore, SIGNAL(clicked()), details, SLOT(close())); - details->description->setTextFormat(RichText); - } - if ( !activePackage ) - { - details->description->setText(tr("no package selected")); - details->description->setText(tr("errmm...<br>...not working?")); - }else{ - details->setCaption("Package: " + activePackage->name()); - details->description->setText(activePackage->details() ); - details->install->setEnabled(!activePackage->installed()); - details->remove->setEnabled(activePackage->installed()); - } - details->showMaximized(); -} - -void MainWindow::toggleActivePackage() -{ - activePackage->toggleProcess(); - if ( details ) details->close(); -} - -void MainWindow::setCurrent( QListViewItem* p ) -{ - if ( !p ) return; - activePackageListItem = (PackageListItem*)p; - activePackage = activePackageListItem->getPackage(); - pvDebug(5, "start timer"); - popupTimer->start( 750, true ); -} - void MainWindow::sectionShow(bool b) @@ -391,37 +324,25 @@ 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* ) +void MainWindow::setDocument(const QString &fileName) { - pvDebug( 5, "stop timer" ); - popupTimer->stop(); + installFile(fileName); + // ##### 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::setDocument(const QString &fileName) +void MainWindow::installFile(const QString &fileName) { + pvDebug(3, "MainWindow::installFile "+fileName); + if ( !QFile::exists( fileName ) ) return; ipkg->installFile( fileName ); + // ##### 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(); } @@ -431,5 +352,5 @@ void MainWindow::receive(const QCString &msg, const QByteArray &arg) pvDebug(3, "QCop "+msg); - if ( msg == "setDocument(QString)" ) + if ( msg == "installFile(QString)" ) { - setDocument( QString(arg) ); + installFile( QString(arg) ); } |