diff options
| author | 2015-04-04 14:41:10 -0400 | |
|---|---|---|
| committer | 2015-04-04 14:41:10 -0400 | |
| commit | b5f93b05578293d1d233b4920a28a5c2fd826f94 (patch) | |
| tree | 82332679f647e9c76e331206786d07a58dcfa9b8 /SQLiteStudio3/guiSQLiteStudio/dblistmodel.cpp | |
| parent | af8a7a3e3dccf9c9ad257e3952173d180c8a7421 (diff) | |
| parent | a5b034d4a9c44f9bc1e83b01de82530f8fc63013 (diff) | |
Merge tag 'upstream/3.0.4'
Upstream version 3.0.4
# gpg: Signature made Sat 04 Apr 2015 02:41:09 PM EDT using RSA key ID EBE9BD91
# gpg: Good signature from "Unit 193 <unit193@gmail.com>"
# gpg: aka "Unit 193 <unit193@ninthfloor.org>"
# gpg: aka "Unit 193 <unit193@ubuntu.com>"
# gpg: aka "Unit 193 <unit193@ninthfloor.com>"
Diffstat (limited to 'SQLiteStudio3/guiSQLiteStudio/dblistmodel.cpp')
| -rw-r--r-- | SQLiteStudio3/guiSQLiteStudio/dblistmodel.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/SQLiteStudio3/guiSQLiteStudio/dblistmodel.cpp b/SQLiteStudio3/guiSQLiteStudio/dblistmodel.cpp index af9da8f..8153fed 100644 --- a/SQLiteStudio3/guiSQLiteStudio/dblistmodel.cpp +++ b/SQLiteStudio3/guiSQLiteStudio/dblistmodel.cpp @@ -77,6 +77,8 @@ void DbListModel::setSortMode(const QString& sortMode) this->sortMode = SortMode::LikeDbTree; else if (sortMode == "Alphabetical") this->sortMode = SortMode::Alphabetical; + else if (sortMode == "AlphabeticalCaseInsensitive") + this->sortMode = SortMode::AlphabeticalCaseInsensitive; else this->sortMode = SortMode::ConnectionOrder; @@ -91,6 +93,8 @@ QString DbListModel::getSortModeString() const return "LikeDbTree"; case DbListModel::SortMode::Alphabetical: return "Alphabetical"; + case DbListModel::SortMode::AlphabeticalCaseInsensitive: + return "AlphabeticalCaseInsensitive"; case DbListModel::SortMode::ConnectionOrder: break; } @@ -119,6 +123,12 @@ void DbListModel::sort() qSort(dbList.begin(), dbList.end(), comparer); break; } + case DbListModel::SortMode::AlphabeticalCaseInsensitive: + { + AlphaComparer comparer(Qt::CaseInsensitive); + qSort(dbList.begin(), dbList.end(), comparer); + break; + } case DbListModel::SortMode::ConnectionOrder: break; } @@ -183,7 +193,12 @@ bool DbListModel::DbTreeComparer::operator()(Db* db1, Db* db2) return dbTreeOrder.indexOf(db1->getName()) < dbTreeOrder.indexOf(db2->getName()); } +DbListModel::AlphaComparer::AlphaComparer(Qt::CaseSensitivity cs) : + cs(cs) +{ +} + bool DbListModel::AlphaComparer::operator()(Db* db1, Db* db2) { - return db1->getName().compare(db2->getName()) < 0; + return db1->getName().compare(db2->getName(), cs) < 0; } |
