Skip to content

Commit 1a936eb

Browse files
committed
fix: ensure remove tone for pinyin first letter search
确保简拼获取时没有音调. PMS: BUG-333411 Log:
1 parent d3f17a6 commit 1a936eb

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Build-Depends:
1818
qt6-wayland-dev,
1919
qt6-wayland-private-dev,
2020
libdtkcommon-dev,
21-
libdtk6core-dev,
21+
libdtk6core-dev (>= 6.0.43),
2222
# v-- provides qdbusxml2cpp-fix binary
2323
libdtk6core-bin,
2424
# v-- provides DHiDPIHelper

src/models/searchfilterproxymodel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ int SearchFilterProxyModel::calculateWeight(const QModelIndex &modelIndex) const
9090
const QString & vendor = modelIndex.data(AppItem::VendorRole).toString();
9191
const QString & genericName = modelIndex.data(AppItem::GenericNameRole).toString();
9292
const QString & transliterated = modelIndex.data(AppsModel::AllTransliteratedRole).toString();
93-
const QString & jianpin = Dtk::Core::firstLetters(displayName).join(',');
93+
const QString & jianpin = Dtk::Core::firstLetters(displayName, TS_NoneTone).join(',');
9494

9595
//包名搜索使用
9696
const QString & desktopId = modelIndex.data(AppItem::DesktopIdRole).toString();

tests/searchfilterproxymodeltest.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ void TestSearchFilterProxyModel::setupTestData()
8080
testItems.append(createTestAppItem("org.deepin.music", "音乐", "音乐播放器", "音乐", "deepin", 12));
8181
testItems.append(createTestAppItem("org.deepin.reader", "阅读器", "文档阅读器", "阅读", "deepin", 7));
8282
testItems.append(createTestAppItem("org.deepin.calendar", "日历", "日历", "日历", "deepin", 4));
83+
testItems.append(createTestAppItem("org.deepin.defender", "安全中心", "安全中心", "安全中心", "deepin", 4));
8384

8485
// 包含特殊符号的应用
8586
testItems.append(createTestAppItem("org.special.app1", "App@Name", "App@Name", "", "special", 1));
@@ -213,6 +214,11 @@ void TestSearchFilterProxyModel::testPinyinSearch()
213214
qCDebug(logTest) << "Pinyin initials search for 'rl' returned" << model.rowCount() << "items";
214215
QCOMPARE(model.rowCount(), 1);
215216
QCOMPARE(model.data(model.index(0, 0), AppItem::DesktopIdRole).toString(), "org.deepin.calendar");
217+
qCDebug(logTest) << "Testing Pinyin initials match for 'aqzx'";
218+
model.setFilterRegularExpression(QRegularExpression("aqzx"));
219+
qCDebug(logTest) << "Pinyin initials search for 'aqzx' returned" << model.rowCount() << "items";
220+
QCOMPARE(model.rowCount(), 1);
221+
QCOMPARE(model.data(model.index(0, 0), AppItem::DesktopIdRole).toString(), "org.deepin.defender");
216222
qCInfo(logTest) << "Pinyin search tests completed successfully";
217223
}
218224

0 commit comments

Comments
 (0)