summaryrefslogtreecommitdiff
authorandyq <andyq>2002-10-16 23:43:27 (UTC)
committer andyq <andyq>2002-10-16 23:43:27 (UTC)
commit5d28c61d84da1814d356540b557bbfe026da98aa (patch) (unidiff)
tree2bf8beae274d59573898cead3fc925d2663348b8
parent35a5fb97aa3cc92e626286285d22d8fbf9d61e3e (diff)
downloadopie-5d28c61d84da1814d356540b557bbfe026da98aa.zip
opie-5d28c61d84da1814d356540b557bbfe026da98aa.tar.gz
opie-5d28c61d84da1814d356540b557bbfe026da98aa.tar.bz2
Fixed bug in jump to package
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 3ce7960..6f528a1 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -111,398 +111,414 @@ void NetworkPackageManager :: initGui()
111 QLabel *l = new QLabel( "Servers", this ); 111 QLabel *l = new QLabel( "Servers", this );
112 serversList = new QComboBox( this ); 112 serversList = new QComboBox( this );
113 packagesList = new QListView( this ); 113 packagesList = new QListView( this );
114 update = new QPushButton( "Refresh List", this ); 114 update = new QPushButton( "Refresh List", this );
115 download = new QPushButton( "Download", this ); 115 download = new QPushButton( "Download", this );
116 upgrade = new QPushButton( "Upgrade", this ); 116 upgrade = new QPushButton( "Upgrade", this );
117 apply = new QPushButton( "Apply", this ); 117 apply = new QPushButton( "Apply", this );
118 118
119 QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" ); 119 QVBoxLayout *vbox = new QVBoxLayout( this, 0, -1, "VBox" );
120 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" ); 120 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1, "HBox1" );
121 hbox1->addWidget( l ); 121 hbox1->addWidget( l );
122 hbox1->addWidget( serversList ); 122 hbox1->addWidget( serversList );
123 123
124 QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1, "HBox1" ); 124 QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1, "HBox1" );
125 QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1, "HBox1" ); 125 QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1, "HBox1" );
126 126
127 char text[2]; 127 char text[2];
128 text[1] = '\0'; 128 text[1] = '\0';
129 for ( int i = 0 ; i < 26 ; ++i ) 129 for ( int i = 0 ; i < 26 ; ++i )
130 { 130 {
131 text[0] = 'A' + i; 131 text[0] = 'A' + i;
132 LetterPushButton *b = new LetterPushButton( text, this ); 132 LetterPushButton *b = new LetterPushButton( text, this );
133 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); 133 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) );
134 if ( i < 16 ) 134 if ( i < 16 )
135 hbox3->addWidget( b ); 135 hbox3->addWidget( b );
136 else 136 else
137 hbox4->addWidget( b ); 137 hbox4->addWidget( b );
138 } 138 }
139 139
140 vbox->addWidget( packagesList ); 140 vbox->addWidget( packagesList );
141 packagesList->addColumn( "Packages" ); 141 packagesList->addColumn( "Packages" );
142 142
143 QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1, "HBox2" ); 143 QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1, "HBox2" );
144 hbox2->addWidget( update ); 144 hbox2->addWidget( update );
145 hbox2->addWidget( download ); 145 hbox2->addWidget( download );
146 hbox2->addWidget( upgrade ); 146 hbox2->addWidget( upgrade );
147 hbox2->addWidget( apply ); 147 hbox2->addWidget( apply );
148} 148}
149 149
150void NetworkPackageManager :: setupConnections() 150void NetworkPackageManager :: setupConnections()
151{ 151{
152 connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int ))); 152 connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int )));
153 connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) ); 153 connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) );
154 connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) ); 154 connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) );
155 connect( upgrade, SIGNAL( released()), this, SLOT(upgradePackages()) ); 155 connect( upgrade, SIGNAL( released()), this, SLOT(upgradePackages()) );
156 connect( update, SIGNAL(released()), this, SLOT(updateServer()) ); 156 connect( update, SIGNAL(released()), this, SLOT(updateServer()) );
157} 157}
158 158
159void NetworkPackageManager :: showProgressDialog( char *initialText ) 159void NetworkPackageManager :: showProgressDialog( char *initialText )
160{ 160{
161 if ( !progressDlg ) 161 if ( !progressDlg )
162 progressDlg = new ProgressDlg( this, "Progress", false ); 162 progressDlg = new ProgressDlg( this, "Progress", false );
163 progressDlg->setText( initialText ); 163 progressDlg->setText( initialText );
164 progressDlg->show(); 164 progressDlg->show();
165} 165}
166 166
167 167
168void NetworkPackageManager :: serverSelected( int ) 168void NetworkPackageManager :: serverSelected( int )
169{ 169{
170 packagesList->clear(); 170 packagesList->clear();
171 171
172 // display packages 172 // display packages
173 QString serverName = serversList->currentText(); 173 QString serverName = serversList->currentText();
174 currentlySelectedServer = serverName; 174 currentlySelectedServer = serverName;
175 175
176#ifdef QWS 176#ifdef QWS
177 // read download directory from config file 177 // read download directory from config file
178 Config cfg( "aqpkg" ); 178 Config cfg( "aqpkg" );
179 cfg.setGroup( "settings" ); 179 cfg.setGroup( "settings" );
180 cfg.writeEntry( "selectedServer", currentlySelectedServer ); 180 cfg.writeEntry( "selectedServer", currentlySelectedServer );
181#endif 181#endif
182 182
183 Server *s = dataMgr->getServer( serverName ); 183 Server *s = dataMgr->getServer( serverName );
184// dataMgr->setActiveServer( serverName ); 184// dataMgr->setActiveServer( serverName );
185 185
186 vector<Package> &list = s->getPackageList(); 186 vector<Package> &list = s->getPackageList();
187 vector<Package>::iterator it; 187 vector<Package>::iterator it;
188 for ( it = list.begin() ; it != list.end() ; ++it ) 188 for ( it = list.begin() ; it != list.end() ; ++it )
189 { 189 {
190 QString text = ""; 190 QString text = "";
191 191
192 // If the local server, only display installed packages 192 // If the local server, only display installed packages
193 if ( serverName == LOCAL_SERVER && !it->isInstalled() ) 193 if ( serverName == LOCAL_SERVER && !it->isInstalled() )
194 continue; 194 continue;
195 195
196 text += it->getPackageName(); 196 text += it->getPackageName();
197 if ( it->isInstalled() ) 197 if ( it->isInstalled() )
198 { 198 {
199 text += " (installed)"; 199 text += " (installed)";
200 200
201 // If a different version of package is available, postfix it with an * 201 // If a different version of package is available, postfix it with an *
202 if ( it->getVersion() != it->getInstalledVersion() ) 202 if ( it->getVersion() != it->getInstalledVersion() )
203 text += "*"; 203 text += "*";
204 } 204 }
205 205
206 QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox ); 206 QCheckListItem *item = new QCheckListItem( packagesList, text, QCheckListItem::CheckBox );
207 if ( !it->isPackageStoredLocally() ) 207 if ( !it->isPackageStoredLocally() )
208 new QCheckListItem( item, QString( "Description - " ) + it->getDescription() ); 208 new QCheckListItem( item, QString( "Description - " ) + it->getDescription() );
209 else 209 else
210 new QCheckListItem( item, QString( "Filename - " ) + it->getFilename() ); 210 new QCheckListItem( item, QString( "Filename - " ) + it->getFilename() );
211 211
212 new QCheckListItem( item, QString( "V. Available - " ) + it->getVersion() ); 212 new QCheckListItem( item, QString( "V. Available - " ) + it->getVersion() );
213 if ( it->getLocalPackage() ) 213 if ( it->getLocalPackage() )
214 { 214 {
215 if ( it->isInstalled() ) 215 if ( it->isInstalled() )
216 new QCheckListItem( item, QString( "V. Installed - " ) + it->getInstalledVersion() ); 216 new QCheckListItem( item, QString( "V. Installed - " ) + it->getInstalledVersion() );
217 } 217 }
218 packagesList->insertItem( item ); 218 packagesList->insertItem( item );
219 } 219 }
220 220
221 // If the local server or the local ipkgs server disable the download button 221 // If the local server or the local ipkgs server disable the download button
222 if ( serverName == LOCAL_SERVER ) 222 if ( serverName == LOCAL_SERVER )
223 { 223 {
224 upgrade->setEnabled( false ); 224 upgrade->setEnabled( false );
225 download->setText( "Download" ); 225 download->setText( "Download" );
226 download->setEnabled( false ); 226 download->setEnabled( false );
227 } 227 }
228 else if ( serverName == LOCAL_IPKGS ) 228 else if ( serverName == LOCAL_IPKGS )
229 { 229 {
230 upgrade->setEnabled( false ); 230 upgrade->setEnabled( false );
231 download->setEnabled( true ); 231 download->setEnabled( true );
232 download->setText( "Remove" ); 232 download->setText( "Remove" );
233 } 233 }
234 else 234 else
235 { 235 {
236 upgrade->setEnabled( true ); 236 upgrade->setEnabled( true );
237 download->setEnabled( true ); 237 download->setEnabled( true );
238 download->setText( "Download" ); 238 download->setText( "Download" );
239 } 239 }
240} 240}
241 241
242void NetworkPackageManager :: updateServer() 242void NetworkPackageManager :: updateServer()
243{ 243{
244 QString serverName = serversList->currentText(); 244 QString serverName = serversList->currentText();
245 245
246 // Update the current server 246 // Update the current server
247 // Display dialog 247 // Display dialog
248 ProgressDlg *dlg = new ProgressDlg( this ); 248 ProgressDlg *dlg = new ProgressDlg( this );
249 QString status = "Updating package lists..."; 249 QString status = "Updating package lists...";
250 dlg->show(); 250 dlg->show();
251 dlg->setText( status ); 251 dlg->setText( status );
252 252
253 // Disable buttons to stop silly people clicking lots on them :) 253 // Disable buttons to stop silly people clicking lots on them :)
254 254
255 // First, write out ipkg_conf file so that ipkg can use it 255 // First, write out ipkg_conf file so that ipkg can use it
256 dataMgr->writeOutIpkgConf(); 256 dataMgr->writeOutIpkgConf();
257 257
258// if ( serverName == LOCAL_SERVER ) 258// if ( serverName == LOCAL_SERVER )
259// ; 259// ;
260// else if ( serverName == LOCAL_IPKGS ) 260// else if ( serverName == LOCAL_IPKGS )
261// ; 261// ;
262// else 262// else
263 { 263 {
264 QString option = "update"; 264 QString option = "update";
265 QString dummy = ""; 265 QString dummy = "";
266 Ipkg ipkg; 266 Ipkg ipkg;
267 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 267 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
268 ipkg.setOption( option ); 268 ipkg.setOption( option );
269 269
270 ipkg.runIpkg( ); 270 ipkg.runIpkg( );
271 } 271 }
272 272
273 // Reload data 273 // Reload data
274 dataMgr->reloadServerData( serversList->currentText() ); 274 dataMgr->reloadServerData( serversList->currentText() );
275 serverSelected(-1); 275 serverSelected(-1);
276 delete dlg; 276 delete dlg;
277} 277}
278 278
279void NetworkPackageManager :: upgradePackages() 279void NetworkPackageManager :: upgradePackages()
280{ 280{
281 // We're gonna do an upgrade of all packages 281 // We're gonna do an upgrade of all packages
282 // First warn user that this isn't recommended 282 // First warn user that this isn't recommended
283 QString text = "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n"; 283 QString text = "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n";
284 QMessageBox warn("Warning", text, QMessageBox::Warning, 284 QMessageBox warn("Warning", text, QMessageBox::Warning,
285 QMessageBox::Yes, 285 QMessageBox::Yes,
286 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , 286 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default ,
287 0, this ); 287 0, this );
288 warn.adjustSize(); 288 warn.adjustSize();
289 289
290 if ( warn.exec() == QMessageBox::Yes ) 290 if ( warn.exec() == QMessageBox::Yes )
291 { 291 {
292 // First, write out ipkg_conf file so that ipkg can use it 292 // First, write out ipkg_conf file so that ipkg can use it
293 dataMgr->writeOutIpkgConf(); 293 dataMgr->writeOutIpkgConf();
294 294
295 // Now run upgrade 295 // Now run upgrade
296 InstallDlgImpl dlg( this, "Upgrade", true ); 296 InstallDlgImpl dlg( this, "Upgrade", true );
297 dlg.showDlg(); 297 dlg.showDlg();
298 298
299 // Reload data 299 // Reload data
300 dataMgr->reloadServerData( LOCAL_SERVER ); 300 dataMgr->reloadServerData( LOCAL_SERVER );
301 301
302 dataMgr->reloadServerData( serversList->currentText() ); 302 dataMgr->reloadServerData( serversList->currentText() );
303 serverSelected(-1); 303 serverSelected(-1);
304 } 304 }
305} 305}
306 306
307 307
308void NetworkPackageManager :: downloadPackage() 308void NetworkPackageManager :: downloadPackage()
309{ 309{
310 if ( download->text() == "Download" ) 310 if ( download->text() == "Download" )
311 { 311 {
312 // First, write out ipkg_conf file so that ipkg can use it 312 // First, write out ipkg_conf file so that ipkg can use it
313 dataMgr->writeOutIpkgConf(); 313 dataMgr->writeOutIpkgConf();
314 314
315 // Display dialog to user asking where to download the files to 315 // Display dialog to user asking where to download the files to
316 bool ok = FALSE; 316 bool ok = FALSE;
317 QString dir = ""; 317 QString dir = "";
318#ifdef QWS 318#ifdef QWS
319 // read download directory from config file 319 // read download directory from config file
320 Config cfg( "aqpkg" ); 320 Config cfg( "aqpkg" );
321 cfg.setGroup( "settings" ); 321 cfg.setGroup( "settings" );
322 dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" ); 322 dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" );
323#endif 323#endif
324 324
325 QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this ); 325 QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this );
326 if ( ok && !text.isEmpty() ) 326 if ( ok && !text.isEmpty() )
327 dir = text; // user entered something and pressed ok 327 dir = text; // user entered something and pressed ok
328 else 328 else
329 return; // user entered nothing or pressed cancel 329 return; // user entered nothing or pressed cancel
330 330
331#ifdef QWS 331#ifdef QWS
332 // Store download directory in config file 332 // Store download directory in config file
333 cfg.writeEntry( "downloadDir", dir ); 333 cfg.writeEntry( "downloadDir", dir );
334#endif 334#endif
335 335
336 // Get starting directory 336 // Get starting directory
337 char initDir[PATH_MAX]; 337 char initDir[PATH_MAX];
338 getcwd( initDir, PATH_MAX ); 338 getcwd( initDir, PATH_MAX );
339 339
340 // Download each package 340 // Download each package
341 Ipkg ipkg; 341 Ipkg ipkg;
342 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 342 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
343 343
344 ipkg.setOption( "download" ); 344 ipkg.setOption( "download" );
345 ipkg.setRuntimeDirectory( dir ); 345 ipkg.setRuntimeDirectory( dir );
346 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 346 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
347 item != 0 ; 347 item != 0 ;
348 item = (QCheckListItem *)item->nextSibling() ) 348 item = (QCheckListItem *)item->nextSibling() )
349 { 349 {
350 if ( item->isOn() ) 350 if ( item->isOn() )
351 { 351 {
352 QString name = item->text(); 352 QString name = item->text();
353 int pos = name.find( "*" ); 353 int pos = name.find( "*" );
354 name.truncate( pos ); 354 name.truncate( pos );
355 355
356 // if (there is a (installed), remove it 356 // if (there is a (installed), remove it
357 pos = name.find( "(installed)" ); 357 pos = name.find( "(installed)" );
358 if ( pos > 0 ) 358 if ( pos > 0 )
359 name.truncate( pos - 1 ); 359 name.truncate( pos - 1 );
360 360
361 ipkg.setPackage( name ); 361 ipkg.setPackage( name );
362 ipkg.runIpkg( ); 362 ipkg.runIpkg( );
363 } 363 }
364 } 364 }
365 } 365 }
366 else if ( download->text() == "Remove" ) 366 else if ( download->text() == "Remove" )
367 { 367 {
368 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 368 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
369 item != 0 ; 369 item != 0 ;
370 item = (QCheckListItem *)item->nextSibling() ) 370 item = (QCheckListItem *)item->nextSibling() )
371 { 371 {
372 if ( item->isOn() ) 372 if ( item->isOn() )
373 { 373 {
374 QString name = item->text(); 374 QString name = item->text();
375 int pos = name.find( "*" ); 375 int pos = name.find( "*" );
376 name.truncate( pos ); 376 name.truncate( pos );
377 377
378 // if (there is a (installed), remove it 378 // if (there is a (installed), remove it
379 pos = name.find( "(installed)" ); 379 pos = name.find( "(installed)" );
380 if ( pos > 0 ) 380 if ( pos > 0 )
381 name.truncate( pos - 1 ); 381 name.truncate( pos - 1 );
382 382
383 Package *p = dataMgr->getServer( serversList->currentText() )->getPackage( name ); 383 Package *p = dataMgr->getServer( serversList->currentText() )->getPackage( name );
384 QFile f( p->getFilename() ); 384 QFile f( p->getFilename() );
385 f.remove(); 385 f.remove();
386 } 386 }
387 } 387 }
388 } 388 }
389 389
390 dataMgr->reloadServerData( LOCAL_IPKGS ); 390 dataMgr->reloadServerData( LOCAL_IPKGS );
391 serverSelected( -1 ); 391 serverSelected( -1 );
392} 392}
393 393
394 394
395void NetworkPackageManager :: applyChanges() 395void NetworkPackageManager :: applyChanges()
396{ 396{
397 // Disable buttons to stop silly people clicking lots on them :) 397 // Disable buttons to stop silly people clicking lots on them :)
398 398
399 // First, write out ipkg_conf file so that ipkg can use it 399 // First, write out ipkg_conf file so that ipkg can use it
400 dataMgr->writeOutIpkgConf(); 400 dataMgr->writeOutIpkgConf();
401 401
402 // Now for each selected item 402 // Now for each selected item
403 // deal with it 403 // deal with it
404 404
405 vector<QString> workingPackages; 405 vector<QString> workingPackages;
406 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 406 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
407 item != 0 ; 407 item != 0 ;
408 item = (QCheckListItem *)item->nextSibling() ) 408 item = (QCheckListItem *)item->nextSibling() )
409 { 409 {
410 if ( item->isOn() ) 410 if ( item->isOn() )
411 { 411 {
412 QString p = dealWithItem( item ); 412 QString p = dealWithItem( item );
413 workingPackages.push_back( p ); 413 workingPackages.push_back( p );
414 } 414 }
415 } 415 }
416 416
417 // do the stuff 417 // do the stuff
418 InstallDlgImpl dlg( workingPackages, dataMgr, this, "Install", true ); 418 InstallDlgImpl dlg( workingPackages, dataMgr, this, "Install", true );
419 dlg.showDlg(); 419 dlg.showDlg();
420 420
421 // Reload data 421 // Reload data
422 dataMgr->reloadServerData( LOCAL_SERVER ); 422 dataMgr->reloadServerData( LOCAL_SERVER );
423 423
424 dataMgr->reloadServerData( serversList->currentText() ); 424 dataMgr->reloadServerData( serversList->currentText() );
425 serverSelected(-1); 425 serverSelected(-1);
426 426
427#ifdef QWS 427#ifdef QWS
428 // Finally let the main system update itself 428 // Finally let the main system update itself
429 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 429 QCopEnvelope e("QPE/System", "linkChanged(QString)");
430 QString lf = QString::null; 430 QString lf = QString::null;
431 e << lf; 431 e << lf;
432#endif 432#endif
433} 433}
434 434
435// decide what to do - either remove, upgrade or install 435// decide what to do - either remove, upgrade or install
436// Current rules: 436// Current rules:
437// If not installed - install 437// If not installed - install
438// If installed and different version available - upgrade 438// If installed and different version available - upgrade
439// If installed and version up to date - remove 439// If installed and version up to date - remove
440QString NetworkPackageManager :: dealWithItem( QCheckListItem *item ) 440QString NetworkPackageManager :: dealWithItem( QCheckListItem *item )
441{ 441{
442 QString name = item->text(); 442 QString name = item->text();
443 int pos = name.find( "*" ); 443 int pos = name.find( "*" );
444 name.truncate( pos ); 444 name.truncate( pos );
445 445
446 // if (there is a (installed), remove it 446 // if (there is a (installed), remove it
447 pos = name.find( "(installed)" ); 447 pos = name.find( "(installed)" );
448 if ( pos > 0 ) 448 if ( pos > 0 )
449 name.truncate( pos - 1 ); 449 name.truncate( pos - 1 );
450 450
451 // Get package 451 // Get package
452 Server *s = dataMgr->getServer( serversList->currentText() ); 452 Server *s = dataMgr->getServer( serversList->currentText() );
453 Package *p = s->getPackage( name ); 453 Package *p = s->getPackage( name );
454 454
455 // If the package has a filename then it is a local file 455 // If the package has a filename then it is a local file
456 if ( p->isPackageStoredLocally() ) 456 if ( p->isPackageStoredLocally() )
457 name = p->getFilename(); 457 name = p->getFilename();
458 QString option; 458 QString option;
459 QString dest = "root"; 459 QString dest = "root";
460 if ( !p->isInstalled() ) 460 if ( !p->isInstalled() )
461 return QString( "I" ) + name; 461 return QString( "I" ) + name;
462 else 462 else
463 { 463 {
464 if ( p->getVersion() == p->getInstalledVersion() ) 464 if ( p->getVersion() == p->getInstalledVersion() )
465 { 465 {
466 QString msgtext; 466 QString msgtext;
467 msgtext.sprintf( "Do you wish to remove or reinstall\n%s?", (const char *)name ); 467 msgtext.sprintf( "Do you wish to remove or reinstall\n%s?", (const char *)name );
468 switch( QMessageBox::information( this, "Remove or ReInstall", 468 switch( QMessageBox::information( this, "Remove or ReInstall",
469 msgtext, "Remove", "ReInstall" ) ) 469 msgtext, "Remove", "ReInstall" ) )
470 { 470 {
471 case 0: // Try again or Enter 471 case 0: // Try again or Enter
472 return QString( "D" ) + name; 472 return QString( "D" ) + name;
473 break; 473 break;
474 case 1: // Quit or Escape 474 case 1: // Quit or Escape
475 return QString( "U" ) + name; 475 return QString( "U" ) + name;
476 break; 476 break;
477 } 477 }
478 478
479 // User hit cancel (on dlg - assume remove) 479 // User hit cancel (on dlg - assume remove)
480 return QString( "D" ) + name; 480 return QString( "D" ) + name;
481 } 481 }
482 else 482 else
483 return QString( "U" ) + name; 483 return QString( "U" ) + name;
484 } 484 }
485} 485}
486 486
487void NetworkPackageManager :: displayText( const QString &t ) 487void NetworkPackageManager :: displayText( const QString &t )
488{ 488{
489 cout << t << endl; 489 cout << t << endl;
490} 490}
491 491
492 492
493void NetworkPackageManager :: letterPushed( QString t ) 493void NetworkPackageManager :: letterPushed( QString t )
494{ 494{
495 QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 495 QCheckListItem *top = (QCheckListItem *)packagesList->firstChild();
496 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
497 if ( packagesList->firstChild() == 0 )
498 return;
499
500 QCheckListItem *item;
501 if ( start == 0 )
502 {
503 item = (QCheckListItem *)packagesList->firstChild();
504 start = top;
505 }
506 else
507 item = (QCheckListItem *)start->nextSibling();
508
509 if ( item == 0 )
510 item = (QCheckListItem *)packagesList->firstChild();
496 do 511 do
497 { 512 {
498 if ( item->text().lower().startsWith( t.lower() ) ) 513 if ( item->text().lower().startsWith( t.lower() ) )
499 { 514 {
500 cout << "Found - item->text()" << endl;
501 packagesList->setSelected( item, true ); 515 packagesList->setSelected( item, true );
502 packagesList->ensureItemVisible( item ); 516 packagesList->ensureItemVisible( item );
503 break; 517 break;
504 } 518 }
505 519
506 item = (QCheckListItem *)item->nextSibling(); 520 item = (QCheckListItem *)item->nextSibling();
507 } while ( item ); 521 if ( !item )
522 item = (QCheckListItem *)packagesList->firstChild();
523 } while ( item != start);
508} 524}