summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Libraries/LibGUI/GSortingProxyModel.cpp6
-rw-r--r--Libraries/LibGUI/GSortingProxyModel.h4
2 files changed, 9 insertions, 1 deletions
diff --git a/Libraries/LibGUI/GSortingProxyModel.cpp b/Libraries/LibGUI/GSortingProxyModel.cpp
index 5bf379695b..0876f960d9 100644
--- a/Libraries/LibGUI/GSortingProxyModel.cpp
+++ b/Libraries/LibGUI/GSortingProxyModel.cpp
@@ -87,7 +87,11 @@ void GSortingProxyModel::resort()
auto data2 = target().data(target().index(row2, m_key_column), GModel::Role::Sort);
if (data1 == data2)
return 0;
- bool is_less_than = data1 < data2;
+ bool is_less_than;
+ if (data1.is_string() && data2.is_string() && !m_sorting_case_sensitive)
+ is_less_than = data1.as_string().to_lowercase() < data2.as_string().to_lowercase();
+ else
+ is_less_than = data1 < data2;
return m_sort_order == GSortOrder::Ascending ? is_less_than : !is_less_than;
});
if (previously_selected_target_row != -1) {
diff --git a/Libraries/LibGUI/GSortingProxyModel.h b/Libraries/LibGUI/GSortingProxyModel.h
index d9f64a1ac1..a70ab4ce05 100644
--- a/Libraries/LibGUI/GSortingProxyModel.h
+++ b/Libraries/LibGUI/GSortingProxyModel.h
@@ -29,8 +29,12 @@ private:
void resort();
+ void set_sorting_case_sensitive(bool b) { m_sorting_case_sensitive = b; }
+ bool is_sorting_case_sensitive() { return m_sorting_case_sensitive; }
+
NonnullRefPtr<GModel> m_target;
Vector<int> m_row_mappings;
int m_key_column { -1 };
GSortOrder m_sort_order { GSortOrder::Ascending };
+ bool m_sorting_case_sensitive { false };
};