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
@@ -30,98 +30,98 @@
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() );
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
@@ -127,98 +127,98 @@ InstallDlgImpl::InstallDlgImpl( const QList<InstallData> &packageList, DataManag
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 }
@@ -233,119 +233,119 @@ void InstallDlgImpl :: optionsSelected()
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 );
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
@@ -243,104 +243,104 @@ void Ipkg :: removeStatusEntry()
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;
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
@@ -55,114 +55,114 @@
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 );
@@ -220,141 +220,141 @@ MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl )
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();
@@ -725,128 +725,128 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
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)" );
@@ -861,179 +861,179 @@ void MainWindow :: downloadPackage()
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 }
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
@@ -66,155 +66,155 @@ SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const
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