mirror of
https://github.com/tnodir/fort
synced 2024-11-15 09:45:44 +00:00
UI: AppListModel: Simplify sqlOrderColumn()
This commit is contained in:
parent
9d14522523
commit
ac9a59c1cf
@ -287,7 +287,6 @@ QVariant AppListModel::dataDecoration(const QModelIndex &index) const
|
|||||||
{
|
{
|
||||||
const int column = index.column();
|
const int column = index.column();
|
||||||
|
|
||||||
if (column == 0 || column == 1 || column == 3 || column == 4) {
|
|
||||||
const int row = index.row();
|
const int row = index.row();
|
||||||
|
|
||||||
const auto appRow = appRowAt(row);
|
const auto appRow = appRowAt(row);
|
||||||
@ -304,7 +303,6 @@ QVariant AppListModel::dataDecoration(const QModelIndex &index) const
|
|||||||
case 4:
|
case 4:
|
||||||
return appScheduledIcon(appRow);
|
return appScheduledIcon(appRow);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@ -482,13 +480,10 @@ QString AppListModel::sqlWhere() const
|
|||||||
QString AppListModel::sqlOrderColumn() const
|
QString AppListModel::sqlOrderColumn() const
|
||||||
{
|
{
|
||||||
QString columnsStr;
|
QString columnsStr;
|
||||||
bool orderApplied = false;
|
|
||||||
|
|
||||||
switch (sortColumn()) {
|
switch (sortColumn()) {
|
||||||
case 0: // Name
|
case 0: // Name
|
||||||
columnsStr = "t.name" + sqlOrderAsc() + ", t.path";
|
return "t.name" + sqlOrderAsc() + ", t.path";
|
||||||
orderApplied = true;
|
|
||||||
break;
|
|
||||||
case 1: // Action
|
case 1: // Action
|
||||||
columnsStr = "alerted DESC, t.kill_process, t.blocked";
|
columnsStr = "alerted DESC, t.kill_process, t.blocked";
|
||||||
break;
|
break;
|
||||||
@ -509,9 +504,5 @@ QString AppListModel::sqlOrderColumn() const
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!orderApplied) {
|
return columnsStr + sqlOrderAsc() + ", t.name";
|
||||||
columnsStr += sqlOrderAsc() + ", t.name";
|
|
||||||
}
|
|
||||||
|
|
||||||
return columnsStr;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user