void KFileItemModel::onGroupedSortingChanged(bool current)
{
- Q_UNUSED(current);
+ Q_UNUSED(current)
m_groups.clear();
}
void KFileItemModel::onSortRoleChanged(const QByteArray& current, const QByteArray& previous, bool resortItems)
{
- Q_UNUSED(previous);
+ Q_UNUSED(previous)
m_sortRole = typeForRole(current);
if (!m_requestRole[m_sortRole]) {
void KFileItemModel::onSortOrderChanged(Qt::SortOrder current, Qt::SortOrder previous)
{
- Q_UNUSED(current);
- Q_UNUSED(previous);
+ Q_UNUSED(current)
+ Q_UNUSED(previous)
resortAllItems();
}
void KFileItemModel::slotCompleted()
{
+ m_maximumUpdateIntervalTimer->stop();
dispatchPendingItemsToInsert();
if (!m_urlsToExpand.isEmpty()) {
}
}
- if (useMaximumUpdateInterval() && !m_maximumUpdateIntervalTimer->isActive()) {
+ if (!m_maximumUpdateIntervalTimer->isActive()) {
// Assure that items get dispatched if no completed() or canceled() signal is
// emitted during the maximum update interval.
m_maximumUpdateIntervalTimer->start();
if (m_requestRole[DestinationRole]) {
QString destination = item.linkDest();
if (destination.isEmpty()) {
- destination = QStringLiteral("-");
+ destination = QLatin1Char('-');
}
data.insert(sharedValue("destination"), destination);
}
default: {
const QByteArray role = roleForType(m_sortRole);
- result = QString::compare(a->values.value(role).toString(),
- b->values.value(role).toString());
+ const QString roleValueA = a->values.value(role).toString();
+ const QString roleValueB = b->values.value(role).toString();
+ if (!roleValueA.isEmpty() && roleValueB.isEmpty()) {
+ result = -1;
+ } else if (roleValueA.isEmpty() && !roleValueB.isEmpty()) {
+ result = +1;
+ } else {
+ result = QString::compare(roleValueA, roleValueB);
+ }
break;
}
return QString::compare(a, b, Qt::CaseSensitive);
}
-bool KFileItemModel::useMaximumUpdateInterval() const
-{
- return !m_dirLister->url().isLocalFile();
-}
-
QList<QPair<int, QVariant> > KFileItemModel::nameRoleGroups() const
{
Q_ASSERT(!m_itemData.isEmpty());