Commit 3d3783ee authored by Laurent Montel's avatar Laurent Montel 😁

Add prefix for private variable

Test Plan: compile

Reviewers: hein, davidedmundson

Reviewed By: davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D8500
parent e795b8b7
......@@ -32,7 +32,7 @@ MimeTypesModel::MimeTypesModel(QObject *parent) : QAbstractListModel(parent)
m_mimeTypesList = db.allMimeTypes();
qStableSort(m_mimeTypesList.begin(), m_mimeTypesList.end(), lessThan);
checkedRows = QVector<bool>(m_mimeTypesList.size(), false);
m_checkedRows = QVector<bool>(m_mimeTypesList.size(), false);
}
MimeTypesModel::~MimeTypesModel()
......@@ -70,7 +70,7 @@ QVariant MimeTypesModel::data(const QModelIndex &index, int role) const
}
case Qt::CheckStateRole:
return checkedRows.at(index.row()) ? Qt::Checked : Qt::Unchecked;
return m_checkedRows.at(index.row()) ? Qt::Checked : Qt::Unchecked;
}
return QVariant();
......@@ -84,8 +84,8 @@ bool MimeTypesModel::setData(const QModelIndex &index, const QVariant &value, in
if (role == Qt::CheckStateRole) {
const bool newChecked = value.toBool();
if (checkedRows.at(index.row()) != newChecked) {
checkedRows[index.row()] = newChecked;
if (m_checkedRows.at(index.row()) != newChecked) {
m_checkedRows[index.row()] = newChecked;
emit dataChanged(index, index, {role});
emit checkedTypesChanged();
return true;
......@@ -97,7 +97,7 @@ bool MimeTypesModel::setData(const QModelIndex &index, const QVariant &value, in
void MimeTypesModel::checkAll()
{
checkedRows = QVector<bool>(m_mimeTypesList.size(), true);
m_checkedRows = QVector<bool>(m_mimeTypesList.size(), true);
emit dataChanged(index(0, 0), index(m_mimeTypesList.size() - 1, 0));
......@@ -118,8 +118,8 @@ QStringList MimeTypesModel::checkedTypes() const
{
QStringList list;
for (int i =0; i < checkedRows.size(); ++i) {
if (checkedRows.at(i)) {
for (int i =0; i < m_checkedRows.size(); ++i) {
if (m_checkedRows.at(i)) {
list.append(m_mimeTypesList.at(i).name());
}
}
......@@ -133,13 +133,13 @@ QStringList MimeTypesModel::checkedTypes() const
void MimeTypesModel::setCheckedTypes(const QStringList &list)
{
checkedRows = QVector<bool>(m_mimeTypesList.size(), false);
m_checkedRows = QVector<bool>(m_mimeTypesList.size(), false);
foreach (const QString &name, list) {
const int row = indexOfType(name);
if (row != -1) {
checkedRows[row] = true;
m_checkedRows[row] = true;
}
}
......
......@@ -53,7 +53,7 @@ class MimeTypesModel : public QAbstractListModel
int indexOfType(const QString &name) const;
QList<QMimeType> m_mimeTypesList;
QVector<bool> checkedRows;
QVector<bool> m_checkedRows;
};
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment