mirror of
https://github.com/tnodir/fort
synced 2024-11-15 06:46:41 +00:00
UI: Programs: Improve sorting
This commit is contained in:
parent
118b431245
commit
51cd76d561
@ -428,15 +428,20 @@ QString AppListModel::sqlWhere() const
|
||||
QString AppListModel::sqlOrderColumn() const
|
||||
{
|
||||
QString columnsStr;
|
||||
bool orderApplied = false;
|
||||
|
||||
switch (sortColumn()) {
|
||||
case 0: // Name
|
||||
columnsStr = "t.name " + sqlOrderAsc() + ", t.path";
|
||||
columnsStr = "t.name" + sqlOrderAsc() + ", t.path";
|
||||
orderApplied = true;
|
||||
break;
|
||||
case 1: // Action
|
||||
columnsStr = "alerted DESC, t.kill_process, t.blocked " + sqlOrderAsc() + ", t.app_id";
|
||||
columnsStr = "alerted DESC, t.kill_process, t.blocked" + sqlOrderAsc() + ", t.name";
|
||||
orderApplied = true;
|
||||
break;
|
||||
case 2: // Group
|
||||
columnsStr = "group_index";
|
||||
columnsStr = "group_index" + sqlOrderAsc() + ", t.name";
|
||||
orderApplied = true;
|
||||
break;
|
||||
case 3: // File Path
|
||||
columnsStr = "t.path";
|
||||
@ -446,5 +451,9 @@ QString AppListModel::sqlOrderColumn() const
|
||||
break;
|
||||
}
|
||||
|
||||
if (!orderApplied) {
|
||||
columnsStr += sqlOrderAsc();
|
||||
}
|
||||
|
||||
return columnsStr;
|
||||
}
|
||||
|
@ -68,17 +68,17 @@ QString TableSqlModel::sqlOrder() const
|
||||
if (sortColumn() == -1)
|
||||
return QString();
|
||||
|
||||
return QString(" ORDER BY %1 %2").arg(sqlOrderColumn(), sqlOrderAsc());
|
||||
return " ORDER BY " + sqlOrderColumn();
|
||||
}
|
||||
|
||||
QString TableSqlModel::sqlOrderAsc() const
|
||||
{
|
||||
return (sortOrder() == Qt::AscendingOrder) ? "ASC" : "DESC";
|
||||
return (sortOrder() == Qt::AscendingOrder) ? " ASC" : " DESC";
|
||||
}
|
||||
|
||||
QString TableSqlModel::sqlOrderColumn() const
|
||||
{
|
||||
return QString::number(sortColumn());
|
||||
return QString::number(sortColumn()) + sqlOrderAsc();
|
||||
}
|
||||
|
||||
QString TableSqlModel::sqlLimitOffset() const
|
||||
|
Loading…
Reference in New Issue
Block a user