author | drw <drw> | 2004-11-17 00:43:35 (UTC) |
---|---|---|
committer | drw <drw> | 2004-11-17 00:43:35 (UTC) |
commit | 718a7a8ba68e10faa1a22fcc6bdc26e1723b2a40 (patch) (unidiff) | |
tree | a6bf4f10db4141ba7098d76d0444bd4d1dd759c1 /noncore/settings/packagemanager/oipkg.cpp | |
parent | 216434aff5921f3c3c2efc9adb58e653a5d224b3 (diff) | |
download | opie-718a7a8ba68e10faa1a22fcc6bdc26e1723b2a40.zip opie-718a7a8ba68e10faa1a22fcc6bdc26e1723b2a40.tar.gz opie-718a7a8ba68e10faa1a22fcc6bdc26e1723b2a40.tar.bz2 |
Some code clean-up items (thanks to zecke)
Diffstat (limited to 'noncore/settings/packagemanager/oipkg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/packagemanager/oipkg.cpp | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp index 1978ad5..b0cc94d 100644 --- a/noncore/settings/packagemanager/oipkg.cpp +++ b/noncore/settings/packagemanager/oipkg.cpp | |||
@@ -1,37 +1,37 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2003 Dan Williams <drw@handhelds.org> | 4 | Copyright (c) 2003 Dan Williams <drw@handhelds.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
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 <qdir.h> | 34 | #include <qdir.h> |
35 | #include <qfile.h> | 35 | #include <qfile.h> |
36 | #include <qtextstream.h> | 36 | #include <qtextstream.h> |
37 | 37 | ||
@@ -43,24 +43,26 @@ const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing | |||
43 | const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location | 43 | const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location |
44 | 44 | ||
45 | OIpkg *oipkg; | 45 | OIpkg *oipkg; |
46 | 46 | ||
47 | // Ipkg callback functions | 47 | // Ipkg callback functions |
48 | 48 | ||
49 | int fsignalIpkgMessage( ipkg_conf_t *conf, message_level_t level, char *msg ) | 49 | int fsignalIpkgMessage( ipkg_conf_t *conf, message_level_t level, char *msg ) |
50 | { | 50 | { |
51 | if ( conf && ( conf->verbosity < level ) ) | 51 | if ( conf && ( conf->verbosity < level ) ) |
52 | return 0; | 52 | return 0; |
53 | else | 53 | else |
54 | oipkg->ipkgMessage( msg ); | 54 | oipkg->ipkgMessage( msg ); |
55 | |||
56 | return 0; | ||
55 | } | 57 | } |
56 | 58 | ||
57 | char *fIpkgResponse( char */*question*/ ) | 59 | char *fIpkgResponse( char */*question*/ ) |
58 | { | 60 | { |
59 | return 0x0; | 61 | return 0x0; |
60 | } | 62 | } |
61 | 63 | ||
62 | int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ ) | 64 | int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ ) |
63 | { | 65 | { |
64 | oipkg->ipkgStatus( desc ); | 66 | oipkg->ipkgStatus( desc ); |
65 | return 0; | 67 | return 0; |
66 | } | 68 | } |
@@ -344,25 +346,25 @@ OPackageList *OIpkg::installedPackages( const QString &destName, const QString & | |||
344 | while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) | 346 | while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) |
345 | line = t.readLine(); | 347 | line = t.readLine(); |
346 | } | 348 | } |
347 | else | 349 | else |
348 | line = t.readLine(); | 350 | line = t.readLine(); |
349 | } | 351 | } |
350 | 352 | ||
351 | f.close(); | 353 | f.close(); |
352 | 354 | ||
353 | return pl; | 355 | return pl; |
354 | } | 356 | } |
355 | 357 | ||
356 | bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, const QString &destination, | 358 | bool OIpkg::executeCommand( OPackage::Command command, const QStringList ¶meters, const QString &destination, |
357 | const QObject *receiver, const char *slotOutput, bool rawOutput ) | 359 | const QObject *receiver, const char *slotOutput, bool rawOutput ) |
358 | { | 360 | { |
359 | if ( command == OPackage::NotDefined ) | 361 | if ( command == OPackage::NotDefined ) |
360 | return false; | 362 | return false; |
361 | 363 | ||
362 | // Set ipkg run-time options/arguments | 364 | // Set ipkg run-time options/arguments |
363 | m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS ); | 365 | m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS ); |
364 | m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL ); | 366 | m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL ); |
365 | // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE ); | 367 | // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE ); |
366 | m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE ); | 368 | m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE ); |
367 | m_ipkgArgs.verbosity = m_ipkgExecVerbosity; | 369 | m_ipkgArgs.verbosity = m_ipkgExecVerbosity; |
368 | if ( m_ipkgArgs.dest ) | 370 | if ( m_ipkgArgs.dest ) |
@@ -394,54 +396,54 @@ bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, | |||
394 | case OPackage::Update : { | 396 | case OPackage::Update : { |
395 | connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); | 397 | connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); |
396 | ipkg_lists_update( &m_ipkgArgs ); | 398 | ipkg_lists_update( &m_ipkgArgs ); |
397 | }; | 399 | }; |
398 | break; | 400 | break; |
399 | case OPackage::Upgrade : { | 401 | case OPackage::Upgrade : { |
400 | connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); | 402 | connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); |
401 | ipkg_packages_upgrade( &m_ipkgArgs ); | 403 | ipkg_packages_upgrade( &m_ipkgArgs ); |
402 | }; | 404 | }; |
403 | break; | 405 | break; |
404 | case OPackage::Install : { | 406 | case OPackage::Install : { |
405 | connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); | 407 | connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); |
406 | for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) | 408 | for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) |
407 | { | 409 | { |
408 | ipkg_packages_install( &m_ipkgArgs, (*it) ); | 410 | ipkg_packages_install( &m_ipkgArgs, (*it) ); |
409 | } | 411 | } |
410 | }; | 412 | }; |
411 | break; | 413 | break; |
412 | case OPackage::Remove : { | 414 | case OPackage::Remove : { |
413 | connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); | 415 | connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); |
414 | for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) | 416 | for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) |
415 | { | 417 | { |
416 | ipkg_packages_remove( &m_ipkgArgs, (*it), true ); | 418 | ipkg_packages_remove( &m_ipkgArgs, (*it), true ); |
417 | } | 419 | } |
418 | }; | 420 | }; |
419 | break; | 421 | break; |
420 | case OPackage::Download : { | 422 | case OPackage::Download : { |
421 | connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); | 423 | connect( this, SIGNAL(signalIpkgMessage(char*)), receiver, slotOutput ); |
422 | for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) | 424 | for ( QStringList::ConstIterator it = parameters.begin(); it != parameters.end(); ++it ) |
423 | { | 425 | { |
424 | ipkg_packages_download( &m_ipkgArgs, (*it) ); | 426 | ipkg_packages_download( &m_ipkgArgs, (*it) ); |
425 | } | 427 | } |
426 | }; | 428 | }; |
427 | break; | 429 | break; |
428 | case OPackage::Info : { | 430 | case OPackage::Info : { |
429 | connect( this, SIGNAL(signalIpkgStatus(char*)), receiver, slotOutput ); | 431 | connect( this, SIGNAL(signalIpkgStatus(char*)), receiver, slotOutput ); |
430 | ipkg_packages_info( &m_ipkgArgs, (*parameters->begin()), &fIpkgStatus, 0x0 ); | 432 | ipkg_packages_info( &m_ipkgArgs, (*parameters.begin()), &fIpkgStatus, 0x0 ); |
431 | }; | 433 | }; |
432 | break; | 434 | break; |
433 | case OPackage::Files : { | 435 | case OPackage::Files : { |
434 | connect( this, SIGNAL(signalIpkgList(char*)), receiver, slotOutput ); | 436 | connect( this, SIGNAL(signalIpkgList(char*)), receiver, slotOutput ); |
435 | ipkg_package_files( &m_ipkgArgs, (*parameters->begin()), &fIpkgFiles, 0x0 ); | 437 | ipkg_package_files( &m_ipkgArgs, (*parameters.begin()), &fIpkgFiles, 0x0 ); |
436 | }; | 438 | }; |
437 | break; | 439 | break; |
438 | default : break; | 440 | default : break; |
439 | }; | 441 | }; |
440 | 442 | ||
441 | return true; | 443 | return true; |
442 | } | 444 | } |
443 | 445 | ||
444 | void OIpkg::ipkgMessage( char *msg ) | 446 | void OIpkg::ipkgMessage( char *msg ) |
445 | { | 447 | { |
446 | emit signalIpkgMessage( msg ); | 448 | emit signalIpkgMessage( msg ); |
447 | } | 449 | } |