Changeset 11073
- Timestamp:
- Jul 31, 2010, 12:03:59 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt/filterbar.cc
r11072 r11073 11 11 */ 12 12 13 #include <iostream> 14 13 15 #include <QString> 14 16 #include <QtGui> … … 465 467 case Prefs :: FILTER_TRACKERS: { 466 468 const QString tracker = myPrefs.getString( key ); 467 QList<QStandardItem*> rows = myTrackerModel->findItems( tracker ); 468 if( !rows.isEmpty( ) ) 469 myTrackerCombo->setCurrentIndex( rows.first()->row() ); 470 else if( myTorrents.rowCount( ) > 0 ) // uh-oh... we don't have this tracker anymore. best use "show all" as a fallback 471 myPrefs.set( key, "" ); 469 QModelIndexList indices = myTrackerModel->match( myTrackerModel->index(0,0), TrackerRole, tracker, 1, Qt::MatchFixedString ); 470 if( !indices.isEmpty( ) ) 471 myTrackerCombo->setCurrentIndex( indices.first().row() ); 472 else { // hm, we don't seem to have this tracker anymore... 473 const bool isBootstrapping = myTrackerModel->rowCount( ) <= 2; 474 if( !isBootstrapping ) 475 myPrefs.set( key, "" ); 476 } 472 477 break; 473 478 } … … 490 495 { 491 496 if( !myIsBootstrapping ) 492 myPrefs.set( Prefs::FILTER_TRACKERS, myTrackerCombo->itemData( i, Qt::DisplayRole ).toString( ) ); 497 { 498 QString str; 499 const bool isTracker = !myTrackerCombo->itemData(i,TrackerRole).toString().isEmpty(); 500 if( isTracker ) 501 str = myTrackerCombo->itemData(i,TrackerRole).toString(); 502 else // show all 503 str = ""; 504 myPrefs.set( Prefs::FILTER_TRACKERS, str ); 505 } 493 506 } 494 507
Note: See TracChangeset
for help on using the changeset viewer.