-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,15 +1,20 @@ | |||
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> |
2 | 7 | ||
3 | * Added package download functionality | 8 | * Added package download functionality |
4 | * Have Opie update links after install/removal so that apps | 9 | * Have Opie update links after install/removal so that apps |
5 | will display properly in Launcher | 10 | will display properly in Launcher |
6 | 11 | ||
7 | 2004-01-20 Dan Williams <drw@handhelds.org> | 12 | 2004-01-20 Dan Williams <drw@handhelds.org> |
8 | 13 | ||
9 | * Released version 0.2.0 | 14 | * Released version 0.2.0 |
10 | * Converted to use libipkg in place of spawning ipkg process | 15 | * Converted to use libipkg in place of spawning ipkg process |
11 | 16 | ||
12 | 2004-01-13 Dan Williams <drw@handhelds.org> | 17 | 2004-01-13 Dan Williams <drw@handhelds.org> |
13 | 18 | ||
14 | * Released version 0.1.0 | 19 | * Released version 0.1.0 |
15 | * Initial check-in of new package management client to eventually replace AQPkg | 20 | * Initial check-in of new package management client to eventually replace AQPkg |
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 | |||
@@ -36,34 +36,34 @@ | |||
36 | #include <qpopupmenu.h> | 36 | #include <qpopupmenu.h> |
37 | #include <qtimer.h> | 37 | #include <qtimer.h> |
38 | #include <qtoolbar.h> | 38 | #include <qtoolbar.h> |
39 | #include <qwhatsthis.h> | 39 | #include <qwhatsthis.h> |
40 | 40 | ||
41 | #include <qpe/qcopenvelope_qws.h> | 41 | #include <qpe/qcopenvelope_qws.h> |
42 | #include <qpe/qpeapplication.h> | 42 | #include <qpe/qpeapplication.h> |
43 | #include <qpe/resource.h> | 43 | #include <qpe/resource.h> |
44 | 44 | ||
45 | #include "mainwindow.h" | 45 | #include "mainwindow.h" |
46 | #include "installdlg.h" | 46 | #include "installdlg.h" |
47 | #include "filterdlg.h" | 47 | #include "filterdlg.h" |
48 | #include "promptdlg.h" | 48 | #include "promptdlg.h" |
49 | #include "entrydlg.h" | 49 | #include "entrydlg.h" |
50 | #include "packageinfodlg.h" | 50 | #include "packageinfodlg.h" |
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" ) |
55 | , m_packman( &m_config, this ) | 55 | , m_packman( &m_config, this ) |
56 | , m_menuBar( this ) | 56 | , m_menuBar( this ) |
57 | , m_toolBar( this ) | 57 | , m_toolBar( this ) |
58 | , m_findBar( this ) | 58 | , m_findBar( this ) |
59 | , m_widgetStack( this ) | 59 | , m_widgetStack( this ) |
60 | , m_packageList( this ) | 60 | , m_packageList( this ) |
61 | , m_statusWidget( this ) | 61 | , m_statusWidget( this ) |
62 | , m_statusText( &m_statusWidget ) | 62 | , m_statusText( &m_statusWidget ) |
63 | , m_statusBar( &m_statusWidget ) | 63 | , m_statusBar( &m_statusWidget ) |
64 | , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) ) | 64 | , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) ) |
65 | , m_iconInstalled( Resource::loadPixmap( "installed" ) ) | 65 | , m_iconInstalled( Resource::loadPixmap( "installed" ) ) |
66 | , m_iconNull( m_iconUpdated.size() ) | 66 | , m_iconNull( m_iconUpdated.size() ) |
67 | , m_filterName( QString::null ) | 67 | , m_filterName( QString::null ) |
68 | , m_filterServer( QString::null ) | 68 | , m_filterServer( QString::null ) |
69 | , m_filterDest( QString::null ) | 69 | , m_filterDest( QString::null ) |
@@ -662,22 +662,21 @@ void MainWindow::slotFindChanged( const QString &findText ) | |||
662 | 662 | ||
663 | m_actionFindNext->setEnabled( !findText.isEmpty() ); | 663 | m_actionFindNext->setEnabled( !findText.isEmpty() ); |
664 | searchForPackage( findText ); | 664 | searchForPackage( findText ); |
665 | } | 665 | } |
666 | 666 | ||
667 | void MainWindow::slotFindNext() | 667 | void MainWindow::slotFindNext() |
668 | { | 668 | { |
669 | searchForPackage( m_findEdit->text() ); | 669 | searchForPackage( m_findEdit->text() ); |
670 | } | 670 | } |
671 | 671 | ||
672 | void MainWindow::slotDisplayPackageInfo( QListViewItem *packageItem ) | 672 | void MainWindow::slotDisplayPackageInfo( QListViewItem *packageItem ) |
673 | { | 673 | { |
674 | QString packageName( ( static_cast<QCheckListItem*>( packageItem ) )->text() ); | 674 | QString packageName( ( static_cast<QCheckListItem*>( packageItem ) )->text() ); |
675 | 675 | ||
676 | // Create package manager output widget | 676 | // Create package manager output widget |
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 | ||
680 | // Display widget | 679 | // Display widget |
681 | m_widgetStack.addWidget( dlg, 3 ); | 680 | m_widgetStack.addWidget( dlg, 3 ); |
682 | m_widgetStack.raiseWidget( dlg ); | 681 | m_widgetStack.raiseWidget( dlg ); |
683 | } | 682 | } |
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 | |||
@@ -18,69 +18,86 @@ | |||
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "oipkg.h" | 32 | #include "oipkg.h" |
33 | 33 | ||
34 | #include <stdio.h> | ||
34 | #include <stdlib.h> | 35 | #include <stdlib.h> |
35 | #include <string.h> | 36 | #include <string.h> |
36 | 37 | ||
37 | #include <qdir.h> | 38 | #include <qdir.h> |
38 | #include <qfile.h> | 39 | #include <qfile.h> |
39 | #include <qmessagebox.h> | 40 | #include <qmessagebox.h> |
40 | #include <qtextstream.h> | 41 | #include <qtextstream.h> |
41 | 42 | ||
42 | const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file | 43 | const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file |
43 | const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files | 44 | const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files |
44 | const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists | 45 | const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists |
45 | const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location | 46 | const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location |
46 | 47 | ||
47 | OIpkg *oipkg; | 48 | 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; |
53 | } | 56 | } |
54 | 57 | ||
55 | char* fIpkgResponse( char */*question*/ ) | 58 | char *fIpkgResponse( char */*question*/ ) |
56 | { | 59 | { |
57 | return 0x0; | 60 | return 0x0; |
58 | } | 61 | } |
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 ) |
61 | : QObject( parent, name ) | 78 | : QObject( parent, name ) |
62 | , m_config( config ) | 79 | , m_config( config ) |
63 | , m_confInfo( NULL ) | 80 | , m_confInfo( NULL ) |
64 | , m_ipkgExecOptions( 0 ) | 81 | , m_ipkgExecOptions( 0 ) |
65 | , m_ipkgExecVerbosity( 1 ) | 82 | , m_ipkgExecVerbosity( 1 ) |
66 | { | 83 | { |
67 | oipkg = this; | 84 | oipkg = this; |
68 | 85 | ||
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" ) ); |
72 | 89 | ||
73 | // Default ipkg run-time arguments | 90 | // Default ipkg run-time arguments |
74 | m_ipkgArgs.noaction = false; | 91 | m_ipkgArgs.noaction = false; |
75 | m_ipkgArgs.force_defaults = true; | 92 | m_ipkgArgs.force_defaults = true; |
76 | } | 93 | } |
77 | 94 | ||
78 | OIpkg::~OIpkg() | 95 | OIpkg::~OIpkg() |
79 | { | 96 | { |
80 | // Upon destruction, ensure that items in config list are deleted with list | 97 | // Upon destruction, ensure that items in config list are deleted with list |
81 | if ( m_confInfo ) | 98 | if ( m_confInfo ) |
82 | m_confInfo->setAutoDelete( true ); | 99 | m_confInfo->setAutoDelete( true ); |
83 | 100 | ||
84 | // Free up libipkg resources | 101 | // Free up libipkg resources |
85 | if ( ipkg_deinit( &m_ipkgArgs ) ) | 102 | if ( ipkg_deinit( &m_ipkgArgs ) ) |
86 | QMessageBox::critical( 0, tr( "OIpkg" ), tr( "Error freeing libipkg" ) ); | 103 | QMessageBox::critical( 0, tr( "OIpkg" ), tr( "Error freeing libipkg" ) ); |
@@ -284,78 +301,108 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, | |||
284 | // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE ); | 301 | // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE ); |
285 | m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE ); | 302 | m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE ); |
286 | m_ipkgArgs.verbosity = m_ipkgExecVerbosity; | 303 | m_ipkgArgs.verbosity = m_ipkgExecVerbosity; |
287 | if ( m_ipkgArgs.dest ) | 304 | if ( m_ipkgArgs.dest ) |
288 | free( m_ipkgArgs.dest ); | 305 | free( m_ipkgArgs.dest ); |
289 | if ( !destination.isNull() ) | 306 | if ( !destination.isNull() ) |
290 | { | 307 | { |
291 | int len = destination.length() + 1; | 308 | int len = destination.length() + 1; |
292 | m_ipkgArgs.dest = (char *)malloc( len ); | 309 | m_ipkgArgs.dest = (char *)malloc( len ); |
293 | strncpy( m_ipkgArgs.dest, destination, destination.length() ); | 310 | strncpy( m_ipkgArgs.dest, destination, destination.length() ); |
294 | m_ipkgArgs.dest[ len - 1 ] = '\0'; | 311 | m_ipkgArgs.dest[ len - 1 ] = '\0'; |
295 | } | 312 | } |
296 | else | 313 | else |
297 | m_ipkgArgs.dest = 0x0; | 314 | m_ipkgArgs.dest = 0x0; |
298 | 315 | ||
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 | } |
305 | else | 323 | else |
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 | } |
309 | 327 | ||
310 | switch( command ) | 328 | switch( command ) |
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 ) |
318 | { | 343 | { |
319 | ipkg_packages_install( &m_ipkgArgs, (*it) ); | 344 | ipkg_packages_install( &m_ipkgArgs, (*it) ); |
320 | } | 345 | } |
321 | }; | 346 | }; |
322 | break; | 347 | break; |
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 ) |
325 | { | 351 | { |
326 | ipkg_packages_remove( &m_ipkgArgs, (*it), true ); | 352 | ipkg_packages_remove( &m_ipkgArgs, (*it), true ); |
327 | } | 353 | } |
328 | }; | 354 | }; |
329 | break; | 355 | break; |
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 ) |
332 | { | 359 | { |
333 | ipkg_packages_download( &m_ipkgArgs, (*it) ); | 360 | ipkg_packages_download( &m_ipkgArgs, (*it) ); |
334 | } | 361 | } |
335 | }; | 362 | }; |
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; |
338 | }; | 375 | }; |
339 | 376 | ||
340 | return true; | 377 | return true; |
341 | } | 378 | } |
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 | } |
347 | 394 | ||
348 | void OIpkg::loadConfiguration() | 395 | void OIpkg::loadConfiguration() |
349 | { | 396 | { |
350 | if ( m_confInfo ) | 397 | if ( m_confInfo ) |
351 | delete m_confInfo; | 398 | delete m_confInfo; |
352 | 399 | ||
353 | // Load configuration item list | 400 | // Load configuration item list |
354 | m_confInfo = new OConfItemList(); | 401 | m_confInfo = new OConfItemList(); |
355 | 402 | ||
356 | QStringList confFiles; | 403 | QStringList confFiles; |
357 | QDir confDir( IPKG_CONF_DIR ); | 404 | QDir confDir( IPKG_CONF_DIR ); |
358 | if ( confDir.exists() ) | 405 | if ( confDir.exists() ) |
359 | { | 406 | { |
360 | confDir.setNameFilter( "*.conf" ); | 407 | confDir.setNameFilter( "*.conf" ); |
361 | confDir.setFilter( QDir::Files ); | 408 | confDir.setFilter( QDir::Files ); |
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 | |||
@@ -69,33 +69,37 @@ public: | |||
69 | 69 | ||
70 | void setConfigItems( OConfItemList *configList ); | 70 | void setConfigItems( OConfItemList *configList ); |
71 | void setIpkgExecOptions( int options ) { m_ipkgExecOptions = options; } | 71 | void setIpkgExecOptions( int options ) { m_ipkgExecOptions = options; } |
72 | void setIpkgExecVerbosity( int verbosity ) { m_ipkgExecVerbosity = verbosity; } | 72 | void setIpkgExecVerbosity( int verbosity ) { m_ipkgExecVerbosity = verbosity; } |
73 | 73 | ||
74 | void saveSettings(); | 74 | void saveSettings(); |
75 | 75 | ||
76 | OPackageList *availablePackages( const QString &server = QString::null ); | 76 | OPackageList *availablePackages( const QString &server = QString::null ); |
77 | OPackageList *installedPackages( const QString &destName = QString::null, | 77 | OPackageList *installedPackages( const QString &destName = QString::null, |
78 | const QString &destPath = QString::null ); | 78 | const QString &destPath = QString::null ); |
79 | 79 | ||
80 | bool executeCommand( OPackage::Command command = OPackage::NotDefined, QStringList *parameters = 0x0, | 80 | bool executeCommand( OPackage::Command command = OPackage::NotDefined, QStringList *parameters = 0x0, |
81 | const QString &destination = QString::null, const QObject *receiver = 0x0, | 81 | const QString &destination = QString::null, const QObject *receiver = 0x0, |
82 | const char *slotOutput = 0x0, bool rawOutput = true ); | 82 | const char *slotOutput = 0x0, bool rawOutput = true ); |
83 | void abortCommand(); | 83 | void abortCommand(); |
84 | 84 | ||
85 | void ipkgOutput( char *msg ); | 85 | void ipkgMessage( char *msg ); |
86 | void ipkgStatus( char *status ); | ||
87 | void ipkgList( char *filelist ); | ||
86 | 88 | ||
87 | private: | 89 | private: |
88 | Config *m_config; // Pointer to application configuration file | 90 | Config *m_config; // Pointer to application configuration file |
89 | args_t m_ipkgArgs; // libipkg configuration arguments | 91 | args_t m_ipkgArgs; // libipkg configuration arguments |
90 | OConfItemList *m_confInfo; // Contains info from all Ipkg configuration files | 92 | OConfItemList *m_confInfo; // Contains info from all Ipkg configuration files |
91 | int m_ipkgExecOptions; // Bit-mapped flags for Ipkg execution options | 93 | int m_ipkgExecOptions; // Bit-mapped flags for Ipkg execution options |
92 | int m_ipkgExecVerbosity; // Ipkg execution verbosity level | 94 | int m_ipkgExecVerbosity; // Ipkg execution verbosity level |
93 | 95 | ||
94 | void loadConfiguration(); | 96 | void loadConfiguration(); |
95 | OConfItemList *filterConfItems( OConfItem::Type typefilter = OConfItem::NotDefined ); | 97 | OConfItemList *filterConfItems( OConfItem::Type typefilter = OConfItem::NotDefined ); |
96 | 98 | ||
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 | }; |
100 | 104 | ||
101 | #endif | 105 | #endif |
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 | |||
@@ -19,25 +19,28 @@ | |||
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "opackage.h" | 32 | #include "opackage.h" |
33 | 33 | ||
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 ) |
37 | , m_version( version ) | 38 | , m_version( version ) |
38 | , m_versionInstalled( versionInstalled ) | 39 | , m_versionInstalled( versionInstalled ) |
39 | , m_source( source ) | 40 | , m_source( source ) |
40 | , m_destination( destination ) | 41 | , m_destination( destination ) |
41 | , m_category( category ) | 42 | , m_category( category ) |
43 | , m_information( information ) | ||
44 | , m_files( files ) | ||
42 | { | 45 | { |
43 | } | 46 | } |
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 | |||
@@ -27,48 +27,55 @@ | |||
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #ifndef OPACKAGE_H | 32 | #ifndef OPACKAGE_H |
33 | #define OPACKAGE_H | 33 | #define OPACKAGE_H |
34 | 34 | ||
35 | #include <qlist.h> | 35 | #include <qlist.h> |
36 | #include <qstring.h> | 36 | #include <qstring.h> |
37 | 37 | ||
38 | class OPackage | 38 | class OPackage |
39 | { | 39 | { |
40 | public: | 40 | public: |
41 | enum Command { Install, Remove, Update, Upgrade, Download, Info, Files, Version, NotDefined }; | 41 | enum Command { Install, Remove, Update, Upgrade, Download, Info, Files, Version, NotDefined }; |
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 | ||
48 | const QString &name() { return m_name; } | 49 | const QString &name() { return m_name; } |
49 | const QString &version() { return m_version; } | 50 | const QString &version() { return m_version; } |
50 | const QString &versionInstalled() { return m_versionInstalled; } | 51 | const QString &versionInstalled() { return m_versionInstalled; } |
51 | const QString &source() { return m_source; } | 52 | const QString &source() { return m_source; } |
52 | const QString &destination() { return m_destination; } | 53 | const QString &destination() { return m_destination; } |
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 | ||
55 | void setName( const QString &name ) { m_name = name; } | 58 | void setName( const QString &name ) { m_name = name; } |
56 | void setVersion( const QString &version ) { m_version = version; } | 59 | void setVersion( const QString &version ) { m_version = version; } |
57 | void setVersionInstalled( const QString &version ) { m_versionInstalled = version; } | 60 | void setVersionInstalled( const QString &version ) { m_versionInstalled = version; } |
58 | void setSource( const QString &source ) { m_source = source; } | 61 | void setSource( const QString &source ) { m_source = source; } |
59 | void setDestination( const QString &destination ) { m_destination = destination; } | 62 | void setDestination( const QString &destination ) { m_destination = destination; } |
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 | ||
62 | private: | 67 | private: |
63 | QString m_name; // Name of item | 68 | QString m_name; // Name of item |
64 | QString m_version; // Available version number of item | 69 | QString m_version; // Available version number of item |
65 | QString m_versionInstalled; // Installed version number of item, null if not installed | 70 | QString m_versionInstalled; // Installed version number of item, null if not installed |
66 | QString m_source; // Source feed of available version | 71 | QString m_source; // Source feed of available version |
67 | QString m_destination; // Location item is installed to, null if not installed | 72 | QString m_destination; // Location item is installed to, null if not installed |
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 | }; |
70 | 77 | ||
71 | typedef QList<OPackage> OPackageList; | 78 | typedef QList<OPackage> OPackageList; |
72 | typedef QListIterator<OPackage> OPackageListIterator; | 79 | typedef QListIterator<OPackage> OPackageListIterator; |
73 | 80 | ||
74 | #endif | 81 | #endif |
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 | |||
@@ -15,68 +15,126 @@ | |||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
19 | ..}^=.= = ; Public License for more details. | 19 | ..}^=.= = ; Public License for more details. |
20 | ++= -. .` .: | 20 | ++= -. .` .: |
21 | : = ...= . :.=- You should have received a copy of the GNU | 21 | : = ...= . :.=- You should have received a copy of the GNU |
22 | -. .:....=;==+<; General Public License along with this file; | 22 | -. .:....=;==+<; General Public License along with this file; |
23 | -_. . . )=. = see the file COPYING. If not, write to the | 23 | -_. . . )=. = see the file COPYING. If not, write to the |
24 | -- :-=` Free Software Foundation, Inc., | 24 | -- :-=` Free Software Foundation, Inc., |
25 | 59 Temple Place - Suite 330, | 25 | 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "packageinfodlg.h" | 30 | #include "packageinfodlg.h" |
31 | #include "opackage.h" | ||
32 | #include "opackagemanager.h" | ||
31 | 33 | ||
32 | #include <qlayout.h> | 34 | #include <qlayout.h> |
33 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
34 | 36 | ||
35 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
36 | 38 | ||
37 | #include <opie/otabwidget.h> | 39 | #include <opie/otabwidget.h> |
38 | 40 | ||
39 | PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QString &package ) | 41 | PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QString &package ) |
40 | : QWidget( 0x0 ) | 42 | : QWidget( 0x0 ) |
41 | , m_packman( pm ) | 43 | , m_packman( pm ) |
42 | , m_information( this ) | 44 | , m_information( this ) |
43 | , m_files( this ) | 45 | , m_files( this ) |
44 | { | 46 | { |
45 | // Initialize UI | 47 | // Initialize UI |
46 | if ( parent ) | 48 | if ( parent ) |
47 | parent->setCaption( package ); | 49 | parent->setCaption( package ); |
48 | 50 | ||
49 | QVBoxLayout *layout = new QVBoxLayout( this, 4, 0 ); | 51 | QVBoxLayout *layout = new QVBoxLayout( this, 4, 2 ); |
50 | 52 | ||
51 | OTabWidget *tabWidget = new OTabWidget( this ); | 53 | OTabWidget *tabWidget = new OTabWidget( this ); |
52 | layout->addWidget( tabWidget ); | 54 | layout->addWidget( tabWidget ); |
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 |
59 | m_information.reparent( tabWidget, QPoint( 0, 0 ) ); | 57 | m_information.reparent( tabWidget, QPoint( 0, 0 ) ); |
60 | m_information.setReadOnly( true ); | 58 | m_information.setReadOnly( true ); |
61 | tabWidget->addTab( &m_information, "UtilsIcon", tr( "Information" ) ); | 59 | tabWidget->addTab( &m_information, "UtilsIcon", tr( "Information" ) ); |
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 | |||
@@ -26,40 +26,42 @@ | |||
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef PACKAGEINFODLG_H | 30 | #ifndef PACKAGEINFODLG_H |
31 | #define PACKAGEINFODLG_H | 31 | #define PACKAGEINFODLG_H |
32 | 32 | ||
33 | #include <qmultilineedit.h> | 33 | #include <qmultilineedit.h> |
34 | #include <qwidget.h> | 34 | #include <qwidget.h> |
35 | 35 | ||
36 | #include <opie/oprocess.h> | 36 | #include <opie/oprocess.h> |
37 | 37 | ||
38 | #include "opackage.h" | 38 | #include "opackage.h" |
39 | 39 | ||
40 | class QPushButton; | 40 | class QPushButton; |
41 | 41 | ||
42 | class OPackage; | ||
42 | class OPackageManager; | 43 | class OPackageManager; |
43 | 44 | ||
44 | class PackageInfoDlg : public QWidget | 45 | class PackageInfoDlg : public QWidget |
45 | { | 46 | { |
46 | Q_OBJECT | 47 | Q_OBJECT |
47 | 48 | ||
48 | public: | 49 | 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 | ||
51 | private: | 53 | 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 | ||
54 | // UI controls | 57 | // UI controls |
55 | QMultiLineEdit m_information; // Multi-line edit to display package information | 58 | QMultiLineEdit m_information; // Multi-line edit to display package information |
56 | QMultiLineEdit m_files; // Multi-line edit to display package file list | 59 | QMultiLineEdit m_files; // Multi-line edit to display package file list |
57 | 60 | ||
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 | }; |
64 | 66 | ||
65 | #endif | 67 | #endif |