Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit ad261afa authored by Daniel Nicoletti's avatar Daniel Nicoletti

Do not sort printers by default and remote

BUG: 365804
parent 6547b707
......@@ -78,23 +78,23 @@ bool PrinterSortFilterModel::filterAcceptsRow(int source_row, const QModelIndex
return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
}
bool PrinterSortFilterModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
{
bool leftIsRemote = sourceModel()->data(left, PrinterModel::DestRemote).toBool();
bool rightIsRemote = sourceModel()->data(right, PrinterModel::DestRemote).toBool();
bool leftDefault = sourceModel()->data(left, PrinterModel::DestIsDefault).toBool();
bool rightDefault = sourceModel()->data(right, PrinterModel::DestIsDefault).toBool();
if (leftDefault != rightDefault) {
return leftDefault;
}
if (leftIsRemote != rightIsRemote) {
// If the right item is a remote the left should move right
return rightIsRemote;
}
return QSortFilterProxyModel::lessThan(left, right);
}
//bool PrinterSortFilterModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
//{
// bool leftIsRemote = sourceModel()->data(left, PrinterModel::DestRemote).toBool();
// bool rightIsRemote = sourceModel()->data(right, PrinterModel::DestRemote).toBool();
// bool leftDefault = sourceModel()->data(left, PrinterModel::DestIsDefault).toBool();
// bool rightDefault = sourceModel()->data(right, PrinterModel::DestIsDefault).toBool();
// if (leftDefault != rightDefault) {
// return leftDefault;
// }
// if (leftIsRemote != rightIsRemote) {
// // If the right item is a remote the left should move right
// return rightIsRemote;
// }
// return QSortFilterProxyModel::lessThan(left, right);
//}
#include "moc_PrinterSortFilterModel.cpp"
......@@ -43,7 +43,7 @@ signals:
private:
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const Q_DECL_OVERRIDE;
bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE;
// bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE;
QStringList m_filteredPrinters;
};
......
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