Diffstat (limited to 'noncore/settings/packagemanager') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/packagemanager/ChangeLog | 5 | ||||
-rw-r--r-- | noncore/settings/packagemanager/mainwindow.cpp | 5 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkg.cpp | 69 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkg.h | 8 | ||||
-rw-r--r-- | noncore/settings/packagemanager/opackage.cpp | 5 | ||||
-rw-r--r-- | noncore/settings/packagemanager/opackage.h | 15 | ||||
-rw-r--r-- | noncore/settings/packagemanager/packageinfodlg.cpp | 96 | ||||
-rw-r--r-- | noncore/settings/packagemanager/packageinfodlg.h | 10 |
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 @@ | |||
1 | 2004-mm-dd Dan Williams <drw@handhelds.org> | ||
2 | |||
3 | * Package information dialog implemented | ||
4 | * What's This app icon enabled | ||
5 | |||
1 | 2004-01-23 Dan Williams <drw@handhelds.org> | 6 | 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 @@ | |||
51 | 51 | ||
52 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl ) | 52 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags /*fl*/ ) |
53 | : QMainWindow( parent, name, fl || WStyle_ContextHelp ) | 53 | : QMainWindow( parent, name, WStyle_ContextHelp ) |
54 | , m_config( "packman" ) | 54 | , m_config( "packman" ) |
@@ -677,3 +677,2 @@ void MainWindow::slotDisplayPackageInfo( QListViewItem *packageItem ) | |||
677 | PackageInfoDlg *dlg = new PackageInfoDlg( this, &m_packman, packageName ); | 677 | PackageInfoDlg *dlg = new PackageInfoDlg( this, &m_packman, packageName ); |
678 | connect( dlg, SIGNAL(closeInfoDlg()), this, SLOT(slotCloseDlg()) ); | ||
679 | 678 | ||
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 @@ | |||
33 | 33 | ||
34 | #include <stdio.h> | ||
34 | #include <stdlib.h> | 35 | #include <stdlib.h> |
@@ -48,5 +49,7 @@ OIpkg *oipkg; | |||
48 | 49 | ||
49 | int fIpkgMessage( ipkg_conf_t */*conf*/, message_level_t /*level*/, char *msg ) | 50 | // Ipkg callback functions |
51 | |||
52 | int fsignalIpkgMessage( ipkg_conf_t */*conf*/, message_level_t /*level*/, char *msg ) | ||
50 | { | 53 | { |
51 | oipkg->ipkgOutput( msg ); | 54 | oipkg->ipkgMessage( msg ); |
52 | return 0; | 55 | return 0; |
@@ -54,3 +57,3 @@ int fIpkgMessage( ipkg_conf_t */*conf*/, message_level_t /*level*/, char *msg ) | |||
54 | 57 | ||
55 | char* fIpkgResponse( char */*question*/ ) | 58 | char *fIpkgResponse( char */*question*/ ) |
56 | { | 59 | { |
@@ -59,2 +62,16 @@ char* fIpkgResponse( char */*question*/ ) | |||
59 | 62 | ||
63 | int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ ) | ||
64 | { | ||
65 | oipkg->ipkgStatus( desc ); | ||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | int fIpkgFiles( char */*name*/, char *desc, char */*version*/, pkg_state_status_t /*status*/, | ||
70 | void */*userdata*/ ) | ||
71 | { | ||
72 | printf( "*****List*****\n%s\n", desc ); | ||
73 | oipkg->ipkgList( desc ); | ||
74 | return 0; | ||
75 | } | ||
76 | |||
60 | OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) | 77 | OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) |
@@ -69,3 +86,3 @@ OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) | |||
69 | // Initialize libipkg | 86 | // Initialize libipkg |
70 | if ( ipkg_init( &fIpkgMessage, &fIpkgResponse, &m_ipkgArgs ) ) | 87 | if ( ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ) ) |
71 | QMessageBox::critical( 0, tr( "OIpkg" ), tr( "Error initialing libipkg" ) ); | 88 | QMessageBox::critical( 0, tr( "OIpkg" ), tr( "Error initialing libipkg" ) ); |
@@ -299,6 +316,7 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, | |||
299 | // Connect output signal to widget | 316 | // Connect output signal to widget |
317 | |||
300 | if ( rawOutput ) | 318 | if ( rawOutput ) |
301 | { | 319 | { |
302 | if ( slotOutput ) | 320 | // if ( slotOutput ) |
303 | connect( this, SIGNAL(execOutput(char *)), receiver, slotOutput ); | 321 | // connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput ); |
304 | } | 322 | } |
@@ -306,3 +324,3 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, | |||
306 | { | 324 | { |
307 | // TODO - connect to local slot and parse output before emitting execOutput | 325 | // TODO - connect to local slot and parse output before emitting signalIpkgMessage |
308 | } | 326 | } |
@@ -311,7 +329,14 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, | |||
311 | { | 329 | { |
312 | case OPackage::Update : ipkg_lists_update( &m_ipkgArgs ); | 330 | case OPackage::Update : { |
331 | connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput ); | ||
332 | ipkg_lists_update( &m_ipkgArgs ); | ||
333 | }; | ||
313 | break; | 334 | break; |
314 | case OPackage::Upgrade : ipkg_packages_upgrade( &m_ipkgArgs ); | 335 | case OPackage::Upgrade : { |
336 | connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput ); | ||
337 | ipkg_packages_upgrade( &m_ipkgArgs ); | ||
338 | }; | ||
315 | break; | 339 | break; |
316 | case OPackage::Install : { | 340 | case OPackage::Install : { |
341 | connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput ); | ||
317 | for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) | 342 | for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) |
@@ -323,2 +348,3 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, | |||
323 | case OPackage::Remove : { | 348 | case OPackage::Remove : { |
349 | connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput ); | ||
324 | for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) | 350 | for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) |
@@ -330,2 +356,3 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, | |||
330 | case OPackage::Download : { | 356 | case OPackage::Download : { |
357 | connect( this, SIGNAL(signalIpkgMessage(char *)), receiver, slotOutput ); | ||
331 | for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) | 358 | for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) |
@@ -336,2 +363,12 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, | |||
336 | break; | 363 | break; |
364 | case OPackage::Info : { | ||
365 | connect( this, SIGNAL(signalIpkgStatus(char *)), receiver, slotOutput ); | ||
366 | ipkg_packages_info( &m_ipkgArgs, (*parameters->begin()), &fIpkgStatus, 0x0 ); | ||
367 | }; | ||
368 | break; | ||
369 | case OPackage::Files : { | ||
370 | connect( this, SIGNAL(signalIpkgList(char *)), receiver, slotOutput ); | ||
371 | ipkg_package_files( &m_ipkgArgs, (*parameters->begin()), &fIpkgFiles, 0x0 ); | ||
372 | }; | ||
373 | break; | ||
337 | default : break; | 374 | default : break; |
@@ -342,5 +379,15 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, | |||
342 | 379 | ||
343 | void OIpkg::ipkgOutput( char *msg ) | 380 | void OIpkg::ipkgMessage( char *msg ) |
381 | { | ||
382 | emit signalIpkgMessage( msg ); | ||
383 | } | ||
384 | |||
385 | void OIpkg::ipkgStatus( char *status ) | ||
386 | { | ||
387 | emit signalIpkgStatus( status ); | ||
388 | } | ||
389 | |||
390 | void OIpkg::ipkgList( char *filelist ) | ||
344 | { | 391 | { |
345 | emit execOutput( msg ); | 392 | emit signalIpkgList( filelist ); |
346 | } | 393 | } |
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: | |||
84 | 84 | ||
85 | void ipkgOutput( char *msg ); | 85 | void ipkgMessage( char *msg ); |
86 | void ipkgStatus( char *status ); | ||
87 | void ipkgList( char *filelist ); | ||
86 | 88 | ||
@@ -97,3 +99,5 @@ private: | |||
97 | signals: | 99 | signals: |
98 | void execOutput( char *msg ); | 100 | void signalIpkgMessage( char *msg ); |
101 | void signalIpkgStatus( char *status ); | ||
102 | void signalIpkgList( char *filelist ); | ||
99 | }; | 103 | }; |
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 @@ | |||
34 | OPackage::OPackage( const QString &name, const QString &version, const QString &versionInstalled, | 34 | OPackage::OPackage( const QString &name, const QString &version, const QString &versionInstalled, |
35 | const QString &source, const QString &destination, const QString &category ) | 35 | const QString &source, const QString &destination, const QString &category, |
36 | const QString &information, const QString &files ) | ||
36 | : m_name( name ) | 37 | : m_name( name ) |
@@ -41,2 +42,4 @@ OPackage::OPackage( const QString &name, const QString &version, const QString & | |||
41 | , m_category( category ) | 42 | , m_category( category ) |
43 | , m_information( information ) | ||
44 | , m_files( files ) | ||
42 | { | 45 | { |
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: | |||
42 | 42 | ||
43 | OPackage( const QString &name = 0x0, | 43 | OPackage( const QString &name= QString::null, |
44 | const QString &version = 0x0, const QString &versionInstalled = 0x0, | 44 | const QString &version= QString::null, const QString &versionInstalled= QString::null, |
45 | const QString &source = 0x0, const QString &destination = 0x0, | 45 | const QString &source= QString::null, const QString &destination= QString::null, |
46 | const QString &category = "misc" ); | 46 | const QString &category = "misc", const QString &information = QString::null, |
47 | const QString &files = QString::null ); | ||
47 | 48 | ||
@@ -53,2 +54,4 @@ public: | |||
53 | const QString &category() { return m_category; } | 54 | const QString &category() { return m_category; } |
55 | const QString &information() { return m_information; } | ||
56 | const QString &files() { return m_files; } | ||
54 | 57 | ||
@@ -60,2 +63,4 @@ public: | |||
60 | void setCategory( const QString &category ) { m_category = category; } | 63 | void setCategory( const QString &category ) { m_category = category; } |
64 | void setInformation( const QString &information ) { m_information = information; } | ||
65 | void setFiles( const QString &files ) { m_files = files; } | ||
61 | 66 | ||
@@ -68,2 +73,4 @@ private: | |||
68 | QString m_category; // Item category | 73 | QString m_category; // Item category |
74 | QString m_information; // Package information | ||
75 | QString m_files; // File list information | ||
69 | }; | 76 | }; |
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 @@ | |||
30 | #include "packageinfodlg.h" | 30 | #include "packageinfodlg.h" |
31 | #include "opackage.h" | ||
32 | #include "opackagemanager.h" | ||
31 | 33 | ||
@@ -48,3 +50,3 @@ PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QStr | |||
48 | 50 | ||
49 | QVBoxLayout *layout = new QVBoxLayout( this, 4, 0 ); | 51 | QVBoxLayout *layout = new QVBoxLayout( this, 4, 2 ); |
50 | 52 | ||
@@ -53,6 +55,2 @@ PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QStr | |||
53 | 55 | ||
54 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "enter" ), tr( "Close" ), this ); | ||
55 | layout->addWidget( btn ); | ||
56 | connect( btn, SIGNAL(clicked()), this, SLOT(slotBtnClose()) ); | ||
57 | |||
58 | // Information tab | 56 | // Information tab |
@@ -62,21 +60,81 @@ PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QStr | |||
62 | 60 | ||
63 | // Files tab | 61 | // Retrive package information |
64 | QWidget *filesWidget = new QWidget( tabWidget ); | 62 | m_package = m_packman->findPackage( package ); |
65 | QVBoxLayout *filesLayout = new QVBoxLayout( filesWidget, 4, 0 ); | 63 | if ( !m_package ) |
66 | m_files.reparent( filesWidget, QPoint( 0, 0 ) ); | 64 | { |
67 | m_files.setReadOnly( true ); | 65 | m_information.setText( tr( "Unable to retrieve package information." ) ); |
68 | filesLayout->addWidget( &m_files ); | 66 | return; |
67 | } | ||
68 | |||
69 | // Display package information | ||
70 | if ( !m_package->information().isNull() ) | ||
71 | m_information.setText( m_package->information() ); | ||
72 | else | ||
73 | { | ||
74 | // Package information is not cached, retrieve it | ||
75 | QStringList list( package ); | ||
76 | m_packman->executeCommand( OPackage::Info, &list, QString::null, this, SLOT(slotInfo(char*)), true ); | ||
77 | } | ||
78 | |||
79 | // Files tab (display only if package is installed) | ||
80 | if ( !m_package->versionInstalled().isNull() ) | ||
81 | { | ||
82 | QWidget *filesWidget = new QWidget( tabWidget ); | ||
83 | QVBoxLayout *filesLayout = new QVBoxLayout( filesWidget, 2, 2 ); | ||
84 | m_files.reparent( filesWidget, QPoint( 0, 0 ) ); | ||
85 | m_files.setReadOnly( true ); | ||
86 | filesLayout->addWidget( &m_files ); | ||
87 | |||
88 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ), | ||
89 | tr( "Retrieve file list" ), filesWidget ); | ||
90 | filesLayout->addWidget( btn ); | ||
91 | connect( btn, SIGNAL(clicked()), this, SLOT(slotBtnFileScan()) ); | ||
92 | tabWidget->addTab( filesWidget, "binary", tr( "File list" ) ); | ||
93 | |||
94 | tabWidget->setCurrentTab( tr( "Information" ) ); | ||
95 | |||
96 | // If file list is already cached, display | ||
97 | if ( !m_package->files().isNull() ) | ||
98 | m_files.setText( m_package->files() ); | ||
99 | } | ||
100 | else | ||
101 | m_files.hide(); | ||
102 | } | ||
103 | |||
104 | PackageInfoDlg::~PackageInfoDlg() | ||
105 | { | ||
106 | if ( !m_package ) | ||
107 | return; | ||
108 | |||
109 | // Cache package information | ||
110 | if ( !m_information.text().isNull() ) | ||
111 | m_package->setInformation( m_information.text() ); | ||
69 | 112 | ||
70 | btn = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ), tr( "Retrieve file list" ), | 113 | // Cache package file list |
71 | filesWidget ); | 114 | if ( !m_files.text().isNull() ) |
72 | filesLayout->addWidget( btn ); | 115 | m_package->setFiles( m_files.text() ); |
73 | // TODO connect( btn, SIGNAL(clicked()), this, SLOT(slotFileScan()) ); | 116 | } |
74 | tabWidget->addTab( filesWidget, "binary", tr( "Files" ) ); | ||
75 | 117 | ||
76 | tabWidget->setCurrentTab( tr( "Information" ) ); | 118 | void PackageInfoDlg::slotBtnFileScan() |
119 | { | ||
120 | m_files.clear(); | ||
121 | |||
122 | QStringList list( m_package->name() ); | ||
123 | m_packman->executeCommand( OPackage::Files, &list, QString::null, this, SLOT(slotFiles(char*)), true ); | ||
77 | } | 124 | } |
78 | 125 | ||
79 | void PackageInfoDlg::slotBtnClose() | 126 | void PackageInfoDlg::slotInfo( char *info ) |
80 | { | 127 | { |
81 | emit closeInfoDlg(); | 128 | m_information.append( info ); |
129 | } | ||
130 | |||
131 | void PackageInfoDlg::slotFiles( char *filelist ) | ||
132 | { | ||
133 | QString str = filelist; | ||
134 | |||
135 | // Skip first line of output ("Package xxx is installed...") | ||
136 | if ( str.startsWith( "Package " ) ) | ||
137 | str = str.right( str.length() - str.find( '\n' ) - 1 ); | ||
138 | |||
139 | m_files.append( str ); | ||
82 | } | 140 | } |
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; | |||
41 | 41 | ||
42 | class OPackage; | ||
42 | class OPackageManager; | 43 | class OPackageManager; |
@@ -49,2 +50,3 @@ public: | |||
49 | PackageInfoDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &package = QString::null ); | 50 | PackageInfoDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &package = QString::null ); |
51 | ~PackageInfoDlg(); | ||
50 | 52 | ||
@@ -52,2 +54,3 @@ private: | |||
52 | OPackageManager *m_packman; // Pointer to application instance of package manager | 54 | OPackageManager *m_packman; // Pointer to application instance of package manager |
55 | OPackage *m_package; // Pointer to package to display information for | ||
53 | 56 | ||
@@ -58,6 +61,5 @@ private: | |||
58 | private slots: | 61 | private slots: |
59 | void slotBtnClose(); | 62 | void slotBtnFileScan(); |
60 | 63 | void slotInfo( char *info ); | |
61 | signals: | 64 | void slotFiles( char *filelist ); |
62 | void closeInfoDlg(); | ||
63 | }; | 65 | }; |