summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg
Unidiff
Diffstat (limited to 'noncore/settings/aqpkg') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/inputdlg.cpp4
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp8
-rw-r--r--noncore/settings/aqpkg/ipkg.cpp10
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp26
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp4
5 files changed, 26 insertions, 26 deletions
diff --git a/noncore/settings/aqpkg/inputdlg.cpp b/noncore/settings/aqpkg/inputdlg.cpp
index 06e934c..30f0527 100644
--- a/noncore/settings/aqpkg/inputdlg.cpp
+++ b/noncore/settings/aqpkg/inputdlg.cpp
@@ -1,134 +1,134 @@
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) 2002 Andy Qua <andy.qua@blueyonder.co.uk> 4 =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk>
5             .=l. Dan Williams <drw@handhelds.org> 5             .=l. Dan Williams <drw@handhelds.org>
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 <qlayout.h> 30#include <qlayout.h>
31#include <qlabel.h> 31#include <qlabel.h>
32#include <qlineedit.h> 32#include <qlineedit.h>
33#include <qpushbutton.h> 33#include <qpushbutton.h>
34#include <qspinbox.h> 34#include <qspinbox.h>
35#include <qcombobox.h> 35#include <qcombobox.h>
36#include <qwidgetstack.h> 36#include <qwidgetstack.h>
37#include <qvalidator.h> 37#include <qvalidator.h>
38#include <qapplication.h> 38#include <qapplication.h>
39 39
40#include "inputdlg.h" 40#include "inputdlg.h"
41#include "global.h" 41#include "global.h"
42 42
43 43
44InputDialog :: InputDialog( const QString &label, QWidget* parent, const char* name, 44InputDialog :: InputDialog( const QString &label, QWidget* parent, const char* name,
45 bool modal ) 45 bool modal )
46 : QDialog( parent, name, modal ) 46 : QDialog( parent, name, modal )
47{ 47{
48 lineEdit = 0; 48 lineEdit = 0;
49 49
50 QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 ); 50 QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 );
51 51
52 QLabel* l = new QLabel( label, this ); 52 QLabel* l = new QLabel( label, this );
53 vbox->addWidget( l ); 53 vbox->addWidget( l );
54 54
55 lineEdit = new QLineEdit( this ); 55 lineEdit = new QLineEdit( this );
56 vbox->addWidget( lineEdit ); 56 vbox->addWidget( lineEdit );
57 57
58 QHBoxLayout *hbox = new QHBoxLayout( 6 ); 58 QHBoxLayout *hbox = new QHBoxLayout( 6 );
59 vbox->addLayout( hbox, AlignRight ); 59 vbox->addLayout( hbox, AlignRight );
60 60
61 ok = new QPushButton( tr( "&OK" ), this ); 61 ok = new QPushButton( tr( "&OK" ), this );
62 ok->setDefault( TRUE ); 62 ok->setDefault( TRUE );
63 QPushButton *cancel = new QPushButton( tr( "&Cancel" ), this ); 63 QPushButton *cancel = new QPushButton( tr( "&Cancel" ), this );
64 64
65 QSize bs( ok->sizeHint() ); 65 QSize bs( ok->sizeHint() );
66 if ( cancel->sizeHint().width() > bs.width() ) 66 if ( cancel->sizeHint().width() > bs.width() )
67 bs.setWidth( cancel->sizeHint().width() ); 67 bs.setWidth( cancel->sizeHint().width() );
68 68
69 ok->setFixedSize( bs ); 69 ok->setFixedSize( bs );
70 cancel->setFixedSize( bs ); 70 cancel->setFixedSize( bs );
71 71
72 hbox->addWidget( new QWidget( this ) ); 72 hbox->addWidget( new QWidget( this ) );
73 hbox->addWidget( ok ); 73 hbox->addWidget( ok );
74 hbox->addWidget( cancel ); 74 hbox->addWidget( cancel );
75 75
76 connect( lineEdit, SIGNAL( returnPressed() ), 76 connect( lineEdit, SIGNAL( returnPressed() ),
77 this, SLOT( tryAccept() ) ); 77 this, SLOT( tryAccept() ) );
78 connect( lineEdit, SIGNAL( textChanged( const QString & ) ), 78 connect( lineEdit, SIGNAL( textChanged(const QString&) ),
79 this, SLOT( textChanged( const QString & ) ) ); 79 this, SLOT( textChanged(const QString&) ) );
80 80
81 connect( ok, SIGNAL( clicked() ), this, SLOT( accept() ) ); 81 connect( ok, SIGNAL( clicked() ), this, SLOT( accept() ) );
82 connect( cancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); 82 connect( cancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
83 83
84 resize( QMAX( sizeHint().width(), 240 ), sizeHint().height() ); 84 resize( QMAX( sizeHint().width(), 240 ), sizeHint().height() );
85} 85}
86 86
87/*! 87/*!
88 Destructor. 88 Destructor.
89*/ 89*/
90 90
91InputDialog::~InputDialog() 91InputDialog::~InputDialog()
92{ 92{
93} 93}
94 94
95void InputDialog :: setText( const QString &text ) 95void InputDialog :: setText( const QString &text )
96{ 96{
97 lineEdit->setText( text ); 97 lineEdit->setText( text );
98 lineEdit->selectAll(); 98 lineEdit->selectAll();
99} 99}
100 100
101QString InputDialog :: getText() 101QString InputDialog :: getText()
102{ 102{
103 return lineEdit->text(); 103 return lineEdit->text();
104} 104}
105 105
106QString InputDialog::getText( const QString &caption, const QString &label, 106QString InputDialog::getText( const QString &caption, const QString &label,
107 const QString &text, bool *ok, QWidget *parent, 107 const QString &text, bool *ok, QWidget *parent,
108 const char *name ) 108 const char *name )
109{ 109{
110 InputDialog *dlg = new InputDialog( label, parent, name, true ); 110 InputDialog *dlg = new InputDialog( label, parent, name, true );
111 dlg->setCaption( caption ); 111 dlg->setCaption( caption );
112 dlg->setText( text ); 112 dlg->setText( text );
113 113
114 QString result; 114 QString result;
115 *ok = dlg->exec() == QDialog::Accepted; 115 *ok = dlg->exec() == QDialog::Accepted;
116 if ( *ok ) 116 if ( *ok )
117 result = dlg->getText(); 117 result = dlg->getText();
118 118
119 delete dlg; 119 delete dlg;
120 return result; 120 return result;
121} 121}
122 122
123 123
124 124
125void InputDialog :: textChanged( const QString &s ) 125void InputDialog :: textChanged( const QString &s )
126{ 126{
127 ok->setEnabled( !s.isEmpty() ); 127 ok->setEnabled( !s.isEmpty() );
128} 128}
129 129
130void InputDialog :: tryAccept() 130void InputDialog :: tryAccept()
131{ 131{
132 if ( !lineEdit->text().isEmpty() ) 132 if ( !lineEdit->text().isEmpty() )
133 accept(); 133 accept();
134} 134}
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index d927a36..d2babb4 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -79,321 +79,321 @@ InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManag
79 79
80 // Grab flags - Turn MAKE_LINKS on by default (if no flags found) 80 // Grab flags - Turn MAKE_LINKS on by default (if no flags found)
81 flags = cfg.readNumEntry( "installFlags", 0 ); 81 flags = cfg.readNumEntry( "installFlags", 0 );
82 infoLevel = cfg.readNumEntry( "infoLevel", 1 ); 82 infoLevel = cfg.readNumEntry( "infoLevel", 1 );
83#else 83#else
84 flags = 0; 84 flags = 0;
85#endif 85#endif
86 86
87 // Output text is read only 87 // Output text is read only
88 output->setReadOnly( true ); 88 output->setReadOnly( true );
89// QFont f( "helvetica" ); 89// QFont f( "helvetica" );
90// f.setPointSize( 10 ); 90// f.setPointSize( 10 );
91// output->setFont( f ); 91// output->setFont( f );
92 92
93 93
94 // setup destination data 94 // setup destination data
95 int defIndex = 0; 95 int defIndex = 0;
96 int i; 96 int i;
97 QListIterator<Destination> dit( dataMgr->getDestinationList() ); 97 QListIterator<Destination> dit( dataMgr->getDestinationList() );
98 for ( i = 0; dit.current(); ++dit, ++i ) 98 for ( i = 0; dit.current(); ++dit, ++i )
99 { 99 {
100 destination->insertItem( dit.current()->getDestinationName() ); 100 destination->insertItem( dit.current()->getDestinationName() );
101 if ( dit.current()->getDestinationName() == defaultDest ) 101 if ( dit.current()->getDestinationName() == defaultDest )
102 defIndex = i; 102 defIndex = i;
103 } 103 }
104 104
105 destination->setCurrentItem( defIndex ); 105 destination->setCurrentItem( defIndex );
106 106
107 QListIterator<InstallData> it( packageList ); 107 QListIterator<InstallData> it( packageList );
108 // setup package data 108 // setup package data
109 QString remove = tr( "Remove\n" ); 109 QString remove = tr( "Remove\n" );
110 QString install = tr( "Install\n" ); 110 QString install = tr( "Install\n" );
111 QString upgrade = tr( "Upgrade\n" ); 111 QString upgrade = tr( "Upgrade\n" );
112 for ( ; it.current(); ++it ) 112 for ( ; it.current(); ++it )
113 { 113 {
114 InstallData *item = it.current(); 114 InstallData *item = it.current();
115 InstallData *newitem = new InstallData(); 115 InstallData *newitem = new InstallData();
116 116
117 newitem->option = item->option; 117 newitem->option = item->option;
118 newitem->packageName = item->packageName; 118 newitem->packageName = item->packageName;
119 newitem->destination = item->destination; 119 newitem->destination = item->destination;
120 newitem->recreateLinks = item->recreateLinks; 120 newitem->recreateLinks = item->recreateLinks;
121 packages.append( newitem ); 121 packages.append( newitem );
122 122
123 if ( item->option == "I" ) 123 if ( item->option == "I" )
124 { 124 {
125 install.append( QString( " %1\n" ).arg( item->packageName ) ); 125 install.append( QString( " %1\n" ).arg( item->packageName ) );
126 } 126 }
127 else if ( item->option == "D" ) 127 else if ( item->option == "D" )
128 { 128 {
129 remove.append( QString( " %1\n" ).arg( item->packageName ) ); 129 remove.append( QString( " %1\n" ).arg( item->packageName ) );
130 } 130 }
131 else if ( item->option == "U" || item->option == "R" ) 131 else if ( item->option == "U" || item->option == "R" )
132 { 132 {
133 QString type; 133 QString type;
134 if ( item->option == "R" ) 134 if ( item->option == "R" )
135 type = tr( "(ReInstall)" ); 135 type = tr( "(ReInstall)" );
136 else 136 else
137 type = tr( "(Upgrade)" ); 137 type = tr( "(Upgrade)" );
138 upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) ); 138 upgrade.append( QString( " %1 %2\n" ).arg( item->packageName ).arg( type ) );
139 } 139 }
140 } 140 }
141 141
142 output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); 142 output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) );
143 143
144 displayAvailableSpace( destination->currentText() ); 144 displayAvailableSpace( destination->currentText() );
145} 145}
146 146
147InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title ) 147InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title )
148 : QWidget( 0, 0, 0 ) 148 : QWidget( 0, 0, 0 )
149{ 149{
150 setCaption( title ); 150 setCaption( title );
151 init( FALSE ); 151 init( FALSE );
152 pIpkg = ipkg; 152 pIpkg = ipkg;
153 output->setText( initialText ); 153 output->setText( initialText );
154} 154}
155 155
156 156
157InstallDlgImpl::~InstallDlgImpl() 157InstallDlgImpl::~InstallDlgImpl()
158{ 158{
159 if ( pIpkg ) 159 if ( pIpkg )
160 delete pIpkg; 160 delete pIpkg;
161} 161}
162 162
163void InstallDlgImpl :: init( bool displayextrainfo ) 163void InstallDlgImpl :: init( bool displayextrainfo )
164{ 164{
165 QGridLayout *layout = new QGridLayout( this ); 165 QGridLayout *layout = new QGridLayout( this );
166 layout->setSpacing( 4 ); 166 layout->setSpacing( 4 );
167 layout->setMargin( 4 ); 167 layout->setMargin( 4 );
168 168
169 if ( displayextrainfo ) 169 if ( displayextrainfo )
170 { 170 {
171 QLabel *label = new QLabel( tr( "Destination" ), this ); 171 QLabel *label = new QLabel( tr( "Destination" ), this );
172 layout->addWidget( label, 0, 0 ); 172 layout->addWidget( label, 0, 0 );
173 destination = new QComboBox( FALSE, this ); 173 destination = new QComboBox( FALSE, this );
174 layout->addWidget( destination, 0, 1 ); 174 layout->addWidget( destination, 0, 1 );
175 connect( destination, SIGNAL( highlighted( const QString & ) ), 175 connect( destination, SIGNAL( highlighted(const QString&) ),
176 this, SLOT( displayAvailableSpace( const QString & ) ) ); 176 this, SLOT( displayAvailableSpace(const QString&) ) );
177 177
178 QLabel *label2 = new QLabel( tr( "Space Avail" ), this ); 178 QLabel *label2 = new QLabel( tr( "Space Avail" ), this );
179 layout->addWidget( label2, 1, 0 ); 179 layout->addWidget( label2, 1, 0 );
180 txtAvailableSpace = new QLabel( "", this ); 180 txtAvailableSpace = new QLabel( "", this );
181 layout->addWidget( txtAvailableSpace, 1, 1 ); 181 layout->addWidget( txtAvailableSpace, 1, 1 );
182 } 182 }
183 else 183 else
184 { 184 {
185 destination = 0x0; 185 destination = 0x0;
186 txtAvailableSpace = 0x0; 186 txtAvailableSpace = 0x0;
187 } 187 }
188 188
189 QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); 189 QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this );
190 GroupBox2->layout()->setSpacing( 0 ); 190 GroupBox2->layout()->setSpacing( 0 );
191 GroupBox2->layout()->setMargin( 4 ); 191 GroupBox2->layout()->setMargin( 4 );
192 192
193 QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() ); 193 QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() );
194 output = new QMultiLineEdit( GroupBox2 ); 194 output = new QMultiLineEdit( GroupBox2 );
195 GroupBox2Layout->addWidget( output ); 195 GroupBox2Layout->addWidget( output );
196 layout->addMultiCellWidget( GroupBox2, 2, 2, 0, 1 ); 196 layout->addMultiCellWidget( GroupBox2, 2, 2, 0, 1 );
197 197
198 btnInstall = new QPushButton( Resource::loadPixmap( "aqpkg/apply" ), tr( "Start" ), this ); 198 btnInstall = new QPushButton( Resource::loadPixmap( "aqpkg/apply" ), tr( "Start" ), this );
199 layout->addWidget( btnInstall, 3, 0 ); 199 layout->addWidget( btnInstall, 3, 0 );
200 connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) ); 200 connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) );
201 201
202 btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this ); 202 btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this );
203 layout->addWidget( btnOptions, 3, 1 ); 203 layout->addWidget( btnOptions, 3, 1 );
204 connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) ); 204 connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) );
205} 205}
206 206
207void InstallDlgImpl :: optionsSelected() 207void InstallDlgImpl :: optionsSelected()
208{ 208{
209 if ( btnOptions->text() == tr( "Options" ) ) 209 if ( btnOptions->text() == tr( "Options" ) )
210 { 210 {
211 InstallOptionsDlgImpl opt( flags, infoLevel, this, "Option", true ); 211 InstallOptionsDlgImpl opt( flags, infoLevel, this, "Option", true );
212 if ( opt.exec() == QDialog::Accepted ) 212 if ( opt.exec() == QDialog::Accepted )
213 { 213 {
214 // set options selected from dialog 214 // set options selected from dialog
215 flags = opt.getFlags(); 215 flags = opt.getFlags();
216 infoLevel = opt.getInfoLevel(); 216 infoLevel = opt.getInfoLevel();
217 217
218#ifdef QWS 218#ifdef QWS
219 Config cfg( "aqpkg" ); 219 Config cfg( "aqpkg" );
220 cfg.setGroup( "settings" ); 220 cfg.setGroup( "settings" );
221 cfg.writeEntry( "installFlags", flags ); 221 cfg.writeEntry( "installFlags", flags );
222 cfg.writeEntry( "infoLevel", infoLevel ); 222 cfg.writeEntry( "infoLevel", infoLevel );
223#endif 223#endif
224 } 224 }
225 } 225 }
226 else // Save output 226 else // Save output
227 { 227 {
228 QMap<QString, QStringList> map; 228 QMap<QString, QStringList> map;
229 map.insert( tr( "All" ), QStringList() ); 229 map.insert( tr( "All" ), QStringList() );
230 QStringList text; 230 QStringList text;
231 text << "text/*"; 231 text << "text/*";
232 map.insert(tr( "Text" ), text ); 232 map.insert(tr( "Text" ), text );
233 text << "*"; 233 text << "*";
234 map.insert( tr( "All" ), text ); 234 map.insert( tr( "All" ), text );
235 235
236 QString filename = Opie::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); 236 QString filename = Opie::OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map );
237 if( !filename.isEmpty() ) 237 if( !filename.isEmpty() )
238 { 238 {
239 QString currentFileName = QFileInfo( filename ).fileName(); 239 QString currentFileName = QFileInfo( filename ).fileName();
240 DocLnk doc; 240 DocLnk doc;
241 doc.setType( "text/plain" ); 241 doc.setType( "text/plain" );
242 doc.setFile( filename ); 242 doc.setFile( filename );
243 doc.setName( currentFileName ); 243 doc.setName( currentFileName );
244 FileManager fm; 244 FileManager fm;
245 fm.saveFile( doc, output->text() ); 245 fm.saveFile( doc, output->text() );
246 } 246 }
247 } 247 }
248} 248}
249 249
250void InstallDlgImpl :: installSelected() 250void InstallDlgImpl :: installSelected()
251{ 251{
252 if ( btnInstall->text() == tr( "Abort" ) ) 252 if ( btnInstall->text() == tr( "Abort" ) )
253 { 253 {
254 if ( pIpkg ) 254 if ( pIpkg )
255 { 255 {
256 displayText( tr( "\n**** User Clicked ABORT ***" ) ); 256 displayText( tr( "\n**** User Clicked ABORT ***" ) );
257 pIpkg->abort(); 257 pIpkg->abort();
258 displayText( tr( "**** Process Aborted ****" ) ); 258 displayText( tr( "**** Process Aborted ****" ) );
259 } 259 }
260 260
261 btnInstall->setText( tr( "Close" ) ); 261 btnInstall->setText( tr( "Close" ) );
262 btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); 262 btnInstall->setIconSet( Resource::loadPixmap( "enter" ) );
263 return; 263 return;
264 } 264 }
265 else if ( btnInstall->text() == tr( "Close" ) ) 265 else if ( btnInstall->text() == tr( "Close" ) )
266 { 266 {
267 emit reloadData( this ); 267 emit reloadData( this );
268 return; 268 return;
269 } 269 }
270 270
271 // Disable buttons 271 // Disable buttons
272 btnOptions->setEnabled( false ); 272 btnOptions->setEnabled( false );
273// btnInstall->setEnabled( false ); 273// btnInstall->setEnabled( false );
274 274
275 btnInstall->setText( tr( "Abort" ) ); 275 btnInstall->setText( tr( "Abort" ) );
276 btnInstall->setIconSet( Resource::loadPixmap( "close" ) ); 276 btnInstall->setIconSet( Resource::loadPixmap( "close" ) );
277 277
278 if ( pIpkg ) 278 if ( pIpkg )
279 { 279 {
280 output->setText( "" ); 280 output->setText( "" );
281 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 281 connect( pIpkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&)));
282 connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); 282 connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished()));
283 pIpkg->runIpkg(); 283 pIpkg->runIpkg();
284 } 284 }
285 else 285 else
286 { 286 {
287 output->setText( "" ); 287 output->setText( "" );
288 Destination *d = dataMgr->getDestination( destination->currentText() ); 288 Destination *d = dataMgr->getDestination( destination->currentText() );
289 QString dest = d->getDestinationName(); 289 QString dest = d->getDestinationName();
290 QString destDir = d->getDestinationPath(); 290 QString destDir = d->getDestinationPath();
291 int instFlags = flags; 291 int instFlags = flags;
292 if ( d->linkToRoot() ) 292 if ( d->linkToRoot() )
293 instFlags |= MAKE_LINKS; 293 instFlags |= MAKE_LINKS;
294 294
295#ifdef QWS 295#ifdef QWS
296 // Save settings 296 // Save settings
297 Config cfg( "aqpkg" ); 297 Config cfg( "aqpkg" );
298 cfg.setGroup( "settings" ); 298 cfg.setGroup( "settings" );
299 cfg.writeEntry( "dest", dest ); 299 cfg.writeEntry( "dest", dest );
300#endif 300#endif
301 301
302 pIpkg = new Ipkg; 302 pIpkg = new Ipkg;
303 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 303 connect( pIpkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&)));
304 connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); 304 connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished()));
305 305
306 firstPackage = TRUE; 306 firstPackage = TRUE;
307 ipkgFinished(); 307 ipkgFinished();
308 308
309 // First run through the remove list, then the install list then the upgrade list 309 // First run through the remove list, then the install list then the upgrade list
310/* 310/*
311 pIpkg->setOption( "remove" ); 311 pIpkg->setOption( "remove" );
312 QListIterator<InstallData> it( removeList ); 312 QListIterator<InstallData> it( removeList );
313 InstallData *idata; 313 InstallData *idata;
314 for ( ; it.current(); ++it ) 314 for ( ; it.current(); ++it )
315 { 315 {
316 idata = it.current(); 316 idata = it.current();
317 pIpkg->setDestination( idata->destination->getDestinationName() ); 317 pIpkg->setDestination( idata->destination->getDestinationName() );
318 pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); 318 pIpkg->setDestinationDir( idata->destination->getDestinationPath() );
319 pIpkg->setPackage( idata->packageName ); 319 pIpkg->setPackage( idata->packageName );
320 320
321 int tmpFlags = flags; 321 int tmpFlags = flags;
322 if ( idata->destination->linkToRoot() ) 322 if ( idata->destination->linkToRoot() )
323 tmpFlags |= MAKE_LINKS; 323 tmpFlags |= MAKE_LINKS;
324 324
325 pIpkg->setFlags( tmpFlags, infoLevel ); 325 pIpkg->setFlags( tmpFlags, infoLevel );
326 pIpkg->runIpkg(); 326 pIpkg->runIpkg();
327 } 327 }
328 328
329 pIpkg->setOption( "install" ); 329 pIpkg->setOption( "install" );
330 pIpkg->setDestination( dest ); 330 pIpkg->setDestination( dest );
331 pIpkg->setDestinationDir( destDir ); 331 pIpkg->setDestinationDir( destDir );
332 pIpkg->setFlags( instFlags, infoLevel ); 332 pIpkg->setFlags( instFlags, infoLevel );
333 QListIterator<InstallData> it2( installList ); 333 QListIterator<InstallData> it2( installList );
334 for ( ; it2.current(); ++it2 ) 334 for ( ; it2.current(); ++it2 )
335 { 335 {
336 pIpkg->setPackage( it2.current()->packageName ); 336 pIpkg->setPackage( it2.current()->packageName );
337 pIpkg->runIpkg(); 337 pIpkg->runIpkg();
338 } 338 }
339 339
340 flags |= FORCE_REINSTALL; 340 flags |= FORCE_REINSTALL;
341 QListIterator<InstallData> it3( updateList ); 341 QListIterator<InstallData> it3( updateList );
342 for ( ; it3.current() ; ++it3 ) 342 for ( ; it3.current() ; ++it3 )
343 { 343 {
344 idata = it3.current(); 344 idata = it3.current();
345 if ( idata->option == "R" ) 345 if ( idata->option == "R" )
346 pIpkg->setOption( "reinstall" ); 346 pIpkg->setOption( "reinstall" );
347 else 347 else
348 pIpkg->setOption( "upgrade" ); 348 pIpkg->setOption( "upgrade" );
349 pIpkg->setDestination( idata->destination->getDestinationName() ); 349 pIpkg->setDestination( idata->destination->getDestinationName() );
350 pIpkg->setDestinationDir( idata->destination->getDestinationPath() ); 350 pIpkg->setDestinationDir( idata->destination->getDestinationPath() );
351 pIpkg->setPackage( idata->packageName ); 351 pIpkg->setPackage( idata->packageName );
352 352
353 int tmpFlags = flags; 353 int tmpFlags = flags;
354 if ( idata->destination->linkToRoot() && idata->recreateLinks ) 354 if ( idata->destination->linkToRoot() && idata->recreateLinks )
355 tmpFlags |= MAKE_LINKS; 355 tmpFlags |= MAKE_LINKS;
356 pIpkg->setFlags( tmpFlags, infoLevel ); 356 pIpkg->setFlags( tmpFlags, infoLevel );
357 pIpkg->runIpkg(); 357 pIpkg->runIpkg();
358 } 358 }
359 359
360 delete pIpkg; 360 delete pIpkg;
361 pIpkg = 0; 361 pIpkg = 0;
362*/ 362*/
363 } 363 }
364} 364}
365 365
366 366
367void InstallDlgImpl :: displayText(const QString &text ) 367void InstallDlgImpl :: displayText(const QString &text )
368{ 368{
369 QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text ); 369 QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text );
370 370
371 /* Set a max line count for the QMultiLineEdit, as users have reported 371 /* Set a max line count for the QMultiLineEdit, as users have reported
372 * performance issues when line count gets extreme. 372 * performance issues when line count gets extreme.
373 */ 373 */
374 if(output->numLines() >= MAXLINES) 374 if(output->numLines() >= MAXLINES)
375 output->removeLine(0); 375 output->removeLine(0);
376 output->setText( newtext ); 376 output->setText( newtext );
377 output->setCursorPosition( output->numLines(), 0 ); 377 output->setCursorPosition( output->numLines(), 0 );
378} 378}
379 379
380 380
381void InstallDlgImpl :: displayAvailableSpace( const QString &text ) 381void InstallDlgImpl :: displayAvailableSpace( const QString &text )
382{ 382{
383 Destination *d = dataMgr->getDestination( text ); 383 Destination *d = dataMgr->getDestination( text );
384 QString destDir = d->getDestinationPath(); 384 QString destDir = d->getDestinationPath();
385 385
386 long blockSize = 0; 386 long blockSize = 0;
387 long totalBlocks = 0; 387 long totalBlocks = 0;
388 long availBlocks = 0; 388 long availBlocks = 0;
389 QString space; 389 QString space;
390 if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) ) 390 if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) )
391 { 391 {
392 long mult = blockSize / 1024; 392 long mult = blockSize / 1024;
393 long div = 1024 / blockSize; 393 long div = 1024 / blockSize;
394 394
395 if ( !mult ) mult = 1; 395 if ( !mult ) mult = 1;
396 if ( !div ) div = 1; 396 if ( !div ) div = 1;
397 long avail = availBlocks * mult / div; 397 long avail = availBlocks * mult / div;
398 398
399 space = tr( "%1 Kb" ).arg( avail ); 399 space = tr( "%1 Kb" ).arg( avail );
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp
index 3761b67..866afed 100644
--- a/noncore/settings/aqpkg/ipkg.cpp
+++ b/noncore/settings/aqpkg/ipkg.cpp
@@ -195,200 +195,200 @@ void Ipkg :: removeStatusEntry()
195 tempstr = tr("package - "); 195 tempstr = tr("package - ");
196 tempstr.append( package ); 196 tempstr.append( package );
197 emit outputText( tempstr ); 197 emit outputText( tempstr );
198 198
199 QFile readFile( statusFile ); 199 QFile readFile( statusFile );
200 QFile writeFile( outStatusFile ); 200 QFile writeFile( outStatusFile );
201 201
202 if ( !readFile.open( IO_ReadOnly ) ) 202 if ( !readFile.open( IO_ReadOnly ) )
203 { 203 {
204 tempstr = tr("Couldn't open status file - "); 204 tempstr = tr("Couldn't open status file - ");
205 tempstr.append( statusFile ); 205 tempstr.append( statusFile );
206 emit outputText( tempstr ); 206 emit outputText( tempstr );
207 return; 207 return;
208 } 208 }
209 209
210 if ( !writeFile.open( IO_WriteOnly ) ) 210 if ( !writeFile.open( IO_WriteOnly ) )
211 { 211 {
212 tempstr = tr("Couldn't create tempory status file - "); 212 tempstr = tr("Couldn't create tempory status file - ");
213 tempstr.append( outStatusFile ); 213 tempstr.append( outStatusFile );
214 emit outputText( tempstr ); 214 emit outputText( tempstr );
215 return; 215 return;
216 } 216 }
217 217
218 int i = 0; 218 int i = 0;
219 219
220 QTextStream readStream( &readFile ); 220 QTextStream readStream( &readFile );
221 QTextStream writeStream( &writeFile ); 221 QTextStream writeStream( &writeFile );
222 QString line; 222 QString line;
223 223
224 char k[21]; 224 char k[21];
225 char v[1001]; 225 char v[1001];
226 QString key; 226 QString key;
227 QString value; 227 QString value;
228 228
229 while ( !readStream.atEnd() ) 229 while ( !readStream.atEnd() )
230 { 230 {
231 //read new line 231 //read new line
232 line = readStream.readLine(); 232 line = readStream.readLine();
233 233
234 if ( line.contains( ":", TRUE ) ) 234 if ( line.contains( ":", TRUE ) )
235 { 235 {
236 //grep key and value from line 236 //grep key and value from line
237 k[0] = '\0'; 237 k[0] = '\0';
238 v[0] = '\0'; 238 v[0] = '\0';
239 sscanf( line, "%[^:]: %[^\n]", k, v ); 239 sscanf( line, "%[^:]: %[^\n]", k, v );
240 key = k; 240 key = k;
241 value = v; 241 value = v;
242 key = key.stripWhiteSpace(); 242 key = key.stripWhiteSpace();
243 value = value.stripWhiteSpace(); 243 value = value.stripWhiteSpace();
244 } else { 244 } else {
245 key = ""; 245 key = "";
246 value = ""; 246 value = "";
247 } 247 }
248 248
249 if ( key == "Package" && value == package ) 249 if ( key == "Package" && value == package )
250 { 250 {
251 //skip lines from the deleted package 251 //skip lines from the deleted package
252 while ( ( !readStream.atEnd() ) && ( line.stripWhiteSpace() != "" ) ) 252 while ( ( !readStream.atEnd() ) && ( line.stripWhiteSpace() != "" ) )
253 { 253 {
254 line = readStream.readLine(); 254 line = readStream.readLine();
255 } 255 }
256 } else { 256 } else {
257 257
258 //write other lines into the tempfile 258 //write other lines into the tempfile
259 writeStream << line << "\n"; 259 writeStream << line << "\n";
260 260
261 // Improve UI responsiveness 261 // Improve UI responsiveness
262 i++; 262 i++;
263 if ( ( i % 50 ) == 0 ) 263 if ( ( i % 50 ) == 0 )
264 qApp->processEvents(); 264 qApp->processEvents();
265 } 265 }
266 } 266 }
267 267
268 readFile.close(); 268 readFile.close();
269 writeFile.close(); 269 writeFile.close();
270 270
271 // Remove old status file and put tmp stats file in its place 271 // Remove old status file and put tmp stats file in its place
272 remove( statusFile ); 272 remove( statusFile );
273 rename( outStatusFile, statusFile ); 273 rename( outStatusFile, statusFile );
274 } 274 }
275 275
276int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ ) 276int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ )
277{ 277{
278 // If one is already running - should never be but just to be safe 278 // If one is already running - should never be but just to be safe
279 if ( proc ) 279 if ( proc )
280 { 280 {
281 delete proc; 281 delete proc;
282 proc = 0; 282 proc = 0;
283 } 283 }
284 284
285 // OK we're gonna use OProcess to run this thing 285 // OK we're gonna use OProcess to run this thing
286 proc = new OProcess(); 286 proc = new OProcess();
287 aborted = false; 287 aborted = false;
288 288
289 289
290 // Connect up our slots 290 // Connect up our slots
291 connect(proc, SIGNAL(processExited(OProcess *)), 291 connect(proc, SIGNAL(processExited(OProcess*)),
292 this, SLOT( processFinished())); 292 this, SLOT( processFinished()));
293 293
294 connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)), 294 connect(proc, SIGNAL(receivedStdout(OProcess*,char*,int)),
295 this, SLOT(commandStdout(OProcess *, char *, int))); 295 this, SLOT(commandStdout(OProcess*,char*,int)));
296 296
297 connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)), 297 connect(proc, SIGNAL(receivedStderr(OProcess*,char*,int)),
298 this, SLOT(commandStderr(OProcess *, char *, int))); 298 this, SLOT(commandStderr(OProcess*,char*,int)));
299 299
300 for ( QStringList::Iterator it = cmd.begin(); it != cmd.end(); ++it ) 300 for ( QStringList::Iterator it = cmd.begin(); it != cmd.end(); ++it )
301 { 301 {
302 *proc << (*it).latin1(); 302 *proc << (*it).latin1();
303 } 303 }
304 304
305 // Start the process going 305 // Start the process going
306 finished = false; 306 finished = false;
307 if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) 307 if(!proc->start(OProcess::NotifyOnExit, OProcess::All))
308 { 308 {
309 emit outputText( tr("Couldn't start ipkg process" ) ); 309 emit outputText( tr("Couldn't start ipkg process" ) );
310 } 310 }
311} 311}
312 312
313void Ipkg::commandStdout(OProcess*, char *buffer, int buflen) 313void Ipkg::commandStdout(OProcess*, char *buffer, int buflen)
314{ 314{
315 QString lineStr = buffer; 315 QString lineStr = buffer;
316 if ( lineStr[buflen-1] == '\n' ) 316 if ( lineStr[buflen-1] == '\n' )
317 buflen --; 317 buflen --;
318 lineStr = lineStr.left( buflen ); 318 lineStr = lineStr.left( buflen );
319 emit outputText( lineStr ); 319 emit outputText( lineStr );
320 320
321 // check if we are installing dependant packages 321 // check if we are installing dependant packages
322 if ( option == "install" || option == "reinstall" ) 322 if ( option == "install" || option == "reinstall" )
323 { 323 {
324 // Need to keep track of any dependant packages that get installed 324 // Need to keep track of any dependant packages that get installed
325 // so that we can create links to them as necessary 325 // so that we can create links to them as necessary
326 if ( lineStr.startsWith( "Installing " ) ) 326 if ( lineStr.startsWith( "Installing " ) )
327 { 327 {
328 int start = lineStr.find( " " ) + 1; 328 int start = lineStr.find( " " ) + 1;
329 int end = lineStr.find( " ", start ); 329 int end = lineStr.find( " ", start );
330 QString *package = new QString( lineStr.mid( start, end-start ) ); 330 QString *package = new QString( lineStr.mid( start, end-start ) );
331 dependantPackages->append( package ); 331 dependantPackages->append( package );
332 } 332 }
333 } 333 }
334 else if ( option == "remove" && !( flags & FORCE_DEPENDS ) && 334 else if ( option == "remove" && !( flags & FORCE_DEPENDS ) &&
335 lineStr.find( "is depended upon by packages:" ) != -1 ) 335 lineStr.find( "is depended upon by packages:" ) != -1 )
336 { 336 {
337 // Ipkg should send this to STDERR, but doesn't - so trap here 337 // Ipkg should send this to STDERR, but doesn't - so trap here
338 error = true; 338 error = true;
339 } 339 }
340 340
341 buffer[0] = '\0'; 341 buffer[0] = '\0';
342} 342}
343 343
344void Ipkg::commandStderr(OProcess*, char *buffer, int buflen) 344void Ipkg::commandStderr(OProcess*, char *buffer, int buflen)
345{ 345{
346 QString lineStr = buffer; 346 QString lineStr = buffer;
347 if ( lineStr[buflen-1] == '\n' ) 347 if ( lineStr[buflen-1] == '\n' )
348 buflen --; 348 buflen --;
349 lineStr=lineStr.left( buflen ); 349 lineStr=lineStr.left( buflen );
350 emit outputText( lineStr ); 350 emit outputText( lineStr );
351 buffer[0] = '\0'; 351 buffer[0] = '\0';
352 error = true; 352 error = true;
353} 353}
354 354
355void Ipkg::processFinished() 355void Ipkg::processFinished()
356{ 356{
357 // Finally, if we are removing a package, remove its entry from the <destdir>/usr/lib/ipkg/status file 357 // Finally, if we are removing a package, remove its entry from the <destdir>/usr/lib/ipkg/status file
358 // to workaround an ipkg bug which stops reinstall to a different location 358 // to workaround an ipkg bug which stops reinstall to a different location
359 359
360 if ( !error && option == "remove" ) 360 if ( !error && option == "remove" )
361 removeStatusEntry(); 361 removeStatusEntry();
362 362
363 delete proc; 363 delete proc;
364 proc = 0; 364 proc = 0;
365 finished = true; 365 finished = true;
366 366
367 emit ipkgFinished(); 367 emit ipkgFinished();
368} 368}
369 369
370 370
371void Ipkg :: abort() 371void Ipkg :: abort()
372{ 372{
373 if ( proc ) 373 if ( proc )
374 { 374 {
375 proc->kill(); 375 proc->kill();
376 aborted = true; 376 aborted = true;
377 } 377 }
378} 378}
379 379
380void Ipkg :: linkPackage( const QString &packFileName, const QString &dest, const QString &destDir ) 380void Ipkg :: linkPackage( const QString &packFileName, const QString &dest, const QString &destDir )
381{ 381{
382 if ( dest == "root" || dest == "/" ) 382 if ( dest == "root" || dest == "/" )
383 return; 383 return;
384 384
385 qApp->processEvents(); 385 qApp->processEvents();
386 QStringList *fileList = getList( packFileName, destDir ); 386 QStringList *fileList = getList( packFileName, destDir );
387 qApp->processEvents(); 387 qApp->processEvents();
388 processFileList( fileList, destDir ); 388 processFileList( fileList, destDir );
389 delete fileList; 389 delete fileList;
390} 390}
391 391
392QStringList* Ipkg :: getList( const QString &packageFilename, const QString &destDir ) 392QStringList* Ipkg :: getList( const QString &packageFilename, const QString &destDir )
393{ 393{
394 QString packageFileDir = destDir; 394 QString packageFileDir = destDir;
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index 6f5c712..6b31cd1 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -7,402 +7,402 @@
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 "categoryfilterimpl.h" 30#include "categoryfilterimpl.h"
31#include "datamgr.h" 31#include "datamgr.h"
32#include "global.h" 32#include "global.h"
33#include "inputdlg.h" 33#include "inputdlg.h"
34#include "ipkg.h" 34#include "ipkg.h"
35#include "installdlgimpl.h" 35#include "installdlgimpl.h"
36#include "letterpushbutton.h" 36#include "letterpushbutton.h"
37#include "mainwin.h" 37#include "mainwin.h"
38#include "packagewin.h" 38#include "packagewin.h"
39#include "settingsimpl.h" 39#include "settingsimpl.h"
40#include "utils.h" 40#include "utils.h"
41 41
42/* OPIE */ 42/* OPIE */
43#include <qpe/qcopenvelope_qws.h> 43#include <qpe/qcopenvelope_qws.h>
44#include <qpe/qpeapplication.h> 44#include <qpe/qpeapplication.h>
45#include <qpe/config.h> 45#include <qpe/config.h>
46#include <qpe/resource.h> 46#include <qpe/resource.h>
47 47
48/* QT */ 48/* QT */
49#include <qmenubar.h> 49#include <qmenubar.h>
50#include <qtoolbar.h> 50#include <qtoolbar.h>
51#include <qaction.h> 51#include <qaction.h>
52#include <qcombobox.h> 52#include <qcombobox.h>
53#include <qfile.h> 53#include <qfile.h>
54#include <qlabel.h> 54#include <qlabel.h>
55#include <qlayout.h> 55#include <qlayout.h>
56#include <qlineedit.h> 56#include <qlineedit.h>
57#include <qlistview.h> 57#include <qlistview.h>
58#include <qmenubar.h> 58#include <qmenubar.h>
59#include <qmessagebox.h> 59#include <qmessagebox.h>
60#include <qpopupmenu.h> 60#include <qpopupmenu.h>
61#include <qprogressbar.h> 61#include <qprogressbar.h>
62#include <qtimer.h> 62#include <qtimer.h>
63#include <qwhatsthis.h> 63#include <qwhatsthis.h>
64#include <qwidgetstack.h> 64#include <qwidgetstack.h>
65 65
66/* STD */ 66/* STD */
67#include <linux/limits.h> 67#include <linux/limits.h>
68#include <unistd.h> 68#include <unistd.h>
69 69
70extern int compareVersions( const char *v1, const char *v2 ); 70extern int compareVersions( const char *v1, const char *v2 );
71 71
72MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl ) 72MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl )
73 :QMainWindow( parent, name, fl || WStyle_ContextHelp ) 73 :QMainWindow( parent, name, fl || WStyle_ContextHelp )
74{ 74{
75 // Disable suspend mode 75 // Disable suspend mode
76 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; 76 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend;
77 77
78 LOCAL_SERVER = QObject::tr( "Installed packages" ); 78 LOCAL_SERVER = QObject::tr( "Installed packages" );
79 LOCAL_IPKGS = QObject::tr( "Local packages" ); 79 LOCAL_IPKGS = QObject::tr( "Local packages" );
80 80
81 setCaption( tr( "AQPkg - Package Manager" ) ); 81 setCaption( tr( "AQPkg - Package Manager" ) );
82 82
83 // Create UI widgets 83 // Create UI widgets
84 initMainWidget(); 84 initMainWidget();
85 initProgressWidget(); 85 initProgressWidget();
86 86
87 // Build menu and tool bars 87 // Build menu and tool bars
88 setToolBarsMovable( FALSE ); 88 setToolBarsMovable( FALSE );
89 89
90 QToolBar *bar = new QToolBar( this ); 90 QToolBar *bar = new QToolBar( this );
91 bar->setHorizontalStretchable( TRUE ); 91 bar->setHorizontalStretchable( TRUE );
92 QMenuBar *mb = new QMenuBar( bar ); 92 QMenuBar *mb = new QMenuBar( bar );
93 mb->setMargin( 0 ); 93 mb->setMargin( 0 );
94 bar = new QToolBar( this ); 94 bar = new QToolBar( this );
95 95
96 // Find toolbar 96 // Find toolbar
97 findBar = new QToolBar( this ); 97 findBar = new QToolBar( this );
98 addToolBar( findBar, QMainWindow::Top, true ); 98 addToolBar( findBar, QMainWindow::Top, true );
99 findBar->setHorizontalStretchable( true ); 99 findBar->setHorizontalStretchable( true );
100 findEdit = new QLineEdit( findBar ); 100 findEdit = new QLineEdit( findBar );
101 QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); 101 QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) );
102 findBar->setStretchableWidget( findEdit ); 102 findBar->setStretchableWidget( findEdit );
103 connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); 103 connect( findEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( findPackage(const QString&) ) );
104 104
105 // Quick jump toolbar 105 // Quick jump toolbar
106 jumpBar = new QToolBar( this ); 106 jumpBar = new QToolBar( this );
107 addToolBar( jumpBar, QMainWindow::Top, true ); 107 addToolBar( jumpBar, QMainWindow::Top, true );
108 jumpBar->setHorizontalStretchable( true ); 108 jumpBar->setHorizontalStretchable( true );
109 QWidget *w = new QWidget( jumpBar ); 109 QWidget *w = new QWidget( jumpBar );
110 jumpBar->setStretchableWidget( w ); 110 jumpBar->setStretchableWidget( w );
111 111
112 QGridLayout *layout = new QGridLayout( w ); 112 QGridLayout *layout = new QGridLayout( w );
113 113
114 char text[2]; 114 char text[2];
115 text[1] = '\0'; 115 text[1] = '\0';
116 for ( int i = 0 ; i < 26 ; ++i ) 116 for ( int i = 0 ; i < 26 ; ++i )
117 { 117 {
118 text[0] = 'A' + i; 118 text[0] = 'A' + i;
119 LetterPushButton *b = new LetterPushButton( text, w ); 119 LetterPushButton *b = new LetterPushButton( text, w );
120 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); 120 connect( b, SIGNAL( released(QString) ), this, SLOT( letterPushed(QString) ) );
121 layout->addWidget( b, i / 13, i % 13); 121 layout->addWidget( b, i / 13, i % 13);
122 } 122 }
123 123
124 QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); 124 QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 );
125 a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); 125 a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) );
126 connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); 126 connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) );
127 a->addTo( jumpBar ); 127 a->addTo( jumpBar );
128 jumpBar->hide(); 128 jumpBar->hide();
129 129
130 // Packages menu 130 // Packages menu
131 QPopupMenu *popup = new QPopupMenu( this ); 131 QPopupMenu *popup = new QPopupMenu( this );
132 132
133 a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); 133 a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 );
134 a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); 134 a->setWhatsThis( tr( "Click here to update package lists from servers." ) );
135 connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); 135 connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) );
136 a->addTo( popup ); 136 a->addTo( popup );
137 a->addTo( bar ); 137 a->addTo( bar );
138 138
139 actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); 139 actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 );
140 actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); 140 actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) );
141 connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) ); 141 connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) );
142 actionUpgrade->addTo( popup ); 142 actionUpgrade->addTo( popup );
143 actionUpgrade->addTo( bar ); 143 actionUpgrade->addTo( bar );
144 144
145 iconDownload = Resource::loadPixmap( "aqpkg/download" ); 145 iconDownload = Resource::loadPixmap( "aqpkg/download" );
146 iconRemove = Resource::loadPixmap( "aqpkg/remove" ); 146 iconRemove = Resource::loadPixmap( "aqpkg/remove" );
147 actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); 147 actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 );
148 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); 148 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) );
149 connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) ); 149 connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) );
150 actionDownload->addTo( popup ); 150 actionDownload->addTo( popup );
151 actionDownload->addTo( bar ); 151 actionDownload->addTo( bar );
152 152
153 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); 153 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 );
154 a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); 154 a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) );
155 connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) ); 155 connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) );
156 a->addTo( popup ); 156 a->addTo( popup );
157 a->addTo( bar ); 157 a->addTo( bar );
158 158
159 popup->insertSeparator(); 159 popup->insertSeparator();
160 160
161 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); 161 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 );
162 a->setWhatsThis( tr( "Click here to configure this application." ) ); 162 a->setWhatsThis( tr( "Click here to configure this application." ) );
163 connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); 163 connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) );
164 a->addTo( popup ); 164 a->addTo( popup );
165 mb->insertItem( tr( "Actions" ), popup ); 165 mb->insertItem( tr( "Actions" ), popup );
166 166
167 // View menu 167 // View menu
168 popup = new QPopupMenu( this ); 168 popup = new QPopupMenu( this );
169 169
170 actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); 170 actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 );
171 actionUninstalled->setToggleAction( TRUE ); 171 actionUninstalled->setToggleAction( TRUE );
172 actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); 172 actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) );
173 connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) ); 173 connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) );
174 actionUninstalled->addTo( popup ); 174 actionUninstalled->addTo( popup );
175 175
176 actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); 176 actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 );
177 actionInstalled->setToggleAction( TRUE ); 177 actionInstalled->setToggleAction( TRUE );
178 actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); 178 actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) );
179 connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) ); 179 connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) );
180 actionInstalled->addTo( popup ); 180 actionInstalled->addTo( popup );
181 181
182 actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); 182 actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 );
183 actionUpdated->setToggleAction( TRUE ); 183 actionUpdated->setToggleAction( TRUE );
184 actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); 184 actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) );
185 connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) ); 185 connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) );
186 actionUpdated->addTo( popup ); 186 actionUpdated->addTo( popup );
187 187
188 popup->insertSeparator(); 188 popup->insertSeparator();
189 189
190 actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 ); 190 actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 );
191 actionFilter->setToggleAction( TRUE ); 191 actionFilter->setToggleAction( TRUE );
192 actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) ); 192 actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) );
193 connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) ); 193 connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) );
194 actionFilter->addTo( popup ); 194 actionFilter->addTo( popup );
195 195
196 a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 ); 196 a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 );
197 a->setWhatsThis( tr( "Click here to change package category to used filter." ) ); 197 a->setWhatsThis( tr( "Click here to change package category to used filter." ) );
198 connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); 198 connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) );
199 a->addTo( popup ); 199 a->addTo( popup );
200 200
201 popup->insertSeparator(); 201 popup->insertSeparator();
202 202
203 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); 203 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
204 a->setWhatsThis( tr( "Click here to search for text in package names." ) ); 204 a->setWhatsThis( tr( "Click here to search for text in package names." ) );
205 connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); 205 connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) );
206 a->addTo( popup ); 206 a->addTo( popup );
207 207
208 actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); 208 actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 );
209 actionFindNext->setEnabled( FALSE ); 209 actionFindNext->setEnabled( FALSE );
210 actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); 210 actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) );
211 connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); 211 connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) );
212 actionFindNext->addTo( popup ); 212 actionFindNext->addTo( popup );
213 actionFindNext->addTo( findBar ); 213 actionFindNext->addTo( findBar );
214 214
215 215
216 popup->insertSeparator(); 216 popup->insertSeparator();
217 217
218 a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 ); 218 a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 );
219 a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) ); 219 a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) );
220 connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) ); 220 connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) );
221 a->addTo( popup ); 221 a->addTo( popup );
222 222
223 mb->insertItem( tr( "View" ), popup ); 223 mb->insertItem( tr( "View" ), popup );
224 224
225 // Finish find toolbar creation 225 // Finish find toolbar creation
226 a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 226 a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
227 a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); 227 a->setWhatsThis( tr( "Click here to hide the find toolbar." ) );
228 connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); 228 connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) );
229 a->addTo( findBar ); 229 a->addTo( findBar );
230 findBar->hide(); 230 findBar->hide();
231 231
232 // Create widget stack and add UI widgets 232 // Create widget stack and add UI widgets
233 stack = new QWidgetStack( this ); 233 stack = new QWidgetStack( this );
234 stack->addWidget( progressWindow, 2 ); 234 stack->addWidget( progressWindow, 2 );
235 stack->addWidget( networkPkgWindow, 1 ); 235 stack->addWidget( networkPkgWindow, 1 );
236 setCentralWidget( stack ); 236 setCentralWidget( stack );
237 stack->raiseWidget( progressWindow ); 237 stack->raiseWidget( progressWindow );
238 238
239 // Delayed call to finish initialization 239 // Delayed call to finish initialization
240 QTimer::singleShot( 100, this, SLOT( init() ) ); 240 QTimer::singleShot( 100, this, SLOT( init() ) );
241} 241}
242 242
243MainWindow :: ~MainWindow() 243MainWindow :: ~MainWindow()
244{ 244{
245 delete mgr; 245 delete mgr;
246 246
247 // Reenable suspend mode 247 // Reenable suspend mode
248 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 248 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
249} 249}
250 250
251void MainWindow :: initMainWidget() 251void MainWindow :: initMainWidget()
252{ 252{
253 networkPkgWindow = new QWidget( this ); 253 networkPkgWindow = new QWidget( this );
254 254
255 QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); 255 QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow );
256 256
257 serversList = new QComboBox( networkPkgWindow ); 257 serversList = new QComboBox( networkPkgWindow );
258 connect( serversList, SIGNAL(activated(int)), this, SLOT(serverSelected(int)) ); 258 connect( serversList, SIGNAL(activated(int)), this, SLOT(serverSelected(int)) );
259 QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); 259 QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) );
260 260
261 installedIcon = Resource::loadPixmap( "installed" ); 261 installedIcon = Resource::loadPixmap( "installed" );
262 updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); 262 updatedIcon = Resource::loadPixmap( "aqpkg/updated" );
263 263
264 packagesList = new QListView( networkPkgWindow ); 264 packagesList = new QListView( networkPkgWindow );
265 packagesList->addColumn( tr( "Packages" ), 225 ); 265 packagesList->addColumn( tr( "Packages" ), 225 );
266 QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\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." ) ); 266 QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\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." ) );
267 QPEApplication::setStylusOperation( packagesList->viewport(), QPEApplication::RightOnHold ); 267 QPEApplication::setStylusOperation( packagesList->viewport(), QPEApplication::RightOnHold );
268 connect( packagesList, SIGNAL(rightButtonPressed(QListViewItem *,const QPoint &,int)), 268 connect( packagesList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)),
269 this, SLOT(slotDisplayPackage(QListViewItem *)) ); 269 this, SLOT(slotDisplayPackage(QListViewItem*)) );
270 270
271 QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); 271 QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 );
272 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); 272 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 );
273 hbox1->addWidget( l ); 273 hbox1->addWidget( l );
274 hbox1->addWidget( serversList ); 274 hbox1->addWidget( serversList );
275 275
276 vbox->addWidget( packagesList ); 276 vbox->addWidget( packagesList );
277 277
278 downloadEnabled = TRUE; 278 downloadEnabled = TRUE;
279} 279}
280 280
281void MainWindow :: initProgressWidget() 281void MainWindow :: initProgressWidget()
282{ 282{
283 progressWindow = new QWidget( this ); 283 progressWindow = new QWidget( this );
284 284
285 QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); 285 QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 );
286 286
287 m_status = new QLabel( progressWindow ); 287 m_status = new QLabel( progressWindow );
288 m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); 288 m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
289 layout->addWidget( m_status ); 289 layout->addWidget( m_status );
290 290
291 m_progress = new QProgressBar( progressWindow ); 291 m_progress = new QProgressBar( progressWindow );
292 layout->addWidget( m_progress ); 292 layout->addWidget( m_progress );
293} 293}
294 294
295void MainWindow :: init() 295void MainWindow :: init()
296{ 296{
297#ifdef QWS 297#ifdef QWS
298 // read download directory from config file 298 // read download directory from config file
299 Config cfg( "aqpkg" ); 299 Config cfg( "aqpkg" );
300 cfg.setGroup( "settings" ); 300 cfg.setGroup( "settings" );
301 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); 301 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" );
302 // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); 302 // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" );
303 303
304#endif 304#endif
305 305
306 stack->raiseWidget( progressWindow ); 306 stack->raiseWidget( progressWindow );
307 307
308 mgr = new DataManager(); 308 mgr = new DataManager();
309 connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) ); 309 connect( mgr, SIGNAL( progressSetSteps(int) ), this, SLOT( setProgressSteps(int) ) );
310 connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), 310 connect( mgr, SIGNAL( progressSetMessage(const QString&) ),
311 this, SLOT( setProgressMessage( const QString & ) ) ); 311 this, SLOT( setProgressMessage(const QString&) ) );
312 connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) ); 312 connect( mgr, SIGNAL( progressUpdate(int) ), this, SLOT( updateProgress(int) ) );
313 mgr->loadServers(); 313 mgr->loadServers();
314 314
315 showUninstalledPkgs = false; 315 showUninstalledPkgs = false;
316 showInstalledPkgs = false; 316 showInstalledPkgs = false;
317 showUpgradedPkgs = false; 317 showUpgradedPkgs = false;
318 categoryFilterEnabled = false; 318 categoryFilterEnabled = false;
319 319
320 updateData(); 320 updateData();
321 321
322 stack->raiseWidget( networkPkgWindow ); 322 stack->raiseWidget( networkPkgWindow );
323} 323}
324 324
325void MainWindow :: setDocument( const QString &doc ) 325void MainWindow :: setDocument( const QString &doc )
326{ 326{
327 // Remove path from package 327 // Remove path from package
328 QString package = Utils::getPackageNameFromIpkFilename( doc ); 328 QString package = Utils::getPackageNameFromIpkFilename( doc );
329 329
330 // First select local server 330 // First select local server
331 for ( int i = 0 ; i < serversList->count() ; ++i ) 331 for ( int i = 0 ; i < serversList->count() ; ++i )
332 { 332 {
333 if ( serversList->text( i ) == LOCAL_IPKGS ) 333 if ( serversList->text( i ) == LOCAL_IPKGS )
334 { 334 {
335 serversList->setCurrentItem( i ); 335 serversList->setCurrentItem( i );
336 break; 336 break;
337 } 337 }
338 } 338 }
339 serverSelected( 0 ); 339 serverSelected( 0 );
340 340
341 // Now set the check box of the selected package 341 // Now set the check box of the selected package
342 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 342 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
343 item != 0 ; 343 item != 0 ;
344 item = (QCheckListItem *)item->nextSibling() ) 344 item = (QCheckListItem *)item->nextSibling() )
345 { 345 {
346 if ( item->text().startsWith( package ) ) 346 if ( item->text().startsWith( package ) )
347 { 347 {
348 item->setOn( true ); 348 item->setOn( true );
349 break; 349 break;
350 } 350 }
351 } 351 }
352} 352}
353 353
354void MainWindow :: displaySettings() 354void MainWindow :: displaySettings()
355{ 355{
356 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); 356 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true );
357 if ( dlg->showDlg() ) 357 if ( dlg->showDlg() )
358 { 358 {
359 stack->raiseWidget( progressWindow ); 359 stack->raiseWidget( progressWindow );
360 updateData(); 360 updateData();
361 stack->raiseWidget( networkPkgWindow ); 361 stack->raiseWidget( networkPkgWindow );
362 } 362 }
363 delete dlg; 363 delete dlg;
364} 364}
365 365
366void MainWindow :: closeEvent( QCloseEvent *e ) 366void MainWindow :: closeEvent( QCloseEvent *e )
367{ 367{
368 // If install dialog is visible, return to main view, otherwise close app 368 // If install dialog is visible, return to main view, otherwise close app
369 QWidget *widget = stack->visibleWidget(); 369 QWidget *widget = stack->visibleWidget();
370 370
371 if ( widget != networkPkgWindow && widget != progressWindow ) 371 if ( widget != networkPkgWindow && widget != progressWindow )
372 { 372 {
373 if ( widget ) delete widget; 373 if ( widget ) delete widget;
374 stack->raiseWidget( networkPkgWindow ); 374 stack->raiseWidget( networkPkgWindow );
375 e->ignore(); 375 e->ignore();
376 } 376 }
377 else 377 else
378 { 378 {
379 e->accept(); 379 e->accept();
380 } 380 }
381} 381}
382 382
383void MainWindow :: displayFindBar() 383void MainWindow :: displayFindBar()
384{ 384{
385 findBar->show(); 385 findBar->show();
386 findEdit->setFocus(); 386 findEdit->setFocus();
387} 387}
388 388
389void MainWindow :: displayJumpBar() 389void MainWindow :: displayJumpBar()
390{ 390{
391 jumpBar->show(); 391 jumpBar->show();
392} 392}
393 393
394void MainWindow :: repeatFind() 394void MainWindow :: repeatFind()
395{ 395{
396 searchForPackage( findEdit->text() ); 396 searchForPackage( findEdit->text() );
397} 397}
398 398
399void MainWindow :: findPackage( const QString &text ) 399void MainWindow :: findPackage( const QString &text )
400{ 400{
401 actionFindNext->setEnabled( !text.isEmpty() ); 401 actionFindNext->setEnabled( !text.isEmpty() );
402 searchForPackage( text ); 402 searchForPackage( text );
403} 403}
404 404
405void MainWindow :: hideFindBar() 405void MainWindow :: hideFindBar()
406{ 406{
407 findBar->hide(); 407 findBar->hide();
408} 408}
@@ -677,411 +677,411 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
677 677
678 // If the local server, only display installed packages 678 // If the local server, only display installed packages
679 if ( serverName == LOCAL_SERVER && !package->isInstalled() ) 679 if ( serverName == LOCAL_SERVER && !package->isInstalled() )
680 continue; 680 continue;
681 681
682 682
683 QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(), 683 QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(),
684 QCheckListItem::CheckBox ); 684 QCheckListItem::CheckBox );
685 685
686 if ( package->isInstalled() ) 686 if ( package->isInstalled() )
687 { 687 {
688 // If a different version of package is available, show update available icon 688 // If a different version of package is available, show update available icon
689 // Otherwise, show installed icon 689 // Otherwise, show installed icon
690 if ( package->getNewVersionAvailable()) 690 if ( package->getNewVersionAvailable())
691 { 691 {
692 692
693 item->setPixmap( 0, updatedIcon ); 693 item->setPixmap( 0, updatedIcon );
694 } 694 }
695 else 695 else
696 { 696 {
697 item->setPixmap( 0, installedIcon ); 697 item->setPixmap( 0, installedIcon );
698 } 698 }
699 } 699 }
700 else 700 else
701 { 701 {
702 item->setPixmap( 0, nullIcon ); 702 item->setPixmap( 0, nullIcon );
703 } 703 }
704 704
705 packagesList->insertItem( item ); 705 packagesList->insertItem( item );
706 } 706 }
707 707
708 // If the local server or the local ipkgs server disable the download button 708 // If the local server or the local ipkgs server disable the download button
709 if ( serverName == LOCAL_SERVER ) 709 if ( serverName == LOCAL_SERVER )
710 { 710 {
711 downloadEnabled = TRUE; 711 downloadEnabled = TRUE;
712 actionUpgrade->setEnabled( FALSE ); 712 actionUpgrade->setEnabled( FALSE );
713 } 713 }
714 else if ( serverName == LOCAL_IPKGS ) 714 else if ( serverName == LOCAL_IPKGS )
715 { 715 {
716 downloadEnabled = FALSE; 716 downloadEnabled = FALSE;
717 actionUpgrade->setEnabled( FALSE ); 717 actionUpgrade->setEnabled( FALSE );
718 } 718 }
719 else 719 else
720 { 720 {
721 downloadEnabled = TRUE; 721 downloadEnabled = TRUE;
722 actionUpgrade->setEnabled( TRUE ); 722 actionUpgrade->setEnabled( TRUE );
723 } 723 }
724 enableDownload( downloadEnabled ); 724 enableDownload( downloadEnabled );
725 725
726 // Display this widget once everything is done 726 // Display this widget once everything is done
727 if ( doProgress && raiseProgress ) 727 if ( doProgress && raiseProgress )
728 { 728 {
729 stack->raiseWidget( networkPkgWindow ); 729 stack->raiseWidget( networkPkgWindow );
730 } 730 }
731} 731}
732 732
733void MainWindow :: searchForPackage( const QString &text ) 733void MainWindow :: searchForPackage( const QString &text )
734{ 734{
735 if ( !text.isEmpty() ) 735 if ( !text.isEmpty() )
736 { 736 {
737 // look through package list for text startng at current position 737 // look through package list for text startng at current position
738 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); 738 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
739 739
740 if ( start == 0 ) 740 if ( start == 0 )
741 start = (QCheckListItem *)packagesList->firstChild(); 741 start = (QCheckListItem *)packagesList->firstChild();
742 742
743 for ( QCheckListItem *item = start; item != 0 ; 743 for ( QCheckListItem *item = start; item != 0 ;
744 item = (QCheckListItem *)item->nextSibling() ) 744 item = (QCheckListItem *)item->nextSibling() )
745 { 745 {
746 if ( item->text().lower().find( text ) != -1 ) 746 if ( item->text().lower().find( text ) != -1 )
747 { 747 {
748 packagesList->ensureItemVisible( item ); 748 packagesList->ensureItemVisible( item );
749 packagesList->setCurrentItem( item ); 749 packagesList->setCurrentItem( item );
750 break; 750 break;
751 } 751 }
752 } 752 }
753 } 753 }
754} 754}
755 755
756void MainWindow :: updateServer() 756void MainWindow :: updateServer()
757{ 757{
758 QString serverName = serversList->currentText(); 758 QString serverName = serversList->currentText();
759 759
760 // Update the current server 760 // Update the current server
761 // Display dialog 761 // Display dialog
762 762
763 // Disable buttons to stop silly people clicking lots on them :) 763 // Disable buttons to stop silly people clicking lots on them :)
764 764
765 // First, write out ipkg_conf file so that ipkg can use it 765 // First, write out ipkg_conf file so that ipkg can use it
766 mgr->writeOutIpkgConf(); 766 mgr->writeOutIpkgConf();
767 767
768 Ipkg *ipkg = new Ipkg; 768 Ipkg *ipkg = new Ipkg;
769 ipkg->setOption( "update" ); 769 ipkg->setOption( "update" );
770 770
771 InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ), 771 InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ),
772 tr( "Update lists" ) ); 772 tr( "Update lists" ) );
773 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); 773 connect( dlg, SIGNAL( reloadData(InstallDlgImpl*) ), this, SLOT( reloadData(InstallDlgImpl*) ) );
774 reloadDocuments = FALSE; 774 reloadDocuments = FALSE;
775 stack->addWidget( dlg, 3 ); 775 stack->addWidget( dlg, 3 );
776 stack->raiseWidget( dlg ); 776 stack->raiseWidget( dlg );
777 777
778 // delete progDlg; 778 // delete progDlg;
779} 779}
780 780
781void MainWindow :: upgradePackages() 781void MainWindow :: upgradePackages()
782{ 782{
783 // We're gonna do an upgrade of all packages 783 // We're gonna do an upgrade of all packages
784 // First warn user that this isn't recommended 784 // First warn user that this isn't recommended
785 // TODO - ODevice???? 785 // TODO - ODevice????
786 QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" ); 786 QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" );
787 QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning, 787 QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning,
788 QMessageBox::Yes, 788 QMessageBox::Yes,
789 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , 789 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default ,
790 0, this ); 790 0, this );
791 warn.adjustSize(); 791 warn.adjustSize();
792 792
793 if ( warn.exec() == QMessageBox::Yes ) 793 if ( warn.exec() == QMessageBox::Yes )
794 { 794 {
795 // First, write out ipkg_conf file so that ipkg can use it 795 // First, write out ipkg_conf file so that ipkg can use it
796 mgr->writeOutIpkgConf(); 796 mgr->writeOutIpkgConf();
797 797
798 // Now run upgrade 798 // Now run upgrade
799 Ipkg *ipkg = new Ipkg; 799 Ipkg *ipkg = new Ipkg;
800 ipkg->setOption( "upgrade" ); 800 ipkg->setOption( "upgrade" );
801 801
802 InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ), 802 InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ),
803 tr ( "Upgrade" ) ); 803 tr ( "Upgrade" ) );
804 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); 804 connect( dlg, SIGNAL( reloadData(InstallDlgImpl*) ), this, SLOT( reloadData(InstallDlgImpl*) ) );
805 reloadDocuments = TRUE; 805 reloadDocuments = TRUE;
806 stack->addWidget( dlg, 3 ); 806 stack->addWidget( dlg, 3 );
807 stack->raiseWidget( dlg ); 807 stack->raiseWidget( dlg );
808 } 808 }
809} 809}
810 810
811void MainWindow :: downloadPackage() 811void MainWindow :: downloadPackage()
812{ 812{
813 bool doUpdate = true; 813 bool doUpdate = true;
814 if ( downloadEnabled ) 814 if ( downloadEnabled )
815 { 815 {
816 // See if any packages are selected 816 // See if any packages are selected
817 bool found = false; 817 bool found = false;
818 if ( serversList->currentText() != LOCAL_SERVER ) 818 if ( serversList->currentText() != LOCAL_SERVER )
819 { 819 {
820 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 820 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
821 item != 0 && !found; 821 item != 0 && !found;
822 item = (QCheckListItem *)item->nextSibling() ) 822 item = (QCheckListItem *)item->nextSibling() )
823 { 823 {
824 if ( item->isOn() ) 824 if ( item->isOn() )
825 found = true; 825 found = true;
826 } 826 }
827 } 827 }
828 828
829 // If user selected some packages then download the and store the locally 829 // If user selected some packages then download the and store the locally
830 // otherwise, display dialog asking user what package to download from an http server 830 // otherwise, display dialog asking user what package to download from an http server
831 // and whether to install it 831 // and whether to install it
832 if ( found ) 832 if ( found )
833 downloadSelectedPackages(); 833 downloadSelectedPackages();
834 else 834 else
835 downloadRemotePackage(); 835 downloadRemotePackage();
836 836
837 } 837 }
838 else 838 else
839 { 839 {
840 doUpdate = false; 840 doUpdate = false;
841 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 841 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
842 item != 0 ; 842 item != 0 ;
843 item = (QCheckListItem *)item->nextSibling() ) 843 item = (QCheckListItem *)item->nextSibling() )
844 { 844 {
845 if ( item->isOn() ) 845 if ( item->isOn() )
846 { 846 {
847 QString name = item->text(); 847 QString name = item->text();
848 int pos = name.find( "*" ); 848 int pos = name.find( "*" );
849 name.truncate( pos ); 849 name.truncate( pos );
850 850
851 // if (there is a (installed), remove it 851 // if (there is a (installed), remove it
852 pos = name.find( "(installed)" ); 852 pos = name.find( "(installed)" );
853 if ( pos > 0 ) 853 if ( pos > 0 )
854 name.truncate( pos - 1 ); 854 name.truncate( pos - 1 );
855 855
856 Package *p = mgr->getServer( serversList->currentText() )->getPackage( name ); 856 Package *p = mgr->getServer( serversList->currentText() )->getPackage( name );
857 857
858 QString msgtext; 858 QString msgtext;
859 msgtext = tr( "Are you sure you wish to delete\n%1?" ).arg( (const char *)p->getPackageName() ); 859 msgtext = tr( "Are you sure you wish to delete\n%1?" ).arg( (const char *)p->getPackageName() );
860 if ( QMessageBox::information( this, tr( "Are you sure?" ), 860 if ( QMessageBox::information( this, tr( "Are you sure?" ),
861 msgtext, tr( "No" ), tr( "Yes" ) ) == 1 ) 861 msgtext, tr( "No" ), tr( "Yes" ) ) == 1 )
862 { 862 {
863 doUpdate = true; 863 doUpdate = true;
864 QFile f( p->getFilename() ); 864 QFile f( p->getFilename() );
865 f.remove(); 865 f.remove();
866 } 866 }
867 } 867 }
868 } 868 }
869 } 869 }
870 870
871 if ( doUpdate ) 871 if ( doUpdate )
872 { 872 {
873 reloadData( 0x0 ); 873 reloadData( 0x0 );
874 } 874 }
875} 875}
876 876
877void MainWindow :: downloadSelectedPackages() 877void MainWindow :: downloadSelectedPackages()
878{ 878{
879 // First, write out ipkg_conf file so that ipkg can use it 879 // First, write out ipkg_conf file so that ipkg can use it
880 mgr->writeOutIpkgConf(); 880 mgr->writeOutIpkgConf();
881 881
882 // Display dialog to user asking where to download the files to 882 // Display dialog to user asking where to download the files to
883 bool ok = FALSE; 883 bool ok = FALSE;
884 QString dir = ""; 884 QString dir = "";
885#ifdef QWS 885#ifdef QWS
886 // read download directory from config file 886 // read download directory from config file
887 Config cfg( "aqpkg" ); 887 Config cfg( "aqpkg" );
888 cfg.setGroup( "settings" ); 888 cfg.setGroup( "settings" );
889 dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" ); 889 dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" );
890#endif 890#endif
891 891
892 QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this ); 892 QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this );
893 if ( ok && !text.isEmpty() ) 893 if ( ok && !text.isEmpty() )
894 dir = text; // user entered something and pressed ok 894 dir = text; // user entered something and pressed ok
895 else 895 else
896 return; // user entered nothing or pressed cancel 896 return; // user entered nothing or pressed cancel
897 897
898#ifdef QWS 898#ifdef QWS
899 // Store download directory in config file 899 // Store download directory in config file
900 cfg.writeEntry( "downloadDir", dir ); 900 cfg.writeEntry( "downloadDir", dir );
901#endif 901#endif
902 902
903 // Get starting directory 903 // Get starting directory
904 char initDir[PATH_MAX]; 904 char initDir[PATH_MAX];
905 getcwd( initDir, PATH_MAX ); 905 getcwd( initDir, PATH_MAX );
906 906
907 // Download each package 907 // Download each package
908 Ipkg ipkg; 908 Ipkg ipkg;
909 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 909 connect( &ipkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&)));
910 910
911 ipkg.setOption( "download" ); 911 ipkg.setOption( "download" );
912 ipkg.setRuntimeDirectory( dir ); 912 ipkg.setRuntimeDirectory( dir );
913 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 913 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
914 item != 0 ; 914 item != 0 ;
915 item = (QCheckListItem *)item->nextSibling() ) 915 item = (QCheckListItem *)item->nextSibling() )
916 { 916 {
917 if ( item->isOn() ) 917 if ( item->isOn() )
918 { 918 {
919 ipkg.setPackage( item->text() ); 919 ipkg.setPackage( item->text() );
920 ipkg.runIpkg( ); 920 ipkg.runIpkg( );
921 } 921 }
922 } 922 }
923} 923}
924 924
925void MainWindow :: downloadRemotePackage() 925void MainWindow :: downloadRemotePackage()
926{ 926{
927 // Display dialog 927 // Display dialog
928 bool ok; 928 bool ok;
929 QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this ); 929 QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this );
930 if ( !ok || package.isEmpty() ) 930 if ( !ok || package.isEmpty() )
931 return; 931 return;
932 // DownloadRemoteDlgImpl dlg( this, "Install", true ); 932 // DownloadRemoteDlgImpl dlg( this, "Install", true );
933 // if ( dlg.exec() == QDialog::Rejected ) 933 // if ( dlg.exec() == QDialog::Rejected )
934 // return; 934 // return;
935 935
936 // grab details from dialog 936 // grab details from dialog
937 // QString package = dlg.getPackageLocation(); 937 // QString package = dlg.getPackageLocation();
938 938
939 InstallData *item = new InstallData(); 939 InstallData *item = new InstallData();
940 item->option = "I"; 940 item->option = "I";
941 item->packageName = package; 941 item->packageName = package;
942 QList<InstallData> workingPackages; 942 QList<InstallData> workingPackages;
943 workingPackages.setAutoDelete( TRUE ); 943 workingPackages.setAutoDelete( TRUE );
944 workingPackages.append( item ); 944 workingPackages.append( item );
945 945
946 InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) ); 946 InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) );
947 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); 947 connect( dlg, SIGNAL( reloadData(InstallDlgImpl*) ), this, SLOT( reloadData(InstallDlgImpl*) ) );
948 reloadDocuments = TRUE; 948 reloadDocuments = TRUE;
949 stack->addWidget( dlg, 3 ); 949 stack->addWidget( dlg, 3 );
950 stack->raiseWidget( dlg ); 950 stack->raiseWidget( dlg );
951} 951}
952 952
953 953
954void MainWindow :: applyChanges() 954void MainWindow :: applyChanges()
955{ 955{
956 stickyOption = ""; 956 stickyOption = "";
957 957
958 // First, write out ipkg_conf file so that ipkg can use it 958 // First, write out ipkg_conf file so that ipkg can use it
959 mgr->writeOutIpkgConf(); 959 mgr->writeOutIpkgConf();
960 960
961 // Now for each selected item 961 // Now for each selected item
962 // deal with it 962 // deal with it
963 963
964 QList<InstallData> workingPackages; 964 QList<InstallData> workingPackages;
965 workingPackages.setAutoDelete( TRUE ); 965 workingPackages.setAutoDelete( TRUE );
966 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 966 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
967 item != 0 ; 967 item != 0 ;
968 item = (QCheckListItem *)item->nextSibling() ) 968 item = (QCheckListItem *)item->nextSibling() )
969 { 969 {
970 if ( item->isOn() ) 970 if ( item->isOn() )
971 { 971 {
972 InstallData *instdata = dealWithItem( item ); 972 InstallData *instdata = dealWithItem( item );
973 if ( instdata ) 973 if ( instdata )
974 workingPackages.append( instdata ); 974 workingPackages.append( instdata );
975 else 975 else
976 return; 976 return;
977 } 977 }
978 } 978 }
979 979
980 if ( workingPackages.count() == 0 ) 980 if ( workingPackages.count() == 0 )
981 { 981 {
982 // Nothing to do 982 // Nothing to do
983 QMessageBox::information( this, tr( "Nothing to do" ), 983 QMessageBox::information( this, tr( "Nothing to do" ),
984 tr( "No packages selected" ), tr( "OK" ) ); 984 tr( "No packages selected" ), tr( "OK" ) );
985 985
986 return; 986 return;
987 } 987 }
988 988
989 // do the stuff 989 // do the stuff
990 InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) ); 990 InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) );
991 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); 991 connect( dlg, SIGNAL( reloadData(InstallDlgImpl*) ), this, SLOT( reloadData(InstallDlgImpl*) ) );
992 reloadDocuments = TRUE; 992 reloadDocuments = TRUE;
993 stack->addWidget( dlg, 3 ); 993 stack->addWidget( dlg, 3 );
994 stack->raiseWidget( dlg ); 994 stack->raiseWidget( dlg );
995} 995}
996 996
997// decide what to do - either remove, upgrade or install 997// decide what to do - either remove, upgrade or install
998// Current rules: 998// Current rules:
999// If not installed - install 999// If not installed - install
1000// If installed and different version available - upgrade 1000// If installed and different version available - upgrade
1001// If installed and version up to date - remove 1001// If installed and version up to date - remove
1002InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) 1002InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
1003{ 1003{
1004 QString name = item->text(); 1004 QString name = item->text();
1005 1005
1006 // Get package 1006 // Get package
1007 Server *s = mgr->getServer( serversList->currentText() ); 1007 Server *s = mgr->getServer( serversList->currentText() );
1008 Package *p = s->getPackage( name ); 1008 Package *p = s->getPackage( name );
1009 1009
1010 // If the package has a filename then it is a local file 1010 // If the package has a filename then it is a local file
1011 if ( p->isPackageStoredLocally() ) 1011 if ( p->isPackageStoredLocally() )
1012 name = p->getFilename(); 1012 name = p->getFilename();
1013 1013
1014 QString option; 1014 QString option;
1015 QString dest = "root"; 1015 QString dest = "root";
1016 if ( !p->isInstalled() ) 1016 if ( !p->isInstalled() )
1017 { 1017 {
1018 InstallData *newitem = new InstallData(); 1018 InstallData *newitem = new InstallData();
1019 newitem->option = "I"; 1019 newitem->option = "I";
1020 newitem->packageName = name; 1020 newitem->packageName = name;
1021 return newitem; 1021 return newitem;
1022 } 1022 }
1023 else 1023 else
1024 { 1024 {
1025 InstallData *newitem = new InstallData(); 1025 InstallData *newitem = new InstallData();
1026 newitem->option = "D"; 1026 newitem->option = "D";
1027 // If local file, remove using package name, not filename 1027 // If local file, remove using package name, not filename
1028 if ( p->isPackageStoredLocally() ) 1028 if ( p->isPackageStoredLocally() )
1029 name = item->text(); 1029 name = item->text();
1030 1030
1031 if ( !p->isPackageStoredLocally() ) 1031 if ( !p->isPackageStoredLocally() )
1032 newitem->packageName = p->getInstalledPackageName(); 1032 newitem->packageName = p->getInstalledPackageName();
1033 else 1033 else
1034 newitem->packageName = name; 1034 newitem->packageName = name;
1035 1035
1036 if ( p->getInstalledTo() ) 1036 if ( p->getInstalledTo() )
1037 { 1037 {
1038 newitem->destination = p->getInstalledTo(); 1038 newitem->destination = p->getInstalledTo();
1039 } 1039 }
1040 else 1040 else
1041 { 1041 {
1042 newitem->destination = p->getLocalPackage()->getInstalledTo(); 1042 newitem->destination = p->getLocalPackage()->getInstalledTo();
1043 } 1043 }
1044 1044
1045 // Now see if version is newer or not 1045 // Now see if version is newer or not
1046 int val = compareVersions( p->getInstalledVersion(), p->getVersion() ); 1046 int val = compareVersions( p->getInstalledVersion(), p->getVersion() );
1047 1047
1048 // If the version requested is older and user selected a local ipk file, then reinstall the file 1048 // If the version requested is older and user selected a local ipk file, then reinstall the file
1049 if ( p->isPackageStoredLocally() && val == -1 ) 1049 if ( p->isPackageStoredLocally() && val == -1 )
1050 val = 0; 1050 val = 0;
1051 1051
1052 if ( val == -2 ) 1052 if ( val == -2 )
1053 { 1053 {
1054 // Error - should handle 1054 // Error - should handle
1055 } 1055 }
1056 else if ( val == -1 ) 1056 else if ( val == -1 )
1057 { 1057 {
1058 // Version available is older - remove only 1058 // Version available is older - remove only
1059 newitem->option = "D"; 1059 newitem->option = "D";
1060 // If local file, remove using package name, not filename 1060 // If local file, remove using package name, not filename
1061 if ( p->isPackageStoredLocally() ) 1061 if ( p->isPackageStoredLocally() )
1062 name = item->text(); 1062 name = item->text();
1063 } 1063 }
1064 else 1064 else
1065 { 1065 {
1066 QString caption; 1066 QString caption;
1067 QString text; 1067 QString text;
1068 QString secondButton; 1068 QString secondButton;
1069 QString secondOption; 1069 QString secondOption;
1070 if ( val == 0 ) 1070 if ( val == 0 )
1071 { 1071 {
1072 // Version available is the same - option to remove or reinstall 1072 // Version available is the same - option to remove or reinstall
1073 caption = tr( "Do you wish to remove or reinstall\n%1?" ); 1073 caption = tr( "Do you wish to remove or reinstall\n%1?" );
1074 text = tr( "Remove or ReInstall" ); 1074 text = tr( "Remove or ReInstall" );
1075 secondButton = tr( "ReInstall" ); 1075 secondButton = tr( "ReInstall" );
1076 secondOption = "R"; // Internal action code, do not translate 1076 secondOption = "R"; // Internal action code, do not translate
1077 } 1077 }
1078 else if ( val == 1 ) 1078 else if ( val == 1 )
1079 { 1079 {
1080 // Version available is newer - option to remove or upgrade 1080 // Version available is newer - option to remove or upgrade
1081 caption = tr( "Do you wish to remove or upgrade\n%1?" ); 1081 caption = tr( "Do you wish to remove or upgrade\n%1?" );
1082 text = tr( "Remove or Upgrade" ); 1082 text = tr( "Remove or Upgrade" );
1083 secondButton = tr( "Upgrade" ); 1083 secondButton = tr( "Upgrade" );
1084 secondOption = "U"; // Internal action code, do not translate 1084 secondOption = "U"; // Internal action code, do not translate
1085 } 1085 }
1086 1086
1087 // Sticky option not implemented yet, but will eventually allow 1087 // Sticky option not implemented yet, but will eventually allow
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp
index 6e9dd99..b9dbb6e 100644
--- a/noncore/settings/aqpkg/settingsimpl.cpp
+++ b/noncore/settings/aqpkg/settingsimpl.cpp
@@ -18,251 +18,251 @@
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 "settingsimpl.h" 30#include "settingsimpl.h"
31#include "global.h" 31#include "global.h"
32 32
33/* OPIE */ 33/* OPIE */
34#include <opie2/otabwidget.h> 34#include <opie2/otabwidget.h>
35#ifdef QWS 35#ifdef QWS
36#include <qpe/config.h> 36#include <qpe/config.h>
37#include <qpe/resource.h> 37#include <qpe/resource.h>
38#endif 38#endif
39#include <qpe/qpeapplication.h> 39#include <qpe/qpeapplication.h>
40 40
41/* QT */ 41/* QT */
42#include <qcheckbox.h> 42#include <qcheckbox.h>
43#include <qgroupbox.h> 43#include <qgroupbox.h>
44#include <qlabel.h> 44#include <qlabel.h>
45#include <qlayout.h> 45#include <qlayout.h>
46#include <qlineedit.h> 46#include <qlineedit.h>
47#include <qlistbox.h> 47#include <qlistbox.h>
48#include <qpushbutton.h> 48#include <qpushbutton.h>
49 49
50/* STD */ 50/* STD */
51#include <fstream> 51#include <fstream>
52#include <algorithm> 52#include <algorithm>
53using namespace std; 53using namespace std;
54 54
55SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) 55SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
56 : QDialog( parent, name, modal, fl ) 56 : QDialog( parent, name, modal, fl )
57{ 57{
58 setCaption( tr( "Configuration" ) ); 58 setCaption( tr( "Configuration" ) );
59 59
60 // Setup layout to make everything pretty 60 // Setup layout to make everything pretty
61 QVBoxLayout *layout = new QVBoxLayout( this ); 61 QVBoxLayout *layout = new QVBoxLayout( this );
62 layout->setMargin( 2 ); 62 layout->setMargin( 2 );
63 layout->setSpacing( 4 ); 63 layout->setSpacing( 4 );
64 64
65 // Setup tabs for all info 65 // Setup tabs for all info
66 Opie::OTabWidget *tabwidget = new Opie::OTabWidget( this ); 66 Opie::OTabWidget *tabwidget = new Opie::OTabWidget( this );
67 layout->addWidget( tabwidget ); 67 layout->addWidget( tabwidget );
68 68
69 tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) ); 69 tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) );
70 tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) ); 70 tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) );
71 tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) ); 71 tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) );
72 tabwidget->setCurrentTab( tr( "Servers" ) ); 72 tabwidget->setCurrentTab( tr( "Servers" ) );
73 73
74 dataMgr = dataManager; 74 dataMgr = dataManager;
75 setupData(); 75 setupData();
76 changed = false; 76 changed = false;
77 newserver = false; 77 newserver = false;
78 newdestination = false; 78 newdestination = false;
79} 79}
80 80
81SettingsImpl :: ~SettingsImpl() 81SettingsImpl :: ~SettingsImpl()
82{ 82{
83} 83}
84 84
85bool SettingsImpl :: showDlg() 85bool SettingsImpl :: showDlg()
86{ 86{
87 QPEApplication::execDialog( this ); 87 QPEApplication::execDialog( this );
88 if ( changed ) 88 if ( changed )
89 dataMgr->writeOutIpkgConf(); 89 dataMgr->writeOutIpkgConf();
90 90
91 return changed; 91 return changed;
92} 92}
93 93
94QWidget *SettingsImpl :: initServerTab() 94QWidget *SettingsImpl :: initServerTab()
95{ 95{
96 QWidget *control = new QWidget( this ); 96 QWidget *control = new QWidget( this );
97 97
98 QVBoxLayout *vb = new QVBoxLayout( control ); 98 QVBoxLayout *vb = new QVBoxLayout( control );
99 99
100 QScrollView *sv = new QScrollView( control ); 100 QScrollView *sv = new QScrollView( control );
101 vb->addWidget( sv, 0, 0 ); 101 vb->addWidget( sv, 0, 0 );
102 sv->setResizePolicy( QScrollView::AutoOneFit ); 102 sv->setResizePolicy( QScrollView::AutoOneFit );
103 sv->setFrameStyle( QFrame::NoFrame ); 103 sv->setFrameStyle( QFrame::NoFrame );
104 104
105 QWidget *container = new QWidget( sv->viewport() ); 105 QWidget *container = new QWidget( sv->viewport() );
106 sv->addChild( container ); 106 sv->addChild( container );
107 107
108 QGridLayout *layout = new QGridLayout( container ); 108 QGridLayout *layout = new QGridLayout( container );
109 layout->setSpacing( 2 ); 109 layout->setSpacing( 2 );
110 layout->setMargin( 4 ); 110 layout->setMargin( 4 );
111 111
112 servers = new QListBox( container ); 112 servers = new QListBox( container );
113 servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); 113 servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
114 connect( servers, SIGNAL( highlighted( int ) ), this, SLOT( editServer( int ) ) ); 114 connect( servers, SIGNAL( highlighted(int) ), this, SLOT( editServer(int) ) );
115 layout->addMultiCellWidget( servers, 0, 0, 0, 1 ); 115 layout->addMultiCellWidget( servers, 0, 0, 0, 1 );
116 116
117 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); 117 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container );
118 connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) ); 118 connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) );
119 layout->addWidget( btn, 1, 0 ); 119 layout->addWidget( btn, 1, 0 );
120 120
121 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); 121 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
122 connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) ); 122 connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) );
123 layout->addWidget( btn, 1, 1 ); 123 layout->addWidget( btn, 1, 1 );
124 124
125 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); 125 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container );
126 grpbox->layout()->setSpacing( 2 ); 126 grpbox->layout()->setSpacing( 2 );
127 grpbox->layout()->setMargin( 4 ); 127 grpbox->layout()->setMargin( 4 );
128 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); 128 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 );
129 129
130 QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); 130 QGridLayout *grplayout = new QGridLayout( grpbox->layout() );
131 131
132 QLabel *label = new QLabel( tr( "Name:" ), grpbox ); 132 QLabel *label = new QLabel( tr( "Name:" ), grpbox );
133 grplayout->addWidget( label, 0, 0 ); 133 grplayout->addWidget( label, 0, 0 );
134 servername = new QLineEdit( grpbox ); 134 servername = new QLineEdit( grpbox );
135 grplayout->addWidget( servername, 0, 1 ); 135 grplayout->addWidget( servername, 0, 1 );
136 136
137 label = new QLabel( tr( "Address:" ), grpbox ); 137 label = new QLabel( tr( "Address:" ), grpbox );
138 grplayout->addWidget( label, 1, 0 ); 138 grplayout->addWidget( label, 1, 0 );
139 serverurl = new QLineEdit( grpbox ); 139 serverurl = new QLineEdit( grpbox );
140 grplayout->addWidget( serverurl, 1, 1 ); 140 grplayout->addWidget( serverurl, 1, 1 );
141 141
142 active = new QCheckBox( tr( "Active Server" ), grpbox ); 142 active = new QCheckBox( tr( "Active Server" ), grpbox );
143 grplayout->addMultiCellWidget( active, 2, 2, 0, 1 ); 143 grplayout->addMultiCellWidget( active, 2, 2, 0, 1 );
144 144
145 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); 145 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox );
146 connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) ); 146 connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) );
147 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); 147 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 );
148 148
149 return control; 149 return control;
150} 150}
151 151
152QWidget *SettingsImpl :: initDestinationTab() 152QWidget *SettingsImpl :: initDestinationTab()
153{ 153{
154 QWidget *control = new QWidget( this ); 154 QWidget *control = new QWidget( this );
155 155
156 QVBoxLayout *vb = new QVBoxLayout( control ); 156 QVBoxLayout *vb = new QVBoxLayout( control );
157 157
158 QScrollView *sv = new QScrollView( control ); 158 QScrollView *sv = new QScrollView( control );
159 vb->addWidget( sv, 0, 0 ); 159 vb->addWidget( sv, 0, 0 );
160 sv->setResizePolicy( QScrollView::AutoOneFit ); 160 sv->setResizePolicy( QScrollView::AutoOneFit );
161 sv->setFrameStyle( QFrame::NoFrame ); 161 sv->setFrameStyle( QFrame::NoFrame );
162 162
163 QWidget *container = new QWidget( sv->viewport() ); 163 QWidget *container = new QWidget( sv->viewport() );
164 sv->addChild( container ); 164 sv->addChild( container );
165 165
166 QGridLayout *layout = new QGridLayout( container ); 166 QGridLayout *layout = new QGridLayout( container );
167 layout->setSpacing( 2 ); 167 layout->setSpacing( 2 );
168 layout->setMargin( 4 ); 168 layout->setMargin( 4 );
169 169
170 destinations = new QListBox( container ); 170 destinations = new QListBox( container );
171 destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); 171 destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
172 connect( destinations, SIGNAL( highlighted( int ) ), this, SLOT( editDestination( int ) ) ); 172 connect( destinations, SIGNAL( highlighted(int) ), this, SLOT( editDestination(int) ) );
173 layout->addMultiCellWidget( destinations, 0, 0, 0, 1 ); 173 layout->addMultiCellWidget( destinations, 0, 0, 0, 1 );
174 174
175 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); 175 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container );
176 connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) ); 176 connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) );
177 layout->addWidget( btn, 1, 0 ); 177 layout->addWidget( btn, 1, 0 );
178 178
179 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); 179 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
180 connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) ); 180 connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) );
181 layout->addWidget( btn, 1, 1 ); 181 layout->addWidget( btn, 1, 1 );
182 182
183 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container ); 183 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container );
184 grpbox->layout()->setSpacing( 2 ); 184 grpbox->layout()->setSpacing( 2 );
185 grpbox->layout()->setMargin( 4 ); 185 grpbox->layout()->setMargin( 4 );
186 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); 186 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 );
187 187
188 QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); 188 QGridLayout *grplayout = new QGridLayout( grpbox->layout() );
189 189
190 QLabel *label = new QLabel( tr( "Name:" ), grpbox ); 190 QLabel *label = new QLabel( tr( "Name:" ), grpbox );
191 grplayout->addWidget( label, 0, 0 ); 191 grplayout->addWidget( label, 0, 0 );
192 destinationname = new QLineEdit( grpbox ); 192 destinationname = new QLineEdit( grpbox );
193 grplayout->addWidget( destinationname, 0, 1 ); 193 grplayout->addWidget( destinationname, 0, 1 );
194 194
195 label = new QLabel( tr( "Location:" ), grpbox ); 195 label = new QLabel( tr( "Location:" ), grpbox );
196 grplayout->addWidget( label, 1, 0 ); 196 grplayout->addWidget( label, 1, 0 );
197 destinationurl = new QLineEdit( grpbox ); 197 destinationurl = new QLineEdit( grpbox );
198 grplayout->addWidget( destinationurl, 1, 1 ); 198 grplayout->addWidget( destinationurl, 1, 1 );
199 199
200 linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox ); 200 linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox );
201 grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 ); 201 grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 );
202 202
203 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); 203 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox );
204 connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) ); 204 connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) );
205 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); 205 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 );
206 206
207 return control; 207 return control;
208} 208}
209 209
210QWidget *SettingsImpl :: initProxyTab() 210QWidget *SettingsImpl :: initProxyTab()
211{ 211{
212 QWidget *control = new QWidget( this ); 212 QWidget *control = new QWidget( this );
213 213
214 QVBoxLayout *vb = new QVBoxLayout( control ); 214 QVBoxLayout *vb = new QVBoxLayout( control );
215 215
216 QScrollView *sv = new QScrollView( control ); 216 QScrollView *sv = new QScrollView( control );
217 vb->addWidget( sv, 0, 0 ); 217 vb->addWidget( sv, 0, 0 );
218 sv->setResizePolicy( QScrollView::AutoOneFit ); 218 sv->setResizePolicy( QScrollView::AutoOneFit );
219 sv->setFrameStyle( QFrame::NoFrame ); 219 sv->setFrameStyle( QFrame::NoFrame );
220 220
221 QWidget *container = new QWidget( sv->viewport() ); 221 QWidget *container = new QWidget( sv->viewport() );
222 sv->addChild( container ); 222 sv->addChild( container );
223 223
224 QGridLayout *layout = new QGridLayout( container ); 224 QGridLayout *layout = new QGridLayout( container );
225 layout->setSpacing( 2 ); 225 layout->setSpacing( 2 );
226 layout->setMargin( 4 ); 226 layout->setMargin( 4 );
227 227
228 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); 228 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container );
229 grpbox->layout()->setSpacing( 2 ); 229 grpbox->layout()->setSpacing( 2 );
230 grpbox->layout()->setMargin( 4 ); 230 grpbox->layout()->setMargin( 4 );
231 layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); 231 layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 );
232 QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); 232 QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() );
233 txtHttpProxy = new QLineEdit( grpbox ); 233 txtHttpProxy = new QLineEdit( grpbox );
234 grplayout->addWidget( txtHttpProxy ); 234 grplayout->addWidget( txtHttpProxy );
235 chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); 235 chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox );
236 grplayout->addWidget( chkHttpProxyEnabled ); 236 grplayout->addWidget( chkHttpProxyEnabled );
237 237
238 grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); 238 grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container );
239 grpbox->layout()->setSpacing( 2 ); 239 grpbox->layout()->setSpacing( 2 );
240 grpbox->layout()->setMargin( 4 ); 240 grpbox->layout()->setMargin( 4 );
241 layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); 241 layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 );
242 grplayout = new QVBoxLayout( grpbox->layout() ); 242 grplayout = new QVBoxLayout( grpbox->layout() );
243 txtFtpProxy = new QLineEdit( grpbox ); 243 txtFtpProxy = new QLineEdit( grpbox );
244 grplayout->addWidget( txtFtpProxy ); 244 grplayout->addWidget( txtFtpProxy );
245 chkFtpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); 245 chkFtpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox );
246 grplayout->addWidget( chkFtpProxyEnabled ); 246 grplayout->addWidget( chkFtpProxyEnabled );
247 247
248 QLabel *label = new QLabel( tr( "Username:" ), container ); 248 QLabel *label = new QLabel( tr( "Username:" ), container );
249 layout->addWidget( label, 2, 0 ); 249 layout->addWidget( label, 2, 0 );
250 txtUsername = new QLineEdit( container ); 250 txtUsername = new QLineEdit( container );
251 layout->addWidget( txtUsername, 2, 1 ); 251 layout->addWidget( txtUsername, 2, 1 );
252 252
253 label = new QLabel( tr( "Password:" ), container ); 253 label = new QLabel( tr( "Password:" ), container );
254 layout->addWidget( label, 3, 0 ); 254 layout->addWidget( label, 3, 0 );
255 txtPassword = new QLineEdit( container ); 255 txtPassword = new QLineEdit( container );
256 layout->addWidget( txtPassword, 3, 1 ); 256 layout->addWidget( txtPassword, 3, 1 );
257 257
258 QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), container ); 258 QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), container );
259 connect( btn, SIGNAL( clicked() ), this, SLOT( proxyApplyChanges() ) ); 259 connect( btn, SIGNAL( clicked() ), this, SLOT( proxyApplyChanges() ) );
260 layout->addMultiCellWidget( btn, 4, 4, 0, 1 ); 260 layout->addMultiCellWidget( btn, 4, 4, 0, 1 );
261 261
262 return control; 262 return control;
263} 263}
264 264
265void SettingsImpl :: setupData() 265void SettingsImpl :: setupData()
266{ 266{
267 // add servers 267 // add servers
268 QString serverName; 268 QString serverName;