Diffstat (limited to 'noncore/settings/packagemanager/oipkg.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/packagemanager/oipkg.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp index eb07a61..086e91b 100644 --- a/noncore/settings/packagemanager/oipkg.cpp +++ b/noncore/settings/packagemanager/oipkg.cpp | |||
@@ -1,120 +1,118 @@ | |||
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 <stdio.h> | ||
35 | #include <stdlib.h> | 34 | #include <stdlib.h> |
36 | #include <string.h> | 35 | #include <string.h> |
37 | 36 | ||
38 | #include <qdir.h> | 37 | #include <qdir.h> |
39 | #include <qfile.h> | 38 | #include <qfile.h> |
40 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
41 | #include <qtextstream.h> | 40 | #include <qtextstream.h> |
42 | 41 | ||
43 | const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file | 42 | const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file |
44 | const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files | 43 | const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files |
45 | const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists | 44 | const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists |
46 | const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location | 45 | const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location |
47 | 46 | ||
48 | OIpkg *oipkg; | 47 | OIpkg *oipkg; |
49 | 48 | ||
50 | // Ipkg callback functions | 49 | // Ipkg callback functions |
51 | 50 | ||
52 | 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 ) |
53 | { | 52 | { |
54 | oipkg->ipkgMessage( msg ); | 53 | oipkg->ipkgMessage( msg ); |
55 | return 0; | 54 | return 0; |
56 | } | 55 | } |
57 | 56 | ||
58 | char *fIpkgResponse( char */*question*/ ) | 57 | char *fIpkgResponse( char */*question*/ ) |
59 | { | 58 | { |
60 | return 0x0; | 59 | return 0x0; |
61 | } | 60 | } |
62 | 61 | ||
63 | int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ ) | 62 | int fIpkgStatus( char */*name*/, int /*status*/, char *desc, void */*userdata*/ ) |
64 | { | 63 | { |
65 | oipkg->ipkgStatus( desc ); | 64 | oipkg->ipkgStatus( desc ); |
66 | return 0; | 65 | return 0; |
67 | } | 66 | } |
68 | 67 | ||
69 | int fIpkgFiles( char */*name*/, char *desc, char */*version*/, pkg_state_status_t /*status*/, | 68 | int fIpkgFiles( char */*name*/, char *desc, char */*version*/, pkg_state_status_t /*status*/, |
70 | void */*userdata*/ ) | 69 | void */*userdata*/ ) |
71 | { | 70 | { |
72 | printf( "*****List*****\n%s\n", desc ); | ||
73 | oipkg->ipkgList( desc ); | 71 | oipkg->ipkgList( desc ); |
74 | return 0; | 72 | return 0; |
75 | } | 73 | } |
76 | 74 | ||
77 | OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) | 75 | OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) |
78 | : QObject( parent, name ) | 76 | : QObject( parent, name ) |
79 | , m_config( config ) | 77 | , m_config( config ) |
80 | , m_confInfo( NULL ) | 78 | , m_confInfo( NULL ) |
81 | , m_ipkgExecOptions( 0 ) | 79 | , m_ipkgExecOptions( 0 ) |
82 | , m_ipkgExecVerbosity( 1 ) | 80 | , m_ipkgExecVerbosity( 1 ) |
83 | { | 81 | { |
84 | oipkg = this; | 82 | oipkg = this; |
85 | 83 | ||
86 | // Initialize libipkg | 84 | // Initialize libipkg |
87 | if ( ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ) ) | 85 | if ( ipkg_init( &fsignalIpkgMessage, &fIpkgResponse, &m_ipkgArgs ) ) |
88 | QMessageBox::critical( 0, tr( "OIpkg" ), tr( "Error initialing libipkg" ) ); | 86 | QMessageBox::critical( 0, tr( "OIpkg" ), tr( "Error initialing libipkg" ) ); |
89 | 87 | ||
90 | // Default ipkg run-time arguments | 88 | // Default ipkg run-time arguments |
91 | m_ipkgArgs.noaction = false; | 89 | m_ipkgArgs.noaction = false; |
92 | m_ipkgArgs.force_defaults = true; | 90 | m_ipkgArgs.force_defaults = true; |
93 | } | 91 | } |
94 | 92 | ||
95 | OIpkg::~OIpkg() | 93 | OIpkg::~OIpkg() |
96 | { | 94 | { |
97 | // Upon destruction, ensure that items in config list are deleted with list | 95 | // Upon destruction, ensure that items in config list are deleted with list |
98 | if ( m_confInfo ) | 96 | if ( m_confInfo ) |
99 | m_confInfo->setAutoDelete( true ); | 97 | m_confInfo->setAutoDelete( true ); |
100 | 98 | ||
101 | // Free up libipkg resources | 99 | // Free up libipkg resources |
102 | if ( ipkg_deinit( &m_ipkgArgs ) ) | 100 | if ( ipkg_deinit( &m_ipkgArgs ) ) |
103 | QMessageBox::critical( 0, tr( "OIpkg" ), tr( "Error freeing libipkg" ) ); | 101 | QMessageBox::critical( 0, tr( "OIpkg" ), tr( "Error freeing libipkg" ) ); |
104 | } | 102 | } |
105 | 103 | ||
106 | OConfItemList *OIpkg::configItems() | 104 | OConfItemList *OIpkg::configItems() |
107 | { | 105 | { |
108 | // Retrieve all configuration items | 106 | // Retrieve all configuration items |
109 | return filterConfItems(); | 107 | return filterConfItems(); |
110 | } | 108 | } |
111 | 109 | ||
112 | OConfItemList *OIpkg::servers() | 110 | OConfItemList *OIpkg::servers() |
113 | { | 111 | { |
114 | // Retrieve only servers | 112 | // Retrieve only servers |
115 | return filterConfItems( OConfItem::Source ); | 113 | return filterConfItems( OConfItem::Source ); |
116 | } | 114 | } |
117 | 115 | ||
118 | OConfItemList *OIpkg::destinations() | 116 | OConfItemList *OIpkg::destinations() |
119 | { | 117 | { |
120 | // Retrieve only destinations | 118 | // Retrieve only destinations |