summaryrefslogtreecommitdiff
authordrw <drw>2005-06-09 21:00:47 (UTC)
committer drw <drw>2005-06-09 21:00:47 (UTC)
commit346a2cd09c2c28bd4d2086b0c152dd348913eaa9 (patch) (unidiff)
treeb79a0e94a2dd35bf9039a2e92ecc033d3572cbb1
parent39a9211b7a43742e214aa815094a576dbae07755 (diff)
downloadopie-346a2cd09c2c28bd4d2086b0c152dd348913eaa9.zip
opie-346a2cd09c2c28bd4d2086b0c152dd348913eaa9.tar.gz
opie-346a2cd09c2c28bd4d2086b0c152dd348913eaa9.tar.bz2
Resource -> OResource
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp58
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp83
-rw-r--r--noncore/settings/aqpkg/packagewin.cpp46
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp61
-rw-r--r--noncore/settings/backup/backuprestore.cpp12
5 files changed, 135 insertions, 125 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index da21cef..e828595 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -1,72 +1,70 @@
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 <stdio.h> 30#include <stdio.h>
31 31
32#include <opie2/ofiledialog.h> 32#include <opie2/ofiledialog.h>
33#include <opie2/oresource.h>
33 34
34#ifdef QWS
35#include <qpe/config.h> 35#include <qpe/config.h>
36#include <qpe/fileselector.h> 36#include <qpe/fileselector.h>
37#include <qpe/qpeapplication.h> 37#include <qpe/qpeapplication.h>
38#include <qpe/resource.h>
39#include <qpe/storage.h> 38#include <qpe/storage.h>
40#endif
41 39
42#include <qcheckbox.h> 40#include <qcheckbox.h>
43#include <qcombobox.h> 41#include <qcombobox.h>
44#include <qdialog.h> 42#include <qdialog.h>
45#include <qfileinfo.h> 43#include <qfileinfo.h>
46#include <qgroupbox.h> 44#include <qgroupbox.h>
47#include <qmultilineedit.h> 45#include <qmultilineedit.h>
48#include <qlabel.h> 46#include <qlabel.h>
49#include <qlayout.h> 47#include <qlayout.h>
50#include <qpushbutton.h> 48#include <qpushbutton.h>
51 49
52#include "datamgr.h" 50#include "datamgr.h"
53#include "destination.h" 51#include "destination.h"
54#include "instoptionsimpl.h" 52#include "instoptionsimpl.h"
55#include "installdlgimpl.h" 53#include "installdlgimpl.h"
56#include "ipkg.h" 54#include "ipkg.h"
57#include "utils.h" 55#include "utils.h"
58#include "global.h" 56#include "global.h"
59 57
60using namespace Opie::Ui; 58using namespace Opie::Ui;
61enum { 59enum {
62 MAXLINES = 100, 60 MAXLINES = 100,
63}; 61};
64 62
65InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManager *dataManager, const char *title ) 63InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManager *dataManager, const char *title )
66 : QWidget( 0, 0, 0 ) 64 : QWidget( 0, 0, 0 )
67{ 65{
68 setCaption( title ); 66 setCaption( title );
69 init( TRUE ); 67 init( TRUE );
70 68
71 pIpkg = 0; 69 pIpkg = 0;
72 upgradePackages = false; 70 upgradePackages = false;
@@ -167,143 +165,143 @@ void InstallDlgImpl :: init( bool displayextrainfo )
167 layout->setSpacing( 4 ); 165 layout->setSpacing( 4 );
168 layout->setMargin( 4 ); 166 layout->setMargin( 4 );
169 167
170 if ( displayextrainfo ) 168 if ( displayextrainfo )
171 { 169 {
172 QLabel *label = new QLabel( tr( "Destination" ), this ); 170 QLabel *label = new QLabel( tr( "Destination" ), this );
173 layout->addWidget( label, 0, 0 ); 171 layout->addWidget( label, 0, 0 );
174 destination = new QComboBox( FALSE, this ); 172 destination = new QComboBox( FALSE, this );
175 layout->addWidget( destination, 0, 1 ); 173 layout->addWidget( destination, 0, 1 );
176 connect( destination, SIGNAL( highlighted(const QString&) ), 174 connect( destination, SIGNAL( highlighted(const QString&) ),
177 this, SLOT( displayAvailableSpace(const QString&) ) ); 175 this, SLOT( displayAvailableSpace(const QString&) ) );
178 176
179 QLabel *label2 = new QLabel( tr( "Space Avail" ), this ); 177 QLabel *label2 = new QLabel( tr( "Space Avail" ), this );
180 layout->addWidget( label2, 1, 0 ); 178 layout->addWidget( label2, 1, 0 );
181 txtAvailableSpace = new QLabel( "", this ); 179 txtAvailableSpace = new QLabel( "", this );
182 layout->addWidget( txtAvailableSpace, 1, 1 ); 180 layout->addWidget( txtAvailableSpace, 1, 1 );
183 } 181 }
184 else 182 else
185 { 183 {
186 destination = 0x0; 184 destination = 0x0;
187 txtAvailableSpace = 0x0; 185 txtAvailableSpace = 0x0;
188 } 186 }
189 187
190 QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); 188 QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this );
191 GroupBox2->layout()->setSpacing( 0 ); 189 GroupBox2->layout()->setSpacing( 0 );
192 GroupBox2->layout()->setMargin( 4 ); 190 GroupBox2->layout()->setMargin( 4 );
193 191
194 QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() ); 192 QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() );
195 output = new QMultiLineEdit( GroupBox2 ); 193 output = new QMultiLineEdit( GroupBox2 );
196 GroupBox2Layout->addWidget( output ); 194 GroupBox2Layout->addWidget( output );
197 layout->addMultiCellWidget( GroupBox2, 2, 2, 0, 1 ); 195 layout->addMultiCellWidget( GroupBox2, 2, 2, 0, 1 );
198 196
199 btnInstall = new QPushButton( Resource::loadPixmap( "aqpkg/apply" ), tr( "Start" ), this ); 197 btnInstall = new QPushButton( Opie::Core::OResource::loadPixmap( "aqpkg/apply", Opie::Core::OResource::SmallIcon ), tr( "Start" ), this );
200 layout->addWidget( btnInstall, 3, 0 ); 198 layout->addWidget( btnInstall, 3, 0 );
201 connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) ); 199 connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) );
202 200
203 btnOptions = new QPushButton( Resource::loadPixmap( "SettingsIcon" ), tr( "Options" ), this ); 201 btnOptions = new QPushButton( Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), tr( "Options" ), this );
204 layout->addWidget( btnOptions, 3, 1 ); 202 layout->addWidget( btnOptions, 3, 1 );
205 connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) ); 203 connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) );
206} 204}
207 205
208void InstallDlgImpl :: optionsSelected() 206void InstallDlgImpl :: optionsSelected()
209{ 207{
210 if ( btnOptions->text() == tr( "Options" ) ) 208 if ( btnOptions->text() == tr( "Options" ) )
211 { 209 {
212 InstallOptionsDlgImpl opt( flags, infoLevel, this, "Option", true ); 210 InstallOptionsDlgImpl opt( flags, infoLevel, this, "Option", true );
213 if ( opt.exec() == QDialog::Accepted ) 211 if ( opt.exec() == QDialog::Accepted )
214 { 212 {
215 // set options selected from dialog 213 // set options selected from dialog
216 flags = opt.getFlags(); 214 flags = opt.getFlags();
217 infoLevel = opt.getInfoLevel(); 215 infoLevel = opt.getInfoLevel();
218 216
219#ifdef QWS 217#ifdef QWS
220 Config cfg( "aqpkg" ); 218 Config cfg( "aqpkg" );
221 cfg.setGroup( "settings" ); 219 cfg.setGroup( "settings" );
222 cfg.writeEntry( "installFlags", flags ); 220 cfg.writeEntry( "installFlags", flags );
223 cfg.writeEntry( "infoLevel", infoLevel ); 221 cfg.writeEntry( "infoLevel", infoLevel );
224#endif 222#endif
225 } 223 }
226 } 224 }
227 else // Save output 225 else // Save output
228 { 226 {
229 QMap<QString, QStringList> map; 227 QMap<QString, QStringList> map;
230 map.insert( tr( "All" ), QStringList() ); 228 map.insert( tr( "All" ), QStringList() );
231 QStringList text; 229 QStringList text;
232 text << "text/*"; 230 text << "text/*";
233 map.insert(tr( "Text" ), text ); 231 map.insert(tr( "Text" ), text );
234 text << "*"; 232 text << "*";
235 map.insert( tr( "All" ), text ); 233 map.insert( tr( "All" ), text );
236 234
237 QString filename = OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map ); 235 QString filename = OFileDialog::getSaveFileName( 2, "/", "ipkg-output", map );
238 if( !filename.isEmpty() ) 236 if( !filename.isEmpty() )
239 { 237 {
240 QString currentFileName = QFileInfo( filename ).fileName(); 238 QString currentFileName = QFileInfo( filename ).fileName();
241 DocLnk doc; 239 DocLnk doc;
242 doc.setType( "text/plain" ); 240 doc.setType( "text/plain" );
243 doc.setFile( filename ); 241 doc.setFile( filename );
244 doc.setName( currentFileName ); 242 doc.setName( currentFileName );
245 FileManager fm; 243 FileManager fm;
246 fm.saveFile( doc, output->text() ); 244 fm.saveFile( doc, output->text() );
247 } 245 }
248 } 246 }
249} 247}
250 248
251void InstallDlgImpl :: installSelected() 249void InstallDlgImpl :: installSelected()
252{ 250{
253 if ( btnInstall->text() == tr( "Abort" ) ) 251 if ( btnInstall->text() == tr( "Abort" ) )
254 { 252 {
255 if ( pIpkg ) 253 if ( pIpkg )
256 { 254 {
257 displayText( tr( "\n**** User Clicked ABORT ***" ) ); 255 displayText( tr( "\n**** User Clicked ABORT ***" ) );
258 pIpkg->abort(); 256 pIpkg->abort();
259 displayText( tr( "**** Process Aborted ****" ) ); 257 displayText( tr( "**** Process Aborted ****" ) );
260 } 258 }
261 259
262 btnInstall->setText( tr( "Close" ) ); 260 btnInstall->setText( tr( "Close" ) );
263 btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); 261 btnInstall->setIconSet( Opie::Core::OResource::loadPixmap( "enter", Opie::Core::OResource::SmallIcon ) );
264 return; 262 return;
265 } 263 }
266 else if ( btnInstall->text() == tr( "Close" ) ) 264 else if ( btnInstall->text() == tr( "Close" ) )
267 { 265 {
268 emit reloadData( this ); 266 emit reloadData( this );
269 return; 267 return;
270 } 268 }
271 269
272 // Disable buttons 270 // Disable buttons
273 btnOptions->setEnabled( false ); 271 btnOptions->setEnabled( false );
274// btnInstall->setEnabled( false ); 272// btnInstall->setEnabled( false );
275 273
276 btnInstall->setText( tr( "Abort" ) ); 274 btnInstall->setText( tr( "Abort" ) );
277 btnInstall->setIconSet( Resource::loadPixmap( "close" ) ); 275 btnInstall->setIconSet( Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ) );
278 276
279 if ( pIpkg ) 277 if ( pIpkg )
280 { 278 {
281 output->setText( "" ); 279 output->setText( "" );
282 connect( pIpkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&))); 280 connect( pIpkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&)));
283 connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); 281 connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished()));
284 pIpkg->runIpkg(); 282 pIpkg->runIpkg();
285 } 283 }
286 else 284 else
287 { 285 {
288 output->setText( "" ); 286 output->setText( "" );
289 Destination *d = dataMgr->getDestination( destination->currentText() ); 287 Destination *d = dataMgr->getDestination( destination->currentText() );
290 QString dest = d->getDestinationName(); 288 QString dest = d->getDestinationName();
291 QString destDir = d->getDestinationPath(); 289 QString destDir = d->getDestinationPath();
292 int instFlags = flags; 290 int instFlags = flags;
293 if ( d->linkToRoot() ) 291 if ( d->linkToRoot() )
294 instFlags |= MAKE_LINKS; 292 instFlags |= MAKE_LINKS;
295 293
296#ifdef QWS 294#ifdef QWS
297 // Save settings 295 // Save settings
298 Config cfg( "aqpkg" ); 296 Config cfg( "aqpkg" );
299 cfg.setGroup( "settings" ); 297 cfg.setGroup( "settings" );
300 cfg.writeEntry( "dest", dest ); 298 cfg.writeEntry( "dest", dest );
301#endif 299#endif
302 300
303 pIpkg = new Ipkg; 301 pIpkg = new Ipkg;
304 connect( pIpkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&))); 302 connect( pIpkg, SIGNAL(outputText(const QString&)), this, SLOT(displayText(const QString&)));
305 connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished())); 303 connect( pIpkg, SIGNAL(ipkgFinished()), this, SLOT(ipkgFinished()));
306 304
307 firstPackage = TRUE; 305 firstPackage = TRUE;
308 ipkgFinished(); 306 ipkgFinished();
309 307
@@ -437,41 +435,41 @@ void InstallDlgImpl :: ipkgFinished()
437 } 435 }
438 else if ( item->option == "D" ) 436 else if ( item->option == "D" )
439 { 437 {
440 pIpkg->setOption( "remove" ); 438 pIpkg->setOption( "remove" );
441 pIpkg->setDestination( item->destination->getDestinationName() ); 439 pIpkg->setDestination( item->destination->getDestinationName() );
442 pIpkg->setDestinationDir( item->destination->getDestinationPath() ); 440 pIpkg->setDestinationDir( item->destination->getDestinationPath() );
443 441
444 if ( item->destination->linkToRoot() ) 442 if ( item->destination->linkToRoot() )
445 tmpFlags |= MAKE_LINKS; 443 tmpFlags |= MAKE_LINKS;
446 } 444 }
447 else 445 else
448 { 446 {
449 if ( item->option == "R" ) 447 if ( item->option == "R" )
450 pIpkg->setOption( "reinstall" ); 448 pIpkg->setOption( "reinstall" );
451 else 449 else
452 pIpkg->setOption( "upgrade" ); 450 pIpkg->setOption( "upgrade" );
453 451
454 pIpkg->setDestination( item->destination->getDestinationName() ); 452 pIpkg->setDestination( item->destination->getDestinationName() );
455 pIpkg->setDestinationDir( item->destination->getDestinationPath() ); 453 pIpkg->setDestinationDir( item->destination->getDestinationPath() );
456 pIpkg->setPackage( item->packageName ); 454 pIpkg->setPackage( item->packageName );
457 455
458 tmpFlags |= FORCE_REINSTALL; 456 tmpFlags |= FORCE_REINSTALL;
459 if ( item->destination->linkToRoot() && item->recreateLinks ) 457 if ( item->destination->linkToRoot() && item->recreateLinks )
460 tmpFlags |= MAKE_LINKS; 458 tmpFlags |= MAKE_LINKS;
461 } 459 }
462 pIpkg->setFlags( tmpFlags, infoLevel ); 460 pIpkg->setFlags( tmpFlags, infoLevel );
463 pIpkg->runIpkg(); 461 pIpkg->runIpkg();
464 } 462 }
465 else 463 else
466 { 464 {
467 btnOptions->setEnabled( true ); 465 btnOptions->setEnabled( true );
468 btnInstall->setText( tr( "Close" ) ); 466 btnInstall->setText( tr( "Close" ) );
469 btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); 467 btnInstall->setIconSet( Opie::Core::OResource::loadPixmap( "enter", Opie::Core::OResource::SmallIcon ) );
470 468
471 btnOptions->setText( tr( "Save output" ) ); 469 btnOptions->setText( tr( "Save output" ) );
472 btnOptions->setIconSet( Resource::loadPixmap( "save" ) ); 470 btnOptions->setIconSet( Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ) );
473 471
474 if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) 472 if ( destination && destination->currentText() != 0 && destination->currentText() != "" )
475 displayAvailableSpace( destination->currentText() ); 473 displayAvailableSpace( destination->currentText() );
476 } 474 }
477} 475}
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index 6b31cd1..e07d8a0 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -1,78 +1,79 @@
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 "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 <opie2/oresource.h>
44
43#include <qpe/qcopenvelope_qws.h> 45#include <qpe/qcopenvelope_qws.h>
44#include <qpe/qpeapplication.h> 46#include <qpe/qpeapplication.h>
45#include <qpe/config.h> 47#include <qpe/config.h>
46#include <qpe/resource.h>
47 48
48/* QT */ 49/* QT */
49#include <qmenubar.h> 50#include <qmenubar.h>
50#include <qtoolbar.h> 51#include <qtoolbar.h>
51#include <qaction.h> 52#include <qaction.h>
52#include <qcombobox.h> 53#include <qcombobox.h>
53#include <qfile.h> 54#include <qfile.h>
54#include <qlabel.h> 55#include <qlabel.h>
55#include <qlayout.h> 56#include <qlayout.h>
56#include <qlineedit.h> 57#include <qlineedit.h>
57#include <qlistview.h> 58#include <qlistview.h>
58#include <qmenubar.h> 59#include <qmenubar.h>
59#include <qmessagebox.h> 60#include <qmessagebox.h>
60#include <qpopupmenu.h> 61#include <qpopupmenu.h>
61#include <qprogressbar.h> 62#include <qprogressbar.h>
62#include <qtimer.h> 63#include <qtimer.h>
63#include <qwhatsthis.h> 64#include <qwhatsthis.h>
64#include <qwidgetstack.h> 65#include <qwidgetstack.h>
65 66
66/* STD */ 67/* STD */
67#include <linux/limits.h> 68#include <linux/limits.h>
68#include <unistd.h> 69#include <unistd.h>
69 70
70extern int compareVersions( const char *v1, const char *v2 ); 71extern int compareVersions( const char *v1, const char *v2 );
71 72
72MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl ) 73MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl )
73 :QMainWindow( parent, name, fl || WStyle_ContextHelp ) 74 :QMainWindow( parent, name, fl || WStyle_ContextHelp )
74{ 75{
75 // Disable suspend mode 76 // Disable suspend mode
76 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; 77 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend;
77 78
78 LOCAL_SERVER = QObject::tr( "Installed packages" ); 79 LOCAL_SERVER = QObject::tr( "Installed packages" );
@@ -92,203 +93,213 @@ MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl )
92 QMenuBar *mb = new QMenuBar( bar ); 93 QMenuBar *mb = new QMenuBar( bar );
93 mb->setMargin( 0 ); 94 mb->setMargin( 0 );
94 bar = new QToolBar( this ); 95 bar = new QToolBar( this );
95 96
96 // Find toolbar 97 // Find toolbar
97 findBar = new QToolBar( this ); 98 findBar = new QToolBar( this );
98 addToolBar( findBar, QMainWindow::Top, true ); 99 addToolBar( findBar, QMainWindow::Top, true );
99 findBar->setHorizontalStretchable( true ); 100 findBar->setHorizontalStretchable( true );
100 findEdit = new QLineEdit( findBar ); 101 findEdit = new QLineEdit( findBar );
101 QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); 102 QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) );
102 findBar->setStretchableWidget( findEdit ); 103 findBar->setStretchableWidget( findEdit );
103 connect( findEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( findPackage(const QString&) ) ); 104 connect( findEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( findPackage(const QString&) ) );
104 105
105 // Quick jump toolbar 106 // Quick jump toolbar
106 jumpBar = new QToolBar( this ); 107 jumpBar = new QToolBar( this );
107 addToolBar( jumpBar, QMainWindow::Top, true ); 108 addToolBar( jumpBar, QMainWindow::Top, true );
108 jumpBar->setHorizontalStretchable( true ); 109 jumpBar->setHorizontalStretchable( true );
109 QWidget *w = new QWidget( jumpBar ); 110 QWidget *w = new QWidget( jumpBar );
110 jumpBar->setStretchableWidget( w ); 111 jumpBar->setStretchableWidget( w );
111 112
112 QGridLayout *layout = new QGridLayout( w ); 113 QGridLayout *layout = new QGridLayout( w );
113 114
114 char text[2]; 115 char text[2];
115 text[1] = '\0'; 116 text[1] = '\0';
116 for ( int i = 0 ; i < 26 ; ++i ) 117 for ( int i = 0 ; i < 26 ; ++i )
117 { 118 {
118 text[0] = 'A' + i; 119 text[0] = 'A' + i;
119 LetterPushButton *b = new LetterPushButton( text, w ); 120 LetterPushButton *b = new LetterPushButton( text, w );
120 connect( b, SIGNAL( released(QString) ), this, SLOT( letterPushed(QString) ) ); 121 connect( b, SIGNAL( released(QString) ), this, SLOT( letterPushed(QString) ) );
121 layout->addWidget( b, i / 13, i % 13); 122 layout->addWidget( b, i / 13, i % 13);
122 } 123 }
123 124
124 QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); 125 QAction *a = new QAction( QString::null, Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ),
126 QString::null, 0, w, 0 );
125 a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); 127 a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) );
126 connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); 128 connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) );
127 a->addTo( jumpBar ); 129 a->addTo( jumpBar );
128 jumpBar->hide(); 130 jumpBar->hide();
129 131
130 // Packages menu 132 // Packages menu
131 QPopupMenu *popup = new QPopupMenu( this ); 133 QPopupMenu *popup = new QPopupMenu( this );
132 134
133 a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); 135 a = new QAction( tr( "Update lists" ), Opie::Core::OResource::loadPixmap( "aqpkg/update", Opie::Core::OResource::SmallIcon ),
136 QString::null, 0, this, 0 );
134 a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); 137 a->setWhatsThis( tr( "Click here to update package lists from servers." ) );
135 connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); 138 connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) );
136 a->addTo( popup ); 139 a->addTo( popup );
137 a->addTo( bar ); 140 a->addTo( bar );
138 141
139 actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); 142 actionUpgrade = new QAction( tr( "Upgrade" ), Opie::Core::OResource::loadPixmap( "aqpkg/upgrade", Opie::Core::OResource::SmallIcon ),
143 QString::null, 0, this, 0 );
140 actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); 144 actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) );
141 connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) ); 145 connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) );
142 actionUpgrade->addTo( popup ); 146 actionUpgrade->addTo( popup );
143 actionUpgrade->addTo( bar ); 147 actionUpgrade->addTo( bar );
144 148
145 iconDownload = Resource::loadPixmap( "aqpkg/download" ); 149 iconDownload = Opie::Core::OResource::loadPixmap( "aqpkg/download", Opie::Core::OResource::SmallIcon );
146 iconRemove = Resource::loadPixmap( "aqpkg/remove" ); 150 iconRemove = Opie::Core::OResource::loadPixmap( "aqpkg/remove", Opie::Core::OResource::SmallIcon );
147 actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); 151 actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 );
148 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); 152 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) );
149 connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) ); 153 connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) );
150 actionDownload->addTo( popup ); 154 actionDownload->addTo( popup );
151 actionDownload->addTo( bar ); 155 actionDownload->addTo( bar );
152 156
153 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); 157 a = new QAction( tr( "Apply changes" ), Opie::Core::OResource::loadPixmap( "aqpkg/apply", Opie::Core::OResource::SmallIcon ),
158 QString::null, 0, this, 0 );
154 a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); 159 a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) );
155 connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) ); 160 connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) );
156 a->addTo( popup ); 161 a->addTo( popup );
157 a->addTo( bar ); 162 a->addTo( bar );
158 163
159 popup->insertSeparator(); 164 popup->insertSeparator();
160 165
161 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); 166 a = new QAction( tr( "Configure" ), Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ),
167 QString::null, 0, this, 0 );
162 a->setWhatsThis( tr( "Click here to configure this application." ) ); 168 a->setWhatsThis( tr( "Click here to configure this application." ) );
163 connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); 169 connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) );
164 a->addTo( popup ); 170 a->addTo( popup );
165 mb->insertItem( tr( "Actions" ), popup ); 171 mb->insertItem( tr( "Actions" ), popup );
166 172
167 // View menu 173 // View menu
168 popup = new QPopupMenu( this ); 174 popup = new QPopupMenu( this );
169 175
170 actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); 176 actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 );
171 actionUninstalled->setToggleAction( TRUE ); 177 actionUninstalled->setToggleAction( TRUE );
172 actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); 178 actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) );
173 connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) ); 179 connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) );
174 actionUninstalled->addTo( popup ); 180 actionUninstalled->addTo( popup );
175 181
176 actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); 182 actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 );
177 actionInstalled->setToggleAction( TRUE ); 183 actionInstalled->setToggleAction( TRUE );
178 actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); 184 actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) );
179 connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) ); 185 connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) );
180 actionInstalled->addTo( popup ); 186 actionInstalled->addTo( popup );
181 187
182 actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); 188 actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 );
183 actionUpdated->setToggleAction( TRUE ); 189 actionUpdated->setToggleAction( TRUE );
184 actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); 190 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() ) ); 191 connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) );
186 actionUpdated->addTo( popup ); 192 actionUpdated->addTo( popup );
187 193
188 popup->insertSeparator(); 194 popup->insertSeparator();
189 195
190 actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 ); 196 actionFilter = new QAction( tr( "Filter by category" ), Opie::Core::OResource::loadPixmap( "aqpkg/filter",
197 Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
191 actionFilter->setToggleAction( TRUE ); 198 actionFilter->setToggleAction( TRUE );
192 actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) ); 199 actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) );
193 connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) ); 200 connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) );
194 actionFilter->addTo( popup ); 201 actionFilter->addTo( popup );
195 202
196 a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 ); 203 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." ) ); 204 a->setWhatsThis( tr( "Click here to change package category to used filter." ) );
198 connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); 205 connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) );
199 a->addTo( popup ); 206 a->addTo( popup );
200 207
201 popup->insertSeparator(); 208 popup->insertSeparator();
202 209
203 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); 210 a = new QAction( tr( "Find" ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ),
211 QString::null, 0, this, 0 );
204 a->setWhatsThis( tr( "Click here to search for text in package names." ) ); 212 a->setWhatsThis( tr( "Click here to search for text in package names." ) );
205 connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); 213 connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) );
206 a->addTo( popup ); 214 a->addTo( popup );
207 215
208 actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); 216 actionFindNext = new QAction( tr( "Find next" ), Opie::Core::OResource::loadPixmap( "next", Opie::Core::OResource::SmallIcon ),
217 QString::null, 0, this, 0 );
209 actionFindNext->setEnabled( FALSE ); 218 actionFindNext->setEnabled( FALSE );
210 actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); 219 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() ) ); 220 connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) );
212 actionFindNext->addTo( popup ); 221 actionFindNext->addTo( popup );
213 actionFindNext->addTo( findBar ); 222 actionFindNext->addTo( findBar );
214 223
215 224
216 popup->insertSeparator(); 225 popup->insertSeparator();
217 226
218 a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 ); 227 a = new QAction( tr( "Quick Jump keypad" ), Opie::Core::OResource::loadPixmap( "aqpkg/keyboard", Opie::Core::OResource::SmallIcon ),
228 QString::null, 0, this, 0 );
219 a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) ); 229 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() ) ); 230 connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) );
221 a->addTo( popup ); 231 a->addTo( popup );
222 232
223 mb->insertItem( tr( "View" ), popup ); 233 mb->insertItem( tr( "View" ), popup );
224 234
225 // Finish find toolbar creation 235 // Finish find toolbar creation
226 a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 236 a = new QAction( QString::null, Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ),
237 QString::null, 0, this, 0 );
227 a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); 238 a->setWhatsThis( tr( "Click here to hide the find toolbar." ) );
228 connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); 239 connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) );
229 a->addTo( findBar ); 240 a->addTo( findBar );
230 findBar->hide(); 241 findBar->hide();
231 242
232 // Create widget stack and add UI widgets 243 // Create widget stack and add UI widgets
233 stack = new QWidgetStack( this ); 244 stack = new QWidgetStack( this );
234 stack->addWidget( progressWindow, 2 ); 245 stack->addWidget( progressWindow, 2 );
235 stack->addWidget( networkPkgWindow, 1 ); 246 stack->addWidget( networkPkgWindow, 1 );
236 setCentralWidget( stack ); 247 setCentralWidget( stack );
237 stack->raiseWidget( progressWindow ); 248 stack->raiseWidget( progressWindow );
238 249
239 // Delayed call to finish initialization 250 // Delayed call to finish initialization
240 QTimer::singleShot( 100, this, SLOT( init() ) ); 251 QTimer::singleShot( 100, this, SLOT( init() ) );
241} 252}
242 253
243MainWindow :: ~MainWindow() 254MainWindow :: ~MainWindow()
244{ 255{
245 delete mgr; 256 delete mgr;
246 257
247 // Reenable suspend mode 258 // Reenable suspend mode
248 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 259 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
249} 260}
250 261
251void MainWindow :: initMainWidget() 262void MainWindow :: initMainWidget()
252{ 263{
253 networkPkgWindow = new QWidget( this ); 264 networkPkgWindow = new QWidget( this );
254 265
255 QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); 266 QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow );
256 267
257 serversList = new QComboBox( networkPkgWindow ); 268 serversList = new QComboBox( networkPkgWindow );
258 connect( serversList, SIGNAL(activated(int)), this, SLOT(serverSelected(int)) ); 269 connect( serversList, SIGNAL(activated(int)), this, SLOT(serverSelected(int)) );
259 QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); 270 QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) );
260 271
261 installedIcon = Resource::loadPixmap( "installed" ); 272 installedIcon = Opie::Core::OResource::loadPixmap( "installed" );
262 updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); 273 updatedIcon = Opie::Core::OResource::loadPixmap( "aqpkg/updated" );
263 274
264 packagesList = new QListView( networkPkgWindow ); 275 packagesList = new QListView( networkPkgWindow );
265 packagesList->addColumn( tr( "Packages" ), 225 ); 276 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." ) ); 277 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 ); 278 QPEApplication::setStylusOperation( packagesList->viewport(), QPEApplication::RightOnHold );
268 connect( packagesList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)), 279 connect( packagesList, SIGNAL(rightButtonPressed(QListViewItem*,const QPoint&,int)),
269 this, SLOT(slotDisplayPackage(QListViewItem*)) ); 280 this, SLOT(slotDisplayPackage(QListViewItem*)) );
270 281
271 QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); 282 QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 );
272 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); 283 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 );
273 hbox1->addWidget( l ); 284 hbox1->addWidget( l );
274 hbox1->addWidget( serversList ); 285 hbox1->addWidget( serversList );
275 286
276 vbox->addWidget( packagesList ); 287 vbox->addWidget( packagesList );
277 288
278 downloadEnabled = TRUE; 289 downloadEnabled = TRUE;
279} 290}
280 291
281void MainWindow :: initProgressWidget() 292void MainWindow :: initProgressWidget()
282{ 293{
283 progressWindow = new QWidget( this ); 294 progressWindow = new QWidget( this );
284 295
285 QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); 296 QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 );
286 297
287 m_status = new QLabel( progressWindow ); 298 m_status = new QLabel( progressWindow );
288 m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); 299 m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
289 layout->addWidget( m_status ); 300 layout->addWidget( m_status );
290 301
291 m_progress = new QProgressBar( progressWindow ); 302 m_progress = new QProgressBar( progressWindow );
292 layout->addWidget( m_progress ); 303 layout->addWidget( m_progress );
293} 304}
294 305
diff --git a/noncore/settings/aqpkg/packagewin.cpp b/noncore/settings/aqpkg/packagewin.cpp
index 499d647..5f0ae20 100644
--- a/noncore/settings/aqpkg/packagewin.cpp
+++ b/noncore/settings/aqpkg/packagewin.cpp
@@ -1,66 +1,66 @@
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 "packagewin.h" 30#include "packagewin.h"
31#include "package.h" 31#include "package.h"
32#include "datamgr.h" 32#include "datamgr.h"
33 33
34#include <qpe/resource.h> 34#include <opie2/oresource.h>
35 35
36#include <qlayout.h> 36#include <qlayout.h>
37#include <qpushbutton.h> 37#include <qpushbutton.h>
38#include <qstring.h> 38#include <qstring.h>
39#include <qtextview.h> 39#include <qtextview.h>
40 40
41PackageWindow::PackageWindow( Package *package, const QString &server ) 41PackageWindow::PackageWindow( Package *package, const QString &server )
42 : QWidget( 0, 0, 0 ) 42 : QWidget( 0, 0, 0 )
43{ 43{
44 QString str; 44 QString str;
45 if ( package ) 45 if ( package )
46 { 46 {
47 Package *local = package->getLocalPackage(); 47 Package *local = package->getLocalPackage();
48 setCaption( package->getPackageName() ); 48 setCaption( package->getPackageName() );
49 QString destName; 49 QString destName;
50 if ( local ) 50 if ( local )
51 { 51 {
52 if ( local->getInstalledTo() ) 52 if ( local->getInstalledTo() )
53 destName = package->getLocalPackage()->getInstalledTo()->getDestinationName(); 53 destName = package->getLocalPackage()->getInstalledTo()->getDestinationName();
54 } 54 }
55 else 55 else
56 { 56 {
57 if ( package->getInstalledTo() ) 57 if ( package->getInstalledTo() )
58 destName = package->getInstalledTo()->getDestinationName(); 58 destName = package->getInstalledTo()->getDestinationName();
59 } 59 }
60 60
61 if ( !package->isPackageStoredLocally() ) 61 if ( !package->isPackageStoredLocally() )
62 { 62 {
63 str.append( tr( "<b>Description</b> - " ) ); 63 str.append( tr( "<b>Description</b> - " ) );
64 str.append( package->getDescription() ); 64 str.append( package->getDescription() );
65 if ( !destName.isNull() ) 65 if ( !destName.isNull() )
66 { 66 {
@@ -79,41 +79,41 @@ PackageWindow::PackageWindow( Package *package, const QString &server )
79 } 79 }
80 80
81 if ( server == LOCAL_SERVER ) 81 if ( server == LOCAL_SERVER )
82 { 82 {
83 str.append( tr( "<p><b>Version Installed</b> - " ) ); 83 str.append( tr( "<p><b>Version Installed</b> - " ) );
84 str.append( package->getVersion() ); 84 str.append( package->getVersion() );
85 } 85 }
86 else 86 else
87 { 87 {
88 str.append( tr( "<p><b>Version Available</b> - " ) ); 88 str.append( tr( "<p><b>Version Available</b> - " ) );
89 str.append( package->getVersion() ); 89 str.append( package->getVersion() );
90 if ( local ) 90 if ( local )
91 { 91 {
92 if ( package->isInstalled() ) 92 if ( package->isInstalled() )
93 { 93 {
94 str.append( tr( "<p><b>Version Installed</b> - " ) ); 94 str.append( tr( "<p><b>Version Installed</b> - " ) );
95 str.append( package->getInstalledVersion() ); 95 str.append( package->getInstalledVersion() );
96 } 96 }
97 } 97 }
98 } 98 }
99 } 99 }
100 else 100 else
101 { 101 {
102 setCaption( tr( "Package Information" ) ); 102 setCaption( tr( "Package Information" ) );
103 str = tr( "Package information is unavailable" ); 103 str = tr( "Package information is unavailable" );
104 } 104 }
105 105
106 QVBoxLayout *layout = new QVBoxLayout( this, 4, 4 ); 106 QVBoxLayout *layout = new QVBoxLayout( this, 4, 4 );
107 107
108 QTextView *l = new QTextView( str, QString::null, this ); 108 QTextView *l = new QTextView( str, QString::null, this );
109 layout->addWidget( l ); 109 layout->addWidget( l );
110 110
111 QPushButton *btn = new QPushButton( Resource::loadPixmap( "enter" ), tr( "Close" ), this ); 111 QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "enter", Opie::Core::OResource::SmallIcon ), tr( "Close" ), this );
112 layout->addWidget( btn ); 112 layout->addWidget( btn );
113 connect( btn, SIGNAL( clicked() ), this, SLOT( close() ) ); 113 connect( btn, SIGNAL( clicked() ), this, SLOT( close() ) );
114 114
115} 115}
116 116
117PackageWindow::~PackageWindow() 117PackageWindow::~PackageWindow()
118{ 118{
119} 119}
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp
index 9c8ec7a..7ffa1d6 100644
--- a/noncore/settings/aqpkg/settingsimpl.cpp
+++ b/noncore/settings/aqpkg/settingsimpl.cpp
@@ -1,70 +1,68 @@
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 "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#include <opie2/oresource.h>
36#include <qpe/config.h> 36#include <qpe/config.h>
37#include <qpe/resource.h>
38#endif
39#include <qpe/qpeapplication.h> 37#include <qpe/qpeapplication.h>
40 38
41/* QT */ 39/* QT */
42#include <qcheckbox.h> 40#include <qcheckbox.h>
43#include <qgroupbox.h> 41#include <qgroupbox.h>
44#include <qlabel.h> 42#include <qlabel.h>
45#include <qlayout.h> 43#include <qlayout.h>
46#include <qlineedit.h> 44#include <qlineedit.h>
47#include <qlistbox.h> 45#include <qlistbox.h>
48#include <qpushbutton.h> 46#include <qpushbutton.h>
49 47
50using namespace Opie::Ui; 48using namespace Opie::Ui;
51using namespace Opie::Ui; 49using namespace Opie::Ui;
52SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) 50SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
53 : QDialog( parent, name, modal, fl ) 51 : QDialog( parent, name, modal, fl )
54{ 52{
55 setCaption( tr( "Configuration" ) ); 53 setCaption( tr( "Configuration" ) );
56 54
57 // Setup layout to make everything pretty 55 // Setup layout to make everything pretty
58 QVBoxLayout *layout = new QVBoxLayout( this ); 56 QVBoxLayout *layout = new QVBoxLayout( this );
59 layout->setMargin( 2 ); 57 layout->setMargin( 2 );
60 layout->setSpacing( 4 ); 58 layout->setSpacing( 4 );
61 59
62 // Setup tabs for all info 60 // Setup tabs for all info
63 OTabWidget *tabwidget = new OTabWidget( this ); 61 OTabWidget *tabwidget = new OTabWidget( this );
64 layout->addWidget( tabwidget ); 62 layout->addWidget( tabwidget );
65 63
66 tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) ); 64 tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) );
67 tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) ); 65 tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) );
68 tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) ); 66 tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) );
69 tabwidget->setCurrentTab( tr( "Servers" ) ); 67 tabwidget->setCurrentTab( tr( "Servers" ) );
70 68
@@ -82,206 +80,207 @@ SettingsImpl :: ~SettingsImpl()
82bool SettingsImpl :: showDlg() 80bool SettingsImpl :: showDlg()
83{ 81{
84 QPEApplication::execDialog( this ); 82 QPEApplication::execDialog( this );
85 if ( changed ) 83 if ( changed )
86 dataMgr->writeOutIpkgConf(); 84 dataMgr->writeOutIpkgConf();
87 85
88 return changed; 86 return changed;
89} 87}
90 88
91QWidget *SettingsImpl :: initServerTab() 89QWidget *SettingsImpl :: initServerTab()
92{ 90{
93 QWidget *control = new QWidget( this ); 91 QWidget *control = new QWidget( this );
94 92
95 QVBoxLayout *vb = new QVBoxLayout( control ); 93 QVBoxLayout *vb = new QVBoxLayout( control );
96 94
97 QScrollView *sv = new QScrollView( control ); 95 QScrollView *sv = new QScrollView( control );
98 vb->addWidget( sv, 0, 0 ); 96 vb->addWidget( sv, 0, 0 );
99 sv->setResizePolicy( QScrollView::AutoOneFit ); 97 sv->setResizePolicy( QScrollView::AutoOneFit );
100 sv->setFrameStyle( QFrame::NoFrame ); 98 sv->setFrameStyle( QFrame::NoFrame );
101 99
102 QWidget *container = new QWidget( sv->viewport() ); 100 QWidget *container = new QWidget( sv->viewport() );
103 sv->addChild( container ); 101 sv->addChild( container );
104 102
105 QGridLayout *layout = new QGridLayout( container ); 103 QGridLayout *layout = new QGridLayout( container );
106 layout->setSpacing( 2 ); 104 layout->setSpacing( 2 );
107 layout->setMargin( 4 ); 105 layout->setMargin( 4 );
108 106
109 servers = new QListBox( container ); 107 servers = new QListBox( container );
110 servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); 108 servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
111 connect( servers, SIGNAL( highlighted(int) ), this, SLOT( editServer(int) ) ); 109 connect( servers, SIGNAL( highlighted(int) ), this, SLOT( editServer(int) ) );
112 layout->addMultiCellWidget( servers, 0, 0, 0, 1 ); 110 layout->addMultiCellWidget( servers, 0, 0, 0, 1 );
113 111
114 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); 112 QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ),
113 tr( "New" ), container );
115 connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) ); 114 connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) );
116 layout->addWidget( btn, 1, 0 ); 115 layout->addWidget( btn, 1, 0 );
117 116
118 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); 117 btn = new QPushButton( Opie::Core::OResource::loadPixmap( "trash", Opie::Core::OResource::SmallIcon ), tr( "Delete" ), container );
119 connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) ); 118 connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) );
120 layout->addWidget( btn, 1, 1 ); 119 layout->addWidget( btn, 1, 1 );
121 120
122 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container ); 121 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container );
123 grpbox->layout()->setSpacing( 2 ); 122 grpbox->layout()->setSpacing( 2 );
124 grpbox->layout()->setMargin( 4 ); 123 grpbox->layout()->setMargin( 4 );
125 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); 124 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 );
126 125
127 QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); 126 QGridLayout *grplayout = new QGridLayout( grpbox->layout() );
128 127
129 QLabel *label = new QLabel( tr( "Name:" ), grpbox ); 128 QLabel *label = new QLabel( tr( "Name:" ), grpbox );
130 grplayout->addWidget( label, 0, 0 ); 129 grplayout->addWidget( label, 0, 0 );
131 servername = new QLineEdit( grpbox ); 130 servername = new QLineEdit( grpbox );
132 grplayout->addWidget( servername, 0, 1 ); 131 grplayout->addWidget( servername, 0, 1 );
133 132
134 label = new QLabel( tr( "Address:" ), grpbox ); 133 label = new QLabel( tr( "Address:" ), grpbox );
135 grplayout->addWidget( label, 1, 0 ); 134 grplayout->addWidget( label, 1, 0 );
136 serverurl = new QLineEdit( grpbox ); 135 serverurl = new QLineEdit( grpbox );
137 grplayout->addWidget( serverurl, 1, 1 ); 136 grplayout->addWidget( serverurl, 1, 1 );
138 137
139 active = new QCheckBox( tr( "Active Server" ), grpbox ); 138 active = new QCheckBox( tr( "Active Server" ), grpbox );
140 grplayout->addMultiCellWidget( active, 2, 2, 0, 1 ); 139 grplayout->addMultiCellWidget( active, 2, 2, 0, 1 );
141 140
142 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); 141 btn = new QPushButton( Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon ), tr( "Update" ), grpbox );
143 connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) ); 142 connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) );
144 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); 143 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 );
145 144
146 return control; 145 return control;
147} 146}
148 147
149QWidget *SettingsImpl :: initDestinationTab() 148QWidget *SettingsImpl :: initDestinationTab()
150{ 149{
151 QWidget *control = new QWidget( this ); 150 QWidget *control = new QWidget( this );
152 151
153 QVBoxLayout *vb = new QVBoxLayout( control ); 152 QVBoxLayout *vb = new QVBoxLayout( control );
154 153
155 QScrollView *sv = new QScrollView( control ); 154 QScrollView *sv = new QScrollView( control );
156 vb->addWidget( sv, 0, 0 ); 155 vb->addWidget( sv, 0, 0 );
157 sv->setResizePolicy( QScrollView::AutoOneFit ); 156 sv->setResizePolicy( QScrollView::AutoOneFit );
158 sv->setFrameStyle( QFrame::NoFrame ); 157 sv->setFrameStyle( QFrame::NoFrame );
159 158
160 QWidget *container = new QWidget( sv->viewport() ); 159 QWidget *container = new QWidget( sv->viewport() );
161 sv->addChild( container ); 160 sv->addChild( container );
162 161
163 QGridLayout *layout = new QGridLayout( container ); 162 QGridLayout *layout = new QGridLayout( container );
164 layout->setSpacing( 2 ); 163 layout->setSpacing( 2 );
165 layout->setMargin( 4 ); 164 layout->setMargin( 4 );
166 165
167 destinations = new QListBox( container ); 166 destinations = new QListBox( container );
168 destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) ); 167 destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
169 connect( destinations, SIGNAL( highlighted(int) ), this, SLOT( editDestination(int) ) ); 168 connect( destinations, SIGNAL( highlighted(int) ), this, SLOT( editDestination(int) ) );
170 layout->addMultiCellWidget( destinations, 0, 0, 0, 1 ); 169 layout->addMultiCellWidget( destinations, 0, 0, 0, 1 );
171 170
172 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container ); 171 QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), tr( "New" ), container );
173 connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) ); 172 connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) );
174 layout->addWidget( btn, 1, 0 ); 173 layout->addWidget( btn, 1, 0 );
175 174
176 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container ); 175 btn = new QPushButton( Opie::Core::OResource::loadPixmap( "trash", Opie::Core::OResource::SmallIcon ), tr( "Delete" ), container );
177 connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) ); 176 connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) );
178 layout->addWidget( btn, 1, 1 ); 177 layout->addWidget( btn, 1, 1 );
179 178
180 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container ); 179 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container );
181 grpbox->layout()->setSpacing( 2 ); 180 grpbox->layout()->setSpacing( 2 );
182 grpbox->layout()->setMargin( 4 ); 181 grpbox->layout()->setMargin( 4 );
183 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 ); 182 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 );
184 183
185 QGridLayout *grplayout = new QGridLayout( grpbox->layout() ); 184 QGridLayout *grplayout = new QGridLayout( grpbox->layout() );
186 185
187 QLabel *label = new QLabel( tr( "Name:" ), grpbox ); 186 QLabel *label = new QLabel( tr( "Name:" ), grpbox );
188 grplayout->addWidget( label, 0, 0 ); 187 grplayout->addWidget( label, 0, 0 );
189 destinationname = new QLineEdit( grpbox ); 188 destinationname = new QLineEdit( grpbox );
190 grplayout->addWidget( destinationname, 0, 1 ); 189 grplayout->addWidget( destinationname, 0, 1 );
191 190
192 label = new QLabel( tr( "Location:" ), grpbox ); 191 label = new QLabel( tr( "Location:" ), grpbox );
193 grplayout->addWidget( label, 1, 0 ); 192 grplayout->addWidget( label, 1, 0 );
194 destinationurl = new QLineEdit( grpbox ); 193 destinationurl = new QLineEdit( grpbox );
195 grplayout->addWidget( destinationurl, 1, 1 ); 194 grplayout->addWidget( destinationurl, 1, 1 );
196 195
197 linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox ); 196 linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox );
198 grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 ); 197 grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 );
199 198
200 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox ); 199 btn = new QPushButton( Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon ), tr( "Update" ), grpbox );
201 connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) ); 200 connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) );
202 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 ); 201 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 );
203 202
204 return control; 203 return control;
205} 204}
206 205
207QWidget *SettingsImpl :: initProxyTab() 206QWidget *SettingsImpl :: initProxyTab()
208{ 207{
209 QWidget *control = new QWidget( this ); 208 QWidget *control = new QWidget( this );
210 209
211 QVBoxLayout *vb = new QVBoxLayout( control ); 210 QVBoxLayout *vb = new QVBoxLayout( control );
212 211
213 QScrollView *sv = new QScrollView( control ); 212 QScrollView *sv = new QScrollView( control );
214 vb->addWidget( sv, 0, 0 ); 213 vb->addWidget( sv, 0, 0 );
215 sv->setResizePolicy( QScrollView::AutoOneFit ); 214 sv->setResizePolicy( QScrollView::AutoOneFit );
216 sv->setFrameStyle( QFrame::NoFrame ); 215 sv->setFrameStyle( QFrame::NoFrame );
217 216
218 QWidget *container = new QWidget( sv->viewport() ); 217 QWidget *container = new QWidget( sv->viewport() );
219 sv->addChild( container ); 218 sv->addChild( container );
220 219
221 QGridLayout *layout = new QGridLayout( container ); 220 QGridLayout *layout = new QGridLayout( container );
222 layout->setSpacing( 2 ); 221 layout->setSpacing( 2 );
223 layout->setMargin( 4 ); 222 layout->setMargin( 4 );
224 223
225 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container ); 224 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container );
226 grpbox->layout()->setSpacing( 2 ); 225 grpbox->layout()->setSpacing( 2 );
227 grpbox->layout()->setMargin( 4 ); 226 grpbox->layout()->setMargin( 4 );
228 layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 ); 227 layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 );
229 QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() ); 228 QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() );
230 txtHttpProxy = new QLineEdit( grpbox ); 229 txtHttpProxy = new QLineEdit( grpbox );
231 grplayout->addWidget( txtHttpProxy ); 230 grplayout->addWidget( txtHttpProxy );
232 chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); 231 chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox );
233 grplayout->addWidget( chkHttpProxyEnabled ); 232 grplayout->addWidget( chkHttpProxyEnabled );
234 233
235 grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container ); 234 grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container );
236 grpbox->layout()->setSpacing( 2 ); 235 grpbox->layout()->setSpacing( 2 );
237 grpbox->layout()->setMargin( 4 ); 236 grpbox->layout()->setMargin( 4 );
238 layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 ); 237 layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 );
239 grplayout = new QVBoxLayout( grpbox->layout() ); 238 grplayout = new QVBoxLayout( grpbox->layout() );
240 txtFtpProxy = new QLineEdit( grpbox ); 239 txtFtpProxy = new QLineEdit( grpbox );
241 grplayout->addWidget( txtFtpProxy ); 240 grplayout->addWidget( txtFtpProxy );
242 chkFtpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox ); 241 chkFtpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox );
243 grplayout->addWidget( chkFtpProxyEnabled ); 242 grplayout->addWidget( chkFtpProxyEnabled );
244 243
245 QLabel *label = new QLabel( tr( "Username:" ), container ); 244 QLabel *label = new QLabel( tr( "Username:" ), container );
246 layout->addWidget( label, 2, 0 ); 245 layout->addWidget( label, 2, 0 );
247 txtUsername = new QLineEdit( container ); 246 txtUsername = new QLineEdit( container );
248 layout->addWidget( txtUsername, 2, 1 ); 247 layout->addWidget( txtUsername, 2, 1 );
249 248
250 label = new QLabel( tr( "Password:" ), container ); 249 label = new QLabel( tr( "Password:" ), container );
251 layout->addWidget( label, 3, 0 ); 250 layout->addWidget( label, 3, 0 );
252 txtPassword = new QLineEdit( container ); 251 txtPassword = new QLineEdit( container );
253 layout->addWidget( txtPassword, 3, 1 ); 252 layout->addWidget( txtPassword, 3, 1 );
254 253
255 QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), container ); 254 QPushButton *btn = new QPushButton( Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon ), tr( "Update" ), container );
256 connect( btn, SIGNAL( clicked() ), this, SLOT( proxyApplyChanges() ) ); 255 connect( btn, SIGNAL( clicked() ), this, SLOT( proxyApplyChanges() ) );
257 layout->addMultiCellWidget( btn, 4, 4, 0, 1 ); 256 layout->addMultiCellWidget( btn, 4, 4, 0, 1 );
258 257
259 return control; 258 return control;
260} 259}
261 260
262void SettingsImpl :: setupData() 261void SettingsImpl :: setupData()
263{ 262{
264 // add servers 263 // add servers
265 QString serverName; 264 QString serverName;
266 QListIterator<Server> it( dataMgr->getServerList() ); 265 QListIterator<Server> it( dataMgr->getServerList() );
267 for ( ; it.current(); ++it ) 266 for ( ; it.current(); ++it )
268 { 267 {
269 serverName = it.current()->getServerName(); 268 serverName = it.current()->getServerName();
270 if ( serverName == LOCAL_SERVER || serverName == LOCAL_IPKGS ) 269 if ( serverName == LOCAL_SERVER || serverName == LOCAL_IPKGS )
271 continue; 270 continue;
272 271
273 servers->insertItem( serverName ); 272 servers->insertItem( serverName );
274 } 273 }
275 274
276 275
277 // add destinations 276 // add destinations
278 QListIterator<Destination> it2( dataMgr->getDestinationList() ); 277 QListIterator<Destination> it2( dataMgr->getDestinationList() );
279 for ( ; it2.current(); ++it2 ) 278 for ( ; it2.current(); ++it2 )
280 destinations->insertItem( it2.current()->getDestinationName() ); 279 destinations->insertItem( it2.current()->getDestinationName() );
281 280
282 // setup proxy tab 281 // setup proxy tab
283 txtHttpProxy->setText( dataMgr->getHttpProxy() ); 282 txtHttpProxy->setText( dataMgr->getHttpProxy() );
284 txtFtpProxy->setText( dataMgr->getFtpProxy() ); 283 txtFtpProxy->setText( dataMgr->getFtpProxy() );
285 txtUsername->setText( dataMgr->getProxyUsername() ); 284 txtUsername->setText( dataMgr->getProxyUsername() );
286 txtPassword->setText( dataMgr->getProxyPassword() ); 285 txtPassword->setText( dataMgr->getProxyPassword() );
287 chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() ); 286 chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() );
diff --git a/noncore/settings/backup/backuprestore.cpp b/noncore/settings/backup/backuprestore.cpp
index 5a4e284..eadfb63 100644
--- a/noncore/settings/backup/backuprestore.cpp
+++ b/noncore/settings/backup/backuprestore.cpp
@@ -1,72 +1,74 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 =. 3 =.
4 .=l. Copyright (c) 2002-2004 The Opie Team <opie-devel@handhelds.org> 4 .=l. Copyright (c) 2002-2004 The Opie Team <opie-devel@handhelds.org>
5 .>+-= 5 .>+-=
6_;:, .> :=|. This file is free software; you can 6_;:, .> :=|. This file is free software; you can
7.> <`_, > . <= redistribute it and/or modify it under 7.> <`_, > . <= redistribute it and/or modify it under
8:`=1 )Y*s>-.-- : the terms of the GNU General Public 8:`=1 )Y*s>-.-- : the terms of the GNU General Public
9.="- .-=="i, .._ License as published by the Free Software 9.="- .-=="i, .._ License as published by the Free Software
10- . .-<_> .<> Foundation; either version 2 of the License, 10- . .-<_> .<> Foundation; either version 2 of the License,
11 ._= =} : or (at your option) any later version. 11 ._= =} : or (at your option) any later version.
12 .%`+i> _;_. 12 .%`+i> _;_.
13 .i_,=:_. -<s. This file is distributed in the hope that 13 .i_,=:_. -<s. This file is distributed in the hope that
14 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 14 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
15 : .. .:, . . . without even the implied warranty of 15 : .. .:, . . . without even the implied warranty of
16 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 16 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
17 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 17 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.= = ; Public License for more details. 18..}^=.= = ; Public License for more details.
19++= -. .` .: 19++= -. .` .:
20: = ...= . :.=- You should have received a copy of the GNU 20: = ...= . :.=- You should have received a copy of the GNU
21-. .:....=;==+<; General Public License along with this file; 21-. .:....=;==+<; General Public License along with this file;
22 -_. . . )=. = see the file COPYING. If not, write to the 22 -_. . . )=. = see the file COPYING. If not, write to the
23 -- :-=` Free Software Foundation, Inc., 23 -- :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "backuprestore.h" 29#include "backuprestore.h"
30#include "errordialog.h" 30#include "errordialog.h"
31 31
32/* OPIE */ 32/* OPIE */
33#include <qpe/qpeapplication.h>
34#include <qpe/resource.h>
35#include <qpe/config.h>
36#include <opie2/odebug.h> 33#include <opie2/odebug.h>
37#include <opie2/odevice.h> 34#include <opie2/odevice.h>
38#include <opie2/ostorageinfo.h> 35#include <opie2/ostorageinfo.h>
39#include <opie2/ofiledialog.h> 36#include <opie2/ofiledialog.h>
37#include <opie2/oresource.h>
40#include <opie2/owait.h> 38#include <opie2/owait.h>
39
40#include <qpe/qpeapplication.h>
41#include <qpe/config.h>
42
41using namespace Opie::Core; 43using namespace Opie::Core;
42using namespace Opie::Ui; 44using namespace Opie::Ui;
43 45
44/* QT */ 46/* QT */
45#include <qapplication.h> 47#include <qapplication.h>
46#include <qmultilineedit.h> 48#include <qmultilineedit.h>
47#include <qdir.h> 49#include <qdir.h>
48#include <qfile.h> 50#include <qfile.h>
49#include <qfileinfo.h> 51#include <qfileinfo.h>
50#include <qlistview.h> 52#include <qlistview.h>
51#include <qpushbutton.h> 53#include <qpushbutton.h>
52#include <qradiobutton.h> 54#include <qradiobutton.h>
53#include <qheader.h> 55#include <qheader.h>
54#include <qmessagebox.h> 56#include <qmessagebox.h>
55#include <qcombobox.h> 57#include <qcombobox.h>
56#include <qlist.h> 58#include <qlist.h>
57#include <qregexp.h> 59#include <qregexp.h>
58#include <qtextstream.h> 60#include <qtextstream.h>
59#include <qtextview.h> 61#include <qtextview.h>
60#include <qlineedit.h> 62#include <qlineedit.h>
61#include <qstringlist.h> 63#include <qstringlist.h>
62 64
63/* STD */ 65/* STD */
64#include <errno.h> 66#include <errno.h>
65#include <stdlib.h> 67#include <stdlib.h>
66#include <unistd.h> 68#include <unistd.h>
67#include <sys/stat.h> 69#include <sys/stat.h>
68#include <dirent.h> 70#include <dirent.h>
69 71
70#define HEADER_NAME 0 72#define HEADER_NAME 0
71#define HEADER_BACKUP 1 73#define HEADER_BACKUP 1
72#define BACKUP_LOCATION 2 74#define BACKUP_LOCATION 2
@@ -204,70 +206,70 @@ void BackupAndRestore::refreshBackupLocations()
204 if ( it.key() == lastStoreLocation ) 206 if ( it.key() == lastStoreLocation )
205 storeToLocation->setCurrentItem( locationIndex ); 207 storeToLocation->setCurrentItem( locationIndex );
206 if ( it.key() == lastRestoreLocation ) 208 if ( it.key() == lastRestoreLocation )
207 restoreSource->setCurrentItem( locationIndex ); 209 restoreSource->setCurrentItem( locationIndex );
208 locationIndex++; 210 locationIndex++;
209 } 211 }
210} 212}
211 213
212QList<QListViewItem> BackupAndRestore::getAllItems(QListViewItem *item, QList<QListViewItem> &list) 214QList<QListViewItem> BackupAndRestore::getAllItems(QListViewItem *item, QList<QListViewItem> &list)
213{ 215{
214 while(item) 216 while(item)
215 { 217 {
216 if(item->childCount() > 0) 218 if(item->childCount() > 0)
217 getAllItems(item->firstChild(), list); 219 getAllItems(item->firstChild(), list);
218 list.append(item); 220 list.append(item);
219 item = item->nextSibling(); 221 item = item->nextSibling();
220 } 222 }
221 return list; 223 return list;
222} 224}
223 225
224/** 226/**
225 * Selects and unselects the item by setting the HEADER_BACKUP to B or !. 227 * Selects and unselects the item by setting the HEADER_BACKUP to B or !.
226 * and changing the icon to match 228 * and changing the icon to match
227 * @param currentItem the item to swich the selection choice. 229 * @param currentItem the item to swich the selection choice.
228 */ 230 */
229void BackupAndRestore::selectItem(QListViewItem *currentItem) 231void BackupAndRestore::selectItem(QListViewItem *currentItem)
230{ 232{
231 if(!currentItem) 233 if(!currentItem)
232 return; 234 return;
233 235
234 if(currentItem->text(HEADER_BACKUP) == "B") 236 if(currentItem->text(HEADER_BACKUP) == "B")
235 { 237 {
236 currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("backup/null")); 238 currentItem->setPixmap(HEADER_NAME, Opie::Core::OResource::loadPixmap("backup/null"));
237 currentItem->setText(HEADER_BACKUP, ""); 239 currentItem->setText(HEADER_BACKUP, "");
238 } 240 }
239 else 241 else
240 { 242 {
241 currentItem->setPixmap(HEADER_NAME, Resource::loadPixmap("backup/check")); 243 currentItem->setPixmap(HEADER_NAME, Opie::Core::OResource::loadPixmap("backup/check"));
242 currentItem->setText(HEADER_BACKUP, "B"); 244 currentItem->setText(HEADER_BACKUP, "B");
243 } 245 }
244} 246}
245 247
246void BackupAndRestore::scanForApplicationSettings() 248void BackupAndRestore::scanForApplicationSettings()
247{ 249{
248 QDir d( QDir::homeDirPath() + "/" + QString( applicationSettings->text(BACKUP_LOCATION) ) ); 250 QDir d( QDir::homeDirPath() + "/" + QString( applicationSettings->text(BACKUP_LOCATION) ) );
249 d.setFilter( QDir::Dirs | QDir::Files | QDir::NoSymLinks ); 251 d.setFilter( QDir::Dirs | QDir::Files | QDir::NoSymLinks );
250 const QFileInfoList *list = d.entryInfoList(); 252 const QFileInfoList *list = d.entryInfoList();
251 QFileInfoListIterator it( *list ); 253 QFileInfoListIterator it( *list );
252 QFileInfo *fi; 254 QFileInfo *fi;
253 while ( (fi=it.current()) ) 255 while ( (fi=it.current()) )
254 { 256 {
255 //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl; 257 //odebug << (d.path()+"/"+fi->fileName()).latin1() << oendl;
256 if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) ) 258 if ( ( fi->fileName() != "." ) && ( fi->fileName() != ".." ) )
257 { 259 {
258 QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName()); 260 QListViewItem *newItem = new QListViewItem(applicationSettings, fi->fileName());
259 selectItem(newItem); 261 selectItem(newItem);
260 } 262 }
261 ++it; 263 ++it;
262 } 264 }
263} 265}
264 266
265/** 267/**
266 * The "Backup" button has been pressed. Get a list of all of the files that 268 * The "Backup" button has been pressed. Get a list of all of the files that
267 * should be backed up. If there are no files, emit and error and exit. 269 * should be backed up. If there are no files, emit and error and exit.
268 * Determine the file name to store the backup in. Backup the file(s) using 270 * Determine the file name to store the backup in. Backup the file(s) using
269 * tar and gzip --best. Report failure or success 271 * tar and gzip --best. Report failure or success
270 */ 272 */
271void BackupAndRestore::backup() 273void BackupAndRestore::backup()
272{ 274{
273 backupUserData(); 275 backupUserData();