diff --git a/src/dde-lock/lockframe.cpp b/src/dde-lock/lockframe.cpp index cf594bcb..55dc7274 100644 --- a/src/dde-lock/lockframe.cpp +++ b/src/dde-lock/lockframe.cpp @@ -171,7 +171,12 @@ bool LockFrame::event(QEvent *event) } if (keyValue != "") { +#ifdef ENABLE_DSS_SNIPE + // v25 dde-daemon接受小驼峰命名的name + emit sendKeyValue(qtifyName(keyValue)); +#else emit sendKeyValue(keyValue); +#endif } } return FullScreenBackground::event(event); diff --git a/src/global_util/public_func.cpp b/src/global_util/public_func.cpp index 20940968..dbddc5d9 100644 --- a/src/global_util/public_func.cpp +++ b/src/global_util/public_func.cpp @@ -356,3 +356,21 @@ bool isSleepLock() return value.toBool(); } #endif + +QString qtifyName(const QString &name) { + bool next_cap = false; + QString result; + + for (auto it = name.cbegin(); it != name.cend(); ++it) { + if (*it == '-') { + next_cap = true; + } else if (next_cap) { + result.append(it->toUpper()); + next_cap = false; + } else { + result.append(*it); + } + } + + return result; +} \ No newline at end of file diff --git a/src/global_util/public_func.h b/src/global_util/public_func.h index 38e010bc..22a98a2a 100644 --- a/src/global_util/public_func.h +++ b/src/global_util/public_func.h @@ -82,4 +82,10 @@ void configWebEngine(); bool isSleepLock(); #endif +/** + * @brief convert 'some-key' to 'someKey'. + */ + +QString qtifyName(const QString &name); + #endif // PUBLIC_FUNC_H