mirror of https://gitee.com/openkylin/peony.git
[FIX]修复U盘没有按照规则排序的问题[LINK]bug#160879
This commit is contained in:
parent
7bbd04104c
commit
69bdcdac7f
|
@ -99,6 +99,7 @@ bool SideBarProxyFilterSortModel::filterAcceptsRow(int sourceRow, const QModelIn
|
|||
if (!m_show_hidden) {
|
||||
return !item->displayName().startsWith(".");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -119,7 +120,51 @@ bool SideBarProxyFilterSortModel::lessThan(const QModelIndex &left, const QModel
|
|||
if (leftItem->type() != SideBarAbstractItem::FileSystemItem || rightItem->type() != SideBarAbstractItem::FileSystemItem) {
|
||||
return false;
|
||||
}
|
||||
//qDebug()<<leftItem->displayName()<<rightItem->displayName();
|
||||
|
||||
if (left.parent().data(Qt::UserRole).toString().compare("computer:///") == 0
|
||||
&& right.parent().data(Qt::UserRole).toString().compare("computer:///") == 0) {
|
||||
if (leftItem->uri().compare("file:///") == 0) {
|
||||
return false;
|
||||
}
|
||||
if (rightItem->uri().compare("file:///") == 0) {
|
||||
return true;
|
||||
}
|
||||
if (leftItem->uri().compare("computer:///ukui-data-volume") == 0) {
|
||||
return false;
|
||||
}
|
||||
if (rightItem->uri().compare("computer:///ukui-data-volume") == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((!(leftItem->isEjectable() || leftItem->isStopable()) && !leftItem->getDevice().startsWith("/dev/bus/usb"))
|
||||
&& (!(rightItem->isEjectable() || rightItem->isStopable()) && !rightItem->getDevice().startsWith("/dev/bus/usb"))) {
|
||||
return m_comparer.compare(leftItem->getDevice(), rightItem->getDevice()) > 0;
|
||||
} else if (!(leftItem->isEjectable() || leftItem->isStopable()) && !leftItem->getDevice().startsWith("/dev/bus/usb")) {
|
||||
return false;
|
||||
} else if (!(rightItem->isEjectable() || rightItem->isStopable()) && !rightItem->getDevice().startsWith("/dev/bus/usb")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (((leftItem->isEjectable() || leftItem->isStopable()) && !leftItem->getDevice().startsWith("/dev/sr"))
|
||||
&& ((rightItem->isEjectable() || rightItem->isStopable()) && !rightItem->getDevice().startsWith("/dev/sr"))) {
|
||||
return m_comparer.compare(leftItem->getDevice(), rightItem->getDevice()) > 0;
|
||||
} else if ((leftItem->isEjectable() || leftItem->isStopable()) && !leftItem->getDevice().startsWith("/dev/sr")) {
|
||||
return false;
|
||||
} else if ((rightItem->isEjectable() || rightItem->isEjectable()) && !rightItem->getDevice().startsWith("/dev/sr")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (leftItem->getDevice().startsWith("/dev/bus/usb") && rightItem->getDevice().startsWith("/dev/bus/usb")) {
|
||||
return m_comparer.compare(leftItem->getDevice(), rightItem->getDevice()) > 0;
|
||||
} else if (leftItem->getDevice().startsWith("/dev/bus/usb")) {
|
||||
return false;
|
||||
} else if (rightItem->getDevice().startsWith("/dev/bus/usb")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return m_comparer.compare(leftItem->getDevice(), rightItem->getDevice()) > 0;
|
||||
}
|
||||
|
||||
return m_comparer.compare(leftItem->displayName(), rightItem->displayName()) > 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue