1/* 2 * This file Copyright (C) Mnemosyne LLC 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License version 2 6 * as published by the Free Software Foundation. 7 * 8 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 9 * 10 * $Id: tracker-model-filter.cc 11092 2010-08-01 20:36:13Z charles $ 11 */ 12 13#include "tracker-model.h" 14#include "tracker-model-filter.h" 15 16TrackerModelFilter :: TrackerModelFilter( QObject * parent ): 17 QSortFilterProxyModel( parent ), 18 myShowBackups( false ) 19{ 20} 21 22void 23TrackerModelFilter :: setShowBackupTrackers( bool b ) 24{ 25 myShowBackups = b; 26 invalidateFilter( ); 27} 28 29bool 30TrackerModelFilter :: filterAcceptsRow( int sourceRow, 31 const QModelIndex & sourceParent ) const 32{ 33 QModelIndex index = sourceModel()->index( sourceRow, 0, sourceParent ); 34 const TrackerInfo trackerInfo = index.data( TrackerModel::TrackerRole ).value<TrackerInfo>(); 35 return myShowBackups || !trackerInfo.st.isBackup; 36} 37