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 override;
166 QVariant
data(
const QModelIndex &
index,
int role)
const override;
175 bool setData(
const QModelIndex &
index,
const QVariant &value,
int role = Qt::EditRole)
override;
184 QVariant
headerData(
int section, Qt::Orientation orientation,
185 int role = Qt::DisplayRole)
const override;
194 QModelIndex
index(
int row,
int column,
195 const QModelIndex &
parent = QModelIndex())
const override;
202 QModelIndex
parent(
const QModelIndex &indexItem)
const override;
222 QMimeData*
mimeData(
const QModelIndexList &indexes)
const override;
233 bool dropMimeData(
const QMimeData *data, Qt::DropAction action,
int row,
int column,
const QModelIndex &
parent)
override;
240 int rowCount(
const QModelIndex &
parent = QModelIndex())
const override;
256 bool insertRows(
int row,
int count,
const QModelIndex &
parent = QModelIndex())
override;
265 bool removeRows(
int row,
int count,
const QModelIndex &
parent = QModelIndex())
override;
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
ColoringRuleItem(bool disabled, QString name, QString filter, QColor foreground, QColor background, ColoringRuleItem *parent)
Constructs a new ColoringRuleItem.
Definition coloring_rules_model.cpp:29
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
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Sets data in the model for the given index and role.
Definition coloring_rules_model.cpp:309
QStringList mimeTypes() const override
Retrieves the list of supported MIME types for drag and drop operations.
Definition coloring_rules_model.cpp:406
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override
Handles dropped MIME data.
Definition coloring_rules_model.cpp:445
QVariant data(const QModelIndex &index, int role) const override
Retrieves data from the model for the given index and role.
Definition coloring_rules_model.cpp:273
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Generates an index for the specified row and column.
Definition coloring_rules_model.cpp:503
ColoringRulesModel(QColor defaultForeground, QColor defaultBackground, QObject *parent)
Constructs a new ColoringRulesModel.
Definition coloring_rules_model.cpp:86
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of columns under the given parent.
Definition coloring_rules_model.cpp:561
bool exportColors(QString filename, QString &err)
Exports the current coloring rules to a file.
Definition coloring_rules_model.cpp:162
Qt::DropActions supportedDropActions() const override
Specifies the supported drag and drop actions.
Definition coloring_rules_model.cpp:401
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
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows under the given parent.
Definition coloring_rules_model.cpp:544
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
QMimeData * mimeData(const QModelIndexList &indexes) const override
Generates MIME data for the specified list of indexes.
Definition coloring_rules_model.cpp:411
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
Removes rows from the model.
Definition coloring_rules_model.cpp:215
Qt::ItemFlags flags(const QModelIndex &index) const override
Retrieves the item flags for a given index.
Definition coloring_rules_model.cpp:251
bool insertRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
Inserts rows into the model.
Definition coloring_rules_model.cpp:195
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
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Retrieves header data for the given section, orientation, and role.
Definition coloring_rules_model.cpp:384
QModelIndex parent(const QModelIndex &indexItem) const override
Retrieves the parent index of the specified index.
Definition coloring_rules_model.cpp:525
ModelHelperTreeItem(ColoringRuleItem *parent)
Definition tree_model_helpers.h:31
struct _color_filter color_filter_t
Data for a color filter.