summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/ChangeLog5
-rw-r--r--noncore/settings/packagemanager/mainwindow.cpp5
-rw-r--r--noncore/settings/packagemanager/oipkg.cpp69
-rw-r--r--noncore/settings/packagemanager/oipkg.h8
-rw-r--r--noncore/settings/packagemanager/opackage.cpp5
-rw-r--r--noncore/settings/packagemanager/opackage.h15
-rw-r--r--noncore/settings/packagemanager/packageinfodlg.cpp96
-rw-r--r--noncore/settings/packagemanager/packageinfodlg.h10
8 files changed, 169 insertions, 44 deletions
diff --git a/noncore/settings/packagemanager/ChangeLog b/noncore/settings/packagemanager/ChangeLog
index efa75b1..72e6169 100644
--- a/noncore/settings/packagemanager/ChangeLog
+++ b/noncore/settings/packagemanager/ChangeLog
@@ -1 +1,6 @@
+2004-mm-dd Dan Williams <drw@handhelds.org>
+
+ * Package information dialog implemented
+ * What's This app icon enabled
+
2004-01-23 Dan Williams <drw@handhelds.org>
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp
index 05f21bc..8b374ab 100644
--- a/noncore/settings/packagemanager/mainwindow.cpp
+++ b/noncore/settings/packagemanager/mainwindow.cpp
@@ -51,4 +51,4 @@
-MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl )
- : QMainWindow( parent, name, fl || WStyle_ContextHelp )
+MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ )
+ : QMainWindow( parent, name, WStyle_ContextHelp )
, m_config( "packman" )
@@ -677,3 +677,2 @@ void MainWindow::slotDisplayPackageInfo( QListViewItem *packageItem )
PackageInfoDlg *dlg = new PackageInfoDlg( this, &m_packman, packageName );
- connect( dlg, SIGNAL(closeInfoDlg()), this, SLOT(slotCloseDlg()) );
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp
index ed9ea10..eb07a61 100644
--- a/noncore/settings/packagemanager/oipkg.cpp
+++ b/noncore/settings/packagemanager/oipkg.cpp
@@ -33,2 +33,3 @@
+#include <stdio.h>
#include <stdlib.h>
@@ -48,5 +49,7 @@ OIpkg *oipkg;
-int fIpkgMessage( ipkg_conf_t */*conf*/, message_level_t /*level*/, char *msg )
+// Ipkg callback functions
+
+int fsignalIpkgMessage( ipkg_conf_t */*conf*/, message_level_t /*level*/, char *msg )
{
- oipkg->ipkgOutput( msg );
+ oipkg->ipkgMessage( msg );
return 0;
@@ -54,3 +57,3 @@ int fIpkgMessage( ipkg_conf_t */*conf*/, message_level_t /*level*/, char *msg )
-char* fIpkgResponse( char */*question*/ )
+char *fIpkgResponse( char */*question*/ )
{
@@ -59,2 +62,16 @@ char* fIpkgResponse( char */*question*/ )
+int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ )
+{
+ oipkg->ipkgStatus( desc );
+ return 0;
+}
+
+int fIpkgFiles( char */*name*/, char *desc, char */*version*/, pkg_state_status_t /*status*/,
+ void */*userdata*/ )
+{
+printf( "*****List*****\n%s\n", desc );
+ oipkg->ipkgList( desc );
+ return 0;
+}
+
OIpkg::OIpkg( Config *config, QObject *parent, const char *name )
@@ -69,3 +86,3 @@ OIpkg::OIpkg( Config *config, QObject *parent, const char *name )
// Initialize libipkg
- if ( ipkg_init( &fIpkgMessage, &fIpkgResponse, &m_ipkgArgs ) )
+ if ( ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ) )
QMessageBox::critical( 0, tr( "OIpkg" ), tr( "Error initialing libipkg" ) );
@@ -299,6 +316,7 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters,
// Connect output signal to widget
+
if ( rawOutput )
{
- if ( slotOutput )
- connect( this, SIGNAL(execOutput(char *)), receiver, slotOutput );
+// if ( slotOutput )
+// connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput );
}
@@ -306,3 +324,3 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters,
{
- // TODO - connect to local slot and parse output before emitting execOutput
+ // TODO - connect to local slot and parse output before emitting signalIpkgMessage
}
@@ -311,7 +329,14 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters,
{
- case OPackage::Update : ipkg_lists_update( &m_ipkgArgs );
+ case OPackage::Update : {
+ connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput );
+ ipkg_lists_update( &m_ipkgArgs );
+ };
break;
- case OPackage::Upgrade : ipkg_packages_upgrade( &m_ipkgArgs );
+ case OPackage::Upgrade : {
+ connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput );
+ ipkg_packages_upgrade( &m_ipkgArgs );
+ };
break;
case OPackage::Install : {
+ connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput );
for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it )
@@ -323,2 +348,3 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters,
case OPackage::Remove : {
+ connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput );
for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it )
@@ -330,2 +356,3 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters,
case OPackage::Download : {
+ connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput );
for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it )
@@ -336,2 +363,12 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters,
break;
+ case OPackage::Info : {
+ connect( this, SIGNAL(signalIpkgStatus(char *)), receiver, slotOutput );
+ ipkg_packages_info( &m_ipkgArgs, (*parameters->begin()), &fIpkgStatus, 0x0 );
+ };
+ break;
+ case OPackage::Files : {
+ connect( this, SIGNAL(signalIpkgList(char *)), receiver, slotOutput );
+ ipkg_package_files( &m_ipkgArgs, (*parameters->begin()), &fIpkgFiles, 0x0 );
+ };
+ break;
default : break;
@@ -342,5 +379,15 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters,
-void OIpkg::ipkgOutput( char *msg )
+void OIpkg::ipkgMessage( char *msg )
+{
+ emit signalIpkgMessage( msg );
+}
+
+void OIpkg::ipkgStatus( char *status )
+{
+ emit signalIpkgStatus( status );
+}
+
+void OIpkg::ipkgList( char *filelist )
{
- emit execOutput( msg );
+ emit signalIpkgList( filelist );
}
diff --git a/noncore/settings/packagemanager/oipkg.h b/noncore/settings/packagemanager/oipkg.h
index 824fa17..ea126cf 100644
--- a/noncore/settings/packagemanager/oipkg.h
+++ b/noncore/settings/packagemanager/oipkg.h
@@ -84,3 +84,5 @@ public:
- void ipkgOutput( char *msg );
+ void ipkgMessage( char *msg );
+ void ipkgStatus( char *status );
+ void ipkgList( char *filelist );
@@ -97,3 +99,5 @@ private:
signals:
- void execOutput( char *msg );
+ void signalIpkgMessage( char *msg );
+ void signalIpkgStatus( char *status );
+ void signalIpkgList( char *filelist );
};
diff --git a/noncore/settings/packagemanager/opackage.cpp b/noncore/settings/packagemanager/opackage.cpp
index 34717e3..37963fa 100644
--- a/noncore/settings/packagemanager/opackage.cpp
+++ b/noncore/settings/packagemanager/opackage.cpp
@@ -34,3 +34,4 @@
OPackage::OPackage( const QString &name, const QString &version, const QString &versionInstalled,
- const QString &source, const QString &destination, const QString &category )
+ const QString &source, const QString &destination, const QString &category,
+ const QString &information, const QString &files )
: m_name( name )
@@ -41,2 +42,4 @@ OPackage::OPackage( const QString &name, const QString &version, const QString &
, m_category( category )
+ , m_information( information )
+ , m_files( files )
{
diff --git a/noncore/settings/packagemanager/opackage.h b/noncore/settings/packagemanager/opackage.h
index 1e2e49f..fbd9ec0 100644
--- a/noncore/settings/packagemanager/opackage.h
+++ b/noncore/settings/packagemanager/opackage.h
@@ -42,6 +42,7 @@ public:
- OPackage( const QString &name = 0x0,
- const QString &version = 0x0, const QString &versionInstalled = 0x0,
- const QString &source = 0x0, const QString &destination = 0x0,
- const QString &category = "misc" );
+ OPackage( const QString &name= QString::null,
+ const QString &version= QString::null, const QString &versionInstalled= QString::null,
+ const QString &source= QString::null, const QString &destination= QString::null,
+ const QString &category = "misc", const QString &information = QString::null,
+ const QString &files = QString::null );
@@ -53,2 +54,4 @@ public:
const QString &category() { return m_category; }
+ const QString &information() { return m_information; }
+ const QString &files() { return m_files; }
@@ -60,2 +63,4 @@ public:
void setCategory( const QString &category ) { m_category = category; }
+ void setInformation( const QString &information ) { m_information = information; }
+ void setFiles( const QString &files ) { m_files = files; }
@@ -68,2 +73,4 @@ private:
QString m_category; // Item category
+ QString m_information; // Package information
+ QString m_files; // File list information
};
diff --git a/noncore/settings/packagemanager/packageinfodlg.cpp b/noncore/settings/packagemanager/packageinfodlg.cpp
index 26356b9..7daf336 100644
--- a/noncore/settings/packagemanager/packageinfodlg.cpp
+++ b/noncore/settings/packagemanager/packageinfodlg.cpp
@@ -30,2 +30,4 @@
#include "packageinfodlg.h"
+#include "opackage.h"
+#include "opackagemanager.h"
@@ -48,3 +50,3 @@ PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QStr
- QVBoxLayout *layout = new QVBoxLayout( this, 4, 0 );
+ QVBoxLayout *layout = new QVBoxLayout( this, 4, 2 );
@@ -53,6 +55,2 @@ PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QStr
- QPushButton *btn = new QPushButton( Resource::loadPixmap( "enter" ), tr( "Close" ), this );
- layout->addWidget( btn );
- connect( btn, SIGNAL(clicked()), this, SLOT(slotBtnClose()) );
-
// Information tab
@@ -62,21 +60,81 @@ PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QStr
- // Files tab
- QWidget *filesWidget = new QWidget( tabWidget );
- QVBoxLayout *filesLayout = new QVBoxLayout( filesWidget, 4, 0 );
- m_files.reparent( filesWidget, QPoint( 0, 0 ) );
- m_files.setReadOnly( true );
- filesLayout->addWidget( &m_files );
+ // Retrive package information
+ m_package = m_packman->findPackage( package );
+ if ( !m_package )
+ {
+ m_information.setText( tr( "Unable to retrieve package information." ) );
+ return;
+ }
+
+ // Display package information
+ if ( !m_package->information().isNull() )
+ m_information.setText( m_package->information() );
+ else
+ {
+ // Package information is not cached, retrieve it
+ QStringList list( package );
+ m_packman->executeCommand( OPackage::Info, &list, QString::null, this, SLOT(slotInfo(char*)), true );
+ }
+
+ // Files tab (display only if package is installed)
+ if ( !m_package->versionInstalled().isNull() )
+ {
+ QWidget *filesWidget = new QWidget( tabWidget );
+ QVBoxLayout *filesLayout = new QVBoxLayout( filesWidget, 2, 2 );
+ m_files.reparent( filesWidget, QPoint( 0, 0 ) );
+ m_files.setReadOnly( true );
+ filesLayout->addWidget( &m_files );
+
+ QPushButton *btn = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ),
+ tr( "Retrieve file list" ), filesWidget );
+ filesLayout->addWidget( btn );
+ connect( btn, SIGNAL(clicked()), this, SLOT(slotBtnFileScan()) );
+ tabWidget->addTab( filesWidget, "binary", tr( "File list" ) );
+
+ tabWidget->setCurrentTab( tr( "Information" ) );
+
+ // If file list is already cached, display
+ if ( !m_package->files().isNull() )
+ m_files.setText( m_package->files() );
+ }
+ else
+ m_files.hide();
+}
+
+PackageInfoDlg::~PackageInfoDlg()
+{
+ if ( !m_package )
+ return;
+
+ // Cache package information
+ if ( !m_information.text().isNull() )
+ m_package->setInformation( m_information.text() );
- btn = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ), tr( "Retrieve file list" ),
- filesWidget );
- filesLayout->addWidget( btn );
-// TODO connect( btn, SIGNAL(clicked()), this, SLOT(slotFileScan()) );
- tabWidget->addTab( filesWidget, "binary", tr( "Files" ) );
+ // Cache package file list
+ if ( !m_files.text().isNull() )
+ m_package->setFiles( m_files.text() );
+}
- tabWidget->setCurrentTab( tr( "Information" ) );
+void PackageInfoDlg::slotBtnFileScan()
+{
+ m_files.clear();
+
+ QStringList list( m_package->name() );
+ m_packman->executeCommand( OPackage::Files, &list, QString::null, this, SLOT(slotFiles(char*)), true );
}
-void PackageInfoDlg::slotBtnClose()
+void PackageInfoDlg::slotInfo( char *info )
{
- emit closeInfoDlg();
+ m_information.append( info );
+}
+
+void PackageInfoDlg::slotFiles( char *filelist )
+{
+ QString str = filelist;
+
+ // Skip first line of output ("Package xxx is installed...")
+ if ( str.startsWith( "Package " ) )
+ str = str.right( str.length() - str.find( '\n' ) - 1 );
+
+ m_files.append( str );
}
diff --git a/noncore/settings/packagemanager/packageinfodlg.h b/noncore/settings/packagemanager/packageinfodlg.h
index 09af6f4..13a15e2 100644
--- a/noncore/settings/packagemanager/packageinfodlg.h
+++ b/noncore/settings/packagemanager/packageinfodlg.h
@@ -41,2 +41,3 @@ class QPushButton;
+class OPackage;
class OPackageManager;
@@ -49,2 +50,3 @@ public:
PackageInfoDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &package = QString::null );
+ ~PackageInfoDlg();
@@ -52,2 +54,3 @@ private:
OPackageManager *m_packman; // Pointer to application instance of package manager
+ OPackage *m_package; // Pointer to package to display information for
@@ -58,6 +61,5 @@ private:
private slots:
- void slotBtnClose();
-
-signals:
- void closeInfoDlg();
+ void slotBtnFileScan();
+ void slotInfo( char *info );
+ void slotFiles( char *filelist );
};