1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-10 14:13:23 +00:00

(trunk qt) fix remove-torrent filtering error reported by W4pp

This commit is contained in:
Charles Kerr 2009-05-03 18:35:33 +00:00
parent 2b42c00c45
commit ccd02666ee
3 changed files with 9 additions and 1 deletions

View file

@ -188,6 +188,9 @@ TrMainWindow :: TrMainWindow( Session& session, Prefs& prefs, TorrentModel& mode
// torrent view // torrent view
myFilterModel.setSourceModel( &myModel ); myFilterModel.setSourceModel( &myModel );
connect( &myModel, SIGNAL(modelReset()), this, SLOT(onModelReset()));
connect( &myModel, SIGNAL(rowsRemoved(const QModelIndex&,int,int)), this, SLOT(onModelReset()));
connect( &myModel, SIGNAL(rowsInserted(const QModelIndex&,int,int)), this, SLOT(onModelReset()));
ui.listView->setModel( &myFilterModel ); ui.listView->setModel( &myFilterModel );
connect( ui.listView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)), this, SLOT(refreshActionSensitivity())); connect( ui.listView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)), this, SLOT(refreshActionSensitivity()));
@ -278,6 +281,11 @@ void
TrMainWindow :: onSessionSourceChanged( ) TrMainWindow :: onSessionSourceChanged( )
{ {
myModel.clear( ); myModel.clear( );
}
void
TrMainWindow :: onModelReset( )
{
refreshTitle( ); refreshTitle( );
refreshVisibleCount( ); refreshVisibleCount( );
refreshActionSensitivity( ); refreshActionSensitivity( );

View file

@ -121,6 +121,7 @@ class TrMainWindow: public QMainWindow
void onSetPrefs( ); void onSetPrefs( );
void onSetPrefs( bool ); void onSetPrefs( bool );
void onSessionSourceChanged( ); void onSessionSourceChanged( );
void onModelReset( );
private slots: private slots:
void setSortPref ( int ); void setSortPref ( int );

View file

@ -204,7 +204,6 @@ TorrentModel :: removeTorrent( int id )
if( row >= 0 ) if( row >= 0 )
{ {
Torrent * tor = myIdToTorrent.value( id, 0 ); Torrent * tor = myIdToTorrent.value( id, 0 );
std::cerr << "removing torrent " << id << std::endl;
beginRemoveRows( QModelIndex(), row, row ); beginRemoveRows( QModelIndex(), row, row );
myIdToRow.remove( id ); myIdToRow.remove( id );