summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/packagemanager/ChangeLog6
-rw-r--r--noncore/settings/packagemanager/entrydlg.cpp82
-rw-r--r--noncore/settings/packagemanager/entrydlg.h57
-rw-r--r--noncore/settings/packagemanager/installdlg.cpp2
-rw-r--r--noncore/settings/packagemanager/mainwindow.cpp50
-rw-r--r--noncore/settings/packagemanager/mainwindow.h2
-rw-r--r--noncore/settings/packagemanager/oipkg.cpp9
-rw-r--r--noncore/settings/packagemanager/packagemanager.pro4
-rw-r--r--noncore/settings/packagemanager/promptdlg.cpp2
9 files changed, 185 insertions, 29 deletions
diff --git a/noncore/settings/packagemanager/ChangeLog b/noncore/settings/packagemanager/ChangeLog
index 1ba12af..efa75b1 100644
--- a/noncore/settings/packagemanager/ChangeLog
+++ b/noncore/settings/packagemanager/ChangeLog
@@ -1,9 +1,15 @@
12004-01-23 Dan Williams <drw@handhelds.org>
2
3 * Added package download functionality
4 * Have Opie update links after install/removal so that apps
5 will display properly in Launcher
6
12004-01-20 Dan Williams <drw@handhelds.org> 72004-01-20 Dan Williams <drw@handhelds.org>
2 8
3 * Released version 0.2.0 9 * Released version 0.2.0
4 * Converted to use libipkg in place of spawning ipkg process 10 * Converted to use libipkg in place of spawning ipkg process
5 11
62004-01-13 Dan Williams <drw@handhelds.org> 122004-01-13 Dan Williams <drw@handhelds.org>
7 13
8 * Released version 0.1.0 14 * Released version 0.1.0
9 * Initial check-in of new package management client to eventually replace AQPkg 15 * Initial check-in of new package management client to eventually replace AQPkg
diff --git a/noncore/settings/packagemanager/entrydlg.cpp b/noncore/settings/packagemanager/entrydlg.cpp
new file mode 100644
index 0000000..8deaa37
--- a/dev/null
+++ b/noncore/settings/packagemanager/entrydlg.cpp
@@ -0,0 +1,82 @@
1/*
2                This file is part of the OPIE Project
3
4 =. Copyright (c) 2004 Dan Williams <drw@handhelds.org>
5             .=l.
6           .>+-=
7 _;:,     .>    :=|. This file is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This file is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.=       =       ; Public License for more details.
20++=   -.     .`     .:
21 :     =  ...= . :.=- You should have received a copy of the GNU
22 -.   .:....=;==+<; General Public License along with this file;
23  -_. . .   )=.  = see the file COPYING. If not, write to the
24    --        :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA.
27
28*/
29
30#include "entrydlg.h"
31
32#include <qlabel.h>
33#include <qlayout.h>
34#include <qlineedit.h>
35#include <qpushbutton.h>
36
37EntryDlg::EntryDlg( const QString &label, QWidget* parent, const char* name, bool modal )
38 : QDialog( parent, name, modal )
39{
40 QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 );
41
42 QLabel *l = new QLabel( label, this );
43 l->setAlignment( AlignLeft | AlignTop | WordBreak );
44 vbox->addWidget( l );
45
46 m_entry = new QLineEdit( this );
47 vbox->addWidget( m_entry );
48
49 connect( m_entry, SIGNAL(returnPressed()), this, SLOT(tryAccept()) );
50}
51
52void EntryDlg::setText( const QString &text )
53{
54 m_entry->setText( text );
55 m_entry->selectAll();
56}
57
58QString EntryDlg::getText()
59{
60 return m_entry->text();
61}
62
63QString EntryDlg::getText( const QString &caption, const QString &label, const QString &text, bool *ok,
64 QWidget *parent, const char *name )
65{
66 EntryDlg *dlg = new EntryDlg( label, parent, name, true );
67 dlg->setCaption( caption );
68 dlg->setText( text );
69
70 QString result;
71 *ok = ( dlg->exec() == QDialog::Accepted );
72 if ( *ok )
73 result = dlg->getText();
74
75 delete dlg;
76 return result;
77}
78void EntryDlg::tryAccept()
79{
80 if ( !m_entry->text().isEmpty() )
81 accept();
82}
diff --git a/noncore/settings/packagemanager/entrydlg.h b/noncore/settings/packagemanager/entrydlg.h
new file mode 100644
index 0000000..33a7920
--- a/dev/null
+++ b/noncore/settings/packagemanager/entrydlg.h
@@ -0,0 +1,57 @@
1/*
2                This file is part of the OPIE Project
3
4 =. Copyright (c) 2004 Dan Williams <drw@handhelds.org>
5             .=l.
6           .>+-=
7 _;:,     .>    :=|. This file is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU General Public
10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This file is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.=       =       ; Public License for more details.
20++=   -.     .`     .:
21 :     =  ...= . :.=- You should have received a copy of the GNU
22 -.   .:....=;==+<; General Public License along with this file;
23  -_. . .   )=.  = see the file COPYING. If not, write to the
24    --        :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA.
27
28*/
29
30#ifndef ENTRYDLG_H
31#define ENTRYDLG_H
32
33#include <qdialog.h>
34
35class QLineEdit;
36
37class EntryDlg : public QDialog
38{
39 Q_OBJECT
40
41public:
42 static QString getText( const QString &caption, const QString &label, const QString &text = QString::null,
43 bool *ok = 0, QWidget *parent = 0, const char *name = 0 );
44
45 EntryDlg( const QString &label, QWidget* parent = 0, const char* name = 0, bool modal = true );
46
47 void setText( const QString &text );
48 QString getText();
49
50private slots:
51 void tryAccept();
52
53private:
54 QLineEdit *m_entry;
55};
56
57#endif // EntryDlg_H
diff --git a/noncore/settings/packagemanager/installdlg.cpp b/noncore/settings/packagemanager/installdlg.cpp
index 6a9ccbd..0c2ea78 100644
--- a/noncore/settings/packagemanager/installdlg.cpp
+++ b/noncore/settings/packagemanager/installdlg.cpp
@@ -1,299 +1,301 @@
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 case OPackage::Download : lineStr.append( tr( "download" ) );
145 break;
144 default : 146 default :
145 break; 147 break;
146 }; 148 };
147 lineStr.append( ":\n" ); 149 lineStr.append( ":\n" );
148 150
149 for ( QStringList::Iterator it = m_packages[ i ]->begin(); it != m_packages[ i ]->end(); ++it ) 151 for ( QStringList::Iterator it = m_packages[ i ]->begin(); it != m_packages[ i ]->end(); ++it )
150 { 152 {
151 lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) ); 153 lineStr.append( QString( "\t%1\n" ).arg( ( *it ) ) );
152 } 154 }
153 155
154 m_output->append( lineStr ); 156 m_output->append( lineStr );
155 } 157 }
156 } 158 }
157 159
158 m_output->append( tr( "Press the start button to begin.\n" ) ); 160 m_output->append( tr( "Press the start button to begin.\n" ) );
159 m_output->setCursorPosition( m_output->numLines(), 0 ); 161 m_output->setCursorPosition( m_output->numLines(), 0 );
160 162
161} 163}
162 164
163InstallDlg::~InstallDlg() 165InstallDlg::~InstallDlg()
164{ 166{
165 for( int i = 0; i < m_numCommands; i++ ) 167 for( int i = 0; i < m_numCommands; i++ )
166 { 168 {
167 if ( m_packages[ i ] ) 169 if ( m_packages[ i ] )
168 delete m_packages[ i ]; 170 delete m_packages[ i ];
169 } 171 }
170} 172}
171 173
172void InstallDlg::slotDisplayAvailSpace( const QString &destination ) 174void InstallDlg::slotDisplayAvailSpace( const QString &destination )
173{ 175{
174 // If available space is not displayed, exit 176 // If available space is not displayed, exit
175 if ( !m_availSpace ) 177 if ( !m_availSpace )
176 return; 178 return;
177 179
178 QString space = tr( "Unknown" ); 180 QString space = tr( "Unknown" );
179 181
180 // Get destination 182 // Get destination
181 OConfItem *dest = m_packman->findConfItem( OConfItem::Destination, destination ); 183 OConfItem *dest = m_packman->findConfItem( OConfItem::Destination, destination );
182 184
183 if ( dest ) 185 if ( dest )
184 { 186 {
185 // Calculate available space 187 // Calculate available space
186 struct statfs fs; 188 struct statfs fs;
187 if ( !statfs( dest->value(), &fs ) ) 189 if ( !statfs( dest->value(), &fs ) )
188 { 190 {
189 long mult = fs.f_bsize / 1024; 191 long mult = fs.f_bsize / 1024;
190 long div = 1024 / fs.f_bsize; 192 long div = 1024 / fs.f_bsize;
191 193
192 if ( !mult ) mult = 1; 194 if ( !mult ) mult = 1;
193 if ( !div ) div = 1; 195 if ( !div ) div = 1;
194 long avail = fs.f_bavail * mult / div; 196 long avail = fs.f_bavail * mult / div;
195 197
196 space = tr( "%1 Kb" ).arg( avail ); 198 space = tr( "%1 Kb" ).arg( avail );
197 } 199 }
198 } 200 }
199 201
200 // Display available space 202 // Display available space
201 m_availSpace->setText( space ); 203 m_availSpace->setText( space );
202} 204}
203 205
204void InstallDlg::slotBtnStart() 206void InstallDlg::slotBtnStart()
205{ 207{
206 QString btnText = m_btnStart->text(); 208 QString btnText = m_btnStart->text();
207 if ( btnText == tr( "Abort" ) ) 209 if ( btnText == tr( "Abort" ) )
208 { 210 {
209 // Prevent unexecuted commands from executing 211 // Prevent unexecuted commands from executing
210 m_currCommand = 999; 212 m_currCommand = 999;
211 213
212 // Allow user to close dialog 214 // Allow user to close dialog
213 m_btnStart->setText( tr( "Close" ) ); 215 m_btnStart->setText( tr( "Close" ) );
214 m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); 216 m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) );
215 return; 217 return;
216 } 218 }
217 else if ( btnText == tr( "Close" ) ) 219 else if ( btnText == tr( "Close" ) )
218 { 220 {
219 // TODO - force reload of package data 221 // TODO - force reload of package data
220 emit closeInstallDlg(); 222 emit closeInstallDlg();
221 return; 223 return;
222 } 224 }
223 225
224 // Start was clicked, start executing 226 // Start was clicked, start executing
225 m_btnOptions->setEnabled( false ); 227 m_btnOptions->setEnabled( false );
226 if ( m_numCommands > 1 ) 228 if ( m_numCommands > 1 )
227 { 229 {
228 m_btnStart->setText( tr( "Abort" ) ); 230 m_btnStart->setText( tr( "Abort" ) );
229 m_btnStart->setIconSet( Resource::loadPixmap( "close" ) ); 231 m_btnStart->setIconSet( Resource::loadPixmap( "close" ) );
230 } 232 }
231 else 233 else
232 { 234 {
233 m_btnStart->setEnabled( false ); 235 m_btnStart->setEnabled( false );
234 } 236 }
235 237
236 QString dest; 238 QString dest;
237 if ( m_destination ) 239 if ( m_destination )
238 dest = m_destination->currentText(); 240 dest = m_destination->currentText();
239 241
240 for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ ) 242 for ( m_currCommand = 0; m_currCommand < m_numCommands; m_currCommand++ )
241 { 243 {
242 // Execute next command 244 // Execute next command
243 m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest, 245 m_packman->executeCommand( m_command[ m_currCommand ], m_packages[ m_currCommand ], dest,
244 this, SLOT(slotOutput(char*)), true ); 246 this, SLOT(slotOutput(char*)), true );
245 } 247 }
246 248
247 // All commands executed, allow user to close dialog 249 // All commands executed, allow user to close dialog
248 m_btnStart->setEnabled( true ); 250 m_btnStart->setEnabled( true );
249 m_btnStart->setText( tr( "Close" ) ); 251 m_btnStart->setText( tr( "Close" ) );
250 m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) ); 252 m_btnStart->setIconSet( Resource::loadPixmap( "enter" ) );
251 253
252 m_btnOptions->setEnabled( true ); 254 m_btnOptions->setEnabled( true );
253 m_btnOptions->setText( tr( "Save output" ) ); 255 m_btnOptions->setText( tr( "Save output" ) );
254 m_btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); 256 m_btnOptions->setIconSet( Resource::loadPixmap( "save" ) );
255} 257}
256 258
257void InstallDlg::slotBtnOptions() 259void InstallDlg::slotBtnOptions()
258{ 260{
259 QString btnText = m_btnOptions->text(); 261 QString btnText = m_btnOptions->text();
260 if ( btnText == tr( "Options" ) ) 262 if ( btnText == tr( "Options" ) )
261 { 263 {
262 // Display configuration dialog (only options tab is enabled) 264 // Display configuration dialog (only options tab is enabled)
263 m_packman->configureDlg( true ); 265 m_packman->configureDlg( true );
264 return; 266 return;
265 } 267 }
266 268
267 // Save output was clicked 269 // Save output was clicked
268 QMap<QString, QStringList> map; 270 QMap<QString, QStringList> map;
269 map.insert( tr( "All" ), QStringList() ); 271 map.insert( tr( "All" ), QStringList() );
270 QStringList text; 272 QStringList text;
271 text << "text/*"; 273 text << "text/*";
272 map.insert(tr( "Text" ), text ); 274 map.insert(tr( "Text" ), text );
273 text << "*"; 275 text << "*";
274 map.insert( tr( "All" ), text ); 276 map.insert( tr( "All" ), text );
275 277
276 QString filename = OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); 278 QString filename = OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map );
277 if( !filename.isEmpty() ) 279 if( !filename.isEmpty() )
278 { 280 {
279 QString currentFileName = QFileInfo( filename ).fileName(); 281 QString currentFileName = QFileInfo( filename ).fileName();
280 DocLnk doc; 282 DocLnk doc;
281 doc.setType( "text/plain" ); 283 doc.setType( "text/plain" );
282 doc.setFile( filename ); 284 doc.setFile( filename );
283 doc.setName( currentFileName ); 285 doc.setName( currentFileName );
284 FileManager fm; 286 FileManager fm;
285 fm.saveFile( doc, m_output->text() ); 287 fm.saveFile( doc, m_output->text() );
286 } 288 }
287} 289}
288 290
289void InstallDlg::slotOutput( char *msg ) 291void InstallDlg::slotOutput( char *msg )
290{ 292{
291 // Allow processing of other events 293 // Allow processing of other events
292 qApp->processEvents(); 294 qApp->processEvents();
293 295
294 QString lineStr = msg; 296 QString lineStr = msg;
295 if ( lineStr[lineStr.length()-1] == '\n' ) 297 if ( lineStr[lineStr.length()-1] == '\n' )
296 lineStr.truncate( lineStr.length() - 1 ); 298 lineStr.truncate( lineStr.length() - 1 );
297 m_output->append( lineStr ); 299 m_output->append( lineStr );
298 m_output->setCursorPosition( m_output->numLines(), 0 ); 300 m_output->setCursorPosition( m_output->numLines(), 0 );
299} 301}
diff --git a/noncore/settings/packagemanager/mainwindow.cpp b/noncore/settings/packagemanager/mainwindow.cpp
index 4611404..486561d 100644
--- a/noncore/settings/packagemanager/mainwindow.cpp
+++ b/noncore/settings/packagemanager/mainwindow.cpp
@@ -1,665 +1,667 @@
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 <qdir.h>
31#include <qlayout.h> 32#include <qlayout.h>
32#include <qlineedit.h> 33#include <qlineedit.h>
33#include <qmenubar.h> 34#include <qmenubar.h>
34#include <qmessagebox.h> 35#include <qmessagebox.h>
35#include <qpopupmenu.h> 36#include <qpopupmenu.h>
36#include <qtimer.h> 37#include <qtimer.h>
37#include <qtoolbar.h> 38#include <qtoolbar.h>
38#include <qwhatsthis.h> 39#include <qwhatsthis.h>
39 40
41#include <qpe/qcopenvelope_qws.h>
40#include <qpe/qpeapplication.h> 42#include <qpe/qpeapplication.h>
41#include <qpe/resource.h> 43#include <qpe/resource.h>
42 44
43#include "mainwindow.h" 45#include "mainwindow.h"
44#include "installdlg.h" 46#include "installdlg.h"
45#include "filterdlg.h" 47#include "filterdlg.h"
46#include "promptdlg.h" 48#include "promptdlg.h"
49#include "entrydlg.h"
47 50
48MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl ) 51MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl )
49 : QMainWindow( parent, name, fl || WStyle_ContextHelp ) 52 : QMainWindow( parent, name, fl || WStyle_ContextHelp )
50 , m_config( "packman" ) 53 , m_config( "packman" )
51 , m_packman( &m_config, this ) 54 , m_packman( &m_config, this )
52 , m_menuBar( this ) 55 , m_menuBar( this )
53 , m_toolBar( this ) 56 , m_toolBar( this )
54 , m_findBar( this ) 57 , m_findBar( this )
55 , m_widgetStack( this ) 58 , m_widgetStack( this )
56 , m_packageList( this ) 59 , m_packageList( this )
57 , m_statusWidget( this ) 60 , m_statusWidget( this )
58 , m_statusText( &m_statusWidget ) 61 , m_statusText( &m_statusWidget )
59 , m_statusBar( &m_statusWidget ) 62 , m_statusBar( &m_statusWidget )
60 , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) ) 63 , m_iconUpdated( Resource::loadPixmap( "packagemanager/updated" ) )
61 , m_iconInstalled( Resource::loadPixmap( "installed" ) ) 64 , m_iconInstalled( Resource::loadPixmap( "installed" ) )
62 , m_iconNull( m_iconUpdated.size() ) 65 , m_iconNull( m_iconUpdated.size() )
63 , m_filterName( QString::null ) 66 , m_filterName( QString::null )
64 , m_filterServer( QString::null ) 67 , m_filterServer( QString::null )
65 , m_filterDest( QString::null ) 68 , m_filterDest( QString::null )
66 , m_filterStatus( OPackageManager::NotDefined ) 69 , m_filterStatus( OPackageManager::NotDefined )
67 , m_filterCategory( QString::null ) 70 , m_filterCategory( QString::null )
68 71
69{ 72{
70// setCaption( tr( "Package Manager" ) ); 73// setCaption( tr( "Package Manager" ) );
71 74
72 m_iconNull.fill( colorGroup().base() ); 75 m_iconNull.fill( colorGroup().base() );
73 76
74 connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) ); 77 connect( &m_widgetStack, SIGNAL(aboutToShow(QWidget*)), this, SLOT(slotWidgetStackShow(QWidget*)) );
75 78
76 // Initialize widget stack, package list and status widget 79 // Initialize widget stack, package list and status widget
77 initStatusWidget(); 80 initStatusWidget();
78 initPackageList(); 81 initPackageList();
79 82
80 m_widgetStack.addWidget( &m_statusWidget, 2 ); 83 m_widgetStack.addWidget( &m_statusWidget, 2 );
81 m_widgetStack.addWidget( &m_packageList, 1 ); 84 m_widgetStack.addWidget( &m_packageList, 1 );
82 setCentralWidget( &m_widgetStack ); 85 setCentralWidget( &m_widgetStack );
83 86
84 // Initialize remaining user interface items 87 // Initialize remaining user interface items
85 initUI(); 88 initUI();
86 89
87 // Initialize package information 90 // Initialize package information
88 QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) ); 91 QTimer::singleShot( 100, this, SLOT( initPackageInfo() ) );
89} 92}
90 93
91void MainWindow::closeEvent( QCloseEvent *event ) 94void MainWindow::closeEvent( QCloseEvent *event )
92{ 95{
93 // Close app only if either the package or status widgets are currently active 96 // Close app only if either the package or status widgets are currently active
94 bool close = m_widgetStack.visibleWidget() == &m_packageList || 97 bool close = m_widgetStack.visibleWidget() == &m_packageList ||
95 m_widgetStack.visibleWidget() == &m_statusWidget; 98 m_widgetStack.visibleWidget() == &m_statusWidget;
96 if ( close ) 99 if ( close )
97 { 100 {
98 // TODO - write out application configuration settings 101 // TODO - write out application configuration settings
99 102
100 // Write out package manager configuration settings 103 // Write out package manager configuration settings
101 m_packman.saveSettings(); 104 m_packman.saveSettings();
102 event->accept(); 105 event->accept();
103 } 106 }
104 else 107 else
105 { 108 {
106 delete m_widgetStack.visibleWidget(); 109 delete m_widgetStack.visibleWidget();
107 m_widgetStack.raiseWidget( &m_packageList ); 110 m_widgetStack.raiseWidget( &m_packageList );
108 event->ignore(); 111 event->ignore();
109 } 112 }
110} 113}
111 114
112void MainWindow::initPackageList() 115void MainWindow::initPackageList()
113{ 116{
114 m_packageList.addColumn( tr( "Packages" ) ); 117 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." ) ); 118 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 ); 119 QPEApplication::setStylusOperation( m_packageList.viewport(), QPEApplication::RightOnHold );
117} 120}
118 121
119void MainWindow::initStatusWidget() 122void MainWindow::initStatusWidget()
120{ 123{
121 QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 ); 124 QVBoxLayout *layout = new QVBoxLayout( &m_statusWidget, 4, 4 );
122 125
123 m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); 126 m_statusText.setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
124 layout->addWidget( &m_statusText ); 127 layout->addWidget( &m_statusText );
125 128
126 connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) ); 129 connect( &m_packman, SIGNAL(initStatus(int)), this, SLOT(slotInitStatusBar(int)) );
127 connect( &m_packman, SIGNAL(statusText(const QString &)), this, SLOT(slotStatusText(const QString &)) ); 130 connect( &m_packman, SIGNAL(statusText(const QString &)), this, SLOT(slotStatusText(const QString &)) );
128 connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) ); 131 connect( &m_packman, SIGNAL(statusBar(int)), this, SLOT(slotStatusBar(int)) );
129 132
130 layout->addWidget( &m_statusBar ); 133 layout->addWidget( &m_statusBar );
131} 134}
132 135
133void MainWindow::initUI() 136void MainWindow::initUI()
134{ 137{
135 // Build menu and tool bars 138 // Build menu and tool bars
136 setToolBarsMovable( false ); 139 setToolBarsMovable( false );
137 140
138 m_menuBar.setHorizontalStretchable( true ); 141 m_menuBar.setHorizontalStretchable( true );
139 QMenuBar *mb = new QMenuBar( &m_menuBar ); 142 QMenuBar *mb = new QMenuBar( &m_menuBar );
140 mb->setMargin( 0 ); 143 mb->setMargin( 0 );
141 144
142 // Find toolbar 145 // Find toolbar
143 addToolBar( &m_findBar, QMainWindow::Top, true ); 146 addToolBar( &m_findBar, QMainWindow::Top, true );
144 m_findBar.setHorizontalStretchable( true ); 147 m_findBar.setHorizontalStretchable( true );
145 m_findEdit = new QLineEdit( &m_findBar ); 148 m_findEdit = new QLineEdit( &m_findBar );
146 QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) ); 149 QWhatsThis::add( m_findEdit, tr( "Type the text to search for here." ) );
147 m_findBar.setStretchableWidget( m_findEdit ); 150 m_findBar.setStretchableWidget( m_findEdit );
148 connect( m_findEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotFindChanged(const QString &)) ); 151 connect( m_findEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotFindChanged(const QString &)) );
149 152
150 // Packages menu 153 // Packages menu
151 QPopupMenu *popup = new QPopupMenu( this ); 154 QPopupMenu *popup = new QPopupMenu( this );
152 155
153 QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "packagemanager/update" ), QString::null, 0, this, 0 ); 156 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." ) ); 157 a->setWhatsThis( tr( "Click here to update package lists from servers." ) );
155 connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) ); 158 connect( a, SIGNAL(activated()), this, SLOT(slotUpdate()) );
156 a->addTo( popup ); 159 a->addTo( popup );
157 a->addTo( &m_toolBar ); 160 a->addTo( &m_toolBar );
158 161
159 QAction *actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "packagemanager/upgrade" ), QString::null, 0, this, 0 ); 162 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." ) ); 163 actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) );
161 connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) ); 164 connect( actionUpgrade, SIGNAL(activated()), this, SLOT(slotUpgrade()) );
162 actionUpgrade->addTo( popup ); 165 actionUpgrade->addTo( popup );
163 actionUpgrade->addTo( &m_toolBar ); 166 actionUpgrade->addTo( &m_toolBar );
164 167
165/*
166 QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" ); 168 QPixmap iconDownload = Resource::loadPixmap( "packagemanager/download" );
167 QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" ); 169 QPixmap iconRemove = Resource::loadPixmap( "packagemanager/remove" );
168 QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); 170 QAction *actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 );
169 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); 171 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) );
170 connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) ); 172 connect( actionDownload, SIGNAL(activated()), this, SLOT(slotDownload()) );
171 actionDownload->addTo( popup ); 173 actionDownload->addTo( popup );
172 actionDownload->addTo( &m_toolBar ); 174 actionDownload->addTo( &m_toolBar );
173*/
174 175
175 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 ); 176 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "packagemanager/apply" ), QString::null, 0, this, 0 );
176 a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); 177 a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) );
177 connect( a, SIGNAL(activated()), this, SLOT(slotApply()) ); 178 connect( a, SIGNAL(activated()), this, SLOT(slotApply()) );
178 a->addTo( popup ); 179 a->addTo( popup );
179 a->addTo( &m_toolBar ); 180 a->addTo( &m_toolBar );
180 181
181 popup->insertSeparator(); 182 popup->insertSeparator();
182 183
183 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); 184 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 );
184 a->setWhatsThis( tr( "Click here to configure this application." ) ); 185 a->setWhatsThis( tr( "Click here to configure this application." ) );
185 connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) ); 186 connect( a, SIGNAL(activated()), this, SLOT(slotConfigure()) );
186 a->addTo( popup ); 187 a->addTo( popup );
187 mb->insertItem( tr( "Actions" ), popup ); 188 mb->insertItem( tr( "Actions" ), popup );
188 189
189 // View menu 190 // View menu
190 popup = new QPopupMenu( this ); 191 popup = new QPopupMenu( this );
191 192
192 m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); 193 m_actionShowNotInstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 );
193 m_actionShowNotInstalled->setToggleAction( true ); 194 m_actionShowNotInstalled->setToggleAction( true );
194 m_actionShowNotInstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); 195 m_actionShowNotInstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) );
195 connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) ); 196 connect( m_actionShowNotInstalled, SIGNAL(activated()), this, SLOT(slotShowNotInstalled()) );
196 m_actionShowNotInstalled->addTo( popup ); 197 m_actionShowNotInstalled->addTo( popup );
197 198
198 m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); 199 m_actionShowInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 );
199 m_actionShowInstalled->setToggleAction( true ); 200 m_actionShowInstalled->setToggleAction( true );
200 m_actionShowInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); 201 m_actionShowInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) );
201 connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) ); 202 connect( m_actionShowInstalled, SIGNAL(activated()), this, SLOT(slotShowInstalled()) );
202 m_actionShowInstalled->addTo( popup ); 203 m_actionShowInstalled->addTo( popup );
203 204
204 m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); 205 m_actionShowUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 );
205 m_actionShowUpdated->setToggleAction( true ); 206 m_actionShowUpdated->setToggleAction( true );
206 m_actionShowUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); 207 m_actionShowUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) );
207 connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) ); 208 connect( m_actionShowUpdated, SIGNAL(activated()), this, SLOT(slotShowUpdated()) );
208 m_actionShowUpdated->addTo( popup ); 209 m_actionShowUpdated->addTo( popup );
209 210
210 popup->insertSeparator(); 211 popup->insertSeparator();
211 212
212 a = new QAction( tr( "Configure filter" ), QString::null, 0, this, 0 ); 213 a = new QAction( tr( "Configure filter" ), QString::null, 0, this, 0 );
213 a->setWhatsThis( tr( "Click here to change package filter criteria." ) ); 214 a->setWhatsThis( tr( "Click here to change package filter criteria." ) );
214 connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) ); 215 connect( a, SIGNAL(activated()), this, SLOT(slotFilterChange()) );
215 a->addTo( popup ); 216 a->addTo( popup );
216 217
217 m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ), 218 m_actionFilter = new QAction( tr( "Filter" ), Resource::loadPixmap( "packagemanager/filter" ),
218 QString::null, 0, this, 0 ); 219 QString::null, 0, this, 0 );
219 m_actionFilter->setToggleAction( true ); 220 m_actionFilter->setToggleAction( true );
220 m_actionFilter->setWhatsThis( tr( "Click here to apply current filter." ) ); 221 m_actionFilter->setWhatsThis( tr( "Click here to apply current filter." ) );
221 connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) ); 222 connect( m_actionFilter, SIGNAL(toggled(bool)), this, SLOT(slotFilter(bool)) );
222 m_actionFilter->addTo( popup ); 223 m_actionFilter->addTo( popup );
223 224
224 popup->insertSeparator(); 225 popup->insertSeparator();
225 226
226 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); 227 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
227 a->setWhatsThis( tr( "Click here to search for text in package names." ) ); 228 a->setWhatsThis( tr( "Click here to search for text in package names." ) );
228 connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) ); 229 connect( a, SIGNAL(activated()), this, SLOT(slotFindShowToolbar()) );
229 a->addTo( popup ); 230 a->addTo( popup );
230 231
231 m_actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); 232 m_actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 );
232 m_actionFindNext->setEnabled( false ); 233 m_actionFindNext->setEnabled( false );
233 m_actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); 234 m_actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) );
234 connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) ); 235 connect( m_actionFindNext, SIGNAL(activated()), this, SLOT(slotFindNext()) );
235 m_actionFindNext->addTo( popup ); 236 m_actionFindNext->addTo( popup );
236 m_actionFindNext->addTo( &m_findBar ); 237 m_actionFindNext->addTo( &m_findBar );
237 238
238 mb->insertItem( tr( "View" ), popup ); 239 mb->insertItem( tr( "View" ), popup );
239 240
240 // Finish find toolbar creation 241 // Finish find toolbar creation
241 a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 242 a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
242 a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); 243 a->setWhatsThis( tr( "Click here to hide the find toolbar." ) );
243 connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) ); 244 connect( a, SIGNAL(activated()), this, SLOT(slotFindHideToolbar()) );
244 a->addTo( &m_findBar ); 245 a->addTo( &m_findBar );
245 m_findBar.hide(); 246 m_findBar.hide();
246} 247}
247 248
248void MainWindow::loadPackageList( OPackageList *packages, bool clearList ) 249void MainWindow::loadPackageList( OPackageList *packages, bool clearList )
249{ 250{
250 if ( clearList ) 251 if ( clearList )
251 m_packageList.clear(); 252 m_packageList.clear();
252 253
253 if ( packages ) 254 if ( packages )
254 { 255 {
255 for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt ) 256 for ( OPackageListIterator packageIt( *packages ); packageIt.current(); ++packageIt )
256 { 257 {
257 OPackage *package = packageIt.current(); 258 OPackage *package = packageIt.current();
258 QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(), 259 QCheckListItem *item = new QCheckListItem( &m_packageList, package->name(),
259 QCheckListItem::CheckBox ); 260 QCheckListItem::CheckBox );
260 m_packageList.insertItem( item ); 261 m_packageList.insertItem( item );
261 262
262 // If a different version of package is available, show update available icon 263 // If a different version of package is available, show update available icon
263 // Otherwise, show installed icon 264 // Otherwise, show installed icon
264 if ( !package->versionInstalled().isNull() ) 265 if ( !package->versionInstalled().isNull() )
265 { 266 {
266 if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) 267 if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 )
267 item->setPixmap( 0, m_iconUpdated ); 268 item->setPixmap( 0, m_iconUpdated );
268 else 269 else
269 item->setPixmap( 0, m_iconInstalled ); 270 item->setPixmap( 0, m_iconInstalled );
270 } 271 }
271 else 272 else
272 item->setPixmap( 0, m_iconNull ); 273 item->setPixmap( 0, m_iconNull );
273 } 274 }
274 } 275 }
275} 276}
276 277
277void MainWindow::searchForPackage( const QString &text ) 278void MainWindow::searchForPackage( const QString &text )
278{ 279{
279 if ( !text.isEmpty() ) 280 if ( !text.isEmpty() )
280 { 281 {
281 // look through package list for text startng at current position 282 // look through package list for text startng at current position
282 QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem()); 283 QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem());
283 if ( start == 0 ) 284 if ( start == 0 )
284 start = static_cast<QCheckListItem *>(m_packageList.firstChild()); 285 start = static_cast<QCheckListItem *>(m_packageList.firstChild());
285 286
286// for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ; 287// for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ;
287 for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ; 288 for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ;
288 item = static_cast<QCheckListItem *>(item->nextSibling()) ) 289 item = static_cast<QCheckListItem *>(item->nextSibling()) )
289 { 290 {
290 if ( item->text().lower().find( text ) != -1 ) 291 if ( item->text().lower().find( text ) != -1 )
291 { 292 {
292 m_packageList.ensureItemVisible( item ); 293 m_packageList.ensureItemVisible( item );
293 m_packageList.setCurrentItem( item ); 294 m_packageList.setCurrentItem( item );
294 break; 295 break;
295 } 296 }
296 } 297 }
297 } 298 }
298} 299}
299 300
300void MainWindow::initPackageInfo() 301void MainWindow::initPackageInfo()
301{ 302{
302 m_widgetStack.raiseWidget( &m_statusWidget ); 303 m_widgetStack.raiseWidget( &m_statusWidget );
303 304
304 // Load package list 305 // Load package list
305 m_packman.loadAvailablePackages(); 306 m_packman.loadAvailablePackages();
306 m_packman.loadInstalledPackages(); 307 m_packman.loadInstalledPackages();
307 308
308 OPackageList *packageList = m_packman.packages(); 309 OPackageList *packageList = m_packman.packages();
309 if ( packageList ) 310 if ( packageList )
310 { 311 {
311 loadPackageList( packageList, true ); 312 loadPackageList( packageList, true );
312 delete packageList; 313 delete packageList;
313 } 314 }
314 315
315 m_widgetStack.raiseWidget( &m_packageList ); 316 m_widgetStack.raiseWidget( &m_packageList );
316} 317}
317 318
318void MainWindow::slotWidgetStackShow( QWidget *widget ) 319void MainWindow::slotWidgetStackShow( QWidget *widget )
319{ 320{
320 if ( widget == &m_packageList ) 321 if ( widget == &m_packageList )
321 { 322 {
322 setCaption( tr( "Package Manager" ) ); 323 setCaption( tr( "Package Manager" ) );
323 324
324 m_menuBar.show(); 325 m_menuBar.show();
325 m_toolBar.show(); 326 m_toolBar.show();
326 } 327 }
327 else 328 else
328 { 329 {
329 m_menuBar.hide(); 330 m_menuBar.hide();
330 m_toolBar.hide(); 331 m_toolBar.hide();
331 } 332 }
332} 333}
333 334
334void MainWindow::slotInitStatusBar( int numSteps ) 335void MainWindow::slotInitStatusBar( int numSteps )
335{ 336{
336 m_statusBar.setTotalSteps( numSteps ); 337 m_statusBar.setTotalSteps( numSteps );
337} 338}
338 339
339void MainWindow::slotStatusText( const QString &status ) 340void MainWindow::slotStatusText( const QString &status )
340{ 341{
341 m_statusText.setText( status ); 342 m_statusText.setText( status );
342} 343}
343 344
344void MainWindow::slotStatusBar( int currStep ) 345void MainWindow::slotStatusBar( int currStep )
345{ 346{
346 m_statusBar.setProgress( currStep ); 347 m_statusBar.setProgress( currStep );
347} 348}
348 349
349void MainWindow::slotUpdate() 350void MainWindow::slotUpdate()
350{ 351{
351 // Create package manager output widget 352 // Create package manager output widget
352 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), false, 353 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Update package information" ), false,
353 OPackage::Update ); 354 OPackage::Update );
354 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) ); 355 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) );
355 356
356 // Display widget 357 // Display widget
357 m_widgetStack.addWidget( dlg, 3 ); 358 m_widgetStack.addWidget( dlg, 3 );
358 m_widgetStack.raiseWidget( dlg ); 359 m_widgetStack.raiseWidget( dlg );
359} 360}
360 361
361void MainWindow::slotUpgrade() 362void MainWindow::slotUpgrade()
362{ 363{
363 // Create package manager output widget 364 // Create package manager output widget
364 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), false, 365 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Upgrade installed packages" ), false,
365 OPackage::Upgrade ); 366 OPackage::Upgrade );
366 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) ); 367 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) );
367 368
368 // Display widget 369 // Display widget
369 m_widgetStack.addWidget( dlg, 3 ); 370 m_widgetStack.addWidget( dlg, 3 );
370 m_widgetStack.raiseWidget( dlg ); 371 m_widgetStack.raiseWidget( dlg );
371} 372}
372 373
373/*
374void MainWindow::slotDownload() 374void MainWindow::slotDownload()
375{ 375{
376 // Retrieve list of packages selected for download (if any) 376 // Retrieve list of packages selected for download (if any)
377 QStringList *workingPackages = new QStringList(); 377 QStringList *workingPackages = new QStringList();
378 378
379 for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); 379 for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild());
380 item != 0 ; 380 item != 0 ;
381 item = static_cast<QCheckListItem *>(item->nextSibling()) ) 381 item = static_cast<QCheckListItem *>(item->nextSibling()) )
382 { 382 {
383 if ( item->isOn() ) 383 if ( item->isOn() )
384 workingPackages->append( item->text() ); 384 workingPackages->append( item->text() );
385 } 385 }
386 386
387 if ( workingPackages->isEmpty() ) 387 if ( workingPackages->isEmpty() )
388 { 388 {
389 // No packages were selected, prompt for URL of package to download 389 QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) );
390 return;
390 } 391 }
391 else 392 else
392 { 393 {
393 // Download selected packages 394 // Download selected packages
394 m_config.setGroup( "settings" ); 395 m_config.setGroup( "settings" );
395 QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" ); 396 QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" );
396 397
397// QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), workingDir, &ok, this ); 398 bool ok = false;
398// if ( ok && !text.isEmpty() ) 399 QString text = EntryDlg::getText( tr( "Download" ), tr( "Enter path to download package to:" ), workingDir, &ok, this );
399// workingDir = text; // user entered something and pressed ok 400 if ( ok && !text.isEmpty() )
400// else 401 workingDir = text; // user entered something and pressed ok
401// return; // user entered nothing or pressed cancel 402 else
403 return; // user entered nothing or pressed cancel
402 404
403// // Store download directory in config file 405 // Store download directory in config file
404// m_config.writeEntry( "DownloadDir", workingDir ); 406 m_config.writeEntry( "DownloadDir", workingDir );
405 407
406 // Get starting directory 408 // Get starting directory
407// char initDir[PATH_MAX]; 409 QDir::setCurrent( workingDir );
408// getcwd( initDir, PATH_MAX );
409 410
410 // Download packages 411 // Create package manager output widget
412 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false,
413 OPackage::Download, workingPackages );
414 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) );
411 415
416 // Display widget
417 m_widgetStack.addWidget( dlg, 3 );
418 m_widgetStack.raiseWidget( dlg );
412 } 419 }
413
414 // Create package manager output widget
415 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ), false,
416 OPackage::Download, workingPackages );
417 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) );
418
419 // Display widget
420 m_widgetStack.addWidget( dlg, 3 );
421 m_widgetStack.raiseWidget( dlg );
422} 420}
423*/
424 421
425void MainWindow::slotApply() 422void MainWindow::slotApply()
426{ 423{
427 QStringList *removeList = 0x0; 424 QStringList *removeList = 0x0;
428 QStringList *installList = 0x0; 425 QStringList *installList = 0x0;
429 QStringList *upgradeList = 0x0; 426 QStringList *upgradeList = 0x0;
430 427
431 for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild()); 428 for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild());
432 item != 0 ; 429 item != 0 ;
433 item = static_cast<QCheckListItem *>(item->nextSibling()) ) 430 item = static_cast<QCheckListItem *>(item->nextSibling()) )
434 { 431 {
435 if ( item->isOn() ) 432 if ( item->isOn() )
436 { 433 {
437 OPackage *package = m_packman.findPackage( item->text() ); 434 OPackage *package = m_packman.findPackage( item->text() );
438 if ( package ) 435 if ( package )
439 { 436 {
440 if ( !package->versionInstalled().isNull() ) 437 if ( !package->versionInstalled().isNull() )
441 { 438 {
442 if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 ) 439 if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 )
443 { 440 {
444 // Remove/upgrade package 441 // Remove/upgrade package
445 int answer = PromptDlg::ask( tr( "Remove or upgrade" ), 442 int answer = PromptDlg::ask( tr( "Remove or upgrade" ),
446 tr( QString( "Do you wish to remove or upgrade\n%1?" ).arg( item->text() ) ), 443 tr( QString( "Do you wish to remove or upgrade\n%1?" ).arg( item->text() ) ),
447 tr( "Remove" ), tr( "Upgrade" ), this ); 444 tr( "Remove" ), tr( "Upgrade" ), this );
448 if ( answer == 1 ) // Remove 445 if ( answer == 1 ) // Remove
449 { 446 {
450 if ( !removeList ) 447 if ( !removeList )
451 removeList = new QStringList(); 448 removeList = new QStringList();
452 removeList->append( item->text() ); 449 removeList->append( item->text() );
453 } 450 }
454 else if ( answer == 2 ) // Upgrade 451 else if ( answer == 2 ) // Upgrade
455 { 452 {
456 if ( !upgradeList ) 453 if ( !upgradeList )
457 upgradeList = new QStringList(); 454 upgradeList = new QStringList();
458 upgradeList->append( item->text() ); 455 upgradeList->append( item->text() );
459 } 456 }
460 } 457 }
461 else 458 else
462 { 459 {
463 // Remove/reinstall package 460 // Remove/reinstall package
464 int answer = PromptDlg::ask( tr( "Remove or reinstall" ), 461 int answer = PromptDlg::ask( tr( "Remove or reinstall" ),
465 tr( QString( "Do you wish to remove or reinstall\n%1?" ).arg( item->text() ) ), 462 tr( QString( "Do you wish to remove or reinstall\n%1?" ).arg( item->text() ) ),
466 tr( "Remove" ), tr( "Reinstall" ), this ); 463 tr( "Remove" ), tr( "Reinstall" ), this );
467 if ( answer == 1 ) // Remove 464 if ( answer == 1 ) // Remove
468 { 465 {
469 if ( !removeList ) 466 if ( !removeList )
470 removeList = new QStringList(); 467 removeList = new QStringList();
471 removeList->append( item->text() ); 468 removeList->append( item->text() );
472 } 469 }
473 else if ( answer == 2 ) // Reinstall 470 else if ( answer == 2 ) // Reinstall
474 { 471 {
475 if ( !installList ) 472 if ( !installList )
476 installList = new QStringList(); 473 installList = new QStringList();
477 installList->append( item->text() ); 474 installList->append( item->text() );
478 } 475 }
479 } 476 }
480 } 477 }
481 else 478 else
482 { 479 {
483 // Install package 480 // Install package
484 if ( !installList ) 481 if ( !installList )
485 installList = new QStringList(); 482 installList = new QStringList();
486 installList->append( item->text() ); 483 installList->append( item->text() );
487 } 484 }
488 } 485 }
489 } 486 }
490 } 487 }
491 488
492 // If nothing is selected, display message and exit 489 // If nothing is selected, display message and exit
493 if ( !removeList && !installList && !upgradeList ) 490 if ( !removeList && !installList && !upgradeList )
494 { 491 {
495 QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); 492 QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) );
496 return; 493 return;
497 } 494 }
498 495
499 // Send command only if there are packages to process 496 // Send command only if there are packages to process
500 OPackage::Command removeCmd = OPackage::NotDefined; 497 OPackage::Command removeCmd = OPackage::NotDefined;
501 if ( removeList && !removeList->isEmpty() ) 498 if ( removeList && !removeList->isEmpty() )
502 removeCmd = OPackage::Remove; 499 removeCmd = OPackage::Remove;
503 OPackage::Command installCmd = OPackage::NotDefined; 500 OPackage::Command installCmd = OPackage::NotDefined;
504 if ( installList && !installList->isEmpty() ) 501 if ( installList && !installList->isEmpty() )
505 installCmd = OPackage::Install; 502 installCmd = OPackage::Install;
506 OPackage::Command upgradeCmd = OPackage::NotDefined; 503 OPackage::Command upgradeCmd = OPackage::NotDefined;
507 if ( upgradeList && !upgradeList->isEmpty() ) 504 if ( upgradeList && !upgradeList->isEmpty() )
508 upgradeCmd = OPackage::Upgrade; 505 upgradeCmd = OPackage::Upgrade;
509 506
510 // Create package manager output widget 507 // Create package manager output widget
511 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true, 508 InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ), true,
512 removeCmd, removeList, 509 removeCmd, removeList,
513 installCmd, installList, 510 installCmd, installList,
514 upgradeCmd, upgradeList ); 511 upgradeCmd, upgradeList );
515 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) ); 512 connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseInstallDlg()) );
516 513
517 // Display widget 514 // Display widget
518 m_widgetStack.addWidget( dlg, 3 ); 515 m_widgetStack.addWidget( dlg, 3 );
519 m_widgetStack.raiseWidget( dlg ); 516 m_widgetStack.raiseWidget( dlg );
520} 517}
521 518
522void MainWindow::slotCloseInstallDlg() 519void MainWindow::slotCloseInstallDlg()
523{ 520{
524 // Close install dialog 521 // Close install dialog
525 delete m_widgetStack.visibleWidget(); 522 delete m_widgetStack.visibleWidget();
526 523
527 // Reload package list 524 // Reload package list
528 initPackageInfo(); 525 initPackageInfo();
526
527 // Update Opie launcher links
528 QCopEnvelope e("QPE/System", "linkChanged(QString)");
529 QString lf = QString::null;
530 e << lf;
529} 531}
530 532
531void MainWindow::slotConfigure() 533void MainWindow::slotConfigure()
532{ 534{
533 if ( m_packman.configureDlg( false ) ) 535 if ( m_packman.configureDlg( false ) )
534 { 536 {
535 if ( PromptDlg::ask( tr( "Config updated" ), 537 if ( PromptDlg::ask( tr( "Config updated" ),
536 tr( "The configuration has been updated. Do you want to update server and package information now?" ), 538 tr( "The configuration has been updated. Do you want to update server and package information now?" ),
537 tr( "Yes" ), tr( "No" ), this ) == 1 ) 539 tr( "Yes" ), tr( "No" ), this ) == 1 )
538 { 540 {
539 // Update package list and reload package info 541 // Update package list and reload package info
540 slotUpdate(); 542 slotUpdate();
541 } 543 }
542 } 544 }
543} 545}
544 546
545void MainWindow::slotShowNotInstalled() 547void MainWindow::slotShowNotInstalled()
546{ 548{
547 OPackageList *packageList; 549 OPackageList *packageList;
548 if ( m_actionShowNotInstalled->isOn() ) 550 if ( m_actionShowNotInstalled->isOn() )
549 { 551 {
550 m_actionShowInstalled->setOn( false ); 552 m_actionShowInstalled->setOn( false );
551 m_actionShowUpdated->setOn( false ); 553 m_actionShowUpdated->setOn( false );
552 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, 554 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null,
553 OPackageManager::NotInstalled, QString::null ); 555 OPackageManager::NotInstalled, QString::null );
554 } 556 }
555 else 557 else
556 packageList = m_packman.packages(); 558 packageList = m_packman.packages();
557 559
558 if ( packageList ) 560 if ( packageList )
559 { 561 {
560 loadPackageList( packageList, true ); 562 loadPackageList( packageList, true );
561 delete packageList; 563 delete packageList;
562 } 564 }
563} 565}
564 566
565void MainWindow::slotShowInstalled() 567void MainWindow::slotShowInstalled()
566{ 568{
567 OPackageList *packageList; 569 OPackageList *packageList;
568 if ( m_actionShowInstalled->isOn() ) 570 if ( m_actionShowInstalled->isOn() )
569 { 571 {
570 m_actionShowNotInstalled->setOn( false ); 572 m_actionShowNotInstalled->setOn( false );
571 m_actionShowUpdated->setOn( false ); 573 m_actionShowUpdated->setOn( false );
572 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, 574 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null,
573 OPackageManager::Installed, QString::null ); 575 OPackageManager::Installed, QString::null );
574 } 576 }
575 else 577 else
576 packageList = m_packman.packages(); 578 packageList = m_packman.packages();
577 579
578 if ( packageList ) 580 if ( packageList )
579 { 581 {
580 loadPackageList( packageList, true ); 582 loadPackageList( packageList, true );
581 delete packageList; 583 delete packageList;
582 } 584 }
583} 585}
584 586
585void MainWindow::slotShowUpdated() 587void MainWindow::slotShowUpdated()
586{ 588{
587 OPackageList *packageList; 589 OPackageList *packageList;
588 if ( m_actionShowUpdated->isOn() ) 590 if ( m_actionShowUpdated->isOn() )
589 { 591 {
590 m_actionShowInstalled->setOn( false ); 592 m_actionShowInstalled->setOn( false );
591 m_actionShowNotInstalled->setOn( false ); 593 m_actionShowNotInstalled->setOn( false );
592 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null, 594 packageList = m_packman.filterPackages( QString::null, QString::null, QString::null,
593 OPackageManager::Updated, QString::null ); 595 OPackageManager::Updated, QString::null );
594 } 596 }
595 else 597 else
596 packageList = m_packman.packages(); 598 packageList = m_packman.packages();
597 599
598 if ( packageList ) 600 if ( packageList )
599 { 601 {
600 loadPackageList( packageList, true ); 602 loadPackageList( packageList, true );
601 delete packageList; 603 delete packageList;
602 } 604 }
603} 605}
604 606
605void MainWindow::slotFilterChange() 607void MainWindow::slotFilterChange()
606{ 608{
607 FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus, 609 FilterDlg dlg( this, &m_packman, m_filterName, m_filterServer, m_filterDest, m_filterStatus,
608 m_filterCategory ); 610 m_filterCategory );
609 if ( dlg.exec() == QDialog::Accepted ) 611 if ( dlg.exec() == QDialog::Accepted )
610 { 612 {
611 m_filterName = dlg.name(); 613 m_filterName = dlg.name();
612 m_filterServer = dlg.server(); 614 m_filterServer = dlg.server();
613 m_filterDest = dlg.destination(); 615 m_filterDest = dlg.destination();
614 m_filterStatus = dlg.status(); 616 m_filterStatus = dlg.status();
615 m_filterCategory = dlg.category(); 617 m_filterCategory = dlg.category();
616 m_actionFilter->setOn( true ); 618 m_actionFilter->setOn( true );
617 slotFilter( true ); 619 slotFilter( true );
618 } 620 }
619 else 621 else
620 { 622 {
621 m_actionFilter->setOn( false ); 623 m_actionFilter->setOn( false );
622 slotFilter( false ); 624 slotFilter( false );
623 } 625 }
624} 626}
625 627
626void MainWindow::slotFilter( bool isOn ) 628void MainWindow::slotFilter( bool isOn )
627{ 629{
628 OPackageList *packageList; 630 OPackageList *packageList;
629 if ( isOn ) 631 if ( isOn )
630 { 632 {
631 packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest, 633 packageList = m_packman.filterPackages( m_filterName, m_filterServer, m_filterDest,
632 m_filterStatus, m_filterCategory ); 634 m_filterStatus, m_filterCategory );
633 } 635 }
634 else 636 else
635 packageList = m_packman.packages(); 637 packageList = m_packman.packages();
636 638
637 if ( packageList ) 639 if ( packageList )
638 { 640 {
639 loadPackageList( packageList, true ); 641 loadPackageList( packageList, true );
640 delete packageList; 642 delete packageList;
641 } 643 }
642} 644}
643 645
644void MainWindow::slotFindShowToolbar() 646void MainWindow::slotFindShowToolbar()
645{ 647{
646 m_findBar.show(); 648 m_findBar.show();
647 m_findEdit->setFocus(); 649 m_findEdit->setFocus();
648} 650}
649 651
650void MainWindow::slotFindHideToolbar() 652void MainWindow::slotFindHideToolbar()
651{ 653{
652 m_findBar.hide(); 654 m_findBar.hide();
653} 655}
654 656
655void MainWindow::slotFindChanged( const QString &findText ) 657void MainWindow::slotFindChanged( const QString &findText )
656{ 658{
657 659
658 m_actionFindNext->setEnabled( !findText.isEmpty() ); 660 m_actionFindNext->setEnabled( !findText.isEmpty() );
659 searchForPackage( findText ); 661 searchForPackage( findText );
660} 662}
661 663
662void MainWindow::slotFindNext() 664void MainWindow::slotFindNext()
663{ 665{
664 searchForPackage( m_findEdit->text() ); 666 searchForPackage( m_findEdit->text() );
665} 667}
diff --git a/noncore/settings/packagemanager/mainwindow.h b/noncore/settings/packagemanager/mainwindow.h
index 49bb66c..285cddf 100644
--- a/noncore/settings/packagemanager/mainwindow.h
+++ b/noncore/settings/packagemanager/mainwindow.h
@@ -1,136 +1,136 @@
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 MAINWINDOW_H 30#ifndef MAINWINDOW_H
31#define MAINWINDOW_H 31#define MAINWINDOW_H
32 32
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qlistview.h> 34#include <qlistview.h>
35#include <qmainwindow.h> 35#include <qmainwindow.h>
36#include <qpixmap.h> 36#include <qpixmap.h>
37#include <qprogressbar.h> 37#include <qprogressbar.h>
38#include <qtoolbar.h> 38#include <qtoolbar.h>
39#include <qwidgetstack.h> 39#include <qwidgetstack.h>
40 40
41#include <qpe/config.h> 41#include <qpe/config.h>
42 42
43#include "opackagemanager.h" 43#include "opackagemanager.h"
44 44
45class QAction; 45class QAction;
46class QLineEdit; 46class QLineEdit;
47 47
48class MainWindow :public QMainWindow 48class MainWindow :public QMainWindow
49{ 49{
50 Q_OBJECT 50 Q_OBJECT
51 51
52public: 52public:
53 MainWindow( QWidget *parent = 0x0, const char *name = 0x0, WFlags fl = 0 ); 53 MainWindow( QWidget *parent = 0x0, const char *name = 0x0, WFlags fl = 0 );
54 static QString appName() { return QString::fromLatin1( "packagemanager" ); }; 54 static QString appName() { return QString::fromLatin1( "packagemanager" ); };
55 55
56protected: 56protected:
57 void closeEvent( QCloseEvent *event ); 57 void closeEvent( QCloseEvent *event );
58 58
59private: 59private:
60 Config m_config; // Configuration file 60 Config m_config; // Configuration file
61 61
62 OPackageManager m_packman; // Package manager 62 OPackageManager m_packman; // Package manager
63 63
64 // Toolbars 64 // Toolbars
65 QToolBar m_menuBar; // Main toolbar containing menu 65 QToolBar m_menuBar; // Main toolbar containing menu
66 QToolBar m_toolBar; // Main toolbar 66 QToolBar m_toolBar; // Main toolbar
67 QToolBar m_findBar; // Find toolbar 67 QToolBar m_findBar; // Find toolbar
68 68
69 QWidgetStack m_widgetStack; // Main widget stack which contains m_packageList & m_statusWidget 69 QWidgetStack m_widgetStack; // Main widget stack which contains m_packageList & m_statusWidget
70 QListView m_packageList; // Main list view of all packages 70 QListView m_packageList; // Main list view of all packages
71 71
72 QLineEdit *m_findEdit; // Line edit box used for find toolbar 72 QLineEdit *m_findEdit; // Line edit box used for find toolbar
73 73
74 // Status widget controls 74 // Status widget controls
75 QWidget m_statusWidget; // Widget to display status during long operations 75 QWidget m_statusWidget; // Widget to display status during long operations
76 QLabel m_statusText; // Text status message 76 QLabel m_statusText; // Text status message
77 QProgressBar m_statusBar; // Progress bar showing % completed 77 QProgressBar m_statusBar; // Progress bar showing % completed
78 78
79 // Icon pixmaps 79 // Icon pixmaps
80 QPixmap m_iconUpdated; // Cached icon which shows when package can be updated 80 QPixmap m_iconUpdated; // Cached icon which shows when package can be updated
81 QPixmap m_iconInstalled; // Cached icon which shows when package is installed 81 QPixmap m_iconInstalled; // Cached icon which shows when package is installed
82 QPixmap m_iconNull; // Cached icon which shows when package is not installed 82 QPixmap m_iconNull; // Cached icon which shows when package is not installed
83 83
84 // Menu/tool bar actions 84 // Menu/tool bar actions
85 QAction *m_actionShowNotInstalled; // Action to show pakages not currently installed 85 QAction *m_actionShowNotInstalled; // Action to show pakages not currently installed
86 QAction *m_actionShowInstalled; // Action to show pakages currently installed 86 QAction *m_actionShowInstalled; // Action to show pakages currently installed
87 QAction *m_actionShowUpdated; // Action to show pakages currently installed with update available 87 QAction *m_actionShowUpdated; // Action to show pakages currently installed with update available
88 QAction *m_actionFilter; // Action to filter packages 88 QAction *m_actionFilter; // Action to filter packages
89 QAction *m_actionFindNext; // Action to find next match 89 QAction *m_actionFindNext; // Action to find next match
90 90
91 // Cached filter settings 91 // Cached filter settings
92 QString m_filterName; // Cached name filter value 92 QString m_filterName; // Cached name filter value
93 QString m_filterServer; // Cached server name filter value 93 QString m_filterServer; // Cached server name filter value
94 QString m_filterDest; // Cached destination name filter value 94 QString m_filterDest; // Cached destination name filter value
95 OPackageManager::Status m_filterStatus; // Cached status filter value 95 OPackageManager::Status m_filterStatus; // Cached status filter value
96 QString m_filterCategory; // Cached category filter value 96 QString m_filterCategory; // Cached category filter value
97 97
98 void initPackageList(); 98 void initPackageList();
99 void initStatusWidget(); 99 void initStatusWidget();
100 void initUI(); 100 void initUI();
101 101
102 void loadPackageList( OPackageList *packages = 0x0, bool clearList = true ); 102 void loadPackageList( OPackageList *packages = 0x0, bool clearList = true );
103 void searchForPackage( const QString &text ); 103 void searchForPackage( const QString &text );
104 104
105private slots: 105private slots:
106 void initPackageInfo(); 106 void initPackageInfo();
107 void slotWidgetStackShow( QWidget *widget ); 107 void slotWidgetStackShow( QWidget *widget );
108 108
109 // Status widget slots 109 // Status widget slots
110 void slotInitStatusBar( int numSteps ); 110 void slotInitStatusBar( int numSteps );
111 void slotStatusText( const QString &status ); 111 void slotStatusText( const QString &status );
112 void slotStatusBar( int currStep ); 112 void slotStatusBar( int currStep );
113 113
114 // Actions menu action slots 114 // Actions menu action slots
115 void slotUpdate(); 115 void slotUpdate();
116 void slotUpgrade(); 116 void slotUpgrade();
117// void slotDownload(); 117 void slotDownload();
118 void slotApply(); 118 void slotApply();
119 void slotCloseInstallDlg(); 119 void slotCloseInstallDlg();
120 void slotConfigure(); 120 void slotConfigure();
121 121
122 // View menu action slots 122 // View menu action slots
123 void slotShowNotInstalled(); 123 void slotShowNotInstalled();
124 void slotShowInstalled(); 124 void slotShowInstalled();
125 void slotShowUpdated(); 125 void slotShowUpdated();
126 void slotFilterChange(); 126 void slotFilterChange();
127 void slotFilter( bool isOn ); 127 void slotFilter( bool isOn );
128 128
129 // Find action slots 129 // Find action slots
130 void slotFindShowToolbar(); 130 void slotFindShowToolbar();
131 void slotFindHideToolbar(); 131 void slotFindHideToolbar();
132 void slotFindChanged( const QString &findText ); 132 void slotFindChanged( const QString &findText );
133 void slotFindNext(); 133 void slotFindNext();
134}; 134};
135 135
136#endif 136#endif
diff --git a/noncore/settings/packagemanager/oipkg.cpp b/noncore/settings/packagemanager/oipkg.cpp
index eeb0131..ed9ea10 100644
--- a/noncore/settings/packagemanager/oipkg.cpp
+++ b/noncore/settings/packagemanager/oipkg.cpp
@@ -138,322 +138,327 @@ OPackageList *OIpkg::availablePackages( const QString &server )
138 // Build new server list (caller is responsible for deleting) 138 // Build new server list (caller is responsible for deleting)
139 OPackageList *pl = new OPackageList; 139 OPackageList *pl = new OPackageList;
140 140
141 // Open package list file 141 // Open package list file
142 QFile f( IPKG_PKG_PATH + "/" + server ); 142 QFile f( IPKG_PKG_PATH + "/" + server );
143 if ( !f.open( IO_ReadOnly ) ) 143 if ( !f.open( IO_ReadOnly ) )
144 return NULL; 144 return NULL;
145 QTextStream t( &f ); 145 QTextStream t( &f );
146 146
147 // Process all information in package list file 147 // Process all information in package list file
148 OPackage *package = NULL; 148 OPackage *package = NULL;
149 QString line = t.readLine(); 149 QString line = t.readLine();
150 while ( !t.eof() ) 150 while ( !t.eof() )
151 { 151 {
152 // Determine key/value pair 152 // Determine key/value pair
153 int pos = line.find( ':', 0 ); 153 int pos = line.find( ':', 0 );
154 QString key; 154 QString key;
155 if ( pos > -1 ) 155 if ( pos > -1 )
156 key = line.mid( 0, pos ); 156 key = line.mid( 0, pos );
157 else 157 else
158 key = QString::null; 158 key = QString::null;
159 QString value = line.mid( pos+2, line.length()-pos ); 159 QString value = line.mid( pos+2, line.length()-pos );
160 160
161 // Allocate new package and insert into list 161 // Allocate new package and insert into list
162 if ( package == NULL && !key.isEmpty() ) 162 if ( package == NULL && !key.isEmpty() )
163 { 163 {
164 package = new OPackage( value ); 164 package = new OPackage( value );
165 package->setSource( server ); 165 package->setSource( server );
166 pl->append( package ); 166 pl->append( package );
167 } 167 }
168 168
169 // Update package data 169 // Update package data
170 if ( key == "Package" ) 170 if ( key == "Package" )
171 package->setName( value ); 171 package->setName( value );
172 else if ( key == "Version" ) 172 else if ( key == "Version" )
173 package->setVersion( value ); 173 package->setVersion( value );
174 else if ( key == "Section" ) 174 else if ( key == "Section" )
175 package->setCategory( value ); 175 package->setCategory( value );
176 //DataManager::setAvailableCategories( value ); 176 //DataManager::setAvailableCategories( value );
177 else if ( key.isEmpty() && value.isEmpty() ) 177 else if ( key.isEmpty() && value.isEmpty() )
178 package = NULL; 178 package = NULL;
179 179
180 // Skip past all description lines 180 // Skip past all description lines
181 if ( key == "Description" ) 181 if ( key == "Description" )
182 { 182 {
183 line = t.readLine(); 183 line = t.readLine();
184 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) 184 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() )
185 line = t.readLine(); 185 line = t.readLine();
186 } 186 }
187 else 187 else
188 line = t.readLine(); 188 line = t.readLine();
189 } 189 }
190 190
191 f.close(); 191 f.close();
192 192
193 return pl; 193 return pl;
194} 194}
195 195
196OPackageList *OIpkg::installedPackages( const QString &destName, const QString &destPath ) 196OPackageList *OIpkg::installedPackages( const QString &destName, const QString &destPath )
197{ 197{
198 // Load Ipkg configuration info if not already cached 198 // Load Ipkg configuration info if not already cached
199 if ( !m_confInfo ) 199 if ( !m_confInfo )
200 loadConfiguration(); 200 loadConfiguration();
201 201
202 // Build new server list (caller is responsible for deleting) 202 // Build new server list (caller is responsible for deleting)
203 OPackageList *pl = new OPackageList; 203 OPackageList *pl = new OPackageList;
204 204
205 // Open status file 205 // Open status file
206 QString path = destPath; 206 QString path = destPath;
207 if ( path.right( 1 ) != "/" ) 207 if ( path.right( 1 ) != "/" )
208 path.append( "/" ); 208 path.append( "/" );
209 path.append( IPKG_STATUS_PATH ); 209 path.append( IPKG_STATUS_PATH );
210 210
211 QFile f( path ); 211 QFile f( path );
212 if ( !f.open( IO_ReadOnly ) ) 212 if ( !f.open( IO_ReadOnly ) )
213 return NULL; 213 return NULL;
214 QTextStream t( &f ); 214 QTextStream t( &f );
215 215
216 // Process all information in status file 216 // Process all information in status file
217 bool newPackage = false; 217 bool newPackage = false;
218 QString line = t.readLine(); 218 QString line = t.readLine();
219 QString name; 219 QString name;
220 QString version; 220 QString version;
221 QString status; 221 QString status;
222 222
223 while ( !t.eof() ) 223 while ( !t.eof() )
224 { 224 {
225 // Determine key/value pair 225 // Determine key/value pair
226 int pos = line.find( ':', 0 ); 226 int pos = line.find( ':', 0 );
227 QString key; 227 QString key;
228 if ( pos > -1 ) 228 if ( pos > -1 )
229 key = line.mid( 0, pos ); 229 key = line.mid( 0, pos );
230 else 230 else
231 key = QString::null; 231 key = QString::null;
232 QString value = line.mid( pos+2, line.length()-pos ); 232 QString value = line.mid( pos+2, line.length()-pos );
233 233
234 // Allocate new package and insert into list 234 // Allocate new package and insert into list
235 if ( newPackage && !key.isEmpty() ) 235 if ( newPackage && !key.isEmpty() )
236 { 236 {
237 // 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
238 if ( !name.isNull() && status.contains( " installed" ) ) 238 if ( !name.isNull() && status.contains( " installed" ) )
239 { 239 {
240 pl->append( new OPackage( name, QString::null, version, QString::null, destName ) ); 240 pl->append( new OPackage( name, QString::null, version, QString::null, destName ) );
241 name = QString::null; 241 name = QString::null;
242 version = QString::null; 242 version = QString::null;
243 status = QString::null; 243 status = QString::null;
244 244
245 newPackage = false; 245 newPackage = false;
246 } 246 }
247 } 247 }
248 248
249 // Update package data 249 // Update package data
250 if ( key == "Package" ) 250 if ( key == "Package" )
251 name = value; 251 name = value;
252 else if ( key == "Version" ) 252 else if ( key == "Version" )
253 version = value; 253 version = value;
254 else if ( key == "Status" ) 254 else if ( key == "Status" )
255 status = value; 255 status = value;
256 else if ( key.isEmpty() && value.isEmpty() ) 256 else if ( key.isEmpty() && value.isEmpty() )
257 newPackage = true; 257 newPackage = true;
258 258
259 // Skip past all description lines 259 // Skip past all description lines
260 if ( key == "Description" ) 260 if ( key == "Description" )
261 { 261 {
262 line = t.readLine(); 262 line = t.readLine();
263 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() ) 263 while ( !line.isEmpty() && line.find( ':', 0 ) == -1 && !t.eof() )
264 line = t.readLine(); 264 line = t.readLine();
265 } 265 }
266 else 266 else
267 line = t.readLine(); 267 line = t.readLine();
268 } 268 }
269 269
270 f.close(); 270 f.close();
271 271
272 return pl; 272 return pl;
273} 273}
274 274
275bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, const QString &destination, 275bool OIpkg::executeCommand( OPackage::Command command, QStringList *parameters, const QString &destination,
276 const QObject *receiver, const char *slotOutput, bool rawOutput ) 276 const QObject *receiver, const char *slotOutput, bool rawOutput )
277{ 277{
278 if ( command == OPackage::NotDefined ) 278 if ( command == OPackage::NotDefined )
279 return false; 279 return false;
280 280
281 // Set ipkg run-time options/arguments 281 // Set ipkg run-time options/arguments
282 m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS ); 282 m_ipkgArgs.force_depends = ( m_ipkgExecOptions & FORCE_DEPENDS );
283 m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL ); 283 m_ipkgArgs.force_reinstall = ( m_ipkgExecOptions & FORCE_REINSTALL );
284 // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE ); 284 // TODO m_ipkgArgs.force_remove = ( m_ipkgExecOptions & FORCE_REMOVE );
285 m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE ); 285 m_ipkgArgs.force_overwrite = ( m_ipkgExecOptions & FORCE_OVERWRITE );
286 m_ipkgArgs.verbosity = m_ipkgExecVerbosity; 286 m_ipkgArgs.verbosity = m_ipkgExecVerbosity;
287 if ( m_ipkgArgs.dest ) 287 if ( m_ipkgArgs.dest )
288 free( m_ipkgArgs.dest ); 288 free( m_ipkgArgs.dest );
289 if ( !destination.isNull() ) 289 if ( !destination.isNull() )
290 { 290 {
291 int len = destination.length() + 1; 291 int len = destination.length() + 1;
292 m_ipkgArgs.dest = (char *)malloc( len ); 292 m_ipkgArgs.dest = (char *)malloc( len );
293 strncpy( m_ipkgArgs.dest, destination, destination.length() ); 293 strncpy( m_ipkgArgs.dest, destination, destination.length() );
294 m_ipkgArgs.dest[ len - 1 ] = '\0'; 294 m_ipkgArgs.dest[ len - 1 ] = '\0';
295 } 295 }
296 else 296 else
297 m_ipkgArgs.dest = 0x0; 297 m_ipkgArgs.dest = 0x0;
298 298
299 // Connect output signal to widget 299 // Connect output signal to widget
300 if ( rawOutput ) 300 if ( rawOutput )
301 { 301 {
302 if ( slotOutput ) 302 if ( slotOutput )
303 connect( this, SIGNAL(execOutput(char *)), receiver, slotOutput ); 303 connect( this, SIGNAL(execOutput(char *)), receiver, slotOutput );
304 } 304 }
305 else 305 else
306 { 306 {
307 // TODO - connect to local slot and parse output before emitting execOutput 307 // TODO - connect to local slot and parse output before emitting execOutput
308 } 308 }
309 309
310 switch( command ) 310 switch( command )
311 { 311 {
312 case OPackage::Update : ipkg_lists_update( &m_ipkgArgs ); 312 case OPackage::Update : ipkg_lists_update( &m_ipkgArgs );
313 break; 313 break;
314 case OPackage::Upgrade : ipkg_packages_upgrade( &m_ipkgArgs ); 314 case OPackage::Upgrade : ipkg_packages_upgrade( &m_ipkgArgs );
315 break; 315 break;
316 case OPackage::Install : { 316 case OPackage::Install : {
317 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) 317 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it )
318 { 318 {
319 ipkg_packages_install( &m_ipkgArgs, (*it) ); 319 ipkg_packages_install( &m_ipkgArgs, (*it) );
320 } 320 }
321 }; 321 };
322 break; 322 break;
323 case OPackage::Remove : { 323 case OPackage::Remove : {
324 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it ) 324 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it )
325 { 325 {
326 ipkg_packages_remove( &m_ipkgArgs, (*it), true ); 326 ipkg_packages_remove( &m_ipkgArgs, (*it), true );
327 } 327 }
328 }; 328 };
329 break; 329 break;
330 //case OPackage::Download : ; 330 case OPackage::Download : {
331 // break; 331 for ( QStringList::Iterator it = parameters->begin(); it != parameters->end(); ++it )
332 {
333 ipkg_packages_download( &m_ipkgArgs, (*it) );
334 }
335 };
336 break;
332 default : break; 337 default : break;
333 }; 338 };
334 339
335 return true; 340 return true;
336} 341}
337 342
338void OIpkg::ipkgOutput( char *msg ) 343void OIpkg::ipkgOutput( char *msg )
339{ 344{
340 emit execOutput( msg ); 345 emit execOutput( msg );
341} 346}
342 347
343void OIpkg::loadConfiguration() 348void OIpkg::loadConfiguration()
344{ 349{
345 if ( m_confInfo ) 350 if ( m_confInfo )
346 delete m_confInfo; 351 delete m_confInfo;
347 352
348 // Load configuration item list 353 // Load configuration item list
349 m_confInfo = new OConfItemList(); 354 m_confInfo = new OConfItemList();
350 355
351 QStringList confFiles; 356 QStringList confFiles;
352 QDir confDir( IPKG_CONF_DIR ); 357 QDir confDir( IPKG_CONF_DIR );
353 if ( confDir.exists() ) 358 if ( confDir.exists() )
354 { 359 {
355 confDir.setNameFilter( "*.conf" ); 360 confDir.setNameFilter( "*.conf" );
356 confDir.setFilter( QDir::Files ); 361 confDir.setFilter( QDir::Files );
357 confFiles = confDir.entryList( "*.conf", QDir::Files ); 362 confFiles = confDir.entryList( "*.conf", QDir::Files );
358 confFiles << IPKG_CONF; 363 confFiles << IPKG_CONF;
359 364
360 for ( QStringList::Iterator it = confFiles.begin(); it != confFiles.end(); ++it ) 365 for ( QStringList::Iterator it = confFiles.begin(); it != confFiles.end(); ++it )
361 { 366 {
362 // Create absolute file path if necessary 367 // Create absolute file path if necessary
363 QString absFile = (*it); 368 QString absFile = (*it);
364 if ( !absFile.startsWith( "/" ) ) 369 if ( !absFile.startsWith( "/" ) )
365 absFile.prepend( QString( IPKG_CONF_DIR ) + "/" ); 370 absFile.prepend( QString( IPKG_CONF_DIR ) + "/" );
366 371
367 // Read in file 372 // Read in file
368 QFile f( absFile ); 373 QFile f( absFile );
369 if ( f.open( IO_ReadOnly ) ) 374 if ( f.open( IO_ReadOnly ) )
370 { 375 {
371 QTextStream s( &f ); 376 QTextStream s( &f );
372 while ( !s.eof() ) 377 while ( !s.eof() )
373 { 378 {
374 379
375 QString line = s.readLine().simplifyWhiteSpace(); 380 QString line = s.readLine().simplifyWhiteSpace();
376 381
377 // Parse line and save info to the conf options list 382 // Parse line and save info to the conf options list
378 if ( !line.isEmpty() ) 383 if ( !line.isEmpty() )
379 { 384 {
380 if ( !line.startsWith( "#" ) || 385 if ( !line.startsWith( "#" ) ||
381 line.startsWith( "#src" ) || 386 line.startsWith( "#src" ) ||
382 line.startsWith( "#dest" ) || 387 line.startsWith( "#dest" ) ||
383 line.startsWith( "#arch" ) || 388 line.startsWith( "#arch" ) ||
384 line.startsWith( "#option" ) ) 389 line.startsWith( "#option" ) )
385 { 390 {
386 int pos = line.find( ' ', 1 ); 391 int pos = line.find( ' ', 1 );
387 392
388 // Type 393 // Type
389 QString typeStr = line.left( pos ); 394 QString typeStr = line.left( pos );
390 OConfItem::Type type; 395 OConfItem::Type type;
391 if ( typeStr == "src" || typeStr == "#src" ) 396 if ( typeStr == "src" || typeStr == "#src" )
392 type = OConfItem::Source; 397 type = OConfItem::Source;
393 else if ( typeStr == "dest" || typeStr == "#dest" ) 398 else if ( typeStr == "dest" || typeStr == "#dest" )
394 type = OConfItem::Destination; 399 type = OConfItem::Destination;
395 else if ( typeStr == "option" || typeStr == "#option" ) 400 else if ( typeStr == "option" || typeStr == "#option" )
396 type = OConfItem::Option; 401 type = OConfItem::Option;
397 else if ( typeStr == "arch" || typeStr == "#arch" ) 402 else if ( typeStr == "arch" || typeStr == "#arch" )
398 type = OConfItem::Arch; 403 type = OConfItem::Arch;
399 else 404 else
400 type = OConfItem::NotDefined; 405 type = OConfItem::NotDefined;
401 ++pos; 406 ++pos;
402 int endpos = line.find( ' ', pos ); 407 int endpos = line.find( ' ', pos );
403 408
404 // Name 409 // Name
405 QString name = line.mid( pos, endpos - pos ); 410 QString name = line.mid( pos, endpos - pos );
406 411
407 // Value 412 // Value
408 QString value = ""; 413 QString value = "";
409 if ( endpos > -1 ) 414 if ( endpos > -1 )
410 value = line.right( line.length() - endpos - 1 ); 415 value = line.right( line.length() - endpos - 1 );
411 416
412 // Active 417 // Active
413 bool active = !line.startsWith( "#" ); 418 bool active = !line.startsWith( "#" );
414 419
415 // Add to list 420 // Add to list
416 m_confInfo->append( new OConfItem( absFile, type, name, value, active ) ); 421 m_confInfo->append( new OConfItem( absFile, type, name, value, active ) );
417 } 422 }
418 } 423 }
419 } 424 }
420 425
421 f.close(); 426 f.close();
422 } 427 }
423 } 428 }
424 } 429 }
425 430
426 // Load Ipkg execution options from application configuration file 431 // Load Ipkg execution options from application configuration file
427 if ( m_config ) 432 if ( m_config )
428 { 433 {
429 m_config->setGroup( "Ipkg" ); 434 m_config->setGroup( "Ipkg" );
430 m_ipkgExecOptions = m_config->readNumEntry( "ExecOptions", m_ipkgExecOptions ); 435 m_ipkgExecOptions = m_config->readNumEntry( "ExecOptions", m_ipkgExecOptions );
431 m_ipkgExecVerbosity = m_config->readNumEntry( "Verbosity", m_ipkgExecVerbosity ); 436 m_ipkgExecVerbosity = m_config->readNumEntry( "Verbosity", m_ipkgExecVerbosity );
432 } 437 }
433} 438}
434 439
435OConfItemList *OIpkg::filterConfItems( OConfItem::Type typefilter ) 440OConfItemList *OIpkg::filterConfItems( OConfItem::Type typefilter )
436{ 441{
437 // Load Ipkg configuration info if not already cached 442 // Load Ipkg configuration info if not already cached
438 if ( !m_confInfo ) 443 if ( !m_confInfo )
439 loadConfiguration(); 444 loadConfiguration();
440 445
441 // Build new server list (caller is responsible for deleting) 446 // Build new server list (caller is responsible for deleting)
442 OConfItemList *sl = new OConfItemList; 447 OConfItemList *sl = new OConfItemList;
443 448
444 // If typefilter is empty, retrieve all items 449 // If typefilter is empty, retrieve all items
445 bool retrieveAll = ( typefilter == OConfItem::NotDefined ); 450 bool retrieveAll = ( typefilter == OConfItem::NotDefined );
446 451
447 // Parse configuration info for servers 452 // Parse configuration info for servers
448 OConfItemListIterator it( *m_confInfo ); 453 OConfItemListIterator it( *m_confInfo );
449 for ( ; it.current(); ++it ) 454 for ( ; it.current(); ++it )
450 { 455 {
451 OConfItem *item = it.current(); 456 OConfItem *item = it.current();
452 if ( retrieveAll || item->type() == typefilter ) 457 if ( retrieveAll || item->type() == typefilter )
453 { 458 {
454 sl->append( item ); 459 sl->append( item );
455 } 460 }
456 } 461 }
457 462
458 return sl; 463 return sl;
459} 464}
diff --git a/noncore/settings/packagemanager/packagemanager.pro b/noncore/settings/packagemanager/packagemanager.pro
index 55af13e..9a64322 100644
--- a/noncore/settings/packagemanager/packagemanager.pro
+++ b/noncore/settings/packagemanager/packagemanager.pro
@@ -1,36 +1,38 @@
1CONFIG = qt warn_on release quick-app 1CONFIG = qt warn_on release quick-app
2//TEMPLATE = app 2//TEMPLATE = app
3//CONFIG += qte warn_on debug 3//CONFIG += qte warn_on debug
4//DESTDIR = $(OPIEDIR)/bin 4//DESTDIR = $(OPIEDIR)/bin
5 5
6SOURCES = opackage.cpp \ 6SOURCES = opackage.cpp \
7 oconfitem.cpp \ 7 oconfitem.cpp \
8 oipkg.cpp \ 8 oipkg.cpp \
9 oipkgconfigdlg.cpp \ 9 oipkgconfigdlg.cpp \
10 opackagemanager.cpp \ 10 opackagemanager.cpp \
11 mainwindow.cpp \ 11 mainwindow.cpp \
12 installdlg.cpp \ 12 installdlg.cpp \
13 packageinfodlg.cpp \ 13 packageinfodlg.cpp \
14 filterdlg.cpp \ 14 filterdlg.cpp \
15 promptdlg.cpp \ 15 promptdlg.cpp \
16 entrydlg.cpp \
16 main.cpp 17 main.cpp
17HEADERS = opackage.h \ 18HEADERS = opackage.h \
18 oconfitem.h \ 19 oconfitem.h \
19 oipkg.h \ 20 oipkg.h \
20 oipkgconfigdlg.h \ 21 oipkgconfigdlg.h \
21 opackagemanager.h \ 22 opackagemanager.h \
22 mainwindow.h \ 23 mainwindow.h \
23 installdlg.h \ 24 installdlg.h \
24 packageinfodlg.h \ 25 packageinfodlg.h \
25 filterdlg.h \ 26 filterdlg.h \
26 promptdlg.h 27 promptdlg.h \
28 entrydlg.h
27 29
28DEFINES += IPKG_LIB 30DEFINES += IPKG_LIB
29DEFINES += HAVE_MKDTEMP 31DEFINES += HAVE_MKDTEMP
30TARGET = packagemanager 32TARGET = packagemanager
31INCLUDEPATH += $(OPIEDIR)/include $(IPKGDIR) 33INCLUDEPATH += $(OPIEDIR)/include $(IPKGDIR)
32DEPENDPATH += $(OPIEDIR)/include 34DEPENDPATH += $(OPIEDIR)/include
33LIBS += -lqpe -lopie -lipkg 35LIBS += -lqpe -lopie -lipkg
34 36
35include ( $(OPIEDIR)/include.pro ) 37include ( $(OPIEDIR)/include.pro )
36 38
diff --git a/noncore/settings/packagemanager/promptdlg.cpp b/noncore/settings/packagemanager/promptdlg.cpp
index 3122699..bb27190 100644
--- a/noncore/settings/packagemanager/promptdlg.cpp
+++ b/noncore/settings/packagemanager/promptdlg.cpp
@@ -1,140 +1,140 @@
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 "promptdlg.h" 30#include "promptdlg.h"
31 31
32#include <qlabel.h> 32#include <qlabel.h>
33#include <qlayout.h> 33#include <qlayout.h>
34#include <qpushbutton.h> 34#include <qpushbutton.h>
35#include <qwidgetlist.h> 35#include <qwidgetlist.h>
36 36
37#include <qpe/qpeapplication.h> 37#include <qpe/qpeapplication.h>
38 38
39PromptDlg::PromptDlg( const QString &caption, const QString &text, const QString &btn1, const QString &btn2, 39PromptDlg::PromptDlg( const QString &caption, const QString &text, const QString &btn1, const QString &btn2,
40 QWidget *parent ) 40 QWidget *parent )
41 : QWidget( parent, QString::null, WType_Modal | WType_TopLevel | WStyle_Dialog ) 41 : QWidget( parent, QString::null, WType_Modal | WType_TopLevel | WStyle_Dialog )
42 , m_btnClicked( -1 ) 42 , m_btnClicked( -1 )
43{ 43{
44 setCaption( caption ); 44 setCaption( caption );
45 45
46 QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 2 ); 46 QGridLayout *layout = new QGridLayout( this, 2, 2, 4, 2 );
47 QLabel *label = new QLabel( text, this ); 47 QLabel *label = new QLabel( text, this );
48 label->setAlignment( AlignCenter | WordBreak ); 48 label->setAlignment( AlignCenter | AlignTop | WordBreak );
49 layout->addMultiCellWidget( label, 0, 0, 0, 1 ); 49 layout->addMultiCellWidget( label, 0, 0, 0, 1 );
50 50
51 QPushButton *btn = new QPushButton( btn1, this ); 51 QPushButton *btn = new QPushButton( btn1, this );
52 layout->addWidget( btn, 1, 0 ); 52 layout->addWidget( btn, 1, 0 );
53 connect( btn, SIGNAL(clicked()), this, SLOT(slotBtn1Clicked()) ); 53 connect( btn, SIGNAL(clicked()), this, SLOT(slotBtn1Clicked()) );
54 54
55 btn = new QPushButton( btn2, this ); 55 btn = new QPushButton( btn2, this );
56 layout->addWidget( btn, 1, 1 ); 56 layout->addWidget( btn, 1, 1 );
57 connect( btn, SIGNAL(clicked()), this, SLOT(slotBtn2Clicked()) ); 57 connect( btn, SIGNAL(clicked()), this, SLOT(slotBtn2Clicked()) );
58} 58}
59 59
60int PromptDlg::exec() 60int PromptDlg::exec()
61{ 61{
62 // Determine position of dialog. Derived from QT's QDialog::show() method. 62 // Determine position of dialog. Derived from QT's QDialog::show() method.
63 QWidget *w = parentWidget(); 63 QWidget *w = parentWidget();
64 QPoint p( 0, 0 ); 64 QPoint p( 0, 0 );
65 int extraw = 0, extrah = 0; 65 int extraw = 0, extrah = 0;
66 QWidget * desk = QApplication::desktop(); 66 QWidget * desk = QApplication::desktop();
67 if ( w ) 67 if ( w )
68 w = w->topLevelWidget(); 68 w = w->topLevelWidget();
69 69
70 QWidgetList *list = QApplication::topLevelWidgets(); 70 QWidgetList *list = QApplication::topLevelWidgets();
71 QWidgetListIt it( *list ); 71 QWidgetListIt it( *list );
72 while ( (extraw == 0 || extrah == 0) && it.current() != 0 ) 72 while ( (extraw == 0 || extrah == 0) && it.current() != 0 )
73 { 73 {
74 int w, h; 74 int w, h;
75 QWidget * current = it.current(); 75 QWidget * current = it.current();
76 ++it; 76 ++it;
77 w = current->geometry().x() - current->x(); 77 w = current->geometry().x() - current->x();
78 h = current->geometry().y() - current->y(); 78 h = current->geometry().y() - current->y();
79 79
80 extraw = QMAX( extraw, w ); 80 extraw = QMAX( extraw, w );
81 extrah = QMAX( extrah, h ); 81 extrah = QMAX( extrah, h );
82 } 82 }
83 delete list; 83 delete list;
84 84
85 // sanity check for decoration frames. With embedding, we 85 // sanity check for decoration frames. With embedding, we
86 // might get extraordinary values 86 // might get extraordinary values
87 if ( extraw >= 10 || extrah >= 40 ) 87 if ( extraw >= 10 || extrah >= 40 )
88 extraw = extrah = 0; 88 extraw = extrah = 0;
89 89
90 if ( w ) 90 if ( w )
91 { 91 {
92 // Use mapToGlobal rather than geometry() in case w might 92 // Use mapToGlobal rather than geometry() in case w might
93 // be embedded in another application 93 // be embedded in another application
94 QPoint pp = w->mapToGlobal( QPoint(0,0) ); 94 QPoint pp = w->mapToGlobal( QPoint(0,0) );
95 p = QPoint( pp.x() + w->width()/2, pp.y() + w->height()/ 2 ); 95 p = QPoint( pp.x() + w->width()/2, pp.y() + w->height()/ 2 );
96 } 96 }
97 else 97 else
98 p = QPoint( desk->width()/2, desk->height()/2 ); 98 p = QPoint( desk->width()/2, desk->height()/2 );
99 99
100 p = QPoint( p.x()-width()/2 - extraw, p.y()-height()/2 - extrah ); 100 p = QPoint( p.x()-width()/2 - extraw, p.y()-height()/2 - extrah );
101 101
102 if ( p.x() + extraw + width() > desk->width() ) 102 if ( p.x() + extraw + width() > desk->width() )
103 p.setX( desk->width() - width() - extraw ); 103 p.setX( desk->width() - width() - extraw );
104 if ( p.x() < 0 ) 104 if ( p.x() < 0 )
105 p.setX( 0 ); 105 p.setX( 0 );
106 106
107 if ( p.y() + extrah + height() > desk->height() ) 107 if ( p.y() + extrah + height() > desk->height() )
108 p.setY( desk->height() - height() - extrah ); 108 p.setY( desk->height() - height() - extrah );
109 if ( p.y() < 0 ) 109 if ( p.y() < 0 )
110 p.setY( 0 ); 110 p.setY( 0 );
111 111
112 move( p ); 112 move( p );
113 show(); 113 show();
114 114
115 // Enter event loop for modality 115 // Enter event loop for modality
116 qApp->enter_loop(); 116 qApp->enter_loop();
117 117
118 return m_btnClicked; 118 return m_btnClicked;
119} 119}
120 120
121int PromptDlg::ask( const QString &caption, const QString &text, const QString &btn1, const QString &btn2, 121int PromptDlg::ask( const QString &caption, const QString &text, const QString &btn1, const QString &btn2,
122 QWidget *parent ) 122 QWidget *parent )
123{ 123{
124 PromptDlg *dlg = new PromptDlg( caption, text, btn1, btn2, parent ); 124 PromptDlg *dlg = new PromptDlg( caption, text, btn1, btn2, parent );
125 int rc = dlg->exec(); 125 int rc = dlg->exec();
126 delete dlg; 126 delete dlg;
127 return rc; 127 return rc;
128} 128}
129 129
130void PromptDlg::slotBtn1Clicked() 130void PromptDlg::slotBtn1Clicked()
131{ 131{
132 m_btnClicked = 1; 132 m_btnClicked = 1;
133 qApp->exit_loop(); 133 qApp->exit_loop();
134} 134}
135 135
136void PromptDlg::slotBtn2Clicked() 136void PromptDlg::slotBtn2Clicked()
137{ 137{
138 m_btnClicked = 2; 138 m_btnClicked = 2;
139 qApp->exit_loop(); 139 qApp->exit_loop();
140} 140}