summaryrefslogtreecommitdiff
authordrw <drw>2004-01-20 19:33:27 (UTC)
committer drw <drw>2004-01-20 19:33:27 (UTC)
commitda0557836c852fade427c03ad59d349f3294bbb8 (patch) (unidiff)
tree979907c816c09f3b3a290b58eac353094cbcd90e
parent996826e77a8f96ada424814716178e65caba9287 (diff)
downloadopie-da0557836c852fade427c03ad59d349f3294bbb8.zip
opie-da0557836c852fade427c03ad59d349f3294bbb8.tar.gz
opie-da0557836c852fade427c03ad59d349f3294bbb8.tar.bz2
Convert to use libipkg
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/.cvsignore2
-rw-r--r--noncore/settings/packagemanager/ChangeLog7
-rw-r--r--noncore/settings/packagemanager/installdlg.cpp76
-rw-r--r--noncore/settings/packagemanager/installdlg.h4
-rw-r--r--noncore/settings/packagemanager/mainwindow.cpp6
-rw-r--r--noncore/settings/packagemanager/oipkg.cpp188
-rw-r--r--noncore/settings/packagemanager/oipkg.h17
-rw-r--r--noncore/settings/packagemanager/opackagemanager.cpp11
-rw-r--r--noncore/settings/packagemanager/opackagemanager.h4
-rw-r--r--noncore/settings/packagemanager/opie-packagemanager.control2
-rw-r--r--noncore/settings/packagemanager/packagemanager.pro9
11 files changed, 135 insertions, 191 deletions
diff --git a/noncore/settings/packagemanager/.cvsignore b/noncore/settings/packagemanager/.cvsignore
index 4183697..9f2b524 100644
--- a/noncore/settings/packagemanager/.cvsignore
+++ b/noncore/settings/packagemanager/.cvsignore
@@ -1,3 +1,5 @@
1Makefile* 1Makefile*
2moc* 2moc*
3.moc* 3.moc*
4.obj
5.moc
diff --git a/noncore/settings/packagemanager/ChangeLog b/noncore/settings/packagemanager/ChangeLog
index a01c8b3..1ba12af 100644
--- a/noncore/settings/packagemanager/ChangeLog
+++ b/noncore/settings/packagemanager/ChangeLog
@@ -1,4 +1,9 @@
12004-01-nn Dan Williams <drw@handhelds.org> 12004-01-20 Dan Williams <drw@handhelds.org>
2
3 * Released version 0.2.0
4 * Converted to use libipkg in place of spawning ipkg process
5
62004-01-13 Dan Williams <drw@handhelds.org>
2 7
3 * Released version 0.1.0 8 * Released version 0.1.0
4 * Initial check-in of new package management client to eventually replace AQPkg 9 * Initial check-in of new package management client to eventually replace AQPkg
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp
index 980d5eb..6a9ccbd 100644
--- a/noncore/settings/packagemanager/installdlg.cpp
+++ b/noncore/settings/packagemanager/installdlg.cpp
@@ -1,309 +1,299 @@
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             .=l. 5             .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This file is free software; you can 7 _;:,     .>    :=|. This file is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public 9:`=1 )Y*s>-.--   : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This file is distributed in the hope that 14    .i_,=:_.      -<s. This file is distributed in the hope that
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 "installdlg.h" 30#include "installdlg.h"
31 31
32#include <sys/vfs.h> 32#include <sys/vfs.h>
33 33
34#include <qapplication.h> 34#include <qapplication.h>
35#include <qcombobox.h> 35#include <qcombobox.h>
36#include <qfileinfo.h> 36#include <qfileinfo.h>
37#include <qgroupbox.h> 37#include <qgroupbox.h>
38#include <qlabel.h> 38#include <qlabel.h>
39#include <qlayout.h> 39#include <qlayout.h>
40#include <qmap.h> 40#include <qmap.h>
41#include <qmultilineedit.h> 41#include <qmultilineedit.h>
42#include <qpushbutton.h> 42#include <qpushbutton.h>
43 43
44#include <qpe/fileselector.h> 44#include <qpe/fileselector.h>
45#include <qpe/resource.h> 45#include <qpe/resource.h>
46#include <qpe/storage.h> 46#include <qpe/storage.h>
47 47
48#include <opie/ofiledialog.h> 48#include <opie/ofiledialog.h>
49 49
50#include "opackagemanager.h" 50#include "opackagemanager.h"
51 51
52InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, bool showDestInfo, 52InstallDlg::InstallDlg( QWidget *parent, OPackageManager *pm, const QString &caption, bool showDestInfo,
53 OPackage::Command command1, QStringList *packages1, 53 OPackage::Command command1, QStringList *packages1,
54 OPackage::Command command2, QStringList *packages2, 54 OPackage::Command command2, QStringList *packages2,
55 OPackage::Command command3, QStringList *packages3 ) 55 OPackage::Command command3, QStringList *packages3 )
56 : QWidget( 0x0 ) 56 : QWidget( 0x0 )
57 , m_packman( pm ) 57 , m_packman( pm )
58 , m_numCommands( 0 ) 58 , m_numCommands( 0 )
59 , m_currCommand( 0 ) 59 , m_currCommand( 0 )
60{ 60{
61 // Save command/package list information 61 // Save command/package list information
62 if ( command1 != OPackage::NotDefined ) 62 if ( command1 != OPackage::NotDefined )
63 { 63 {
64 m_command[ m_numCommands ] = command1; 64 m_command[ m_numCommands ] = command1;
65 m_packages[ m_numCommands ] = packages1; 65 m_packages[ m_numCommands ] = packages1;
66 ++m_numCommands; 66 ++m_numCommands;
67 } 67 }
68 if ( command2 != OPackage::NotDefined ) 68 if ( command2 != OPackage::NotDefined )
69 { 69 {
70 m_command[ m_numCommands ] = command2; 70 m_command[ m_numCommands ] = command2;
71 m_packages[ m_numCommands ] = packages2; 71 m_packages[ m_numCommands ] = packages2;
72 ++m_numCommands; 72 ++m_numCommands;
73 } 73 }
74 if ( command3 != OPackage::NotDefined ) 74 if ( command3 != OPackage::NotDefined )
75 { 75 {
76 m_command[ m_numCommands ] = command3; 76 m_command[ m_numCommands ] = command3;
77 m_packages[ m_numCommands ] = packages3; 77 m_packages[ m_numCommands ] = packages3;
78 ++m_numCommands; 78 ++m_numCommands;
79 } 79 }
80 80
81 // Initialize UI 81 // Initialize UI
82 if ( parent ) 82 if ( parent )
83 parent->setCaption( caption ); 83 parent->setCaption( caption );
84 84
85 QGridLayout *layout = new QGridLayout( this, 4, 2, 2, 4 ); 85 QGridLayout *layout = new QGridLayout( this, 4, 2, 2, 4 );
86 86
87 if ( showDestInfo ) 87 if ( showDestInfo )
88 { 88 {
89 QLabel *label = new QLabel( tr( "Destination" ), this ); 89 QLabel *label = new QLabel( tr( "Destination" ), this );
90 layout->addWidget( label, 0, 0 ); 90 layout->addWidget( label, 0, 0 );
91 m_destination = new QComboBox( this ); 91 m_destination = new QComboBox( this );
92 m_destination->insertStringList( *(m_packman->destinations()) ); 92 m_destination->insertStringList( *(m_packman->destinations()) );
93 layout->addWidget( m_destination, 0, 1 ); 93 layout->addWidget( m_destination, 0, 1 );
94 connect( m_destination, SIGNAL(highlighted(const QString&)), 94 connect( m_destination, SIGNAL(highlighted(const QString&)),
95 this, SLOT(slotDisplayAvailSpace(const QString&)) ); 95 this, SLOT(slotDisplayAvailSpace(const QString&)) );
96 96
97 label = new QLabel( tr( "Space Avail" ), this ); 97 label = new QLabel( tr( "Space Avail" ), this );
98 layout->addWidget( label, 1, 0 ); 98 layout->addWidget( label, 1, 0 );
99 m_availSpace = new QLabel( this ); 99 m_availSpace = new QLabel( this );
100 layout->addWidget( m_availSpace, 1, 1 ); 100 layout->addWidget( m_availSpace, 1, 1 );
101 101
102 // TODO - select correct destination 102 // TODO - select correct destination
103 slotDisplayAvailSpace( m_destination->currentText() ); 103 slotDisplayAvailSpace( m_destination->currentText() );
104 } 104 }
105 else 105 else
106 { 106 {
107 m_destination = 0x0; 107 m_destination = 0x0;
108 m_availSpace = 0x0; 108 m_availSpace = 0x0;
109 } 109 }
110 110
111 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); 111 QGroupBox *groupBox = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this );
112 groupBox->layout()->setSpacing( 0 ); 112 groupBox->layout()->setSpacing( 0 );
113 groupBox->layout()->setMargin( 4 ); 113 groupBox->layout()->setMargin( 4 );
114 114
115 QVBoxLayout *groupBoxLayout = new QVBoxLayout( groupBox->layout() ); 115 QVBoxLayout *groupBoxLayout = new QVBoxLayout( groupBox->layout() );
116 m_output = new QMultiLineEdit( groupBox ); 116 m_output = new QMultiLineEdit( groupBox );
117 m_output->setReadOnly( true ); 117 m_output->setReadOnly( true );
118 groupBoxLayout->addWidget( m_output ); 118 groupBoxLayout->addWidget( m_output );
119 layout->addMultiCellWidget( groupBox, 2, 2, 0, 1 ); 119 layout->addMultiCellWidget( groupBox, 2, 2, 0, 1 );
120 120
121 m_btnStart = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ), tr( "Start" ), this ); 121 m_btnStart = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ), tr( "Start" ), this );
122 layout->addWidget( m_btnStart, 3, 0 ); 122 layout->addWidget( m_btnStart, 3, 0 );
123 connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) ); 123 connect( m_btnStart, SIGNAL(clicked()), this, SLOT(slotBtnStart()) );
124 124
125 m_btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this ); 125 m_btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this );
126 layout->addWidget( m_btnOptions, 3, 1 ); 126 layout->addWidget( m_btnOptions, 3, 1 );
127 connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) ); 127 connect( m_btnOptions, SIGNAL( clicked() ), this, SLOT(slotBtnOptions()) );
128 128
129 // Display packages being acted upon in output widget 129 // Display packages being acted upon in output widget
130 for( int i = 0; i < m_numCommands; i++ ) 130 for( int i = 0; i < m_numCommands; i++ )
131 { 131 {
132 if ( m_packages[ i ] ) 132 if ( m_packages[ i ] )
133 { 133 {
134 QString lineStr = tr( "Packages to " ); 134 QString lineStr = tr( "Packages to " );
135 135
136 switch( m_command[ i ] ) 136 switch( m_command[ i ] )
137 { 137 {
138 case OPackage::Install : lineStr.append( tr( "install" ) ); 138 case OPackage::Install : lineStr.append( tr( "install" ) );
139 break; 139 break;
140 case OPackage::Remove : lineStr.append( tr( "remove" ) ); 140 case OPackage::Remove : lineStr.append( tr( "remove" ) );
141 break; 141 break;
142 case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) ); 142 case OPackage::Upgrade : lineStr.append( tr( "upgrade" ) );
143 break; 143 break;
144 default : 144 default :
145 break; 145 break;
146 }; 146 };
147 lineStr.append( ":\n" ); 147 lineStr.append( ":\n" );
148 148
149 for ( QStringList::Iterator it = m_packages[ i ]->begin(); it != m_packages[ i ]->end(); ++it ) 149 for ( QStringList::Iterator it = m_packages[ i ]->begin(); it != m_packages[ i ]->end(); ++it )
150 { 150 {
151 lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) ); 151 lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) );
152 } 152 }
153 153
154 m_output->append( lineStr ); 154 m_output->append( lineStr );
155 } 155 }
156 } 156 }
157 157
158 m_output->append( tr( "Press the start button to begin.\n" ) ); 158 m_output->append( tr( "Press the start button to begin.\n" ) );
159 m_output->setCursorPosition( m_output->numLines(), 0 ); 159 m_output->setCursorPosition( m_output->numLines(), 0 );
160 160
161} 161}
162 162
163InstallDlg::~InstallDlg() 163InstallDlg::~InstallDlg()
164{ 164{
165 for( int i = 0; i < m_numCommands; i++ ) 165 for( int i = 0; i < m_numCommands; i++ )
166 { 166 {
167 if ( m_packages[ i ] ) 167 if ( m_packages[ i ] )
168 delete m_packages[ i ]; 168 delete m_packages[ i ];
169 } 169 }
170} 170}
171 171
172void InstallDlg::slotDisplayAvailSpace( const QString &destination ) 172void InstallDlg::slotDisplayAvailSpace( const QString &destination )
173{ 173{
174 // If available space is not displayed, exit 174 // If available space is not displayed, exit
175 if ( !m_availSpace ) 175 if ( !m_availSpace )
176 return; 176 return;
177 177
178 QString space = tr( "Unknown" ); 178 QString space = tr( "Unknown" );
179 179
180 // Get destination 180 // Get destination
181 OConfItem *dest = m_packman->findConfItem( OConfItem::Destination, destination ); 181 OConfItem *dest = m_packman->findConfItem( OConfItem::Destination, destination );
182 182
183 if ( dest ) 183 if ( dest )
184 { 184 {
185 // Calculate available space 185 // Calculate available space
186 struct statfs fs; 186 struct statfs fs;
187 if ( !statfs( dest->value(), &fs ) ) 187 if ( !statfs( dest->value(), &fs ) )
188 { 188 {
189 long mult = fs.f_bsize / 1024; 189 long mult = fs.f_bsize / 1024;
190 long div = 1024 / fs.f_bsize; 190 long div = 1024 / fs.f_bsize;
191 191
192 if ( !mult ) mult = 1; 192 if ( !mult ) mult = 1;
193 if ( !div ) div = 1; 193 if ( !div ) div = 1;
194 long avail = fs.f_bavail * mult / div; 194 long avail = fs.f_bavail * mult / div;
195 195
196 space = tr( "%1 Kb" ).arg( avail ); 196 space = tr( "%1 Kb" ).arg( avail );
197 } 197 }
198 } 198 }
199 199
200 // Display available space 200 // Display available space
201 m_availSpace->setText( space ); 201 m_availSpace->setText( space );
202} 202}
203 203
204void InstallDlg::slotBtnStart() 204void InstallDlg::slotBtnStart()
205{ 205{
206 QString btnText = m_btnStart->text(); 206 QString btnText = m_btnStart->text();
207 if ( btnText == tr( "Abort" ) ) 207 if ( btnText == tr( "Abort" ) )
208 { 208 {
209 // Stop execution of current command and prevent any others from executing 209 // Prevent unexecuted commands from executing
210 m_packman->abortCommand();
211 m_currCommand = 999; 210 m_currCommand = 999;
212 211
213 // Allow user to close dialog 212 // Allow user to close dialog
214 m_btnStart->setText( tr( "Close" ) ); 213 m_btnStart->setText( tr( "Close" ) );
215 m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); 214 m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) );
216 return; 215 return;
217 } 216 }
218 else if ( btnText == tr( "Close" ) ) 217 else if ( btnText == tr( "Close" ) )
219 { 218 {
220 // TODO - force reload of package data 219 // TODO - force reload of package data
221 emit closeInstallDlg(); 220 emit closeInstallDlg();
222 return; 221 return;
223 } 222 }
224 223
225 // Start was clicked, execute first command 224 // Start was clicked, start executing
226 m_btnOptions->setEnabled( false ); 225 m_btnOptions->setEnabled( false );
227 m_btnStart->setText( tr( "Abort" ) ); 226 if ( m_numCommands > 1 )
228 m_btnStart->setIconSet( Resource::loadPixmap( "close" ) ); 227 {
228 m_btnStart->setText( tr( "Abort" ) );
229 m_btnStart->setIconSet( Resource::loadPixmap( "close" ) );
230 }
231 else
232 {
233 m_btnStart->setEnabled( false );
234 }
229 235
230 QString dest; 236 QString dest;
231 if ( m_destination ) 237 if ( m_destination )
232 dest = m_destination->currentText(); 238 dest = m_destination->currentText();
233 m_packman->executeCommand( m_command[ 0 ], m_packages[ 0 ], dest, this, 239
234 SLOT(slotOutput(OProcess*,char*,int)), SLOT(slotErrors(OProcess*,char*,int)), 240 for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ )
235 SLOT(slotFinished(OProcess*)), true ); 241 {
242 // Execute next command
243 m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest,
244 this, SLOT(slotOutput(char*)), true );
245 }
246
247 // All commands executed, allow user to close dialog
248 m_btnStart->setEnabled( true );
249 m_btnStart->setText( tr( "Close" ) );
250 m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) );
251
252 m_btnOptions->setEnabled( true );
253 m_btnOptions->setText( tr( "Save output" ) );
254 m_btnOptions->setIconSet( Resource::loadPixmap( "save" ) );
236} 255}
237 256
238void InstallDlg::slotBtnOptions() 257void InstallDlg::slotBtnOptions()
239{ 258{
240 QString btnText = m_btnOptions->text(); 259 QString btnText = m_btnOptions->text();
241 if ( btnText == tr( "Options" ) ) 260 if ( btnText == tr( "Options" ) )
242 { 261 {
243 // Display configuration dialog (only options tab is enabled) 262 // Display configuration dialog (only options tab is enabled)
244 m_packman->configureDlg( true ); 263 m_packman->configureDlg( true );
245 return; 264 return;
246 } 265 }
247 266
248 // Save output was clicked 267 // Save output was clicked
249 QMap<QString, QStringList> map; 268 QMap<QString, QStringList> map;
250 map.insert( tr( "All" ), QStringList() ); 269 map.insert( tr( "All" ), QStringList() );
251 QStringList text; 270 QStringList text;
252 text << "text/*"; 271 text << "text/*";
253 map.insert(tr( "Text" ), text ); 272 map.insert(tr( "Text" ), text );
254 text << "*"; 273 text << "*";
255 map.insert( tr( "All" ), text ); 274 map.insert( tr( "All" ), text );
256 275
257 QString filename = OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); 276 QString filename = OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map );
258 if( !filename.isEmpty() ) 277 if( !filename.isEmpty() )
259 { 278 {
260 QString currentFileName = QFileInfo( filename ).fileName(); 279 QString currentFileName = QFileInfo( filename ).fileName();
261 DocLnk doc; 280 DocLnk doc;
262 doc.setType( "text/plain" ); 281 doc.setType( "text/plain" );
263 doc.setFile( filename ); 282 doc.setFile( filename );
264 doc.setName( currentFileName ); 283 doc.setName( currentFileName );
265 FileManager fm; 284 FileManager fm;
266 fm.saveFile( doc, m_output->text() ); 285 fm.saveFile( doc, m_output->text() );
267 } 286 }
268} 287}
269 288
270void InstallDlg::slotOutput( OProcess */*process*/, char *buffer, int buffLen ) 289void InstallDlg::slotOutput( char *msg )
271{ 290{
272 QString lineStr = buffer; 291 // Allow processing of other events
273 if ( lineStr[buffLen-1] == '\n' ) 292 qApp->processEvents();
274 lineStr.truncate( buffLen - 1 );
275 m_output->append( lineStr );
276 m_output->setCursorPosition( m_output->numLines(), 0 );
277}
278 293
279void InstallDlg::slotErrors( OProcess */*process*/, char *buffer, int buffLen ) 294 QString lineStr = msg;
280{ 295 if ( lineStr[lineStr.length()-1] == '\n' )
281 QString lineStr = buffer; 296 lineStr.truncate( lineStr.length() - 1 );
282 if ( lineStr[buffLen-1] == '\n' )
283 lineStr.truncate( buffLen - 1 );
284 m_output->append( lineStr ); 297 m_output->append( lineStr );
285 m_output->setCursorPosition( m_output->numLines(), 0 ); 298 m_output->setCursorPosition( m_output->numLines(), 0 );
286} 299}
287
288void InstallDlg::slotFinished( OProcess */*process*/ )
289{
290 ++m_currCommand;
291 if ( m_currCommand < m_numCommands )
292 {
293 // More commands left, execute next one
294 m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], m_destination->currentText(),
295 this, SLOT(slotOutput(OProcess*,char*,int)),
296 SLOT(slotErrors(OProcess*,char*,int)),
297 SLOT(slotFinished(OProcess*)), true );
298 }
299 else
300 {
301 // All commands executed, allow user to close dialog
302 m_btnStart->setText( tr( "Close" ) );
303 m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) );
304
305 m_btnOptions->setEnabled( true );
306 m_btnOptions->setText( tr( "Save output" ) );
307 m_btnOptions->setIconSet( Resource::loadPixmap( "save" ) );
308 }
309}
diff --git a/noncore/settings/packagemanager/installdlg.h b/noncore/settings/packagemanager/installdlg.h
index 8075f1d..7efe721 100644
--- a/noncore/settings/packagemanager/installdlg.h
+++ b/noncore/settings/packagemanager/installdlg.h
@@ -1,89 +1,87 @@
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             .=l. 5             .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This file is free software; you can 7 _;:,     .>    :=|. This file is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public 9:`=1 )Y*s>-.--   : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This file is distributed in the hope that 14    .i_,=:_.      -<s. This file is distributed in the hope that
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#ifndef INSTALLDLG_H 30#ifndef INSTALLDLG_H
31#define INSTALLDLG_H 31#define INSTALLDLG_H
32 32
33#include <qwidget.h> 33#include <qwidget.h>
34 34
35#include <opie/oprocess.h> 35#include <opie/oprocess.h>
36 36
37#include "opackage.h" 37#include "opackage.h"
38 38
39class QComboBox; 39class QComboBox;
40class QLabel; 40class QLabel;
41class QMultiLineEdit; 41class QMultiLineEdit;
42class QPushButton; 42class QPushButton;
43 43
44class OPackageManager; 44class OPackageManager;
45 45
46class InstallDlg : public QWidget 46class InstallDlg : public QWidget
47{ 47{
48 Q_OBJECT 48 Q_OBJECT
49 49
50public: 50public:
51 InstallDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &caption = QString::null, 51 InstallDlg( QWidget *parent = 0x0, OPackageManager *pm = 0x0, const QString &caption = QString::null,
52 bool showDestInfo = true, 52 bool showDestInfo = true,
53 OPackage::Command command1 = OPackage::NotDefined, QStringList *packages1 = 0x0, 53 OPackage::Command command1 = OPackage::NotDefined, QStringList *packages1 = 0x0,
54 OPackage::Command command2 = OPackage::NotDefined, QStringList *packages2 = 0x0, 54 OPackage::Command command2 = OPackage::NotDefined, QStringList *packages2 = 0x0,
55 OPackage::Command command3 = OPackage::NotDefined, QStringList *packages3 = 0x0 ); 55 OPackage::Command command3 = OPackage::NotDefined, QStringList *packages3 = 0x0 );
56 ~InstallDlg(); 56 ~InstallDlg();
57 57
58private: 58private:
59 OPackageManager *m_packman; // Pointer to application instance of package manager 59 OPackageManager *m_packman; // Pointer to application instance of package manager
60 60
61 // UI controls 61 // UI controls
62 QComboBox *m_destination; // Destination selection list 62 QComboBox *m_destination; // Destination selection list
63 QLabel *m_availSpace; // Text label to display available space on selected destination 63 QLabel *m_availSpace; // Text label to display available space on selected destination
64 QMultiLineEdit *m_output; // Multi-line edit to display status 64 QMultiLineEdit *m_output; // Multi-line edit to display status
65 QPushButton *m_btnStart; // Start/abort/close button 65 QPushButton *m_btnStart; // Start/abort/close button
66 QPushButton *m_btnOptions; // Installation options button 66 QPushButton *m_btnOptions; // Installation options button
67 67
68 // Commands and packages to execute 68 // Commands and packages to execute
69 int m_numCommands; // Number of commands to be executed 69 int m_numCommands; // Number of commands to be executed
70 int m_currCommand; // Number of currently executing command 70 int m_currCommand; // Number of currently executing command
71 OPackage::Command m_command[3]; // List of commands to be executed 71 OPackage::Command m_command[3]; // List of commands to be executed
72 QStringList *m_packages[3]; // Lists of package names associated to commands (m_command[]) 72 QStringList *m_packages[3]; // Lists of package names associated to commands (m_command[])
73 73
74private slots: 74private slots:
75 // UI control slots 75 // UI control slots
76 void slotDisplayAvailSpace( const QString &destination ); 76 void slotDisplayAvailSpace( const QString &destination );
77 void slotBtnStart(); 77 void slotBtnStart();
78 void slotBtnOptions(); 78 void slotBtnOptions();
79 79
80 // Execution slots 80 // Execution slots
81 void slotOutput( OProcess *process, char *buffer, int buffLen ); 81 void slotOutput( char *msg );
82 void slotErrors( OProcess *process, char *buffer, int buffLen );
83 void slotFinished( OProcess *process );
84 82
85signals: 83signals:
86 void closeInstallDlg(); 84 void closeInstallDlg();
87}; 85};
88 86
89#endif 87#endif
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp
index 311b5fc..4611404 100644
--- a/noncore/settings/packagemanager/mainwindow.cpp
+++ b/noncore/settings/packagemanager/mainwindow.cpp
@@ -1,667 +1,665 @@
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             .=l. 5             .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This file is free software; you can 7 _;:,     .>    :=|. This file is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public 9:`=1 )Y*s>-.--   : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This file is distributed in the hope that 14    .i_,=:_.      -<s. This file is distributed in the hope that
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 <qaction.h> 30#include <qaction.h>
31#include <qlayout.h> 31#include <qlayout.h>
32#include <qlineedit.h> 32#include <qlineedit.h>
33#include <qmenubar.h> 33#include <qmenubar.h>
34#include <qmessagebox.h> 34#include <qmessagebox.h>
35#include <qpopupmenu.h> 35#include <qpopupmenu.h>
36#include <qtimer.h> 36#include <qtimer.h>
37#include <qtoolbar.h> 37#include <qtoolbar.h>
38#include <qwhatsthis.h> 38#include <qwhatsthis.h>
39 39
40#include <qpe/qpeapplication.h> 40#include <qpe/qpeapplication.h>
41#include <qpe/resource.h> 41#include <qpe/resource.h>
42 42
43#include "mainwindow.h" 43#include "mainwindow.h"
44#include "installdlg.h" 44#include "installdlg.h"
45#include "filterdlg.h" 45#include "filterdlg.h"
46#include "promptdlg.h" 46#include "promptdlg.h"
47 47
48MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl ) 48MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl )
49 : QMainWindow( parent, name, fl || WStyle_ContextHelp ) 49 : QMainWindow( parent, name, fl || WStyle_ContextHelp )
50 , m_config( "packman" ) 50 , m_config( "packman" )
51 , m_packman( &m_config, this ) 51 , m_packman( &m_config, this )
52 , m_menuBar( this ) 52 , m_menuBar( this )
53 , m_toolBar( this ) 53 , m_toolBar( this )
54 , m_findBar( this ) 54 , m_findBar( this )
55 , m_widgetStack( this ) 55 , m_widgetStack( this )
56 , m_packageList( this ) 56 , m_packageList( this )
57 , m_statusWidget( this ) 57 , m_statusWidget( this )
58 , m_statusText( &m_statusWidget ) 58 , m_statusText( &m_statusWidget )
59 , m_statusBar( &m_statusWidget ) 59 , m_statusBar( &m_statusWidget )
60 , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) ) 60 , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) )
61 , m_iconInstalled( Resource::loadPixmap( "installed" ) ) 61 , m_iconInstalled( Resource::loadPixmap( "installed" ) )
62 , m_iconNull( m_iconUpdated.size() ) 62 , m_iconNull( m_iconUpdated.size() )
63 , m_filterName( QString::null ) 63 , m_filterName( QString::null )
64 , m_filterServer( QString::null ) 64 , m_filterServer( QString::null )
65 , m_filterDest( QString::null ) 65 , m_filterDest( QString::null )
66 , m_filterStatus( OPackageManager::NotDefined ) 66 , m_filterStatus( OPackageManager::NotDefined )
67 , m_filterCategory( QString::null ) 67 , m_filterCategory( QString::null )
68 68
69{ 69{
70// setCaption( tr( "Package Manager" ) ); 70// setCaption( tr( "Package Manager" ) );
71 71
72 m_iconNull.fill( colorGroup().base() ); 72 m_iconNull.fill( colorGroup().base() );
73 73
74 connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) ); 74 connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) );
75 75
76 // Initialize widget stack, package list and status widget 76 // Initialize widget stack, package list and status widget
77 initStatusWidget(); 77 initStatusWidget();
78 initPackageList(); 78 initPackageList();
79 79
80 m_widgetStack.addWidget( &m_statusWidget, 2 ); 80 m_widgetStack.addWidget( &m_statusWidget, 2 );
81 m_widgetStack.addWidget( &m_packageList, 1 ); 81 m_widgetStack.addWidget( &m_packageList, 1 );
82 setCentralWidget( &m_widgetStack ); 82 setCentralWidget( &m_widgetStack );
83 83
84 // Initialize remaining user interface items 84 // Initialize remaining user interface items
85 initUI(); 85 initUI();
86 86
87 // Initialize package information 87 // Initialize package information
88 QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) ); 88 QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) );
89} 89}
90 90
91void MainWindow::closeEvent( QCloseEvent *event ) 91void MainWindow::closeEvent( QCloseEvent *event )
92{ 92{
93 // Close app only if either the package or status widgets are currently active 93 // Close app only if either the package or status widgets are currently active
94 bool close = m_widgetStack.visibleWidget() == &m_packageList || 94 bool close = m_widgetStack.visibleWidget() == &m_packageList ||
95 m_widgetStack.visibleWidget() == &m_statusWidget; 95 m_widgetStack.visibleWidget() == &m_statusWidget;
96 if ( close ) 96 if ( close )
97 { 97 {
98 // TODO - write out application configuration settings 98 // TODO - write out application configuration settings
99 99
100 // Write out package manager configuration settings 100 // Write out package manager configuration settings
101 m_packman.saveSettings(); 101 m_packman.saveSettings();
102 event->accept(); 102 event->accept();
103 } 103 }
104 else 104 else
105 { 105 {
106 delete m_widgetStack.visibleWidget(); 106 delete m_widgetStack.visibleWidget();
107 m_widgetStack.raiseWidget( &m_packageList ); 107 m_widgetStack.raiseWidget( &m_packageList );
108 event->ignore(); 108 event->ignore();
109 } 109 }
110} 110}
111 111
112void MainWindow::initPackageList() 112void MainWindow::initPackageList()
113{ 113{
114 m_packageList.addColumn( tr( "Packages" ) ); 114 m_packageList.addColumn( tr( "Packages" ) );
115 QWhatsThis::add( &m_packageList, tr( "This is a listing of all packages.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); 115 QWhatsThis::add( &m_packageList, tr( "This is a listing of all packages.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) );
116 QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold ); 116 QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold );
117} 117}
118 118
119void MainWindow::initStatusWidget() 119void MainWindow::initStatusWidget()
120{ 120{
121 QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 ); 121 QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 );
122 122
123 m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); 123 m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
124 layout->addWidget( &m_statusText ); 124 layout->addWidget( &m_statusText );
125 125
126 connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) ); 126 connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) );
127 connect( &m_packman, SIGNAL(statusText(const QString &)), this, SLOT(slotStatusText(const QString &)) ); 127 connect( &m_packman, SIGNAL(statusText(const QString &)), this, SLOT(slotStatusText(const QString &)) );
128 connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) ); 128 connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) );
129 129
130 layout->addWidget( &m_statusBar ); 130 layout->addWidget( &m_statusBar );
131} 131}
132 132
133void MainWindow::initUI() 133void MainWindow::initUI()
134{ 134{
135 // Build menu and tool bars 135 // Build menu and tool bars
136 setToolBarsMovable( false ); 136 setToolBarsMovable( false );
137 137
138 m_menuBar.setHorizontalStretchable( true ); 138 m_menuBar.setHorizontalStretchable( true );
139 QMenuBar *mb = new QMenuBar( &m_menuBar ); 139 QMenuBar *mb = new QMenuBar( &m_menuBar );
140 mb->setMargin( 0 ); 140 mb->setMargin( 0 );
141 141
142 // Find toolbar 142 // Find toolbar
143 addToolBar( &m_findBar, QMainWindow::Top, true ); 143 addToolBar( &m_findBar, QMainWindow::Top, true );
144 m_findBar.setHorizontalStretchable( true ); 144 m_findBar.setHorizontalStretchable( true );
145 m_findEdit = new QLineEdit( &m_findBar ); 145 m_findEdit = new QLineEdit( &m_findBar );
146 QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) ); 146 QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) );
147 m_findBar.setStretchableWidget( m_findEdit ); 147 m_findBar.setStretchableWidget( m_findEdit );
148 connect( m_findEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotFindChanged(const QString &)) ); 148 connect( m_findEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotFindChanged(const QString &)) );
149 149
150 // Packages menu 150 // Packages menu
151 QPopupMenu *popup = new QPopupMenu( this ); 151 QPopupMenu *popup = new QPopupMenu( this );
152 152
153 QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 ); 153 QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 );
154 a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); 154 a->setWhatsThis( tr( "Click here to update package lists from servers." ) );
155 connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); 155 connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) );
156 a->addTo( popup ); 156 a->addTo( popup );
157 a->addTo( &m_toolBar ); 157 a->addTo( &m_toolBar );
158 158
159 QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 ); 159 QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 );
160 actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); 160 actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) );
161 connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); 161 connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) );
162 actionUpgrade->addTo( popup ); 162 actionUpgrade->addTo( popup );
163 actionUpgrade->addTo( &m_toolBar ); 163 actionUpgrade->addTo( &m_toolBar );
164 164
165 // Ipkg implementation does not seem to work currently? (not working in aqpkg either) 165/*
166 /*
167 QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); 166 QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" );
168 QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); 167 QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" );
169 QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); 168 QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 );
170 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); 169 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) );
171 connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); 170 connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) );
172 actionDownload->addTo( popup ); 171 actionDownload->addTo( popup );
173 actionDownload->addTo( &m_toolBar ); 172 actionDownload->addTo( &m_toolBar );
174 */ 173*/
175 174
176 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); 175 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 );
177 a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); 176 a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) );
178 connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); 177 connect( a, SIGNAL(activated()), this, SLOT(slotApply()) );
179 a->addTo( popup ); 178 a->addTo( popup );
180 a->addTo( &m_toolBar ); 179 a->addTo( &m_toolBar );
181 180
182 popup->insertSeparator(); 181 popup->insertSeparator();
183 182
184 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); 183 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 );
185 a->setWhatsThis( tr( "Click here to configure this application." ) ); 184 a->setWhatsThis( tr( "Click here to configure this application." ) );
186 connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); 185 connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) );
187 a->addTo( popup ); 186 a->addTo( popup );
188 mb->insertItem( tr( "Actions" ), popup ); 187 mb->insertItem( tr( "Actions" ), popup );
189 188
190 // View menu 189 // View menu
191 popup = new QPopupMenu( this ); 190 popup = new QPopupMenu( this );
192 191
193 m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); 192 m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 );
194 m_actionShowNotInstalled->setToggleAction( true ); 193 m_actionShowNotInstalled->setToggleAction( true );
195 m_actionShowNotInstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); 194 m_actionShowNotInstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) );
196 connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); 195 connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) );
197 m_actionShowNotInstalled->addTo( popup ); 196 m_actionShowNotInstalled->addTo( popup );
198 197
199 m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); 198 m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 );
200 m_actionShowInstalled->setToggleAction( true ); 199 m_actionShowInstalled->setToggleAction( true );
201 m_actionShowInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); 200 m_actionShowInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) );
202 connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); 201 connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) );
203 m_actionShowInstalled->addTo( popup ); 202 m_actionShowInstalled->addTo( popup );
204 203
205 m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); 204 m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 );
206 m_actionShowUpdated->setToggleAction( true ); 205 m_actionShowUpdated->setToggleAction( true );
207 m_actionShowUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); 206 m_actionShowUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) );
208 connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); 207 connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) );
209 m_actionShowUpdated->addTo( popup ); 208 m_actionShowUpdated->addTo( popup );
210 209
211 popup->insertSeparator(); 210 popup->insertSeparator();
212 211
213 a = new QAction( tr( "Configure filter" ), QString::null, 0, this, 0 ); 212 a = new QAction( tr( "Configure filter" ), QString::null, 0, this, 0 );
214 a->setWhatsThis( tr( "Click here to change package filter criteria." ) ); 213 a->setWhatsThis( tr( "Click here to change package filter criteria." ) );
215 connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); 214 connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) );
216 a->addTo( popup ); 215 a->addTo( popup );
217 216
218 m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ), 217 m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ),
219 QString::null, 0, this, 0 ); 218 QString::null, 0, this, 0 );
220 m_actionFilter->setToggleAction( true ); 219 m_actionFilter->setToggleAction( true );
221 m_actionFilter->setWhatsThis( tr( "Click here to apply current filter." ) ); 220 m_actionFilter->setWhatsThis( tr( "Click here to apply current filter." ) );
222 connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); 221 connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) );
223 m_actionFilter->addTo( popup ); 222 m_actionFilter->addTo( popup );
224 223
225 popup->insertSeparator(); 224 popup->insertSeparator();
226 225
227 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); 226 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
228 a->setWhatsThis( tr( "Click here to search for text in package names." ) ); 227 a->setWhatsThis( tr( "Click here to search for text in package names." ) );
229 connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); 228 connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) );
230 a->addTo( popup ); 229 a->addTo( popup );
231 230
232 m_actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); 231 m_actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 );
233 m_actionFindNext->setEnabled( false ); 232 m_actionFindNext->setEnabled( false );
234 m_actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); 233 m_actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) );
235 connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); 234 connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) );
236 m_actionFindNext->addTo( popup ); 235 m_actionFindNext->addTo( popup );
237 m_actionFindNext->addTo( &m_findBar ); 236 m_actionFindNext->addTo( &m_findBar );
238 237
239 mb->insertItem( tr( "View" ), popup ); 238 mb->insertItem( tr( "View" ), popup );
240 239
241 // Finish find toolbar creation 240 // Finish find toolbar creation
242 a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 241 a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
243 a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); 242 a->setWhatsThis( tr( "Click here to hide the find toolbar." ) );
244 connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); 243 connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) );
245 a->addTo( &m_findBar ); 244 a->addTo( &m_findBar );
246 m_findBar.hide(); 245 m_findBar.hide();
247} 246}
248 247
249void MainWindow::loadPackageList( OPackageList *packages, bool clearList ) 248void MainWindow::loadPackageList( OPackageList *packages, bool clearList )
250{ 249{
251 if ( clearList ) 250 if ( clearList )
252 m_packageList.clear(); 251 m_packageList.clear();
253 252
254 if ( packages ) 253 if ( packages )
255 { 254 {
256 for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt ) 255 for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt )
257 { 256 {
258 OPackage *package = packageIt.current(); 257 OPackage *package = packageIt.current();
259 QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(), 258 QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(),
260 QCheckListItem::CheckBox ); 259 QCheckListItem::CheckBox );
261 m_packageList.insertItem( item ); 260 m_packageList.insertItem( item );
262 261
263 // If a different version of package is available, show update available icon 262 // If a different version of package is available, show update available icon
264 // Otherwise, show installed icon 263 // Otherwise, show installed icon
265 if ( !package->versionInstalled().isNull() ) 264 if ( !package->versionInstalled().isNull() )
266 { 265 {
267 if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) 266 if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 )
268 item->setPixmap( 0, m_iconUpdated ); 267 item->setPixmap( 0, m_iconUpdated );
269 else 268 else
270 item->setPixmap( 0, m_iconInstalled ); 269 item->setPixmap( 0, m_iconInstalled );
271 } 270 }
272 else 271 else
273 item->setPixmap( 0, m_iconNull ); 272 item->setPixmap( 0, m_iconNull );
274 } 273 }
275 } 274 }
276} 275}
277 276
278void MainWindow::searchForPackage( const QString &text ) 277void MainWindow::searchForPackage( const QString &text )
279{ 278{
280 if ( !text.isEmpty() ) 279 if ( !text.isEmpty() )
281 { 280 {
282 // look through package list for text startng at current position 281 // look through package list for text startng at current position
283 QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem()); 282 QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem());
284 if ( start == 0 ) 283 if ( start == 0 )
285 start = static_cast<QCheckListItem *>(m_packageList.firstChild()); 284 start = static_cast<QCheckListItem *>(m_packageList.firstChild());
286 285
287// for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ; 286// for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ;
288 for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ; 287 for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ;
289 item = static_cast<QCheckListItem *>(item->nextSibling()) ) 288 item = static_cast<QCheckListItem *>(item->nextSibling()) )
290 { 289 {
291 if ( item->text().lower().find( text ) != -1 ) 290 if ( item->text().lower().find( text ) != -1 )
292 { 291 {
293 m_packageList.ensureItemVisible( item ); 292 m_packageList.ensureItemVisible( item );
294 m_packageList.setCurrentItem( item ); 293 m_packageList.setCurrentItem( item );
295 break; 294 break;
296 } 295 }
297 } 296 }
298 } 297 }
299} 298}
300 299
301void MainWindow::initPackageInfo() 300void MainWindow::initPackageInfo()
302{ 301{
303 m_widgetStack.raiseWidget( &m_statusWidget ); 302 m_widgetStack.raiseWidget( &m_statusWidget );
304 303
305 // Load package list 304 // Load package list
306 m_packman.loadAvailablePackages(); 305 m_packman.loadAvailablePackages();
307 m_packman.loadInstalledPackages(); 306 m_packman.loadInstalledPackages();
308 307
309 OPackageList *packageList = m_packman.packages(); 308 OPackageList *packageList = m_packman.packages();
310 if ( packageList ) 309 if ( packageList )
311 { 310 {
312 loadPackageList( packageList, true ); 311 loadPackageList( packageList, true );
313 delete packageList; 312 delete packageList;
314 } 313 }
315 314
316 m_widgetStack.raiseWidget( &m_packageList ); 315 m_widgetStack.raiseWidget( &m_packageList );
317} 316}
318 317
319void MainWindow::slotWidgetStackShow( QWidget *widget ) 318void MainWindow::slotWidgetStackShow( QWidget *widget )
320{ 319{
321 if ( widget == &m_packageList ) 320 if ( widget == &m_packageList )
322 { 321 {
323 setCaption( tr( "Package Manager" ) ); 322 setCaption( tr( "Package Manager" ) );
324 323
325 m_menuBar.show(); 324 m_menuBar.show();
326 m_toolBar.show(); 325 m_toolBar.show();
327 } 326 }
328 else 327 else
329 { 328 {
330 m_menuBar.hide(); 329 m_menuBar.hide();
331 m_toolBar.hide(); 330 m_toolBar.hide();
332 } 331 }
333} 332}
334 333
335void MainWindow::slotInitStatusBar( int numSteps ) 334void MainWindow::slotInitStatusBar( int numSteps )
336{ 335{
337 m_statusBar.setTotalSteps( numSteps ); 336 m_statusBar.setTotalSteps( numSteps );
338} 337}
339 338
340void MainWindow::slotStatusText( const QString &status ) 339void MainWindow::slotStatusText( const QString &status )
341{ 340{
342 m_statusText.setText( status ); 341 m_statusText.setText( status );
343} 342}
344 343
345void MainWindow::slotStatusBar( int currStep ) 344void MainWindow::slotStatusBar( int currStep )
346{ 345{
347 m_statusBar.setProgress( currStep ); 346 m_statusBar.setProgress( currStep );
348} 347}
349 348
350void MainWindow::slotUpdate() 349void MainWindow::slotUpdate()
351{ 350{
352 // Create package manager output widget 351 // Create package manager output widget
353 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), false, 352 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), false,
354 OPackage::Update ); 353 OPackage::Update );
355 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) ); 354 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) );
356 355
357 // Display widget 356 // Display widget
358 m_widgetStack.addWidget( dlg, 3 ); 357 m_widgetStack.addWidget( dlg, 3 );
359 m_widgetStack.raiseWidget( dlg ); 358 m_widgetStack.raiseWidget( dlg );
360} 359}
361 360
362void MainWindow::slotUpgrade() 361void MainWindow::slotUpgrade()
363{ 362{
364 // Create package manager output widget 363 // Create package manager output widget
365 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), false, 364 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), false,
366 OPackage::Upgrade ); 365 OPackage::Upgrade );
367 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) ); 366 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) );
368 367
369 // Display widget 368 // Display widget
370 m_widgetStack.addWidget( dlg, 3 ); 369 m_widgetStack.addWidget( dlg, 3 );
371 m_widgetStack.raiseWidget( dlg ); 370 m_widgetStack.raiseWidget( dlg );
372} 371}
373 372
374 // Ipkg implementation does not seem to work currently? (not working in aqpkg either)
375/* 373/*
376void MainWindow::slotDownload() 374void MainWindow::slotDownload()
377{ 375{
378 // Retrieve list of packages selected for download (if any) 376 // Retrieve list of packages selected for download (if any)
379 QStringList *workingPackages = new QStringList(); 377 QStringList *workingPackages = new QStringList();
380 378
381 for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); 379 for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild());
382 item != 0 ; 380 item != 0 ;
383 item = static_cast<QCheckListItem *>(item->nextSibling()) ) 381 item = static_cast<QCheckListItem *>(item->nextSibling()) )
384 { 382 {
385 if ( item->isOn() ) 383 if ( item->isOn() )
386 workingPackages->append( item->text() ); 384 workingPackages->append( item->text() );
387 } 385 }
388 386
389 if ( workingPackages->isEmpty() ) 387 if ( workingPackages->isEmpty() )
390 { 388 {
391 // No packages were selected, prompt for URL of package to download 389 // No packages were selected, prompt for URL of package to download
392 } 390 }
393 else 391 else
394 { 392 {
395 // Download selected packages 393 // Download selected packages
396 m_config.setGroup( "settings" ); 394 m_config.setGroup( "settings" );
397 QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" ); 395 QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" );
398 396
399// QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), workingDir, &ok, this ); 397// QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), workingDir, &ok, this );
400// if ( ok && !text.isEmpty() ) 398// if ( ok && !text.isEmpty() )
401// workingDir = text; // user entered something and pressed ok 399// workingDir = text; // user entered something and pressed ok
402// else 400// else
403// return; // user entered nothing or pressed cancel 401// return; // user entered nothing or pressed cancel
404 402
405// // Store download directory in config file 403// // Store download directory in config file
406// m_config.writeEntry( "DownloadDir", workingDir ); 404// m_config.writeEntry( "DownloadDir", workingDir );
407 405
408 // Get starting directory 406 // Get starting directory
409// char initDir[PATH_MAX]; 407// char initDir[PATH_MAX];
410// getcwd( initDir, PATH_MAX ); 408// getcwd( initDir, PATH_MAX );
411 409
412 // Download packages 410 // Download packages
413 411
414 } 412 }
415 413
416 // Create package manager output widget 414 // Create package manager output widget
417 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false, 415 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false,
418 OPackage::Download, workingPackages ); 416 OPackage::Download, workingPackages );
419 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) ); 417 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) );
420 418
421 // Display widget 419 // Display widget
422 m_widgetStack.addWidget( dlg, 3 ); 420 m_widgetStack.addWidget( dlg, 3 );
423 m_widgetStack.raiseWidget( dlg ); 421 m_widgetStack.raiseWidget( dlg );
424} 422}
425*/ 423*/
426 424
427void MainWindow::slotApply() 425void MainWindow::slotApply()
428{ 426{
429 QStringList *removeList = 0x0; 427 QStringList *removeList = 0x0;
430 QStringList *installList = 0x0; 428 QStringList *installList = 0x0;
431 QStringList *upgradeList = 0x0; 429 QStringList *upgradeList = 0x0;
432 430
433 for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); 431 for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild());
434 item != 0 ; 432 item != 0 ;
435 item = static_cast<QCheckListItem *>(item->nextSibling()) ) 433 item = static_cast<QCheckListItem *>(item->nextSibling()) )
436 { 434 {
437 if ( item->isOn() ) 435 if ( item->isOn() )
438 { 436 {
439 OPackage *package = m_packman.findPackage( item->text() ); 437 OPackage *package = m_packman.findPackage( item->text() );
440 if ( package ) 438 if ( package )
441 { 439 {
442 if ( !package->versionInstalled().isNull() ) 440 if ( !package->versionInstalled().isNull() )
443 { 441 {
444 if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) 442 if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 )
445 { 443 {
446 // Remove/upgrade package 444 // Remove/upgrade package
447 int answer = PromptDlg::ask( tr( "Remove or upgrade" ), 445 int answer = PromptDlg::ask( tr( "Remove or upgrade" ),
448 tr( QString( "Do you wish to remove or upgrade\n%1?" ).arg( item->text() ) ), 446 tr( QString( "Do you wish to remove or upgrade\n%1?" ).arg( item->text() ) ),
449 tr( "Remove" ), tr( "Upgrade" ), this ); 447 tr( "Remove" ), tr( "Upgrade" ), this );
450 if ( answer == 1 ) // Remove 448 if ( answer == 1 ) // Remove
451 { 449 {
452 if ( !removeList ) 450 if ( !removeList )
453 removeList = new QStringList(); 451 removeList = new QStringList();
454 removeList->append( item->text() ); 452 removeList->append( item->text() );
455 } 453 }
456 else if ( answer == 2 ) // Upgrade 454 else if ( answer == 2 ) // Upgrade
457 { 455 {
458 if ( !upgradeList ) 456 if ( !upgradeList )
459 upgradeList = new QStringList(); 457 upgradeList = new QStringList();
460 upgradeList->append( item->text() ); 458 upgradeList->append( item->text() );
461 } 459 }
462 } 460 }
463 else 461 else
464 { 462 {
465 // Remove/reinstall package 463 // Remove/reinstall package
466 int answer = PromptDlg::ask( tr( "Remove or reinstall" ), 464 int answer = PromptDlg::ask( tr( "Remove or reinstall" ),
467 tr( QString( "Do you wish to remove or reinstall\n%1?" ).arg( item->text() ) ), 465 tr( QString( "Do you wish to remove or reinstall\n%1?" ).arg( item->text() ) ),
468 tr( "Remove" ), tr( "Reinstall" ), this ); 466 tr( "Remove" ), tr( "Reinstall" ), this );
469 if ( answer == 1 ) // Remove 467 if ( answer == 1 ) // Remove
470 { 468 {
471 if ( !removeList ) 469 if ( !removeList )
472 removeList = new QStringList(); 470 removeList = new QStringList();
473 removeList->append( item->text() ); 471 removeList->append( item->text() );
474 } 472 }
475 else if ( answer == 2 ) // Reinstall 473 else if ( answer == 2 ) // Reinstall
476 { 474 {
477 if ( !installList ) 475 if ( !installList )
478 installList = new QStringList(); 476 installList = new QStringList();
479 installList->append( item->text() ); 477 installList->append( item->text() );
480 } 478 }
481 } 479 }
482 } 480 }
483 else 481 else
484 { 482 {
485 // Install package 483 // Install package
486 if ( !installList ) 484 if ( !installList )
487 installList = new QStringList(); 485 installList = new QStringList();
488 installList->append( item->text() ); 486 installList->append( item->text() );
489 } 487 }
490 } 488 }
491 } 489 }
492 } 490 }
493 491
494 // If nothing is selected, display message and exit 492 // If nothing is selected, display message and exit
495 if ( !removeList && !installList && !upgradeList ) 493 if ( !removeList && !installList && !upgradeList )
496 { 494 {
497 QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); 495 QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) );
498 return; 496 return;
499 } 497 }
500 498
501 // Send command only if there are packages to process 499 // Send command only if there are packages to process
502 OPackage::Command removeCmd = OPackage::NotDefined; 500 OPackage::Command removeCmd = OPackage::NotDefined;
503 if ( removeList && !removeList->isEmpty() ) 501 if ( removeList && !removeList->isEmpty() )
504 removeCmd = OPackage::Remove; 502 removeCmd = OPackage::Remove;
505 OPackage::Command installCmd = OPackage::NotDefined; 503 OPackage::Command installCmd = OPackage::NotDefined;
506 if ( installList && !installList->isEmpty() ) 504 if ( installList && !installList->isEmpty() )
507 installCmd = OPackage::Install; 505 installCmd = OPackage::Install;
508 OPackage::Command upgradeCmd = OPackage::NotDefined; 506 OPackage::Command upgradeCmd = OPackage::NotDefined;
509 if ( upgradeList && !upgradeList->isEmpty() ) 507 if ( upgradeList && !upgradeList->isEmpty() )
510 upgradeCmd = OPackage::Upgrade; 508 upgradeCmd = OPackage::Upgrade;
511 509
512 // Create package manager output widget 510 // Create package manager output widget
513 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true, 511 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true,
514 removeCmd, removeList, 512 removeCmd, removeList,
515 installCmd, installList, 513 installCmd, installList,
516 upgradeCmd, upgradeList ); 514 upgradeCmd, upgradeList );
517 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) ); 515 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) );
518 516
519 // Display widget 517 // Display widget
520 m_widgetStack.addWidget( dlg, 3 ); 518 m_widgetStack.addWidget( dlg, 3 );
521 m_widgetStack.raiseWidget( dlg ); 519 m_widgetStack.raiseWidget( dlg );
522} 520}
523 521
524void MainWindow::slotCloseInstallDlg() 522void MainWindow::slotCloseInstallDlg()
525{ 523{
526 // Close install dialog 524 // Close install dialog
527 delete m_widgetStack.visibleWidget(); 525 delete m_widgetStack.visibleWidget();
528 526
529 // Reload package list 527 // Reload package list
530 initPackageInfo(); 528 initPackageInfo();
531} 529}
532 530
533void MainWindow::slotConfigure() 531void MainWindow::slotConfigure()
534{ 532{
535 if ( m_packman.configureDlg( false ) ) 533 if ( m_packman.configureDlg( false ) )
536 { 534 {
537 if ( PromptDlg::ask( tr( "Config updated" ), 535 if ( PromptDlg::ask( tr( "Config updated" ),
538 tr( "The configuration has been updated. Do you want to update server and package information now?" ), 536 tr( "The configuration has been updated. Do you want to update server and package information now?" ),
539 tr( "Yes" ), tr( "No" ), this ) == 1 ) 537 tr( "Yes" ), tr( "No" ), this ) == 1 )
540 { 538 {
541 // Update package list and reload package info 539 // Update package list and reload package info
542 slotUpdate(); 540 slotUpdate();
543 } 541 }
544 } 542 }
545} 543}
546 544
547void MainWindow::slotShowNotInstalled() 545void MainWindow::slotShowNotInstalled()
548{ 546{
549 OPackageList *packageList; 547 OPackageList *packageList;
550 if ( m_actionShowNotInstalled->isOn() ) 548 if ( m_actionShowNotInstalled->isOn() )
551 { 549 {
552 m_actionShowInstalled->setOn( false ); 550 m_actionShowInstalled->setOn( false );
553 m_actionShowUpdated->setOn( false ); 551 m_actionShowUpdated->setOn( false );
554 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, 552 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null,
555 OPackageManager::NotInstalled, QString::null ); 553 OPackageManager::NotInstalled, QString::null );
556 } 554 }
557 else 555 else
558 packageList = m_packman.packages(); 556 packageList = m_packman.packages();
559 557
560 if ( packageList ) 558 if ( packageList )
561 { 559 {
562 loadPackageList( packageList, true ); 560 loadPackageList( packageList, true );
563 delete packageList; 561 delete packageList;
564 } 562 }
565} 563}
566 564
567void MainWindow::slotShowInstalled() 565void MainWindow::slotShowInstalled()
568{ 566{
569 OPackageList *packageList; 567 OPackageList *packageList;
570 if ( m_actionShowInstalled->isOn() ) 568 if ( m_actionShowInstalled->isOn() )
571 { 569 {
572 m_actionShowNotInstalled->setOn( false ); 570 m_actionShowNotInstalled->setOn( false );
573 m_actionShowUpdated->setOn( false ); 571 m_actionShowUpdated->setOn( false );
574 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, 572 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null,
575 OPackageManager::Installed, QString::null ); 573 OPackageManager::Installed, QString::null );
576 } 574 }
577 else 575 else
578 packageList = m_packman.packages(); 576 packageList = m_packman.packages();
579 577
580 if ( packageList ) 578 if ( packageList )
581 { 579 {
582 loadPackageList( packageList, true ); 580 loadPackageList( packageList, true );
583 delete packageList; 581 delete packageList;
584 } 582 }
585} 583}
586 584
587void MainWindow::slotShowUpdated() 585void MainWindow::slotShowUpdated()
588{ 586{
589 OPackageList *packageList; 587 OPackageList *packageList;
590 if ( m_actionShowUpdated->isOn() ) 588 if ( m_actionShowUpdated->isOn() )
591 { 589 {
592 m_actionShowInstalled->setOn( false ); 590 m_actionShowInstalled->setOn( false );
593 m_actionShowNotInstalled->setOn( false ); 591 m_actionShowNotInstalled->setOn( false );
594 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, 592 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null,
595 OPackageManager::Updated, QString::null ); 593 OPackageManager::Updated, QString::null );
596 } 594 }
597 else 595 else
598 packageList = m_packman.packages(); 596 packageList = m_packman.packages();
599 597
600 if ( packageList ) 598 if ( packageList )
601 { 599 {
602 loadPackageList( packageList, true ); 600 loadPackageList( packageList, true );
603 delete packageList; 601 delete packageList;
604 } 602 }
605} 603}
606 604
607void MainWindow::slotFilterChange() 605void MainWindow::slotFilterChange()
608{ 606{
609 FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, 607 FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus,
610 m_filterCategory ); 608 m_filterCategory );
611 if ( dlg.exec() == QDialog::Accepted ) 609 if ( dlg.exec() == QDialog::Accepted )
612 { 610 {
613 m_filterName = dlg.name(); 611 m_filterName = dlg.name();
614 m_filterServer = dlg.server(); 612 m_filterServer = dlg.server();
615 m_filterDest = dlg.destination(); 613 m_filterDest = dlg.destination();
616 m_filterStatus = dlg.status(); 614 m_filterStatus = dlg.status();
617 m_filterCategory = dlg.category(); 615 m_filterCategory = dlg.category();
618 m_actionFilter->setOn( true ); 616 m_actionFilter->setOn( true );
619 slotFilter( true ); 617 slotFilter( true );
620 } 618 }
621 else 619 else
622 { 620 {
623 m_actionFilter->setOn( false ); 621 m_actionFilter->setOn( false );
624 slotFilter( false ); 622 slotFilter( false );
625 } 623 }
626} 624}
627 625
628void MainWindow::slotFilter( bool isOn ) 626void MainWindow::slotFilter( bool isOn )
629{ 627{
630 OPackageList *packageList; 628 OPackageList *packageList;
631 if ( isOn ) 629 if ( isOn )
632 { 630 {
633 packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, 631 packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest,
634 m_filterStatus, m_filterCategory ); 632 m_filterStatus, m_filterCategory );
635 } 633 }
636 else 634 else
637 packageList = m_packman.packages(); 635 packageList = m_packman.packages();
638 636
639 if ( packageList ) 637 if ( packageList )
640 { 638 {
641 loadPackageList( packageList, true ); 639 loadPackageList( packageList, true );
642 delete packageList; 640 delete packageList;
643 } 641 }
644} 642}
645 643
646void MainWindow::slotFindShowToolbar() 644void MainWindow::slotFindShowToolbar()
647{ 645{
648 m_findBar.show(); 646 m_findBar.show();
649 m_findEdit->setFocus(); 647 m_findEdit->setFocus();
650} 648}
651 649
652void MainWindow::slotFindHideToolbar() 650void MainWindow::slotFindHideToolbar()
653{ 651{
654 m_findBar.hide(); 652 m_findBar.hide();
655} 653}
656 654
657void MainWindow::slotFindChanged( const QString &findText ) 655void MainWindow::slotFindChanged( const QString &findText )
658{ 656{
659 657
660 m_actionFindNext->setEnabled( !findText.isEmpty() ); 658 m_actionFindNext->setEnabled( !findText.isEmpty() );
661 searchForPackage( findText ); 659 searchForPackage( findText );
662} 660}
663 661
664void MainWindow::slotFindNext() 662void MainWindow::slotFindNext()
665{ 663{
666 searchForPackage( m_findEdit->text() ); 664 searchForPackage( m_findEdit->text() );
667} 665}
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp
index 13f3d7d..eeb0131 100644
--- a/noncore/settings/packagemanager/oipkg.cpp
+++ b/noncore/settings/packagemanager/oipkg.cpp
@@ -1,505 +1,459 @@
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> 34#include <stdlib.h>
35#include <string.h>
35 36
36#include <qdir.h> 37#include <qdir.h>
37#include <qfile.h> 38#include <qfile.h>
39#include <qmessagebox.h>
38#include <qtextstream.h> 40#include <qtextstream.h>
39 41
40#include <opie/oprocess.h>
41
42const QString IPKG_EXEC = "ipkg"; // Fully-qualified name of Ipkg executable
43const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file 42const QString IPKG_CONF = "/etc/ipkg.conf"; // Fully-qualified name of Ipkg primary configuration file
44const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files 43const QString IPKG_CONF_DIR = "/etc/ipkg"; // Directory of secondary Ipkg configuration files
45const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists 44const QString IPKG_PKG_PATH = "/usr/lib/ipkg/lists"; // Directory containing server package lists
46const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location 45const QString IPKG_STATUS_PATH = "usr/lib/ipkg/status"; // Destination status file location
47 46
47OIpkg *oipkg;
48
49int fIpkgMessage( ipkg_conf_t */*conf*/, message_level_t /*level*/, char *msg )
50{
51 oipkg->ipkgOutput( msg );
52 return 0;
53}
54
55char* fIpkgResponse( char */*question*/ )
56{
57 return 0x0;
58}
59
48OIpkg::OIpkg( Config *config, QObject *parent, const char *name ) 60OIpkg::OIpkg( Config *config, QObject *parent, const char *name )
49 : QObject( parent, name ) 61 : QObject( parent, name )
50 , m_config( config ) 62 , m_config( config )
51 , m_ipkgExec( IPKG_EXEC ) // TODO - find executable?
52 , m_confInfo( NULL ) 63 , m_confInfo( NULL )
53 , m_ipkgExecOptions( 0 ) 64 , m_ipkgExecOptions( 0 )
54 , m_ipkgExecVerbosity( 1 ) 65 , m_ipkgExecVerbosity( 1 )
55 , m_ipkgProcess( NULL )
56{ 66{
67 oipkg = this;
68
69 // Initialize libipkg
70 if ( ipkg_init( &fIpkgMessage, &fIpkgResponse, &m_ipkgArgs ) )
71 QMessageBox::critical( 0, tr( "OIpkg" ), tr( "Error initialing libipkg" ) );
72
73 // Default ipkg run-time arguments
74 m_ipkgArgs.noaction = false;
75 m_ipkgArgs.force_defaults = true;
57} 76}
58 77
59OIpkg::~OIpkg() 78OIpkg::~OIpkg()
60{ 79{
61 // Upon destruction, ensure that items in config list are deleted with list 80 // Upon destruction, ensure that items in config list are deleted with list
62 if ( m_confInfo ) 81 if ( m_confInfo )
63 m_confInfo->setAutoDelete( true ); 82 m_confInfo->setAutoDelete( true );
64 83
65 // Terminate any running ipkg processes 84 // Free up libipkg resources
66 if ( m_ipkgProcess ) 85 if ( ipkg_deinit( &m_ipkgArgs ) )
67 delete m_ipkgProcess; 86 QMessageBox::critical( 0, tr( "OIpkg" ), tr( "Error freeing libipkg" ) );
68} 87}
69 88
70OConfItemList *OIpkg::configItems() 89OConfItemList *OIpkg::configItems()
71{ 90{
72 // Retrieve all configuration items 91 // Retrieve all configuration items
73 return filterConfItems(); 92 return filterConfItems();
74} 93}
75 94
76OConfItemList *OIpkg::servers() 95OConfItemList *OIpkg::servers()
77{ 96{
78 // Retrieve only servers 97 // Retrieve only servers
79 return filterConfItems( OConfItem::Source ); 98 return filterConfItems( OConfItem::Source );
80} 99}
81 100
82OConfItemList *OIpkg::destinations() 101OConfItemList *OIpkg::destinations()
83{ 102{
84 // Retrieve only destinations 103 // Retrieve only destinations
85 return filterConfItems( OConfItem::Destination ); 104 return filterConfItems( OConfItem::Destination );
86} 105}
87 106
88OConfItemList *OIpkg::options() 107OConfItemList *OIpkg::options()
89{ 108{
90 // Retrieve only destinations 109 // Retrieve only destinations
91 return filterConfItems( OConfItem::Option ); 110 return filterConfItems( OConfItem::Option );
92} 111}
93 112
94void OIpkg::setConfigItems( OConfItemList *configList ) 113void OIpkg::setConfigItems( OConfItemList *configList )
95{ 114{
96 if ( m_confInfo ) 115 if ( m_confInfo )
97 delete m_confInfo; 116 delete m_confInfo;
98 117
99 m_confInfo = configList; 118 m_confInfo = configList;
100} 119}
101 120
102void OIpkg::saveSettings() 121void OIpkg::saveSettings()
103{ 122{
104 // Save Ipkg execution options to application configuration file 123 // Save Ipkg execution options to application configuration file
105 if ( m_config ) 124 if ( m_config )
106 { 125 {
107 m_config->setGroup( "Ipkg" ); 126 m_config->setGroup( "Ipkg" );
108 m_config->writeEntry( "ExecOptions", m_ipkgExecOptions ); 127 m_config->writeEntry( "ExecOptions", m_ipkgExecOptions );
109 m_config->writeEntry( "Verbosity", m_ipkgExecVerbosity ); 128 m_config->writeEntry( "Verbosity", m_ipkgExecVerbosity );
110 } 129 }
111} 130}
112 131
113OPackageList *OIpkg::availablePackages( const QString &server ) 132OPackageList *OIpkg::availablePackages( const QString &server )
114{ 133{
115 // Load Ipkg configuration info if not already cached 134 // Load Ipkg configuration info if not already cached
116 if ( !m_confInfo ) 135 if ( !m_confInfo )
117 loadConfiguration(); 136 loadConfiguration();
118 137
119 // Build new server list (caller is responsible for deleting) 138 // Build new server list (caller is responsible for deleting)
120 OPackageList *pl = new OPackageList; 139 OPackageList *pl = new OPackageList;
121 140
122 // Open package list file 141 // Open package list file
123 QFile f( IPKG_PKG_PATH + "/" + server ); 142 QFile f( IPKG_PKG_PATH + "/" + server );
124 if ( !f.open( IO_ReadOnly ) ) 143 if ( !f.open( IO_ReadOnly ) )
125 return NULL; 144 return NULL;
126 QTextStream t( &f ); 145 QTextStream t( &f );
127 146
128 // Process all information in package list file 147 // Process all information in package list file
129 OPackage *package = NULL; 148 OPackage *package = NULL;
130 QString line = t.readLine(); 149 QString line = t.readLine();
131 while ( !t.eof() ) 150 while ( !t.eof() )
132 { 151 {
133 // Determine key/value pair 152 // Determine key/value pair
134 int pos = line.find( ':', 0 ); 153 int pos = line.find( ':', 0 );
135 QString key; 154 QString key;
136 if ( pos > -1 ) 155 if ( pos > -1 )
137 key = line.mid( 0, pos ); 156 key = line.mid( 0, pos );
138 else 157 else
139 key = QString::null; 158 key = QString::null;
140 QString value = line.mid( pos+2, line.length()-pos ); 159 QString value = line.mid( pos+2, line.length()-pos );
141 160
142 // Allocate new package and insert into list 161 // Allocate new package and insert into list
143 if ( package == NULL && !key.isEmpty() ) 162 if ( package == NULL && !key.isEmpty() )
144 { 163 {
145 package = new OPackage( value ); 164 package = new OPackage( value );
146 package->setSource( server ); 165 package->setSource( server );
147 pl->append( package ); 166 pl->append( package );
148 } 167 }
149 168
150 // Update package data 169 // Update package data
151 if ( key == "Package" ) 170 if ( key == "Package" )
152 package->setName( value ); 171 package->setName( value );
153 else if ( key == "Version" ) 172 else if ( key == "Version" )
154 package->setVersion( value ); 173 package->setVersion( value );
155 else if ( key == "Section" ) 174 else if ( key == "Section" )
156 package->setCategory( value ); 175 package->setCategory( value );
157 //DataManager::setAvailableCategories( value ); 176 //DataManager::setAvailableCategories( value );
158 else if ( key.isEmpty() && value.isEmpty() ) 177 else if ( key.isEmpty() && value.isEmpty() )
159 package = NULL; 178 package = NULL;
160 179
161 // Skip past all description lines 180 // Skip past all description lines
162 if ( key == "Description" ) 181 if ( key == "Description" )
163 { 182 {
164 line = t.readLine(); 183 line = t.readLine();
165 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) 184 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() )
166 line = t.readLine(); 185 line = t.readLine();
167 } 186 }
168 else 187 else
169 line = t.readLine(); 188 line = t.readLine();
170 } 189 }
171 190
172 f.close(); 191 f.close();
173 192
174 return pl; 193 return pl;
175} 194}
176 195
177OPackageList *OIpkg::installedPackages( const QString &destName, const QString &destPath ) 196OPackageList *OIpkg::installedPackages( const QString &destName, const QString &destPath )
178{ 197{
179 // Load Ipkg configuration info if not already cached 198 // Load Ipkg configuration info if not already cached
180 if ( !m_confInfo ) 199 if ( !m_confInfo )
181 loadConfiguration(); 200 loadConfiguration();
182 201
183 // Build new server list (caller is responsible for deleting) 202 // Build new server list (caller is responsible for deleting)
184 OPackageList *pl = new OPackageList; 203 OPackageList *pl = new OPackageList;
185 204
186 // Open status file 205 // Open status file
187 QString path = destPath; 206 QString path = destPath;
188 if ( path.right( 1 ) != "/" ) 207 if ( path.right( 1 ) != "/" )
189 path.append( "/" ); 208 path.append( "/" );
190 path.append( IPKG_STATUS_PATH ); 209 path.append( IPKG_STATUS_PATH );
191 210
192 QFile f( path ); 211 QFile f( path );
193 if ( !f.open( IO_ReadOnly ) ) 212 if ( !f.open( IO_ReadOnly ) )
194 return NULL; 213 return NULL;
195 QTextStream t( &f ); 214 QTextStream t( &f );
196 215
197 // Process all information in status file 216 // Process all information in status file
198 bool newPackage = false; 217 bool newPackage = false;
199 QString line = t.readLine(); 218 QString line = t.readLine();
200 QString name; 219 QString name;
201 QString version; 220 QString version;
202 QString status; 221 QString status;
203 222
204 while ( !t.eof() ) 223 while ( !t.eof() )
205 { 224 {
206 // Determine key/value pair 225 // Determine key/value pair
207 int pos = line.find( ':', 0 ); 226 int pos = line.find( ':', 0 );
208 QString key; 227 QString key;
209 if ( pos > -1 ) 228 if ( pos > -1 )
210 key = line.mid( 0, pos ); 229 key = line.mid( 0, pos );
211 else 230 else
212 key = QString::null; 231 key = QString::null;
213 QString value = line.mid( pos+2, line.length()-pos ); 232 QString value = line.mid( pos+2, line.length()-pos );
214 233
215 // Allocate new package and insert into list 234 // Allocate new package and insert into list
216 if ( newPackage && !key.isEmpty() ) 235 if ( newPackage && !key.isEmpty() )
217 { 236 {
218 // Add to list only if it has a valid name and is installed 237 // Add to list only if it has a valid name and is installed
219 if ( !name.isNull() && status.contains( " installed" ) ) 238 if ( !name.isNull() && status.contains( " installed" ) )
220 { 239 {
221 pl->append( new OPackage( name, QString::null, version, QString::null, destName ) ); 240 pl->append( new OPackage( name, QString::null, version, QString::null, destName ) );
222 name = QString::null; 241 name = QString::null;
223 version = QString::null; 242 version = QString::null;
224 status = QString::null; 243 status = QString::null;
225 244
226 newPackage = false; 245 newPackage = false;
227 } 246 }
228 } 247 }
229 248
230 // Update package data 249 // Update package data
231 if ( key == "Package" ) 250 if ( key == "Package" )
232 name = value; 251 name = value;
233 else if ( key == "Version" ) 252 else if ( key == "Version" )
234 version = value; 253 version = value;
235 else if ( key == "Status" ) 254 else if ( key == "Status" )
236 status = value; 255 status = value;
237 else if ( key.isEmpty() && value.isEmpty() ) 256 else if ( key.isEmpty() && value.isEmpty() )
238 newPackage = true; 257 newPackage = true;
239 258
240 // Skip past all description lines 259 // Skip past all description lines
241 if ( key == "Description" ) 260 if ( key == "Description" )
242 { 261 {
243 line = t.readLine(); 262 line = t.readLine();
244 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) 263 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() )
245 line = t.readLine(); 264 line = t.readLine();
246 } 265 }
247 else 266 else
248 line = t.readLine(); 267 line = t.readLine();
249 } 268 }
250 269
251 f.close(); 270 f.close();
252 271
253 return pl; 272 return pl;
254} 273}
255 274
256bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, const QString &destination, 275bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, const QString &destination,
257 const QObject *receiver, const char *slotOutput, const char *slotErrors, 276 const QObject *receiver, const char *slotOutput, bool rawOutput )
258 const char *slotFinished, bool rawOutput )
259{ 277{
260 if ( command == OPackage::NotDefined ) 278 if ( command == OPackage::NotDefined )
261 return false; 279 return false;
262 280
263 // Set up command line for execution 281 // Set ipkg run-time options/arguments
264 QStringList cmdLine; 282 m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS );
265 cmdLine.append( IPKG_EXEC ); 283 m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL );
266 284 // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE );
267 QString verbosity( "-V" ); 285 m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE );
268 verbosity.append( QString::number( m_ipkgExecVerbosity ) ); 286 m_ipkgArgs.verbosity = m_ipkgExecVerbosity;
269 cmdLine.append( verbosity ); 287 if ( m_ipkgArgs.dest )
270 288 free( m_ipkgArgs.dest );
271 // Determine Ipkg execution options 289 if ( !destination.isNull() )
272 if ( command == OPackage::Install && destination != QString::null )
273 { 290 {
274 // TODO - Set destination for installs 291 int len = destination.length() + 1;
275 cmdLine.append( "-dest" ); 292 m_ipkgArgs.dest = (char *)malloc( len );
276 cmdLine.append( destination ); 293 strncpy( m_ipkgArgs.dest, destination, destination.length() );
294 m_ipkgArgs.dest[ len - 1 ] = '\0';
277 } 295 }
296 else
297 m_ipkgArgs.dest = 0x0;
278 298
279 if ( command != OPackage::Update && command != OPackage::Download ) 299 // Connect output signal to widget
300 if ( rawOutput )
280 { 301 {
281 if ( m_ipkgExecOptions & FORCE_DEPENDS ) 302 if ( slotOutput )
282 cmdLine.append( "-force-depends" ); 303 connect( this, SIGNAL(execOutput(char *)), receiver, slotOutput );
283 if ( m_ipkgExecOptions & FORCE_REINSTALL ) 304 }
284 cmdLine.append( "-force-reinstall" ); 305 else
285 if ( m_ipkgExecOptions & FORCE_REMOVE ) 306 {
286 cmdLine.append( "-force-removal-of-essential-packages" ); 307 // TODO - connect to local slot and parse output before emitting execOutput
287 if ( m_ipkgExecOptions & FORCE_OVERWRITE )
288 cmdLine.append( "-force-overwrite" );
289 if ( m_ipkgExecVerbosity == 3 )
290 cmdLine.append( "-verbose_wget" );
291
292 // TODO
293 // Handle make links
294 // Rules - If make links is switched on, create links to root
295 // if destDir is NOT /
296 /*
297 if ( m_ipkgExecOptions & MAKE_LINKS )
298 {
299 // If destDir == / turn off make links as package is being insalled
300 // to root already.
301 if ( destDir == "/" )
302 m_ipkgExecOptions ^= MAKE_LINKS;
303 }
304 */
305 } 308 }
306 309
307 QString cmd;
308 switch( command ) 310 switch( command )
309 { 311 {
310 case OPackage::Install: cmd = "install"; 312 case OPackage::Update : ipkg_lists_update( &m_ipkgArgs );
311 break;
312 case OPackage::Remove: cmd = "remove";
313 break; 313 break;
314 case OPackage::Update: cmd = "update"; 314 case OPackage::Upgrade : ipkg_packages_upgrade( &m_ipkgArgs );
315 break; 315 break;
316 case OPackage::Upgrade: cmd = "upgrade"; 316 case OPackage::Install : {
317 break; 317 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it )
318 case OPackage::Download: cmd = "download"; 318 {
319 break; 319 ipkg_packages_install( &m_ipkgArgs, (*it) );
320 case OPackage::Info: cmd = "info"; 320 }
321 };
321 break; 322 break;
322 case OPackage::Files: cmd = "files"; 323 case OPackage::Remove : {
324 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it )
325 {
326 ipkg_packages_remove( &m_ipkgArgs, (*it), true );
327 }
328 };
323 break; 329 break;
324 //case OPackage::Version: cmd = "" ); 330 //case OPackage::Download : ;
325 // break; 331 // break;
326 default: 332 default : break;
327 break;
328 }; 333 };
329 cmdLine.append( cmd );
330
331 // TODO
332 // If we are removing, reinstalling or upgrading packages and make links option is selected
333 // create the links
334/*
335 if ( command == Remove || command == Upgrade )
336 {
337 createLinks = false;
338 if ( flags & MAKE_LINKS )
339 {
340 emit outputText( tr( "Removing symbolic links...\n" ) );
341 linkPackage( Utils::getPackageNameFromIpkFilename( package ), destination, destDir );
342 emit outputText( QString( " " ) );
343 }
344 }
345*/
346 // Append package list (if any) to end of command line
347 if ( parameters && !parameters->isEmpty() )
348 {
349 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it )
350 {
351 cmdLine.append( *it );
352 }
353 }
354
355 // Create OProcess
356 if ( m_ipkgProcess )
357 delete m_ipkgProcess;
358 m_ipkgProcess = new OProcess( cmdLine, this );
359
360 // Connect signals (if any)
361 if ( receiver )
362 {
363 if ( rawOutput )
364 {
365 if ( slotOutput )
366 connect( m_ipkgProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), receiver, slotOutput );
367 if ( slotErrors )
368 connect( m_ipkgProcess, SIGNAL(receivedStderr(OProcess*,char*,int)), receiver, slotErrors );
369 if ( slotFinished )
370 connect( m_ipkgProcess, SIGNAL(processExited(OProcess*)), receiver, slotFinished );
371 }
372 else // !rawOutput
373 {
374 // TODO - how should it handle partial lines? (i.e. "Installing opi", "e-aqpkg...")
375 }
376 }
377 334
378 // Run process 335 return true;
379printf( "Running: \'%s\'\n", cmdLine.join( " " ).latin1() );
380 return m_ipkgProcess->start( OProcess::NotifyOnExit, OProcess::All );
381} 336}
382 337
383void OIpkg::abortCommand() 338void OIpkg::ipkgOutput( char *msg )
384{ 339{
385 if ( m_ipkgProcess ) 340 emit execOutput( msg );
386 delete m_ipkgProcess;
387} 341}
388 342
389void OIpkg::loadConfiguration() 343void OIpkg::loadConfiguration()
390{ 344{
391 if ( m_confInfo ) 345 if ( m_confInfo )
392 delete m_confInfo; 346 delete m_confInfo;
393 347
394 // Load configuration item list 348 // Load configuration item list
395 m_confInfo = new OConfItemList(); 349 m_confInfo = new OConfItemList();
396 350
397 QStringList confFiles; 351 QStringList confFiles;
398 QDir confDir( IPKG_CONF_DIR ); 352 QDir confDir( IPKG_CONF_DIR );
399 if ( confDir.exists() ) 353 if ( confDir.exists() )
400 { 354 {
401 confDir.setNameFilter( "*.conf" ); 355 confDir.setNameFilter( "*.conf" );
402 confDir.setFilter( QDir::Files ); 356 confDir.setFilter( QDir::Files );
403 confFiles = confDir.entryList( "*.conf", QDir::Files ); 357 confFiles = confDir.entryList( "*.conf", QDir::Files );
404 confFiles << IPKG_CONF; 358 confFiles << IPKG_CONF;
405 359
406 for ( QStringList::Iterator it = confFiles.begin(); it != confFiles.end(); ++it ) 360 for ( QStringList::Iterator it = confFiles.begin(); it != confFiles.end(); ++it )
407 { 361 {
408 // Create absolute file path if necessary 362 // Create absolute file path if necessary
409 QString absFile = (*it); 363 QString absFile = (*it);
410 if ( !absFile.startsWith( "/" ) ) 364 if ( !absFile.startsWith( "/" ) )
411 absFile.prepend( QString( IPKG_CONF_DIR ) + "/" ); 365 absFile.prepend( QString( IPKG_CONF_DIR ) + "/" );
412 366
413 // Read in file 367 // Read in file
414 QFile f( absFile ); 368 QFile f( absFile );
415 if ( f.open( IO_ReadOnly ) ) 369 if ( f.open( IO_ReadOnly ) )
416 { 370 {
417 QTextStream s( &f ); 371 QTextStream s( &f );
418 while ( !s.eof() ) 372 while ( !s.eof() )
419 { 373 {
420 374
421 QString line = s.readLine().simplifyWhiteSpace(); 375 QString line = s.readLine().simplifyWhiteSpace();
422 376
423 // Parse line and save info to the conf options list 377 // Parse line and save info to the conf options list
424 if ( !line.isEmpty() ) 378 if ( !line.isEmpty() )
425 { 379 {
426 if ( !line.startsWith( "#" ) || 380 if ( !line.startsWith( "#" ) ||
427 line.startsWith( "#src" ) || 381 line.startsWith( "#src" ) ||
428 line.startsWith( "#dest" ) || 382 line.startsWith( "#dest" ) ||
429 line.startsWith( "#arch" ) || 383 line.startsWith( "#arch" ) ||
430 line.startsWith( "#option" ) ) 384 line.startsWith( "#option" ) )
431 { 385 {
432 int pos = line.find( ' ', 1 ); 386 int pos = line.find( ' ', 1 );
433 387
434 // Type 388 // Type
435 QString typeStr = line.left( pos ); 389 QString typeStr = line.left( pos );
436 OConfItem::Type type; 390 OConfItem::Type type;
437 if ( typeStr == "src" || typeStr == "#src" ) 391 if ( typeStr == "src" || typeStr == "#src" )
438 type = OConfItem::Source; 392 type = OConfItem::Source;
439 else if ( typeStr == "dest" || typeStr == "#dest" ) 393 else if ( typeStr == "dest" || typeStr == "#dest" )
440 type = OConfItem::Destination; 394 type = OConfItem::Destination;
441 else if ( typeStr == "option" || typeStr == "#option" ) 395 else if ( typeStr == "option" || typeStr == "#option" )
442 type = OConfItem::Option; 396 type = OConfItem::Option;
443 else if ( typeStr == "arch" || typeStr == "#arch" ) 397 else if ( typeStr == "arch" || typeStr == "#arch" )
444 type = OConfItem::Arch; 398 type = OConfItem::Arch;
445 else 399 else
446 type = OConfItem::NotDefined; 400 type = OConfItem::NotDefined;
447 ++pos; 401 ++pos;
448 int endpos = line.find( ' ', pos ); 402 int endpos = line.find( ' ', pos );
449 403
450 // Name 404 // Name
451 QString name = line.mid( pos, endpos - pos ); 405 QString name = line.mid( pos, endpos - pos );
452 406
453 // Value 407 // Value
454 QString value = ""; 408 QString value = "";
455 if ( endpos > -1 ) 409 if ( endpos > -1 )
456 value = line.right( line.length() - endpos - 1 ); 410 value = line.right( line.length() - endpos - 1 );
457 411
458 // Active 412 // Active
459 bool active = !line.startsWith( "#" ); 413 bool active = !line.startsWith( "#" );
460 414
461 // Add to list 415 // Add to list
462 m_confInfo->append( new OConfItem( absFile, type, name, value, active ) ); 416 m_confInfo->append( new OConfItem( absFile, type, name, value, active ) );
463 } 417 }
464 } 418 }
465 } 419 }
466 420
467 f.close(); 421 f.close();
468 } 422 }
469 } 423 }
470 } 424 }
471 425
472 // Load Ipkg execution options from application configuration file 426 // Load Ipkg execution options from application configuration file
473 if ( m_config ) 427 if ( m_config )
474 { 428 {
475 m_config->setGroup( "Ipkg" ); 429 m_config->setGroup( "Ipkg" );
476 m_ipkgExecOptions = m_config->readNumEntry( "ExecOptions", m_ipkgExecOptions ); 430 m_ipkgExecOptions = m_config->readNumEntry( "ExecOptions", m_ipkgExecOptions );
477 m_ipkgExecVerbosity = m_config->readNumEntry( "Verbosity", m_ipkgExecVerbosity ); 431 m_ipkgExecVerbosity = m_config->readNumEntry( "Verbosity", m_ipkgExecVerbosity );
478 } 432 }
479} 433}
480 434
481OConfItemList *OIpkg::filterConfItems( OConfItem::Type typefilter ) 435OConfItemList *OIpkg::filterConfItems( OConfItem::Type typefilter )
482{ 436{
483 // Load Ipkg configuration info if not already cached 437 // Load Ipkg configuration info if not already cached
484 if ( !m_confInfo ) 438 if ( !m_confInfo )
485 loadConfiguration(); 439 loadConfiguration();
486 440
487 // Build new server list (caller is responsible for deleting) 441 // Build new server list (caller is responsible for deleting)
488 OConfItemList *sl = new OConfItemList; 442 OConfItemList *sl = new OConfItemList;
489 443
490 // If typefilter is empty, retrieve all items 444 // If typefilter is empty, retrieve all items
491 bool retrieveAll = ( typefilter == OConfItem::NotDefined ); 445 bool retrieveAll = ( typefilter == OConfItem::NotDefined );
492 446
493 // Parse configuration info for servers 447 // Parse configuration info for servers
494 OConfItemListIterator it( *m_confInfo ); 448 OConfItemListIterator it( *m_confInfo );
495 for ( ; it.current(); ++it ) 449 for ( ; it.current(); ++it )
496 { 450 {
497 OConfItem *item = it.current(); 451 OConfItem *item = it.current();
498 if ( retrieveAll || item->type() == typefilter ) 452 if ( retrieveAll || item->type() == typefilter )
499 { 453 {
500 sl->append( item ); 454 sl->append( item );
501 } 455 }
502 } 456 }
503 457
504 return sl; 458 return sl;
505} 459}
diff --git a/noncore/settings/packagemanager/oipkg.h b/noncore/settings/packagemanager/oipkg.h
index 4065f48..824fa17 100644
--- a/noncore/settings/packagemanager/oipkg.h
+++ b/noncore/settings/packagemanager/oipkg.h
@@ -1,100 +1,101 @@
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#ifndef OIPKG_H 32#ifndef OIPKG_H
33#define OIPKG_H 33#define OIPKG_H
34 34
35extern "C" {
36#include <libipkg.h>
37};
38
35#include <qobject.h> 39#include <qobject.h>
36 40
37#include <qpe/config.h> 41#include <qpe/config.h>
38 42
39#include "oconfitem.h" 43#include "oconfitem.h"
40#include "opackage.h" 44#include "opackage.h"
41 45
42// Ipkg execution options (m_ipkgExecOptions) 46// Ipkg execution options (m_ipkgExecOptions)
43#define FORCE_DEPENDS 0x0001 47#define FORCE_DEPENDS 0x0001
44#define FORCE_REMOVE 0x0002 48#define FORCE_REMOVE 0x0002
45#define FORCE_REINSTALL 0x0004 49#define FORCE_REINSTALL 0x0004
46#define FORCE_OVERWRITE 0x0008 50#define FORCE_OVERWRITE 0x0008
47 51
48class OConfItemList; 52class OConfItemList;
49class OProcess;
50 53
51class OIpkg : public QObject 54class OIpkg : public QObject
52{ 55{
53 Q_OBJECT 56 Q_OBJECT
54 57
55public: 58public:
56 OIpkg( Config *config = 0x0, QObject *parent = 0x0, const char *name = 0x0 ); 59 OIpkg( Config *config = 0x0, QObject *parent = 0x0, const char *name = 0x0 );
57 ~OIpkg(); 60 ~OIpkg();
58 61
59 OConfItemList *configItems(); 62 OConfItemList *configItems();
60 OConfItemList *servers(); 63 OConfItemList *servers();
61 OConfItemList *destinations(); 64 OConfItemList *destinations();
62 OConfItemList *options(); 65 OConfItemList *options();
63 66
64 int ipkgExecOptions() { return m_ipkgExecOptions; } 67 int ipkgExecOptions() { return m_ipkgExecOptions; }
65 int ipkgExecVerbosity() { return m_ipkgExecVerbosity; } 68 int ipkgExecVerbosity() { return m_ipkgExecVerbosity; }
66 69
67 void setConfigItems( OConfItemList *configList ); 70 void setConfigItems( OConfItemList *configList );
68 void setIpkgExecOptions( int options ) { m_ipkgExecOptions = options; } 71 void setIpkgExecOptions( int options ) { m_ipkgExecOptions = options; }
69 void setIpkgExecVerbosity( int verbosity ) { m_ipkgExecVerbosity = verbosity; } 72 void setIpkgExecVerbosity( int verbosity ) { m_ipkgExecVerbosity = verbosity; }
70 73
71 void saveSettings(); 74 void saveSettings();
72 75
73 OPackageList *availablePackages( const QString &server = QString::null ); 76 OPackageList *availablePackages( const QString &server = QString::null );
74 OPackageList *installedPackages( const QString &destName = QString::null, 77 OPackageList *installedPackages( const QString &destName = QString::null,
75 const QString &destPath = QString::null ); 78 const QString &destPath = QString::null );
76 79
77 bool executeCommand( OPackage::Command command = OPackage::NotDefined, QStringList *parameters = 0x0, 80 bool executeCommand( OPackage::Command command = OPackage::NotDefined, QStringList *parameters = 0x0,
78 const QString &destination = QString::null, const QObject *receiver = 0x0, 81 const QString &destination = QString::null, const QObject *receiver = 0x0,
79 const char *slotOutput = 0x0, const char *slotErrors = 0x0, 82 const char *slotOutput = 0x0, bool rawOutput = true );
80 const char *slotFinished = 0x0, bool rawOutput = true );
81 void abortCommand(); 83 void abortCommand();
82 84
85 void ipkgOutput( char *msg );
86
83private: 87private:
84 Config *m_config; // Pointer to application configuration file 88 Config *m_config; // Pointer to application configuration file
85 QString m_ipkgExec; // Fully qualified path/filename of ipkg binary 89 args_t m_ipkgArgs; // libipkg configuration arguments
86 OConfItemList *m_confInfo; // Contains info from all Ipkg configuration files 90 OConfItemList *m_confInfo; // Contains info from all Ipkg configuration files
87 int m_ipkgExecOptions; // Bit-mapped flags for Ipkg execution options 91 int m_ipkgExecOptions; // Bit-mapped flags for Ipkg execution options
88 int m_ipkgExecVerbosity; // Ipkg execution verbosity level 92 int m_ipkgExecVerbosity; // Ipkg execution verbosity level
89 OProcess *m_ipkgProcess; // Pointer to process which Ipkg will run in
90 93
91 void loadConfiguration(); 94 void loadConfiguration();
92 OConfItemList *filterConfItems( OConfItem::Type typefilter = OConfItem::NotDefined ); 95 OConfItemList *filterConfItems( OConfItem::Type typefilter = OConfItem::NotDefined );
93 96
94signals: 97signals:
95 void execOutput( OProcess *process, char *buffer, int length ); 98 void execOutput( char *msg );
96 void execErrors( OProcess *process, char *buffer, int length );
97 void execFinished( OProcess *process, char *buffer, int length );
98}; 99};
99 100
100#endif 101#endif
diff --git a/noncore/settings/packagemanager/opackagemanager.cpp b/noncore/settings/packagemanager/opackagemanager.cpp
index 6bef918..e1c8a21 100644
--- a/noncore/settings/packagemanager/opackagemanager.cpp
+++ b/noncore/settings/packagemanager/opackagemanager.cpp
@@ -1,330 +1,323 @@
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 <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
33 33
34#include "opackagemanager.h" 34#include "opackagemanager.h"
35#include "oipkgconfigdlg.h" 35#include "oipkgconfigdlg.h"
36 36
37OPackageManager::OPackageManager( Config *config, QObject *parent, const char *name ) 37OPackageManager::OPackageManager( Config *config, QObject *parent, const char *name )
38 : QObject( parent, name ) 38 : QObject( parent, name )
39 , m_config( config ) 39 , m_config( config )
40 , m_ipkg( m_config, this ) 40 , m_ipkg( m_config, this )
41 , m_packages( 9973 ) 41 , m_packages( 9973 )
42 , m_categories() 42 , m_categories()
43{ 43{
44 m_packages.setAutoDelete( true ); 44 m_packages.setAutoDelete( true );
45} 45}
46 46
47void OPackageManager::loadAvailablePackages() 47void OPackageManager::loadAvailablePackages()
48{ 48{
49 m_packages.clear(); 49 m_packages.clear();
50 50
51 OConfItemList *serverList = m_ipkg.servers(); 51 OConfItemList *serverList = m_ipkg.servers();
52 52
53 if ( serverList ) 53 if ( serverList )
54 { 54 {
55 // Initialize status messaging 55 // Initialize status messaging
56 emit initStatus( serverList->count() ); 56 emit initStatus( serverList->count() );
57 int serverCount = 0; 57 int serverCount = 0;
58 58
59 bool categoryAdded = false; 59 bool categoryAdded = false;
60 60
61 for ( OConfItemListIterator serverIt( *serverList ); serverIt.current(); ++serverIt ) 61 for ( OConfItemListIterator serverIt( *serverList ); serverIt.current(); ++serverIt )
62 { 62 {
63 OConfItem *server = serverIt.current(); 63 OConfItem *server = serverIt.current();
64 64
65 // Process server only if it is active 65 // Process server only if it is active
66 if ( server->active() ) 66 if ( server->active() )
67 { 67 {
68 // Update status 68 // Update status
69 QString status = tr( "Reading available packages:\n\t" ); 69 QString status = tr( "Reading available packages:\n\t" );
70 status.append( server->name() ); 70 status.append( server->name() );
71 emit statusText( status ); 71 emit statusText( status );
72 ++serverCount; 72 ++serverCount;
73 emit statusBar( serverCount ); 73 emit statusBar( serverCount );
74 qApp->processEvents(); 74 qApp->processEvents();
75 75
76 OPackageList *packageList = m_ipkg.availablePackages( server->name() ); 76 OPackageList *packageList = m_ipkg.availablePackages( server->name() );
77 if ( packageList ) 77 if ( packageList )
78 { 78 {
79 for ( OPackageListIterator packageIt( *packageList ); packageIt.current(); ++packageIt ) 79 for ( OPackageListIterator packageIt( *packageList ); packageIt.current(); ++packageIt )
80 { 80 {
81 OPackage *package = packageIt.current(); 81 OPackage *package = packageIt.current();
82 82
83 // Load package info 83 // Load package info
84 if ( !m_packages.find( package->name() ) ) 84 if ( !m_packages.find( package->name() ) )
85 m_packages.insert( package->name(), package ); 85 m_packages.insert( package->name(), package );
86 else 86 else
87 { 87 {
88 // If new package is newer version, replace existing package 88 // If new package is newer version, replace existing package
89 OPackage *currPackage = m_packages[package->name()]; 89 OPackage *currPackage = m_packages[package->name()];
90 if ( compareVersions( package->version(), currPackage->version() ) == 1 ) 90 if ( compareVersions( package->version(), currPackage->version() ) == 1 )
91 m_packages.replace( package->name(), package ); 91 m_packages.replace( package->name(), package );
92 } 92 }
93 93
94 // Add category to list if it doesn't already exist 94 // Add category to list if it doesn't already exist
95 if ( m_categories.grep( package->category() ).isEmpty() ) 95 if ( m_categories.grep( package->category() ).isEmpty() )
96 { 96 {
97 m_categories << package->category(); 97 m_categories << package->category();
98 categoryAdded = true; 98 categoryAdded = true;
99 } 99 }
100 } 100 }
101 } 101 }
102 } 102 }
103 } 103 }
104 delete serverList; 104 delete serverList;
105 105
106 // Sort category list if categories were added 106 // Sort category list if categories were added
107 if ( categoryAdded ) 107 if ( categoryAdded )
108 m_categories.sort(); 108 m_categories.sort();
109 } 109 }
110} 110}
111 111
112void OPackageManager::loadInstalledPackages() 112void OPackageManager::loadInstalledPackages()
113{ 113{
114 OConfItemList *destList = m_ipkg.destinations(); 114 OConfItemList *destList = m_ipkg.destinations();
115 115
116 if ( destList ) 116 if ( destList )
117 { 117 {
118 // Initialize status messaging 118 // Initialize status messaging
119 emit initStatus( destList->count() ); 119 emit initStatus( destList->count() );
120 int destCount = 0; 120 int destCount = 0;
121 121
122 bool categoryAdded = false; 122 bool categoryAdded = false;
123 123
124 for ( OConfItemListIterator destIt( *destList ); destIt.current(); ++destIt ) 124 for ( OConfItemListIterator destIt( *destList ); destIt.current(); ++destIt )
125 { 125 {
126 OConfItem *destination = destIt.current(); 126 OConfItem *destination = destIt.current();
127 127
128 // Process destination only if it is active 128 // Process destination only if it is active
129 if ( destination->active() ) 129 if ( destination->active() )
130 { 130 {
131 // Update status 131 // Update status
132 QString status = tr( "Reading installed packages:\n\t" ); 132 QString status = tr( "Reading installed packages:\n\t" );
133 status.append( destination->name() ); 133 status.append( destination->name() );
134 emit statusText( status ); 134 emit statusText( status );
135 ++destCount; 135 ++destCount;
136 emit statusBar( destCount ); 136 emit statusBar( destCount );
137 qApp->processEvents(); 137 qApp->processEvents();
138 138
139 OPackageList *packageList = m_ipkg.installedPackages( destination->name(), 139 OPackageList *packageList = m_ipkg.installedPackages( destination->name(),
140 destination->value() ); 140 destination->value() );
141 if ( packageList ) 141 if ( packageList )
142 { 142 {
143 for ( OPackageListIterator packageIt( *packageList ); packageIt.current(); ++packageIt ) 143 for ( OPackageListIterator packageIt( *packageList ); packageIt.current(); ++packageIt )
144 { 144 {
145 OPackage *package = packageIt.current(); 145 OPackage *package = packageIt.current();
146 OPackage *currPackage = m_packages[package->name()]; 146 OPackage *currPackage = m_packages[package->name()];
147 if ( currPackage ) 147 if ( currPackage )
148 { 148 {
149 // Package is in a current feed, update installed version, destination 149 // Package is in a current feed, update installed version, destination
150 currPackage->setVersionInstalled( package->versionInstalled() ); 150 currPackage->setVersionInstalled( package->versionInstalled() );
151 currPackage->setDestination( package->destination() ); 151 currPackage->setDestination( package->destination() );
152 152
153 delete package; 153 delete package;
154 } 154 }
155 else 155 else
156 { 156 {
157 // Package isn't in a current feed, add to list 157 // Package isn't in a current feed, add to list
158 m_packages.insert( package->name(), package ); 158 m_packages.insert( package->name(), package );
159 159
160 // Add category to list if it doesn't already exist 160 // Add category to list if it doesn't already exist
161 if ( m_categories.grep( package->category() ).isEmpty() ) 161 if ( m_categories.grep( package->category() ).isEmpty() )
162 { 162 {
163 m_categories << package->category(); 163 m_categories << package->category();
164 categoryAdded = true; 164 categoryAdded = true;
165 } 165 }
166 } 166 }
167 } 167 }
168 } 168 }
169 } 169 }
170 } 170 }
171 delete destList; 171 delete destList;
172 172
173 // Sort category list if categories were added 173 // Sort category list if categories were added
174 if ( categoryAdded ) 174 if ( categoryAdded )
175 m_categories.sort(); 175 m_categories.sort();
176 } 176 }
177} 177}
178 178
179OPackageList *OPackageManager::packages() 179OPackageList *OPackageManager::packages()
180{ 180{
181 // TODO - look to see if list is loaded, if not, load available & installed 181 // TODO - look to see if list is loaded, if not, load available & installed
182 182
183 OPackageList *pl = new OPackageList; 183 OPackageList *pl = new OPackageList;
184 184
185 for ( QDictIterator<OPackage> packageIt( m_packages ); packageIt.current(); ++packageIt ) 185 for ( QDictIterator<OPackage> packageIt( m_packages ); packageIt.current(); ++packageIt )
186 pl->append( packageIt.current() ); 186 pl->append( packageIt.current() );
187 187
188 return pl; 188 return pl;
189} 189}
190 190
191OPackageList *OPackageManager::filterPackages( const QString &name,const QString &server, 191OPackageList *OPackageManager::filterPackages( const QString &name,const QString &server,
192 const QString &destination, Status status, const QString &category ) 192 const QString &destination, Status status, const QString &category )
193{ 193{
194 // TODO - look to see if list is loaded, if not, load available & installed 194 // TODO - look to see if list is loaded, if not, load available & installed
195 195
196 OPackageList *pl = new OPackageList; 196 OPackageList *pl = new OPackageList;
197 for ( QDictIterator<OPackage> packageIt( m_packages ); packageIt.current(); ++packageIt ) 197 for ( QDictIterator<OPackage> packageIt( m_packages ); packageIt.current(); ++packageIt )
198 { 198 {
199 OPackage *package = packageIt.current(); 199 OPackage *package = packageIt.current();
200 200
201 bool nameMatch = ( name.isNull() || package->name().contains( name ) ); 201 bool nameMatch = ( name.isNull() || package->name().contains( name ) );
202 bool serverMatch = ( server.isNull() || package->source() == server ); 202 bool serverMatch = ( server.isNull() || package->source() == server );
203 bool destinationMatch = ( destination.isNull() || package->destination() == destination ); 203 bool destinationMatch = ( destination.isNull() || package->destination() == destination );
204 bool statusMatch; 204 bool statusMatch;
205 switch ( status ) 205 switch ( status )
206 { 206 {
207 case All : statusMatch = true; 207 case All : statusMatch = true;
208 break; 208 break;
209 case NotInstalled : statusMatch = package->versionInstalled().isNull(); 209 case NotInstalled : statusMatch = package->versionInstalled().isNull();
210 break; 210 break;
211 case Installed : statusMatch = !package->versionInstalled().isNull(); 211 case Installed : statusMatch = !package->versionInstalled().isNull();
212 break; 212 break;
213 case Updated : statusMatch = ( !package->versionInstalled().isNull() && 213 case Updated : statusMatch = ( !package->versionInstalled().isNull() &&
214 compareVersions( package->version(), package->versionInstalled() ) == 1 ); 214 compareVersions( package->version(), package->versionInstalled() ) == 1 );
215 break; 215 break;
216 default : statusMatch = true; 216 default : statusMatch = true;
217 break; 217 break;
218 }; 218 };
219 bool categoryMatch = ( category.isNull() || package->category() == category ); 219 bool categoryMatch = ( category.isNull() || package->category() == category );
220 220
221 if ( nameMatch && serverMatch && destinationMatch && statusMatch && categoryMatch ) 221 if ( nameMatch && serverMatch && destinationMatch && statusMatch && categoryMatch )
222 pl->append( packageIt.current() ); 222 pl->append( packageIt.current() );
223 } 223 }
224 224
225 return pl; 225 return pl;
226} 226}
227 227
228QStringList *OPackageManager::servers() 228QStringList *OPackageManager::servers()
229{ 229{
230 QStringList *sl = new QStringList(); 230 QStringList *sl = new QStringList();
231 231
232 OConfItemList *serverList = m_ipkg.servers(); 232 OConfItemList *serverList = m_ipkg.servers();
233 if ( serverList ) 233 if ( serverList )
234 { 234 {
235 for ( OConfItemListIterator serverIt( *serverList ); serverIt.current(); ++serverIt ) 235 for ( OConfItemListIterator serverIt( *serverList ); serverIt.current(); ++serverIt )
236 { 236 {
237 OConfItem *server = serverIt.current(); 237 OConfItem *server = serverIt.current();
238 238
239 // Add only active servers 239 // Add only active servers
240 if ( server->active() ) 240 if ( server->active() )
241 *sl << server->name(); 241 *sl << server->name();
242 } 242 }
243 } 243 }
244 244
245 return sl; 245 return sl;
246} 246}
247 247
248QStringList *OPackageManager::destinations() 248QStringList *OPackageManager::destinations()
249{ 249{
250 QStringList *dl = new QStringList(); 250 QStringList *dl = new QStringList();
251 251
252 OConfItemList *destList = m_ipkg.destinations(); 252 OConfItemList *destList = m_ipkg.destinations();
253 if ( destList ) 253 if ( destList )
254 { 254 {
255 for ( OConfItemListIterator destIt( *destList ); destIt.current(); ++destIt ) 255 for ( OConfItemListIterator destIt( *destList ); destIt.current(); ++destIt )
256 { 256 {
257 OConfItem *destination = destIt.current(); 257 OConfItem *destination = destIt.current();
258 258
259 // Add only active destinations 259 // Add only active destinations
260 if ( destination->active() ) 260 if ( destination->active() )
261 *dl << destination->name(); 261 *dl << destination->name();
262 } 262 }
263 } 263 }
264 264
265 return dl; 265 return dl;
266} 266}
267 267
268OConfItem *OPackageManager::findConfItem( OConfItem::Type type, const QString &name ) 268OConfItem *OPackageManager::findConfItem( OConfItem::Type type, const QString &name )
269{ 269{
270 OConfItem *confItem = 0x0; 270 OConfItem *confItem = 0x0;
271 OConfItemList *confList = m_ipkg.configItems(); 271 OConfItemList *confList = m_ipkg.configItems();
272 if ( confList ) 272 if ( confList )
273 { 273 {
274 for ( OConfItemListIterator confIt( *confList ); confIt.current(); ++confIt ) 274 for ( OConfItemListIterator confIt( *confList ); confIt.current(); ++confIt )
275 { 275 {
276 OConfItem *conf = confIt.current(); 276 OConfItem *conf = confIt.current();
277 277
278 // Add only active confinations 278 // Add only active confinations
279 if ( conf->type() == type && conf->name() == name ) 279 if ( conf->type() == type && conf->name() == name )
280 { 280 {
281 confItem = conf; 281 confItem = conf;
282 break; 282 break;
283 } 283 }
284 } 284 }
285 } 285 }
286 286
287 return confItem; 287 return confItem;
288 288
289} 289}
290 290
291OPackage *OPackageManager::findPackage( const QString &name ) 291OPackage *OPackageManager::findPackage( const QString &name )
292{ 292{
293 return m_packages[ name ]; 293 return m_packages[ name ];
294} 294}
295 295
296int OPackageManager::compareVersions( const QString &version1, const QString &version2 ) 296int OPackageManager::compareVersions( const QString &version1, const QString &version2 )
297{ 297{
298 // TODO - do proper compare! 298 // TODO - do proper compare!
299 if ( version1 < version2 ) 299 if ( version1 < version2 )
300 return -1; 300 return -1;
301 else if ( version1 > version2 ) 301 else if ( version1 > version2 )
302 return 1; 302 return 1;
303 303
304 return 0; 304 return 0;
305} 305}
306 306
307bool OPackageManager::configureDlg( bool installOptions ) 307bool OPackageManager::configureDlg( bool installOptions )
308{ 308{
309 OIpkgConfigDlg dlg( &m_ipkg, installOptions, static_cast<QWidget *>(parent()) ); 309 OIpkgConfigDlg dlg( &m_ipkg, installOptions, static_cast<QWidget *>(parent()) );
310 return ( dlg.exec() == QDialog::Accepted ); 310 return ( dlg.exec() == QDialog::Accepted );
311} 311}
312 312
313void OPackageManager::saveSettings() 313void OPackageManager::saveSettings()
314{ 314{
315 m_ipkg.saveSettings(); 315 m_ipkg.saveSettings();
316} 316}
317 317
318bool OPackageManager::executeCommand( OPackage::Command command, QStringList *packages, 318bool OPackageManager::executeCommand( OPackage::Command command, QStringList *packages,
319 const QString &destination, const QObject *receiver, 319 const QString &destination, const QObject *receiver,
320 const char *slotOutput, const char *slotErrors, 320 const char *slotOutput, bool rawOutput )
321 const char *slotFinished, bool rawOutput )
322{ 321{
323 return m_ipkg.executeCommand( command, packages, destination, receiver, slotOutput, slotErrors, 322 return m_ipkg.executeCommand( command, packages, destination, receiver, slotOutput, rawOutput );
324 slotFinished, rawOutput );
325}
326
327void OPackageManager::abortCommand()
328{
329 m_ipkg.abortCommand();
330} 323}
diff --git a/noncore/settings/packagemanager/opackagemanager.h b/noncore/settings/packagemanager/opackagemanager.h
index 5e1a30a..871af0c 100644
--- a/noncore/settings/packagemanager/opackagemanager.h
+++ b/noncore/settings/packagemanager/opackagemanager.h
@@ -1,91 +1,89 @@
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#ifndef OPACKAGEMANAGER_H 32#ifndef OPACKAGEMANAGER_H
33#define OPACKAGEMANAGER_H 33#define OPACKAGEMANAGER_H
34 34
35#include <qdict.h> 35#include <qdict.h>
36#include <qobject.h> 36#include <qobject.h>
37#include <qstringlist.h> 37#include <qstringlist.h>
38 38
39#include <qpe/config.h> 39#include <qpe/config.h>
40 40
41#include "oipkg.h" 41#include "oipkg.h"
42 42
43class OPackageManager : public QObject 43class OPackageManager : public QObject
44{ 44{
45 Q_OBJECT 45 Q_OBJECT
46 46
47public: 47public:
48 OPackageManager( Config *config = 0x0, QObject *parent = 0x0, const char *name = 0x0 ); 48 OPackageManager( Config *config = 0x0, QObject *parent = 0x0, const char *name = 0x0 );
49 49
50 void loadAvailablePackages(); 50 void loadAvailablePackages();
51 void loadInstalledPackages(); 51 void loadInstalledPackages();
52 52
53 enum Status { All, NotInstalled, Installed, Updated, NotDefined }; 53 enum Status { All, NotInstalled, Installed, Updated, NotDefined };
54 54
55 OPackageList *packages(); 55 OPackageList *packages();
56 OPackageList *filterPackages( const QString &name = 0x0,const QString &server = 0x0, 56 OPackageList *filterPackages( const QString &name = 0x0,const QString &server = 0x0,
57 const QString &destination = 0x0, Status status = NotDefined, 57 const QString &destination = 0x0, Status status = NotDefined,
58 const QString &category = 0x0 ); 58 const QString &category = 0x0 );
59 59
60 const QStringList &categories() { return m_categories; } 60 const QStringList &categories() { return m_categories; }
61 QStringList *servers(); 61 QStringList *servers();
62 QStringList *destinations(); 62 QStringList *destinations();
63 63
64 int compareVersions( const QString &version1, const QString &version2 ); 64 int compareVersions( const QString &version1, const QString &version2 );
65 65
66 OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined, 66 OConfItem *findConfItem( OConfItem::Type type = OConfItem::NotDefined,
67 const QString &name = QString::null ); 67 const QString &name = QString::null );
68 OPackage *findPackage( const QString &name = QString::null ); 68 OPackage *findPackage( const QString &name = QString::null );
69 69
70 bool configureDlg( bool installOptions = false ); 70 bool configureDlg( bool installOptions = false );
71 void saveSettings(); 71 void saveSettings();
72 72
73 bool executeCommand( OPackage::Command command = OPackage::NotDefined, QStringList *parameters = 0x0, 73 bool executeCommand( OPackage::Command command = OPackage::NotDefined, QStringList *parameters = 0x0,
74 const QString &destination = QString::null, const QObject *receiver = 0x0, 74 const QString &destination = QString::null, const QObject *receiver = 0x0,
75 const char *slotOutput = 0x0, const char *slotErrors = 0x0, 75 const char *slotOutput = 0x0, bool rawOutput = true );
76 const char *slotFinished = 0x0, bool rawOutput = true );
77 void abortCommand();
78 76
79private: 77private:
80 Config *m_config; // Pointer to application configuration file 78 Config *m_config; // Pointer to application configuration file
81 OIpkg m_ipkg; // OIpkg object to retrieve package/configuration information 79 OIpkg m_ipkg; // OIpkg object to retrieve package/configuration information
82 QDict<OPackage> m_packages; // Global list of available packages 80 QDict<OPackage> m_packages; // Global list of available packages
83 QStringList m_categories; // List of all categories 81 QStringList m_categories; // List of all categories
84 82
85signals: 83signals:
86 void initStatus( int numSteps ); 84 void initStatus( int numSteps );
87 void statusText( const QString &status ); 85 void statusText( const QString &status );
88 void statusBar( int currStep ); 86 void statusBar( int currStep );
89}; 87};
90 88
91#endif 89#endif
diff --git a/noncore/settings/packagemanager/opie-packagemanager.control b/noncore/settings/packagemanager/opie-packagemanager.control
index db06761..095e3be 100644
--- a/noncore/settings/packagemanager/opie-packagemanager.control
+++ b/noncore/settings/packagemanager/opie-packagemanager.control
@@ -1,10 +1,10 @@
1Package: opie-packagemanager 1Package: opie-packagemanager
2Files: plugins/application/libpackagemanager.so* bin/packagemanager pics/packagemanager apps/Settings/packagemanager.desktop 2Files: plugins/application/libpackagemanager.so* bin/packagemanager pics/packagemanager apps/Settings/packagemanager.desktop
3Priority: optional 3Priority: optional
4Section: Settings 4Section: Settings
5Depends: task-opie-minimal 5Depends: task-opie-minimal
6Replaces: packagemanager 6Replaces: packagemanager
7Architecture: arm 7Architecture: arm
8Maintainer: Dan Williams (drw@handhelds.org) 8Maintainer: Dan Williams (drw@handhelds.org)
9Description: Opie package management client 9Description: Opie package management client
10Version: 0.1.0 10Version: 0.2.0
diff --git a/noncore/settings/packagemanager/packagemanager.pro b/noncore/settings/packagemanager/packagemanager.pro
index 9aa3dc6..55af13e 100644
--- a/noncore/settings/packagemanager/packagemanager.pro
+++ b/noncore/settings/packagemanager/packagemanager.pro
@@ -1,31 +1,36 @@
1CONFIG = qt warn_on release quick-app 1CONFIG = qt warn_on release quick-app
2//TEMPLATE = app
3//CONFIG += qte warn_on debug
4//DESTDIR = $(OPIEDIR)/bin
2 5
3SOURCES = opackage.cpp \ 6SOURCES = opackage.cpp \
4 oconfitem.cpp \ 7 oconfitem.cpp \
5 oipkg.cpp \ 8 oipkg.cpp \
6 oipkgconfigdlg.cpp \ 9 oipkgconfigdlg.cpp \
7 opackagemanager.cpp \ 10 opackagemanager.cpp \
8 mainwindow.cpp \ 11 mainwindow.cpp \
9 installdlg.cpp \ 12 installdlg.cpp \
10 packageinfodlg.cpp \ 13 packageinfodlg.cpp \
11 filterdlg.cpp \ 14 filterdlg.cpp \
12 promptdlg.cpp \ 15 promptdlg.cpp \
13 main.cpp 16 main.cpp
14HEADERS = opackage.h \ 17HEADERS = opackage.h \
15 oconfitem.h \ 18 oconfitem.h \
16 oipkg.h \ 19 oipkg.h \
17 oipkgconfigdlg.h \ 20 oipkgconfigdlg.h \
18 opackagemanager.h \ 21 opackagemanager.h \
19 mainwindow.h \ 22 mainwindow.h \
20 installdlg.h \ 23 installdlg.h \
21 packageinfodlg.h \ 24 packageinfodlg.h \
22 filterdlg.h \ 25 filterdlg.h \
23 promptdlg.h 26 promptdlg.h
24 27
28DEFINES += IPKG_LIB
29DEFINES += HAVE_MKDTEMP
25TARGET = packagemanager 30TARGET = packagemanager
26INCLUDEPATH += $(OPIEDIR)/include 31INCLUDEPATH += $(OPIEDIR)/include $(IPKGDIR)
27DEPENDPATH += $(OPIEDIR)/include 32DEPENDPATH += $(OPIEDIR)/include
28LIBS += -lqpe -lopie 33LIBS += -lqpe -lopie -lipkg
29 34
30include ( $(OPIEDIR)/include.pro ) 35include ( $(OPIEDIR)/include.pro )
31 36