┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kfileitemmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kitemviews/kfileitemmodel.cpp')
-rw-r--r--src/kitemviews/kfileitemmodel.cpp34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp
index 5f6fed0dc..8626f947d 100644
--- a/src/kitemviews/kfileitemmodel.cpp
+++ b/src/kitemviews/kfileitemmodel.cpp
@@ -41,7 +41,6 @@
KFileItemModel::KFileItemModel(QObject* parent) :
KItemModelBase("text", parent),
m_dirLister(0),
- m_naturalSorting(GeneralSettings::naturalSorting()),
m_sortDirsFirst(true),
m_sortRole(NameRole),
m_sortingProgressPercent(-1),
@@ -58,9 +57,10 @@ KFileItemModel::KFileItemModel(QObject* parent) :
m_expandedDirs(),
m_urlsToExpand()
{
- m_collator.setCaseSensitivity(Qt::CaseInsensitive);
m_collator.setNumericMode(true);
+ loadSortingSettings();
+
m_dirLister = new KFileItemModelDirLister(this);
m_dirLister->setDelayedMimeTypes(true);
@@ -106,8 +106,7 @@ KFileItemModel::KFileItemModel(QObject* parent) :
m_resortAllItemsTimer->setSingleShot(true);
connect(m_resortAllItemsTimer, &QTimer::timeout, this, &KFileItemModel::resortAllItems);
- connect(GeneralSettings::self(), &GeneralSettings::naturalSortingChanged,
- this, &KFileItemModel::slotNaturalSortingChanged);
+ connect(GeneralSettings::self(), &GeneralSettings::sortingChoiceChanged, this, &KFileItemModel::slotSortingChoiceChanged);
}
KFileItemModel::~KFileItemModel()
@@ -783,6 +782,27 @@ void KFileItemModel::onSortOrderChanged(Qt::SortOrder current, Qt::SortOrder pre
resortAllItems();
}
+void KFileItemModel::loadSortingSettings()
+{
+ using Choice = GeneralSettings::EnumSortingChoice;
+ switch (GeneralSettings::sortingChoice()) {
+ case Choice::NaturalSorting:
+ m_naturalSorting = true;
+ m_collator.setCaseSensitivity(Qt::CaseInsensitive);
+ break;
+ case Choice::CaseSensitiveSorting:
+ m_naturalSorting = false;
+ m_collator.setCaseSensitivity(Qt::CaseSensitive);
+ break;
+ case Choice::CaseInsensitiveSorting:
+ m_naturalSorting = false;
+ m_collator.setCaseSensitivity(Qt::CaseInsensitive);
+ break;
+ default:
+ Q_UNREACHABLE();
+ }
+}
+
void KFileItemModel::resortAllItems()
{
m_resortAllItemsTimer->stop();
@@ -1103,9 +1123,9 @@ void KFileItemModel::slotClear()
m_expandedDirs.clear();
}
-void KFileItemModel::slotNaturalSortingChanged()
+void KFileItemModel::slotSortingChoiceChanged()
{
- m_naturalSorting = GeneralSettings::naturalSorting();
+ loadSortingSettings();
resortAllItems();
}
@@ -2200,7 +2220,7 @@ const KFileItemModel::RoleInfoMap* KFileItemModel::rolesInfoMap(int& count)
{ "track", TrackRole, I18N_NOOP2_NOSTRIP("@label", "Track"), I18N_NOOP2_NOSTRIP("@label", "Audio"), true, true },
{ "path", PathRole, I18N_NOOP2_NOSTRIP("@label", "Path"), I18N_NOOP2_NOSTRIP("@label", "Other"), false, false },
{ "destination", DestinationRole, I18N_NOOP2_NOSTRIP("@label", "Link Destination"), I18N_NOOP2_NOSTRIP("@label", "Other"), false, false },
- { "copiedFrom", CopiedFromRole, I18N_NOOP2_NOSTRIP("@label", "Copied From"), I18N_NOOP2_NOSTRIP("@label", "Other"), true, false },
+ { "originUrl", OriginUrlRole, I18N_NOOP2_NOSTRIP("@label", "Downloaded From"), I18N_NOOP2_NOSTRIP("@label", "Other"), true, false },
{ "permissions", PermissionsRole, I18N_NOOP2_NOSTRIP("@label", "Permissions"), I18N_NOOP2_NOSTRIP("@label", "Other"), false, false },
{ "owner", OwnerRole, I18N_NOOP2_NOSTRIP("@label", "Owner"), I18N_NOOP2_NOSTRIP("@label", "Other"), false, false },
{ "group", GroupRole, I18N_NOOP2_NOSTRIP("@label", "User Group"), I18N_NOOP2_NOSTRIP("@label", "Other"), false, false },