, m_sortDirsFirst(true)
, m_sortHiddenLast(false)
, m_sortRole(NameRole)
+ , m_groupRole(NoRole)
, m_sortingProgressPercent(-1)
, m_roles()
, m_itemData()
KFileItemModel::ItemGroupInfo KFileItemModel::nameRoleGroup(const ItemData *itemData, bool withString) const
{
+ static bool oldWithString;
static ItemGroupInfo oldGroupInfo;
static QChar oldFirstChar;
ItemGroupInfo groupInfo;
// Use the first character of the name as group indication
firstChar = name.at(0).toUpper();
-
- if (firstChar == oldFirstChar) {
+
+ if (firstChar == oldFirstChar && withString == oldWithString) {
return oldGroupInfo;
}
if (firstChar == QLatin1Char('~') && name.length() > 1) {
}
groupInfo.comparable = (int)'.';
}
+ oldWithString = withString;
oldFirstChar = firstChar;
oldGroupInfo = groupInfo;
return groupInfo;
KFileItemModel::ItemGroupInfo
KFileItemModel::timeRoleGroup(const std::function<QDateTime(const ItemData *)> &fileTimeCb, const ItemData *itemData, bool withString) const
{
+ static bool oldWithString;
static ItemGroupInfo oldGroupInfo;
static QDate oldFileDate;
ItemGroupInfo groupInfo;
const QDate fileDate = fileTime.date();
const int daysDistance = fileDate.daysTo(currentDate);
+ if (fileDate == oldFileDate && withString == oldWithString) {
+ return oldGroupInfo;
+ }
// Simplified grouping algorithm, preserving dates
// but not taking "pretty printing" into account
if (currentDate.year() == fileDate.year() && currentDate.month() == fileDate.month()) {
}
}
}
+ oldWithString = withString;
oldFileDate = fileDate;
oldGroupInfo = groupInfo;
return groupInfo;
KFileItemModel::ItemGroupInfo KFileItemModel::permissionRoleGroup(const ItemData *itemData, bool withString) const
{
+ static bool oldWithString;
static ItemGroupInfo oldGroupInfo;
static QFileDevice::Permissions oldPermissions;
ItemGroupInfo groupInfo;
const QFileInfo info(itemData->item.url().toLocalFile());
const QFileDevice::Permissions permissions = info.permissions();
- if (permissions == oldPermissions) {
+ if (permissions == oldPermissions && withString == oldWithString) {
return oldGroupInfo;
}
groupInfo.comparable = (int)permissions;
others = others.isEmpty() ? i18nc("@item:intext Access permission, concatenated", "Forbidden") : others.mid(0, others.length() - 2);
groupInfo.text = i18nc("@title:group Files and folders by permissions", "User: %1 | Group: %2 | Others: %3", user, group, others);
}
+ oldWithString = withString;
oldPermissions = permissions;
oldGroupInfo = groupInfo;
return groupInfo;