author | drw <drw> | 2005-01-02 20:26:01 (UTC) |
---|---|---|
committer | drw <drw> | 2005-01-02 20:26:01 (UTC) |
commit | e763e0cea060ae3a2dfb1c411f56354e27ac12a9 (patch) (unidiff) | |
tree | 37896734be7d2679c3f19635fe9fe3b52a549332 | |
parent | 020ea2d54bcd0fc4420cb433b3e657cd13ae07e2 (diff) | |
download | opie-e763e0cea060ae3a2dfb1c411f56354e27ac12a9.zip opie-e763e0cea060ae3a2dfb1c411f56354e27ac12a9.tar.gz opie-e763e0cea060ae3a2dfb1c411f56354e27ac12a9.tar.bz2 |
Implement native package linking code (removing need for ipkg-link and its shortcomings), move package linking code to OIpkg (proper place for ipkg specific code), many small code tweaks and bump version up to 0.6.1
-rw-r--r-- | noncore/settings/packagemanager/ChangeLog | 7 | ||||
-rw-r--r-- | noncore/settings/packagemanager/TODO | 8 | ||||
-rw-r--r-- | noncore/settings/packagemanager/installdlg.cpp | 81 | ||||
-rw-r--r-- | noncore/settings/packagemanager/installdlg.h | 11 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkg.cpp | 208 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkg.h | 20 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.cpp | 34 | ||||
-rw-r--r-- | noncore/settings/packagemanager/oipkgconfigdlg.h | 3 | ||||
-rw-r--r-- | noncore/settings/packagemanager/opackagemanager.cpp | 20 | ||||
-rw-r--r-- | noncore/settings/packagemanager/opie-packagemanager.control | 4 | ||||
-rw-r--r-- | noncore/settings/packagemanager/packageinfodlg.cpp | 10 | ||||
-rw-r--r-- | noncore/settings/packagemanager/packageinfodlg.h | 4 |
12 files changed, 237 insertions, 173 deletions
diff --git a/noncore/settings/packagemanager/ChangeLog b/noncore/settings/packagemanager/ChangeLog index c776ce5..608cd98 100644 --- a/noncore/settings/packagemanager/ChangeLog +++ b/noncore/settings/packagemanager/ChangeLog | |||
@@ -1,8 +1,15 @@ | |||
1 | 2005-01-02 Dan Williams <drw@handhelds.org> | ||
2 | |||
3 | * Released version 0.6.1 | ||
4 | * Implemented native package linking code to remove need for ipkg-link | ||
5 | * Implement package in OIpkg (removed from InstallDlg) as this is ipkg specific | ||
6 | * Many small code tweaks | ||
7 | |||
1 | 2004-12-21 Dan Williams <drw@handhelds.org> | 8 | 2004-12-21 Dan Williams <drw@handhelds.org> |
2 | 9 | ||
3 | * Released version 0.6.0 | 10 | * Released version 0.6.0 |
4 | * Added support for Ipkg 'src/gz' feeds | 11 | * Added support for Ipkg 'src/gz' feeds |
5 | * Improve server and destination tabs UI's in configuration dialog | 12 | * Improve server and destination tabs UI's in configuration dialog |
6 | * Fix app linking to link all dependent packages as well as selected packages | 13 | * Fix app linking to link all dependent packages as well as selected packages |
7 | * Hide 'Retrive File List' button once list is retrieved in Package Info dialog | 14 | * Hide 'Retrive File List' button once list is retrieved in Package Info dialog |
8 | 15 | ||
diff --git a/noncore/settings/packagemanager/TODO b/noncore/settings/packagemanager/TODO index 744ad95..2512624 100644 --- a/noncore/settings/packagemanager/TODO +++ b/noncore/settings/packagemanager/TODO | |||
@@ -1,17 +1,15 @@ | |||
1 | /************************************************************************ | 1 | /************************************************************************ |
2 | /* | 2 | /* |
3 | /* Opie - Package Manager | 3 | /* Opie - Package Manager |
4 | /* ======================== | 4 | /* ======================== |
5 | /* Version 0.6.0 | 5 | /* Version 0.6.1 |
6 | /* | 6 | /* |
7 | /* A package management client for Opie | 7 | /* A package management client for Opie |
8 | /* | 8 | /* |
9 | /************************************************************************ | 9 | /************************************************************************ |
10 | 10 | ||
11 | ----------------------------------------------- | 11 | ----------------------------------------------- |
12 | To-do for Opie-PackageManager - December, 2004 | 12 | To-do for Opie-PackageManager - January, 2005 |
13 | ----------------------------------------------- | 13 | ----------------------------------------------- |
14 | 14 | ||
15 | 1. Move ipkg-link code from InstallDlg to OIpkg | 15 | 1. Re-work package download dialog |
16 | 2. Code ipkg-link logic directly in OIpkg | ||
17 | 3. Re-work package download dialog | ||
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp index 985e2bd..7dea591 100644 --- a/noncore/settings/packagemanager/installdlg.cpp +++ b/noncore/settings/packagemanager/installdlg.cpp | |||
@@ -25,17 +25,16 @@ _;:, .> :=|. This file is free software; you can | |||
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 "installdlg.h" | 30 | #include "installdlg.h" |
31 | 31 | ||
32 | #include <opie2/ofiledialog.h> | 32 | #include <opie2/ofiledialog.h> |
33 | #include <opie2/oprocess.h> | ||
34 | 33 | ||
35 | #include <qpe/fileselector.h> | 34 | #include <qpe/fileselector.h> |
36 | #include <qpe/resource.h> | 35 | #include <qpe/resource.h> |
37 | #include <qpe/storage.h> | 36 | #include <qpe/storage.h> |
38 | 37 | ||
39 | #include <qapplication.h> | 38 | #include <qapplication.h> |
40 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
41 | #include <qfileinfo.h> | 40 | #include <qfileinfo.h> |
@@ -242,97 +241,21 @@ void InstallDlg::slotBtnStart() | |||
242 | m_btnStart->setText( tr( "Abort" ) ); | 241 | m_btnStart->setText( tr( "Abort" ) ); |
243 | m_btnStart->setIconSet( Resource::loadPixmap( "close" ) ); | 242 | m_btnStart->setIconSet( Resource::loadPixmap( "close" ) ); |
244 | } | 243 | } |
245 | else | 244 | else |
246 | { | 245 | { |
247 | m_btnStart->setEnabled( false ); | 246 | m_btnStart->setEnabled( false ); |
248 | } | 247 | } |
249 | 248 | ||
250 | Opie::Core::OProcess process( this ); | ||
251 | for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) | 249 | for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) |
252 | { | 250 | { |
253 | // Execute next command | 251 | // Execute next command |
254 | m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, | 252 | m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, |
255 | this, SLOT(slotOutput(char*)), true ); | 253 | this, SLOT(slotOutput(const QString &)), true ); |
256 | |||
257 | if ( m_command[ m_currCommand ] == OPackage::Remove ) | ||
258 | { | ||
259 | // Unlink application if the package was removed | ||
260 | |||
261 | // Loop through all package names in the command group | ||
262 | for ( QStringList::Iterator it = m_packages[ m_currCommand ].begin(); | ||
263 | it != m_packages[ m_currCommand ].end(); | ||
264 | ++it ) | ||
265 | { | ||
266 | OPackage *currPackage = m_packman->findPackage( (*it) ); | ||
267 | |||
268 | // Skip package if it is not found or being removed from 'root' | ||
269 | if ( !currPackage || ( m_command[ m_currCommand ] == OPackage::Remove && | ||
270 | currPackage->destination() == "root" ) ) | ||
271 | continue; | ||
272 | |||
273 | // Display feedback to user | ||
274 | m_output->append( tr( QString( "Running ipkg-link to remove links for package '%1'." ) | ||
275 | .arg( currPackage->name() ) ) ); | ||
276 | m_output->setCursorPosition( m_output->numLines(), 0 ); | ||
277 | |||
278 | // Execute ipkg-link | ||
279 | process.clearArguments(); | ||
280 | process << "ipkg-link" | ||
281 | << ( ( m_command[ m_currCommand ] == OPackage::Install ) ? "add" : "remove" ) | ||
282 | << currPackage->name(); | ||
283 | if ( !process.start( Opie::Core::OProcess::Block, | ||
284 | Opie::Core::OProcess::NoCommunication ) ) | ||
285 | { | ||
286 | slotProcessDone( 0l ); | ||
287 | m_output->append( tr( "Unable to run ipkg-link." ) ); | ||
288 | m_output->setCursorPosition( m_output->numLines(), 0 ); | ||
289 | return; | ||
290 | } | ||
291 | } | ||
292 | } | ||
293 | else if ( m_command[ m_currCommand ] == OPackage::Install && dest != "root" ) | ||
294 | { | ||
295 | // Link applications in the destination directory | ||
296 | |||
297 | m_output->append( tr( "Running ipkg-link to link packages in '%1'." ).arg( dest ) ); | ||
298 | m_output->setCursorPosition( m_output->numLines(), 0 ); | ||
299 | |||
300 | QString destPath; | ||
301 | OConfItem *destItem = m_packman->findConfItem( OConfItem::Destination, dest ); | ||
302 | |||
303 | // Execute ipkg-link | ||
304 | process.clearArguments(); | ||
305 | process << "ipkg-link" | ||
306 | << "mount" | ||
307 | << destItem->value(); | ||
308 | if ( !process.start( Opie::Core::OProcess::Block, | ||
309 | Opie::Core::OProcess::NoCommunication ) ) | ||
310 | { | ||
311 | slotProcessDone( 0l ); | ||
312 | m_output->append( tr( "Unable to run ipkg-link." ) ); | ||
313 | m_output->setCursorPosition( m_output->numLines(), 0 ); | ||
314 | return; | ||
315 | } | ||
316 | } | ||
317 | } | ||
318 | |||
319 | slotProcessDone( 0l ); | ||
320 | } | ||
321 | |||
322 | void InstallDlg::slotProcessDone( Opie::Core::OProcess *proc ) | ||
323 | { | ||
324 | if ( proc ) | ||
325 | { | ||
326 | // Display message pnly if linking was done | ||
327 | m_output->append( tr( "The package linking is done." ) ); | ||
328 | m_output->setCursorPosition( m_output->numLines(), 0 ); | ||
329 | |||
330 | delete proc; | ||
331 | } | 254 | } |
332 | 255 | ||
333 | // All commands executed, allow user to close dialog | 256 | // All commands executed, allow user to close dialog |
334 | m_btnStart->setEnabled( true ); | 257 | m_btnStart->setEnabled( true ); |
335 | m_btnStart->setText( tr( "Close" ) ); | 258 | m_btnStart->setText( tr( "Close" ) ); |
336 | m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); | 259 | m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); |
337 | 260 | ||
338 | m_btnOptions->setEnabled( true ); | 261 | m_btnOptions->setEnabled( true ); |
@@ -367,17 +290,17 @@ void InstallDlg::slotBtnOptions() | |||
367 | doc.setType( "text/plain" ); | 290 | doc.setType( "text/plain" ); |
368 | doc.setFile( filename ); | 291 | doc.setFile( filename ); |
369 | doc.setName( currentFileName ); | 292 | doc.setName( currentFileName ); |
370 | FileManager fm; | 293 | FileManager fm; |
371 | fm.saveFile( doc, m_output->text() ); | 294 | fm.saveFile( doc, m_output->text() ); |
372 | } | 295 | } |
373 | } | 296 | } |
374 | 297 | ||
375 | void InstallDlg::slotOutput( char *msg ) | 298 | void InstallDlg::slotOutput( const QString &msg ) |
376 | { | 299 | { |
377 | // Allow processing of other events | 300 | // Allow processing of other events |
378 | qApp->processEvents(); | 301 | qApp->processEvents(); |
379 | 302 | ||
380 | QString lineStr = msg; | 303 | QString lineStr = msg; |
381 | if ( lineStr[lineStr.length()-1] == '\n' ) | 304 | if ( lineStr[lineStr.length()-1] == '\n' ) |
382 | lineStr.truncate( lineStr.length() - 1 ); | 305 | lineStr.truncate( lineStr.length() - 1 ); |
383 | m_output->append( lineStr ); | 306 | m_output->append( lineStr ); |
diff --git a/noncore/settings/packagemanager/installdlg.h b/noncore/settings/packagemanager/installdlg.h index 7a64fe0..e633809 100644 --- a/noncore/settings/packagemanager/installdlg.h +++ b/noncore/settings/packagemanager/installdlg.h | |||
@@ -37,24 +37,16 @@ _;:, .> :=|. This file is free software; you can | |||
37 | class QComboBox; | 37 | class QComboBox; |
38 | class QLabel; | 38 | class QLabel; |
39 | class QMultiLineEdit; | 39 | class QMultiLineEdit; |
40 | class QPushButton; | 40 | class QPushButton; |
41 | 41 | ||
42 | class OConfItem; | 42 | class OConfItem; |
43 | class OPackageManager; | 43 | class OPackageManager; |
44 | 44 | ||
45 | namespace Opie | ||
46 | { | ||
47 | namespace Core | ||
48 | { | ||
49 | class OProcess; | ||
50 | } | ||
51 | } | ||
52 | |||
53 | class InstallDlg : public QWidget | 45 | class InstallDlg : public QWidget |
54 | { | 46 | { |
55 | Q_OBJECT | 47 | Q_OBJECT |
56 | 48 | ||
57 | public: | 49 | public: |
58 | InstallDlg( QWidget *parent = 0l, OPackageManager *pm = 0l, | 50 | InstallDlg( QWidget *parent = 0l, OPackageManager *pm = 0l, |
59 | const QString &caption = QString::null, | 51 | const QString &caption = QString::null, |
60 | OPackage::Command command1 = OPackage::NotDefined, | 52 | OPackage::Command command1 = OPackage::NotDefined, |
@@ -84,18 +76,17 @@ private: | |||
84 | QStringList m_packages[3]; // Lists of package names associated to commands (m_command[]) | 76 | QStringList m_packages[3]; // Lists of package names associated to commands (m_command[]) |
85 | OConfItem *m_destItem; // Pointer to destination for package installation | 77 | OConfItem *m_destItem; // Pointer to destination for package installation |
86 | 78 | ||
87 | private slots: | 79 | private slots: |
88 | // UI control slots | 80 | // UI control slots |
89 | void slotDisplayAvailSpace( const QString &destination ); | 81 | void slotDisplayAvailSpace( const QString &destination ); |
90 | void slotBtnStart(); | 82 | void slotBtnStart(); |
91 | void slotBtnOptions(); | 83 | void slotBtnOptions(); |
92 | void slotProcessDone( Opie::Core::OProcess *proc ); | ||
93 | 84 | ||
94 | // Execution slots | 85 | // Execution slots |
95 | void slotOutput( char *msg ); | 86 | void slotOutput( const QString &msg ); |
96 | 87 | ||
97 | signals: | 88 | signals: |
98 | void closeInstallDlg(); | 89 | void closeInstallDlg(); |
99 | }; | 90 | }; |
100 | 91 | ||
101 | #endif | 92 | #endif |
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp index a66bd51..f2d7e39 100644 --- a/noncore/settings/packagemanager/oipkg.cpp +++ b/noncore/settings/packagemanager/oipkg.cpp | |||
@@ -31,39 +31,42 @@ _;:, .> :=|. This program is free software; you can | |||
31 | 31 | ||
32 | #include "oipkg.h" | 32 | #include "oipkg.h" |
33 | 33 | ||
34 | #include <qdir.h> | 34 | #include <qdir.h> |
35 | #include <qfile.h> | 35 | #include <qfile.h> |
36 | #include <qtextstream.h> | 36 | #include <qtextstream.h> |
37 | 37 | ||
38 | #include <stdlib.h> | 38 | #include <stdlib.h> |
39 | #include <unistd.h> | ||
39 | 40 | ||
40 | const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file | 41 | const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file |
41 | const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files | 42 | const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files |
42 | const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists | 43 | const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists |
43 | const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location | 44 | const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location |
45 | const QString IPKG_INFO_PATH = "usr/lib/ipkg/info"; // Package file lists location | ||
44 | 46 | ||
45 | OIpkg *oipkg; | 47 | OIpkg *oipkg; |
46 | 48 | ||
47 | // Ipkg callback functions | 49 | // Ipkg callback functions |
48 | 50 | ||
49 | int fsignalIpkgMessage( ipkg_conf_t *conf, message_level_t level, char *msg ) | 51 | int fsignalIpkgMessage( ipkg_conf_t *conf, message_level_t level, char *msg ) |
50 | { | 52 | { |
53 | // Display message only if it is below the message level threshold | ||
51 | if ( conf && ( conf->verbosity < level ) ) | 54 | if ( conf && ( conf->verbosity < level ) ) |
52 | return 0; | 55 | return 0; |
53 | else | 56 | else |
54 | oipkg->ipkgMessage( msg ); | 57 | oipkg->ipkgMessage( msg ); |
55 | 58 | ||
56 | return 0; | 59 | return 0; |
57 | } | 60 | } |
58 | 61 | ||
59 | char *fIpkgResponse( char */*question*/ ) | 62 | char *fIpkgResponse( char */*question*/ ) |
60 | { | 63 | { |
61 | return 0x0; | 64 | return 0l; |
62 | } | 65 | } |
63 | 66 | ||
64 | int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ ) | 67 | int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ ) |
65 | { | 68 | { |
66 | oipkg->ipkgStatus( desc ); | 69 | oipkg->ipkgStatus( desc ); |
67 | return 0; | 70 | return 0; |
68 | } | 71 | } |
69 | 72 | ||
@@ -76,16 +79,17 @@ int fIpkgFiles( char */*name*/, char *desc, char */*version*/, pkg_state_status_ | |||
76 | 79 | ||
77 | OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) | 80 | OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) |
78 | : QObject( parent, name ) | 81 | : QObject( parent, name ) |
79 | , m_config( config ) | 82 | , m_config( config ) |
80 | , m_confInfo( NULL ) | 83 | , m_confInfo( NULL ) |
81 | , m_ipkgExecOptions( 0 ) | 84 | , m_ipkgExecOptions( 0 ) |
82 | , m_ipkgExecVerbosity( 1 ) | 85 | , m_ipkgExecVerbosity( 1 ) |
83 | { | 86 | { |
87 | // Keep pointer to self for the Ipkg callback functions | ||
84 | oipkg = this; | 88 | oipkg = this; |
85 | 89 | ||
86 | // Initialize libipkg | 90 | // Initialize libipkg |
87 | ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ); | 91 | ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ); |
88 | 92 | ||
89 | // Default ipkg run-time arguments | 93 | // Default ipkg run-time arguments |
90 | m_ipkgArgs.noaction = false; | 94 | m_ipkgArgs.noaction = false; |
91 | m_ipkgArgs.force_defaults = true; | 95 | m_ipkgArgs.force_defaults = true; |
@@ -357,16 +361,34 @@ OPackageList *OIpkg::installedPackages( const QString &destName, const QString & | |||
357 | line = t.readLine(); | 361 | line = t.readLine(); |
358 | } | 362 | } |
359 | 363 | ||
360 | f.close(); | 364 | f.close(); |
361 | 365 | ||
362 | return pl; | 366 | return pl; |
363 | } | 367 | } |
364 | 368 | ||
369 | OConfItem *OIpkg::findConfItem( OConfItem::Type type, const QString &name ) | ||
370 | { | ||
371 | // Find configuration item in list | ||
372 | OConfItemListIterator configIt( *m_confInfo ); | ||
373 | OConfItem *config = 0l; | ||
374 | for ( ; configIt.current(); ++configIt ) | ||
375 | { | ||
376 | config = configIt.current(); | ||
377 | if ( config->type() == type && config->name() == name ) | ||
378 | break; | ||
379 | } | ||
380 | |||
381 | if ( config && config->type() == type && config->name() == name ) | ||
382 | return config; | ||
383 | |||
384 | return 0l; | ||
385 | } | ||
386 | |||
365 | bool OIpkg::executeCommand( OPackage::Command command, const QStringList ¶meters, const QString &destination, | 387 | bool OIpkg::executeCommand( OPackage::Command command, const QStringList ¶meters, const QString &destination, |
366 | const QObject *receiver, const char *slotOutput, bool rawOutput ) | 388 | const QObject *receiver, const char *slotOutput, bool rawOutput ) |
367 | { | 389 | { |
368 | if ( command == OPackage::NotDefined ) | 390 | if ( command == OPackage::NotDefined ) |
369 | return false; | 391 | return false; |
370 | 392 | ||
371 | // Set ipkg run-time options/arguments | 393 | // Set ipkg run-time options/arguments |
372 | m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS ); | 394 | m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS ); |
@@ -379,74 +401,89 @@ bool OIpkg::executeCommand( OPackage::Command command, const QStringList ¶me | |||
379 | if ( !destination.isNull() ) | 401 | if ( !destination.isNull() ) |
380 | { | 402 | { |
381 | int len = destination.length() + 1; | 403 | int len = destination.length() + 1; |
382 | m_ipkgArgs.dest = (char *)malloc( len ); | 404 | m_ipkgArgs.dest = (char *)malloc( len ); |
383 | strncpy( m_ipkgArgs.dest, destination, destination.length() ); | 405 | strncpy( m_ipkgArgs.dest, destination, destination.length() ); |
384 | m_ipkgArgs.dest[ len - 1 ] = '\0'; | 406 | m_ipkgArgs.dest[ len - 1 ] = '\0'; |
385 | } | 407 | } |
386 | else | 408 | else |
387 | m_ipkgArgs.dest = 0x0; | 409 | m_ipkgArgs.dest = 0l; |
388 | 410 | ||
389 | // Connect output signal to widget | 411 | // Connect output signal to widget |
390 | 412 | ||
391 | if ( rawOutput ) | 413 | if ( !rawOutput ) |
392 | { | ||
393 | // if ( slotOutput ) | ||
394 | // connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); | ||
395 | } | ||
396 | else | ||
397 | { | 414 | { |
398 | // TODO - connect to local slot and parse output before emitting signalIpkgMessage | 415 | // TODO - connect to local slot and parse output before emitting signalIpkgMessage |
399 | } | 416 | } |
400 | 417 | ||
401 | switch( command ) | 418 | switch( command ) |
402 | { | 419 | { |
403 | case OPackage::Update : { | 420 | case OPackage::Update : { |
404 | connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); | 421 | connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); |
405 | ipkg_lists_update( &m_ipkgArgs ); | 422 | ipkg_lists_update( &m_ipkgArgs ); |
406 | }; | 423 | }; |
407 | break; | 424 | break; |
408 | case OPackage::Upgrade : { | 425 | case OPackage::Upgrade : { |
409 | connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); | 426 | connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); |
410 | ipkg_packages_upgrade( &m_ipkgArgs ); | 427 | ipkg_packages_upgrade( &m_ipkgArgs ); |
428 | |||
429 | // Re-link non-root destinations to make sure everything is in sync | ||
430 | OConfItemList *destList = destinations(); | ||
431 | OConfItemListIterator it( *destList ); | ||
432 | for ( ; it.current(); ++it ) | ||
433 | { | ||
434 | OConfItem *dest = it.current(); | ||
435 | if ( dest->name() != "root" ) | ||
436 | linkPackageDir( dest->name() ); | ||
437 | } | ||
438 | delete destList; | ||
411 | }; | 439 | }; |
412 | break; | 440 | break; |
413 | case OPackage::Install : { | 441 | case OPackage::Install : { |
414 | connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); | 442 | connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); |
415 | for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) | 443 | for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) |
416 | { | 444 | { |
417 | ipkg_packages_install( &m_ipkgArgs, (*it) ); | 445 | ipkg_packages_install( &m_ipkgArgs, (*it) ); |
418 | } | 446 | } |
447 | if ( destination != "root" ) | ||
448 | linkPackageDir( destination ); | ||
419 | }; | 449 | }; |
420 | break; | 450 | break; |
421 | case OPackage::Remove : { | 451 | case OPackage::Remove : { |
422 | connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); | 452 | connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); |
453 | |||
454 | // Get list of destinations for unlinking of packages not installed to root | ||
455 | OConfItemList *destList = destinations(); | ||
456 | |||
423 | for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) | 457 | for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) |
424 | { | 458 | { |
459 | unlinkPackage( (*it), destList ); | ||
425 | ipkg_packages_remove( &m_ipkgArgs, (*it), true ); | 460 | ipkg_packages_remove( &m_ipkgArgs, (*it), true ); |
426 | } | 461 | } |
462 | |||
463 | delete destList; | ||
427 | }; | 464 | }; |
428 | break; | 465 | break; |
429 | case OPackage::Download : { | 466 | case OPackage::Download : { |
430 | connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); | 467 | connect( this, SIGNAL(signalIpkgMessage(const QString &)), receiver, slotOutput ); |
431 | for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) | 468 | for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) |
432 | { | 469 | { |
433 | ipkg_packages_download( &m_ipkgArgs, (*it) ); | 470 | ipkg_packages_download( &m_ipkgArgs, (*it) ); |
434 | } | 471 | } |
435 | }; | 472 | }; |
436 | break; | 473 | break; |
437 | case OPackage::Info : { | 474 | case OPackage::Info : { |
438 | connect( this, SIGNAL(signalIpkgStatus(char*)), receiver, slotOutput ); | 475 | connect( this, SIGNAL(signalIpkgStatus(const QString &)), receiver, slotOutput ); |
439 | ipkg_packages_info( &m_ipkgArgs, (*parameters.begin()), &fIpkgStatus, 0x0 ); | 476 | ipkg_packages_info( &m_ipkgArgs, (*parameters.begin()), &fIpkgStatus, 0l ); |
440 | }; | 477 | }; |
441 | break; | 478 | break; |
442 | case OPackage::Files : { | 479 | case OPackage::Files : { |
443 | connect( this, SIGNAL(signalIpkgList(char*)), receiver, slotOutput ); | 480 | connect( this, SIGNAL(signalIpkgList(const QString &)), receiver, slotOutput ); |
444 | ipkg_package_files( &m_ipkgArgs, (*parameters.begin()), &fIpkgFiles, 0x0 ); | 481 | ipkg_package_files( &m_ipkgArgs, (*parameters.begin()), &fIpkgFiles, 0l ); |
445 | }; | 482 | }; |
446 | break; | 483 | break; |
447 | default : break; | 484 | default : break; |
448 | }; | 485 | }; |
449 | 486 | ||
450 | return true; | 487 | return true; |
451 | } | 488 | } |
452 | 489 | ||
@@ -584,8 +621,145 @@ OConfItemList *OIpkg::filterConfItems( OConfItem::Type typefilter ) | |||
584 | if ( retrieveAll || item->type() == typefilter ) | 621 | if ( retrieveAll || item->type() == typefilter ) |
585 | { | 622 | { |
586 | sl->append( item ); | 623 | sl->append( item ); |
587 | } | 624 | } |
588 | } | 625 | } |
589 | 626 | ||
590 | return sl; | 627 | return sl; |
591 | } | 628 | } |
629 | |||
630 | const QString &OIpkg::rootPath() | ||
631 | { | ||
632 | if ( m_rootPath.isEmpty() ) | ||
633 | { | ||
634 | OConfItem *rootDest = findConfItem( OConfItem::Destination, "root" ); | ||
635 | rootDest ? m_rootPath = rootDest->value() | ||
636 | : m_rootPath = '/'; | ||
637 | if ( m_rootPath.right( 1 ) == '/' ) | ||
638 | m_rootPath.truncate( m_rootPath.length() - 1 ); | ||
639 | } | ||
640 | return m_rootPath; | ||
641 | } | ||
642 | |||
643 | void OIpkg::linkPackageDir( const QString &dest ) | ||
644 | { | ||
645 | if ( !dest.isNull() ) | ||
646 | { | ||
647 | OConfItem *destConfItem = findConfItem( OConfItem::Destination, dest ); | ||
648 | |||
649 | emit signalIpkgMessage( tr( "Linking packages installed in: %1" ).arg( dest ) ); | ||
650 | |||
651 | // Set package destination directory | ||
652 | QString destDir = destConfItem->value(); | ||
653 | QString destInfoDir = destDir; | ||
654 | if ( destInfoDir.right( 1 ) != '/' ) | ||
655 | destInfoDir.append( '/' ); | ||
656 | destInfoDir.append( IPKG_INFO_PATH ); | ||
657 | |||
658 | // Get list of installed packages in destination | ||
659 | QDir packageDir( destInfoDir ); | ||
660 | QStringList packageFiles; | ||
661 | if ( packageDir.exists() ) | ||
662 | { | ||
663 | packageDir.setNameFilter( "*.list" ); | ||
664 | packageDir.setFilter( QDir::Files ); | ||
665 | packageFiles = packageDir.entryList( "*.list", QDir::Files ); | ||
666 | } | ||
667 | |||
668 | // Link all files for every package installed in desination | ||
669 | QStringList::Iterator lastFile = packageFiles.end(); | ||
670 | for ( QStringList::Iterator it = packageFiles.begin(); it != lastFile; ++it ) | ||
671 | { | ||
672 | //emit signalIpkgMessage( QString( "Processing: %1/%2" ).arg( destInfoDir ).arg (*it) ); | ||
673 | QString packageFileName = destInfoDir; | ||
674 | packageFileName.append( '/' ); | ||
675 | packageFileName.append( (*it) ); | ||
676 | QFile packageFile( packageFileName ); | ||
677 | if ( packageFile.open( IO_ReadOnly ) ) | ||
678 | { | ||
679 | QTextStream t( &packageFile ); | ||
680 | QString linkFile; | ||
681 | while ( !t.eof() ) | ||
682 | { | ||
683 | // Get the name of the file to link and build the sym link filename | ||
684 | linkFile = t.readLine(); | ||
685 | QString linkDest( linkFile.right( linkFile.length() - destDir.length() ) ); | ||
686 | linkDest.prepend( rootPath() ); | ||
687 | |||
688 | // If file installed file is actually symbolic link, use actual file for linking | ||
689 | QFileInfo fileInfo( linkFile ); | ||
690 | if ( fileInfo.isSymLink() && !fileInfo.readLink().isEmpty() ) | ||
691 | linkFile = fileInfo.readLink(); | ||
692 | |||
693 | // See if directory exists in 'root', if not, create | ||
694 | fileInfo.setFile( linkDest ); | ||
695 | QString linkDestDirName = fileInfo.dirPath( true ); | ||
696 | QDir linkDestDir( linkDestDirName ); | ||
697 | if ( !linkDestDir.exists() ) | ||
698 | { | ||
699 | linkDestDir.mkdir( linkDestDirName ); | ||
700 | } | ||
701 | else | ||
702 | { | ||
703 | // Remove any previous link to make sure we will be pointing to the current version | ||
704 | if ( QFile::exists( linkDest ) ) | ||
705 | QFile::remove( linkDest ); | ||
706 | } | ||
707 | |||
708 | // Link the file | ||
709 | //emit signalIpkgMessage( QString( "Linking '%1' to '%2'" ).arg( linkFile ).arg( linkDest ) ); | ||
710 | if ( symlink( linkFile, linkDest ) == -1 ) | ||
711 | emit signalIpkgMessage( tr( "Error linkling '%1' to '%2'" ) | ||
712 | .arg( linkFile ) | ||
713 | .arg( linkDest ) ); | ||
714 | } | ||
715 | packageFile.close(); | ||
716 | } | ||
717 | } | ||
718 | } | ||
719 | } | ||
720 | |||
721 | void OIpkg::unlinkPackage( const QString &package, OConfItemList *destList ) | ||
722 | { | ||
723 | if ( !package.isNull() ) | ||
724 | { | ||
725 | // Find destination package is installed in | ||
726 | if ( destList ) | ||
727 | { | ||
728 | OConfItemListIterator it( *destList ); | ||
729 | for ( ; it.current(); ++it ) | ||
730 | { | ||
731 | OConfItem *dest = it.current(); | ||
732 | QString destInfoFileName = QString( "%1/%2/%3.list" ).arg( dest->value() ) | ||
733 | .arg( IPKG_INFO_PATH ) | ||
734 | .arg( package ); | ||
735 | //emit signalIpkgMessage( QString( "Looking for '%1'" ).arg ( destInfoFileName ) ); | ||
736 | |||
737 | // If found and destination is not 'root', remove symbolic links | ||
738 | if ( QFile::exists( destInfoFileName ) && dest->name() != "root" ) | ||
739 | { | ||
740 | QFile destInfoFile( destInfoFileName ); | ||
741 | if ( destInfoFile.open( IO_ReadOnly ) ) | ||
742 | { | ||
743 | QTextStream t( &destInfoFile ); | ||
744 | QString linkFile; | ||
745 | while ( !t.eof() ) | ||
746 | { | ||
747 | // Get the name of the file to link and build the sym link filename | ||
748 | linkFile = t.readLine(); | ||
749 | QString linkDest( linkFile.right( linkFile.length() - | ||
750 | dest->value().length() ) ); | ||
751 | linkDest.prepend( rootPath() ); | ||
752 | |||
753 | //emit signalIpkgMessage( QString( "Deleting: '%1'" ).arg( linkDest ) ); | ||
754 | QFile::remove( linkDest ); | ||
755 | } | ||
756 | destInfoFile.close(); | ||
757 | } | ||
758 | |||
759 | emit signalIpkgMessage( tr( "Links removed for: %1" ).arg( package ) ); | ||
760 | return; | ||
761 | } | ||
762 | } | ||
763 | } | ||
764 | } | ||
765 | } | ||
diff --git a/noncore/settings/packagemanager/oipkg.h b/noncore/settings/packagemanager/oipkg.h index 3c96200..0263f50 100644 --- a/noncore/settings/packagemanager/oipkg.h +++ b/noncore/settings/packagemanager/oipkg.h | |||
@@ -51,17 +51,17 @@ extern "C" { | |||
51 | 51 | ||
52 | class OConfItemList; | 52 | class OConfItemList; |
53 | 53 | ||
54 | class OIpkg : public QObject | 54 | class OIpkg : public QObject |
55 | { | 55 | { |
56 | Q_OBJECT | 56 | Q_OBJECT |
57 | 57 | ||
58 | public: | 58 | public: |
59 | OIpkg( Config *config = 0x0, QObject *parent = 0x0, const char *name = 0x0 ); | 59 | OIpkg( Config *config = 0l, QObject *parent = 0l, const char *name = 0l ); |
60 | ~OIpkg(); | 60 | ~OIpkg(); |
61 | 61 | ||
62 | OConfItemList *configItems(); | 62 | OConfItemList *configItems(); |
63 | OConfItemList *servers(); | 63 | OConfItemList *servers(); |
64 | OConfItemList *destinations(); | 64 | OConfItemList *destinations(); |
65 | OConfItemList *options(); | 65 | OConfItemList *options(); |
66 | 66 | ||
67 | int ipkgExecOptions() { return m_ipkgExecOptions; } | 67 | int ipkgExecOptions() { return m_ipkgExecOptions; } |
@@ -72,37 +72,45 @@ public: | |||
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 | OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined, | ||
81 | const QString &name = QString::null ); | ||
82 | |||
80 | bool executeCommand( OPackage::Command command = OPackage::NotDefined, | 83 | bool executeCommand( OPackage::Command command = OPackage::NotDefined, |
81 | const QStringList ¶meters = QStringList(), | 84 | const QStringList ¶meters = QStringList(), |
82 | const QString &destination = QString::null, | 85 | const QString &destination = QString::null, |
83 | const QObject *receiver = 0x0, | 86 | const QObject *receiver = 0l, |
84 | const char *slotOutput = 0x0, | 87 | const char *slotOutput = 0l, |
85 | bool rawOutput = true ); | 88 | bool rawOutput = true ); |
86 | void abortCommand(); | 89 | void abortCommand(); |
87 | 90 | ||
88 | void ipkgMessage( char *msg ); | 91 | void ipkgMessage( char *msg ); |
89 | void ipkgStatus( char *status ); | 92 | void ipkgStatus( char *status ); |
90 | void ipkgList( char *filelist ); | 93 | void ipkgList( char *filelist ); |
91 | 94 | ||
92 | private: | 95 | private: |
93 | Config *m_config; // Pointer to application configuration file | 96 | Config *m_config; // Pointer to application configuration file |
94 | args_t m_ipkgArgs; // libipkg configuration arguments | 97 | args_t m_ipkgArgs; // libipkg configuration arguments |
95 | OConfItemList *m_confInfo; // Contains info from all Ipkg configuration files | 98 | OConfItemList *m_confInfo; // Contains info from all Ipkg configuration files |
96 | int m_ipkgExecOptions; // Bit-mapped flags for Ipkg execution options | 99 | int m_ipkgExecOptions; // Bit-mapped flags for Ipkg execution options |
97 | int m_ipkgExecVerbosity; // Ipkg execution verbosity level | 100 | int m_ipkgExecVerbosity; // Ipkg execution verbosity level |
101 | QString m_rootPath; // Directory path where the 'root' destination is located | ||
98 | 102 | ||
99 | void loadConfiguration(); | 103 | void loadConfiguration(); |
100 | OConfItemList *filterConfItems( OConfItem::Type typefilter = OConfItem::NotDefined ); | 104 | OConfItemList *filterConfItems( OConfItem::Type typefilter = OConfItem::NotDefined ); |
105 | const QString &rootPath(); | ||
106 | void linkPackageDir( const QString &dest = QString::null ); | ||
107 | void unlinkPackage( const QString &package = QString::null, | ||
108 | OConfItemList *destList = 0l ); | ||
101 | 109 | ||
102 | signals: | 110 | signals: |
103 | void signalIpkgMessage( char *msg ); | 111 | void signalIpkgMessage( const QString &msg ); |
104 | void signalIpkgStatus( char *status ); | 112 | void signalIpkgStatus( const QString &status ); |
105 | void signalIpkgList( char *filelist ); | 113 | void signalIpkgList( const QString &filelist ); |
106 | }; | 114 | }; |
107 | 115 | ||
108 | #endif | 116 | #endif |
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.cpp b/noncore/settings/packagemanager/oipkgconfigdlg.cpp index 77ad220..e6d6a81 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.cpp +++ b/noncore/settings/packagemanager/oipkgconfigdlg.cpp | |||
@@ -87,46 +87,46 @@ OIpkgConfigDlg::OIpkgConfigDlg( OIpkg *ipkg, bool installOptions, QWidget *paren | |||
87 | } | 87 | } |
88 | 88 | ||
89 | void OIpkgConfigDlg::accept() | 89 | void OIpkgConfigDlg::accept() |
90 | { | 90 | { |
91 | // Save server, destination and proxy configuration | 91 | // Save server, destination and proxy configuration |
92 | if ( !m_installOptions ) | 92 | if ( !m_installOptions ) |
93 | { | 93 | { |
94 | // Update proxy information before saving settings | 94 | // Update proxy information before saving settings |
95 | OConfItem *confItem = findConfItem( OConfItem::Option, "http_proxy" ); | 95 | OConfItem *confItem = m_ipkg->findConfItem( OConfItem::Option, "http_proxy" ); |
96 | if ( confItem ) | 96 | if ( confItem ) |
97 | { | 97 | { |
98 | confItem->setValue( m_proxyHttpServer->text() ); | 98 | confItem->setValue( m_proxyHttpServer->text() ); |
99 | confItem->setActive( m_proxyHttpActive->isChecked() ); | 99 | confItem->setActive( m_proxyHttpActive->isChecked() ); |
100 | } | 100 | } |
101 | else | 101 | else |
102 | m_configs->append( new OConfItem( OConfItem::Option, "http_proxy", | 102 | m_configs->append( new OConfItem( OConfItem::Option, "http_proxy", |
103 | m_proxyHttpServer->text(), QString::null, | 103 | m_proxyHttpServer->text(), QString::null, |
104 | m_proxyHttpActive->isChecked() ) ); | 104 | m_proxyHttpActive->isChecked() ) ); |
105 | 105 | ||
106 | confItem = findConfItem( OConfItem::Option, "ftp_proxy" ); | 106 | confItem = m_ipkg->findConfItem( OConfItem::Option, "ftp_proxy" ); |
107 | if ( confItem ) | 107 | if ( confItem ) |
108 | { | 108 | { |
109 | confItem->setValue( m_proxyFtpServer->text() ); | 109 | confItem->setValue( m_proxyFtpServer->text() ); |
110 | confItem->setActive( m_proxyFtpActive->isChecked() ); | 110 | confItem->setActive( m_proxyFtpActive->isChecked() ); |
111 | } | 111 | } |
112 | else | 112 | else |
113 | m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy", | 113 | m_configs->append( new OConfItem( OConfItem::Option, "ftp_proxy", |
114 | m_proxyFtpServer->text(), QString::null, | 114 | m_proxyFtpServer->text(), QString::null, |
115 | m_proxyFtpActive->isChecked() ) ); | 115 | m_proxyFtpActive->isChecked() ) ); |
116 | 116 | ||
117 | confItem = findConfItem( OConfItem::Option, "proxy_username" ); | 117 | confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_username" ); |
118 | if ( confItem ) | 118 | if ( confItem ) |
119 | confItem->setValue( m_proxyUsername->text() ); | 119 | confItem->setValue( m_proxyUsername->text() ); |
120 | else | 120 | else |
121 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_username", | 121 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_username", |
122 | m_proxyUsername->text() ) ); | 122 | m_proxyUsername->text() ) ); |
123 | 123 | ||
124 | confItem = findConfItem( OConfItem::Option, "proxy_password" ); | 124 | confItem = m_ipkg->findConfItem( OConfItem::Option, "proxy_password" ); |
125 | if ( confItem ) | 125 | if ( confItem ) |
126 | confItem->setValue( m_proxyPassword->text() ); | 126 | confItem->setValue( m_proxyPassword->text() ); |
127 | else | 127 | else |
128 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_password", | 128 | m_configs->append( new OConfItem( OConfItem::Option, "proxy_password", |
129 | m_proxyPassword->text() ) ); | 129 | m_proxyPassword->text() ) ); |
130 | 130 | ||
131 | m_ipkg->setConfigItems( m_configs ); | 131 | m_ipkg->setConfigItems( m_configs ); |
132 | } | 132 | } |
@@ -388,34 +388,16 @@ void OIpkgConfigDlg::initData() | |||
388 | if ( options & FORCE_REMOVE ) | 388 | if ( options & FORCE_REMOVE ) |
389 | m_optForceRemove->setChecked( true ); | 389 | m_optForceRemove->setChecked( true ); |
390 | if ( options & FORCE_OVERWRITE ) | 390 | if ( options & FORCE_OVERWRITE ) |
391 | m_optForceOverwrite->setChecked( true ); | 391 | m_optForceOverwrite->setChecked( true ); |
392 | 392 | ||
393 | m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); | 393 | m_optVerboseIpkg->setCurrentItem( m_ipkg->ipkgExecVerbosity() ); |
394 | } | 394 | } |
395 | 395 | ||
396 | OConfItem *OIpkgConfigDlg::findConfItem( OConfItem::Type type, const QString &name ) | ||
397 | { | ||
398 | // Find selected server in list | ||
399 | OConfItemListIterator configIt( *m_configs ); | ||
400 | OConfItem *config = 0l; | ||
401 | for ( ; configIt.current(); ++configIt ) | ||
402 | { | ||
403 | config = configIt.current(); | ||
404 | if ( config->type() == type && config->name() == name ) | ||
405 | break; | ||
406 | } | ||
407 | |||
408 | if ( config && config->type() == type && config->name() == name ) | ||
409 | return config; | ||
410 | |||
411 | return 0l; | ||
412 | } | ||
413 | |||
414 | void OIpkgConfigDlg::slotServerSelected( int index ) | 396 | void OIpkgConfigDlg::slotServerSelected( int index ) |
415 | { | 397 | { |
416 | m_serverCurrent = index; | 398 | m_serverCurrent = index; |
417 | 399 | ||
418 | // Enable Edit and Delete buttons | 400 | // Enable Edit and Delete buttons |
419 | m_serverEditBtn->setEnabled( true ); | 401 | m_serverEditBtn->setEnabled( true ); |
420 | m_serverDeleteBtn->setEnabled( true ); | 402 | m_serverDeleteBtn->setEnabled( true ); |
421 | } | 403 | } |
@@ -437,17 +419,17 @@ void OIpkgConfigDlg::slotServerNew() | |||
437 | } | 419 | } |
438 | else | 420 | else |
439 | delete server; | 421 | delete server; |
440 | } | 422 | } |
441 | 423 | ||
442 | void OIpkgConfigDlg::slotServerEdit() | 424 | void OIpkgConfigDlg::slotServerEdit() |
443 | { | 425 | { |
444 | // Find selected server in list | 426 | // Find selected server in list |
445 | OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); | 427 | OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); |
446 | 428 | ||
447 | // Edit server | 429 | // Edit server |
448 | if ( server ) | 430 | if ( server ) |
449 | { | 431 | { |
450 | QString origName = server->name(); | 432 | QString origName = server->name(); |
451 | OIpkgServerDlg dlg( server, this ); | 433 | OIpkgServerDlg dlg( server, this ); |
452 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 434 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
453 | { | 435 | { |
@@ -456,17 +438,17 @@ void OIpkgConfigDlg::slotServerEdit() | |||
456 | m_serverList->changeItem( server->name(), m_serverCurrent ); | 438 | m_serverList->changeItem( server->name(), m_serverCurrent ); |
457 | } | 439 | } |
458 | } | 440 | } |
459 | } | 441 | } |
460 | 442 | ||
461 | void OIpkgConfigDlg::slotServerDelete() | 443 | void OIpkgConfigDlg::slotServerDelete() |
462 | { | 444 | { |
463 | // Find selected server in list | 445 | // Find selected server in list |
464 | OConfItem *server = findConfItem( OConfItem::Source, m_serverList->currentText() ); | 446 | OConfItem *server = m_ipkg->findConfItem( OConfItem::Source, m_serverList->currentText() ); |
465 | 447 | ||
466 | // Delete server | 448 | // Delete server |
467 | if ( server ) | 449 | if ( server ) |
468 | { | 450 | { |
469 | m_configs->removeRef( server ); | 451 | m_configs->removeRef( server ); |
470 | m_serverList->removeItem( m_serverCurrent ); | 452 | m_serverList->removeItem( m_serverCurrent ); |
471 | } | 453 | } |
472 | } | 454 | } |
@@ -497,17 +479,17 @@ void OIpkgConfigDlg::slotDestNew() | |||
497 | } | 479 | } |
498 | else | 480 | else |
499 | delete dest; | 481 | delete dest; |
500 | } | 482 | } |
501 | 483 | ||
502 | void OIpkgConfigDlg::slotDestEdit() | 484 | void OIpkgConfigDlg::slotDestEdit() |
503 | { | 485 | { |
504 | // Find selected destination in list | 486 | // Find selected destination in list |
505 | OConfItem *dest = findConfItem( OConfItem::Destination, m_destList->currentText() ); | 487 | OConfItem *dest = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() ); |
506 | 488 | ||
507 | // Edit destination | 489 | // Edit destination |
508 | if ( dest ) | 490 | if ( dest ) |
509 | { | 491 | { |
510 | QString origName = dest->name(); | 492 | QString origName = dest->name(); |
511 | OIpkgDestDlg dlg( dest, this ); | 493 | OIpkgDestDlg dlg( dest, this ); |
512 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) | 494 | if ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ) |
513 | { | 495 | { |
@@ -516,17 +498,17 @@ void OIpkgConfigDlg::slotDestEdit() | |||
516 | m_destList->changeItem( dest->name(), m_destCurrent ); | 498 | m_destList->changeItem( dest->name(), m_destCurrent ); |
517 | } | 499 | } |
518 | } | 500 | } |
519 | } | 501 | } |
520 | 502 | ||
521 | void OIpkgConfigDlg::slotDestDelete() | 503 | void OIpkgConfigDlg::slotDestDelete() |
522 | { | 504 | { |
523 | // Find selected destination in list | 505 | // Find selected destination in list |
524 | OConfItem *destination = findConfItem( OConfItem::Destination, m_destList->currentText() ); | 506 | OConfItem *destination = m_ipkg->findConfItem( OConfItem::Destination, m_destList->currentText() ); |
525 | 507 | ||
526 | // Delete destination | 508 | // Delete destination |
527 | if ( destination ) | 509 | if ( destination ) |
528 | { | 510 | { |
529 | m_configs->removeRef( destination ); | 511 | m_configs->removeRef( destination ); |
530 | m_destList->removeItem( m_destCurrent ); | 512 | m_destList->removeItem( m_destCurrent ); |
531 | } | 513 | } |
532 | } | 514 | } |
diff --git a/noncore/settings/packagemanager/oipkgconfigdlg.h b/noncore/settings/packagemanager/oipkgconfigdlg.h index 5b7e91d..0fb2e16 100644 --- a/noncore/settings/packagemanager/oipkgconfigdlg.h +++ b/noncore/settings/packagemanager/oipkgconfigdlg.h | |||
@@ -102,19 +102,16 @@ private: | |||
102 | 102 | ||
103 | void initServerWidget(); | 103 | void initServerWidget(); |
104 | void initDestinationWidget(); | 104 | void initDestinationWidget(); |
105 | void initProxyWidget(); | 105 | void initProxyWidget(); |
106 | void initOptionsWidget(); | 106 | void initOptionsWidget(); |
107 | 107 | ||
108 | void initData(); | 108 | void initData(); |
109 | 109 | ||
110 | OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined, | ||
111 | const QString &name = QString::null ); | ||
112 | |||
113 | private slots: | 110 | private slots: |
114 | void slotServerSelected( int index ); | 111 | void slotServerSelected( int index ); |
115 | void slotServerNew(); | 112 | void slotServerNew(); |
116 | void slotServerEdit(); | 113 | void slotServerEdit(); |
117 | void slotServerDelete(); | 114 | void slotServerDelete(); |
118 | 115 | ||
119 | void slotDestSelected( int index ); | 116 | void slotDestSelected( int index ); |
120 | void slotDestNew(); | 117 | void slotDestNew(); |
diff --git a/noncore/settings/packagemanager/opackagemanager.cpp b/noncore/settings/packagemanager/opackagemanager.cpp index cbddfe7..c9fdec1 100644 --- a/noncore/settings/packagemanager/opackagemanager.cpp +++ b/noncore/settings/packagemanager/opackagemanager.cpp | |||
@@ -264,35 +264,17 @@ QStringList OPackageManager::destinations() | |||
264 | } | 264 | } |
265 | } | 265 | } |
266 | 266 | ||
267 | return dl; | 267 | return dl; |
268 | } | 268 | } |
269 | 269 | ||
270 | OConfItem *OPackageManager::findConfItem( OConfItem::Type type, const QString &name ) | 270 | OConfItem *OPackageManager::findConfItem( OConfItem::Type type, const QString &name ) |
271 | { | 271 | { |
272 | OConfItem *confItem = 0x0; | 272 | return m_ipkg.findConfItem( type, name ); |
273 | OConfItemList *confList = m_ipkg.configItems(); | ||
274 | if ( confList ) | ||
275 | { | ||
276 | for ( OConfItemListIterator confIt( *confList ); confIt.current(); ++confIt ) | ||
277 | { | ||
278 | OConfItem *conf = confIt.current(); | ||
279 | |||
280 | // Add only active confinations | ||
281 | if ( conf->type() == type && conf->name() == name ) | ||
282 | { | ||
283 | confItem = conf; | ||
284 | break; | ||
285 | } | ||
286 | } | ||
287 | } | ||
288 | |||
289 | return confItem; | ||
290 | |||
291 | } | 273 | } |
292 | 274 | ||
293 | OPackage *OPackageManager::findPackage( const QString &name ) | 275 | OPackage *OPackageManager::findPackage( const QString &name ) |
294 | { | 276 | { |
295 | return m_packages[ name ]; | 277 | return m_packages[ name ]; |
296 | } | 278 | } |
297 | 279 | ||
298 | int OPackageManager::compareVersions( const QString &ver1, const QString &ver2 ) | 280 | int OPackageManager::compareVersions( const QString &ver1, const QString &ver2 ) |
diff --git a/noncore/settings/packagemanager/opie-packagemanager.control b/noncore/settings/packagemanager/opie-packagemanager.control index cdf419c..da3ddfe 100644 --- a/noncore/settings/packagemanager/opie-packagemanager.control +++ b/noncore/settings/packagemanager/opie-packagemanager.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-packagemanager | 1 | Package: opie-packagemanager |
2 | Files: plugins/application/libpackagemanager.so* bin/packagemanager pics/packagemanager apps/Settings/packagemanager.desktop | 2 | Files: plugins/application/libpackagemanager.so* bin/packagemanager pics/packagemanager apps/Settings/packagemanager.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Depends: task-opie-minimal, libopiecore2, libopieui2, libipkg (>=0.99.120), ipkg-link | 5 | Depends: task-opie-minimal, libopiecore2, libopieui2, libipkg (>=0.99.120) |
6 | Replaces: packagemanager | 6 | Replaces: packagemanager |
7 | Architecture: arm | 7 | Architecture: arm |
8 | Maintainer: Dan Williams (drw@handhelds.org) | 8 | Maintainer: Dan Williams (drw@handhelds.org) |
9 | Description: Opie package management client | 9 | Description: Opie package management client |
10 | Version: 0.6.0$EXTRAVERSION | 10 | Version: 0.6.1$EXTRAVERSION |
diff --git a/noncore/settings/packagemanager/packageinfodlg.cpp b/noncore/settings/packagemanager/packageinfodlg.cpp index 5f72a67..3eef939 100644 --- a/noncore/settings/packagemanager/packageinfodlg.cpp +++ b/noncore/settings/packagemanager/packageinfodlg.cpp | |||
@@ -71,17 +71,18 @@ PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QStr | |||
71 | 71 | ||
72 | // Display package information | 72 | // Display package information |
73 | if ( !m_package->information().isNull() ) | 73 | if ( !m_package->information().isNull() ) |
74 | m_information.setText( m_package->information() ); | 74 | m_information.setText( m_package->information() ); |
75 | else | 75 | else |
76 | { | 76 | { |
77 | // Package information is not cached, retrieve it | 77 | // Package information is not cached, retrieve it |
78 | QStringList list( package ); | 78 | QStringList list( package ); |
79 | m_packman->executeCommand( OPackage::Info, list, QString::null, this, SLOT(slotInfo(char*)), true ); | 79 | m_packman->executeCommand( OPackage::Info, list, QString::null, |
80 | this, SLOT(slotInfo(const QString &)), true ); | ||
80 | } | 81 | } |
81 | 82 | ||
82 | // Files tab (display only if package is installed) | 83 | // Files tab (display only if package is installed) |
83 | if ( !m_package->versionInstalled().isNull() ) | 84 | if ( !m_package->versionInstalled().isNull() ) |
84 | { | 85 | { |
85 | QWidget *filesWidget = new QWidget( tabWidget ); | 86 | QWidget *filesWidget = new QWidget( tabWidget ); |
86 | QVBoxLayout *filesLayout = new QVBoxLayout( filesWidget, 2, 2 ); | 87 | QVBoxLayout *filesLayout = new QVBoxLayout( filesWidget, 2, 2 ); |
87 | QWhatsThis::add( &m_files, tr( "This area contains a list of files contained in this package." ) ); | 88 | QWhatsThis::add( &m_files, tr( "This area contains a list of files contained in this package." ) ); |
@@ -123,28 +124,29 @@ PackageInfoDlg::~PackageInfoDlg() | |||
123 | m_package->setFiles( m_files.text() ); | 124 | m_package->setFiles( m_files.text() ); |
124 | } | 125 | } |
125 | 126 | ||
126 | void PackageInfoDlg::slotBtnFileScan() | 127 | void PackageInfoDlg::slotBtnFileScan() |
127 | { | 128 | { |
128 | m_files.clear(); | 129 | m_files.clear(); |
129 | 130 | ||
130 | QStringList list( m_package->name() ); | 131 | QStringList list( m_package->name() ); |
131 | m_packman->executeCommand( OPackage::Files, list, QString::null, this, SLOT(slotFiles(char*)), true ); | 132 | m_packman->executeCommand( OPackage::Files, list, QString::null, |
133 | this, SLOT(slotFiles(const QString &)), true ); | ||
132 | 134 | ||
133 | if ( m_retrieveFiles ) | 135 | if ( m_retrieveFiles ) |
134 | m_retrieveFiles->hide(); | 136 | m_retrieveFiles->hide(); |
135 | } | 137 | } |
136 | 138 | ||
137 | void PackageInfoDlg::slotInfo( char *info ) | 139 | void PackageInfoDlg::slotInfo( const QString &info ) |
138 | { | 140 | { |
139 | m_information.append( info ); | 141 | m_information.append( info ); |
140 | } | 142 | } |
141 | 143 | ||
142 | void PackageInfoDlg::slotFiles( char *filelist ) | 144 | void PackageInfoDlg::slotFiles( const QString &filelist ) |
143 | { | 145 | { |
144 | QString str = filelist; | 146 | QString str = filelist; |
145 | 147 | ||
146 | // Skip first line of output ("Package xxx is installed...") | 148 | // Skip first line of output ("Package xxx is installed...") |
147 | if ( str.startsWith( "Package " ) ) | 149 | if ( str.startsWith( "Package " ) ) |
148 | str = str.right( str.length() - str.find( '\n' ) - 1 ); | 150 | str = str.right( str.length() - str.find( '\n' ) - 1 ); |
149 | 151 | ||
150 | m_files.append( str ); | 152 | m_files.append( str ); |
diff --git a/noncore/settings/packagemanager/packageinfodlg.h b/noncore/settings/packagemanager/packageinfodlg.h index d1830de..2962f9a 100644 --- a/noncore/settings/packagemanager/packageinfodlg.h +++ b/noncore/settings/packagemanager/packageinfodlg.h | |||
@@ -54,13 +54,13 @@ private: | |||
54 | 54 | ||
55 | // UI controls | 55 | // UI controls |
56 | QMultiLineEdit m_information; // Multi-line edit to display package information | 56 | QMultiLineEdit m_information; // Multi-line edit to display package information |
57 | QMultiLineEdit m_files; // Multi-line edit to display package file list | 57 | QMultiLineEdit m_files; // Multi-line edit to display package file list |
58 | QPushButton *m_retrieveFiles; // Push button to retrieve file list | 58 | QPushButton *m_retrieveFiles; // Push button to retrieve file list |
59 | 59 | ||
60 | private slots: | 60 | private slots: |
61 | void slotBtnFileScan(); | 61 | void slotBtnFileScan(); |
62 | void slotInfo( char *info ); | 62 | void slotInfo( const QString &info ); |
63 | void slotFiles( char *filelist ); | 63 | void slotFiles( const QString &filelist ); |
64 | }; | 64 | }; |
65 | 65 | ||
66 | #endif | 66 | #endif |