forked from openkylin/ukui-menu
修改全部应用界面应用排序顺序
This commit is contained in:
parent
841fd7571d
commit
6d9742c5f7
|
@ -158,8 +158,13 @@ bool AllAppDataProvider::appDataSort(const DataEntity &a, const DataEntity &b)
|
|||
} else if ((a.top() == 0) && (b.top() == 0)) {
|
||||
if (a.isRecentInstall()) {
|
||||
if (b.isRecentInstall()) {
|
||||
if (QDateTime::fromString(a.insertTime(), "yyyy-MM-dd hh:mm:ss")
|
||||
!= QDateTime::fromString(b.insertTime(), "yyyy-MM-dd hh:mm:ss")) {
|
||||
return QDateTime::fromString(a.insertTime(), "yyyy-MM-dd hh:mm:ss")
|
||||
> QDateTime::fromString(b.insertTime(), "yyyy-MM-dd hh:mm:ss");
|
||||
} else {
|
||||
return letterSort(a.firstLetter(), b.firstLetter());
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
@ -188,6 +193,14 @@ void AllAppDataProvider::setRecentState(DataEntity &app)
|
|||
app.setRecentInstall(false);
|
||||
}
|
||||
|
||||
bool AllAppDataProvider::letterSort(const QString &a, const QString &b)
|
||||
{
|
||||
if (QString::compare(a, b, Qt::CaseInsensitive) == 0) {
|
||||
return false;
|
||||
}
|
||||
return QString::compare(a, b, Qt::CaseInsensitive) > 0 ? false : true;
|
||||
}
|
||||
|
||||
void AllAppDataProvider::sendData()
|
||||
{
|
||||
QVector<DataEntity> data;
|
||||
|
|
|
@ -55,6 +55,7 @@ private:
|
|||
void updateData(const QList<DataEntity>& apps);
|
||||
static bool appDataSort(const DataEntity &a, const DataEntity &b);
|
||||
static void setRecentState(DataEntity &app);
|
||||
static bool letterSort(const QString &a, const QString &b);
|
||||
|
||||
private:
|
||||
QMutex m_mutex;
|
||||
|
|
Loading…
Reference in New Issue