2010-07-28 14:43:47 +00:00
|
|
|
/*
|
2010-08-01 20:36:13 +00:00
|
|
|
* This file Copyright (C) Mnemosyne LLC
|
2010-07-28 14:43:47 +00:00
|
|
|
*
|
2010-08-01 20:36:13 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
2010-07-28 14:43:47 +00:00
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "tracker-model.h"
|
|
|
|
#include "tracker-model-filter.h"
|
|
|
|
|
|
|
|
TrackerModelFilter :: TrackerModelFilter( QObject * parent ):
|
|
|
|
QSortFilterProxyModel( parent ),
|
|
|
|
myShowBackups( false )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TrackerModelFilter :: setShowBackupTrackers( bool b )
|
|
|
|
{
|
|
|
|
myShowBackups = b;
|
|
|
|
invalidateFilter( );
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
TrackerModelFilter :: filterAcceptsRow( int sourceRow,
|
|
|
|
const QModelIndex & sourceParent ) const
|
|
|
|
{
|
|
|
|
QModelIndex index = sourceModel()->index( sourceRow, 0, sourceParent );
|
2010-07-30 22:24:48 +00:00
|
|
|
const TrackerInfo trackerInfo = index.data( TrackerModel::TrackerRole ).value<TrackerInfo>();
|
2010-07-28 14:43:47 +00:00
|
|
|
return myShowBackups || !trackerInfo.st.isBackup;
|
|
|
|
}
|