/***************************************************************************
- * Copyright (C) 2005-08 by the Quassel Project *
+ * Copyright (C) 2005-09 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
***************************************************************************/
#include "nickviewfilter.h"
+
#include "networkmodel.h"
-#include "uisettings.h"
/******************************************************************************************
* NickViewFilter
setDynamicSortFilter(true);
setSortCaseSensitivity(Qt::CaseInsensitive);
setSortRole(TreeModel::SortRole);
- loadColors();
-}
-
-void NickViewFilter::loadColors() {
- UiSettings s("QtUi/Colors");
- _FgOnlineStatus = s.value("onlineStatusFG", QVariant(QColor(Qt::black))).value<QColor>();
- _FgAwayStatus = s.value("awayStatusFG", QVariant(QColor(Qt::gray))).value<QColor>();
- // FIXME: use the style interface instead of qsettings
-}
-
-QVariant NickViewFilter::data(const QModelIndex &index, int role) const {
- if(role == Qt::ForegroundRole)
- return foreground(index);
- else
- return QSortFilterProxyModel::data(index, role);
-}
-
-QVariant NickViewFilter::foreground(const QModelIndex &index) const {
- if(!index.data(NetworkModel::ItemActiveRole).toBool())
- return _FgAwayStatus;
- return _FgOnlineStatus;
}
-
bool NickViewFilter::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const {
// root node, networkindexes, the bufferindex of the buffer this filter is active for and it's childs are accepted
if(!source_parent.isValid())