12#ifndef COLORING_RULES_MODEL_H
13#define COLORING_RULES_MODEL_H
23#include <QAbstractTableModel>
24#include <QSortFilterProxyModel>
128 void addColor(
bool disabled, QString filter, QColor foreground, QColor background);
158 Qt::ItemFlags flags(
const QModelIndex &
index)
const;
166 QVariant data(
const QModelIndex &
index,
int role)
const;
175 bool setData(
const QModelIndex &
index,
const QVariant &value,
int role = Qt::EditRole);
184 QVariant
headerData(
int section, Qt::Orientation orientation,
185 int role = Qt::DisplayRole)
const;
194 QModelIndex
index(
int row,
int column,
195 const QModelIndex &
parent = QModelIndex())
const;
202 QModelIndex
parent(
const QModelIndex &indexItem)
const;
222 QMimeData*
mimeData(
const QModelIndexList &indexes)
const;
233 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &
parent);
256 bool insertRows(
int row,
int count,
const QModelIndex &
parent = QModelIndex());
265 bool removeRows(
int row,
int count,
const QModelIndex &
parent = QModelIndex());
273 bool copyRow(
int dst_row,
int src_row);
285 struct _GSList *createColorFilterList();
292 struct _GSList *conversation_colors_;
295 QColor defaultForeground_;
298 QColor defaultBackground_;
301 QList<int> dragDropRows_;
Represents a single coloring rule item in a tree model.
Definition coloring_rules_model.h:30
virtual ~ColoringRuleItem()
Destroys the ColoringRuleItem.
Definition coloring_rules_model.cpp:39
QString name_
The display name of the rule.
Definition coloring_rules_model.h:65
bool disabled_
Indicates if the rule is currently disabled.
Definition coloring_rules_model.h:62
ColoringRuleItem & operator=(ColoringRuleItem &rhs)
Assignment operator for ColoringRuleItem.
Definition coloring_rules_model.cpp:64
QColor background_
The background color applied by the rule.
Definition coloring_rules_model.h:74
QString filter_
The display filter string associated with the rule.
Definition coloring_rules_model.h:68
QColor foreground_
The foreground color applied by the rule.
Definition coloring_rules_model.h:71
A model managing the coloring rules for packet display.
Definition coloring_rules_model.h:89
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Retrieves header data for the given section, orientation, and role.
Definition coloring_rules_model.cpp:392
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
Handles dropped MIME data.
Definition coloring_rules_model.cpp:453
QStringList mimeTypes() const
Retrieves the list of supported MIME types for drag and drop operations.
Definition coloring_rules_model.cpp:414
bool exportColors(QString filename, QString &err)
Exports the current coloring rules to a file.
Definition coloring_rules_model.cpp:162
bool writeColors(QString &err)
Writes the coloring rules to the internal configuration.
Definition coloring_rules_model.cpp:176
bool copyRow(int dst_row, int src_row)
Copies a row from one index to another.
Definition coloring_rules_model.cpp:230
ColoringRulesColumn
Defines the columns used in the coloring rules model.
Definition coloring_rules_model.h:109
@ colColoringRulesMax
Definition coloring_rules_model.h:112
@ colFilter
Definition coloring_rules_model.h:111
@ colName
Definition coloring_rules_model.h:110
bool importColors(QString filename, QString &err)
Imports coloring rules from a specified file.
Definition coloring_rules_model.cpp:150
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Sets data in the model for the given index and role.
Definition coloring_rules_model.cpp:309
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Generates an index for the specified row and column.
Definition coloring_rules_model.cpp:511
int columnCount(const QModelIndex &parent=QModelIndex()) const
Returns the number of columns under the given parent.
Definition coloring_rules_model.cpp:569
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex())
Removes rows from the model.
Definition coloring_rules_model.cpp:215
int rowCount(const QModelIndex &parent=QModelIndex()) const
Returns the number of rows under the given parent.
Definition coloring_rules_model.cpp:552
QModelIndex parent(const QModelIndex &indexItem) const
Retrieves the parent index of the specified index.
Definition coloring_rules_model.cpp:533
virtual ~ColoringRulesModel()
Destroys the ColoringRulesModel.
Definition coloring_rules_model.cpp:97
void addColor(color_filter_t *colorf)
Adds a new color rule from a core color filter.
Definition coloring_rules_model.cpp:123
bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex())
Inserts rows into the model.
Definition coloring_rules_model.cpp:195
QMimeData * mimeData(const QModelIndexList &indexes) const
Generates MIME data for the specified list of indexes.
Definition coloring_rules_model.cpp:419
Qt::DropActions supportedDropActions() const
Specifies the supported drag and drop actions.
Definition coloring_rules_model.cpp:409
Base class to inherit basic tree item from.
Definition tree_model_helpers.h:25
Data for a color filter.
Definition color_filters.h:34