fix google-chrome context menu error

This commit is contained in:
guorongfei 2024-03-25 16:42:31 +08:00
parent d34983f9a7
commit 97b15a9dd9
1 changed files with 6 additions and 2 deletions

View File

@ -68,7 +68,8 @@ QString ConvertDesktopToWinId::confirmDesktopFile(int id)
//第一种方法:比较名字一致性
if (m_desktopfilePath.isEmpty()) {
m_className = kdk::WindowManager::getWindowGroup(id);
// getWindowGroup 这个方法的实现有异常,如果单例没有初始化会直接返回空,加上 self 保证初始化。
m_className = kdk::WindowManager::self()->getWindowGroup(id);
//匹配安卓兼容
if (m_className == "kylin-kmre-window") {
@ -203,7 +204,10 @@ void ConvertDesktopToWinId::compareClassName()
}
path_desktop_name = path_desktop_name.mid(path_desktop_name.lastIndexOf("/") + 1);
path_desktop_name = path_desktop_name.left(path_desktop_name.lastIndexOf("."));
if (path_desktop_name == m_className || path_desktop_name == m_statusName) {
// Chrome 浏览器的 ClassName 是 Google-chromedestkop 名是 google-crhome忽略大小写以适配这种情况。
if (QString::compare(path_desktop_name, m_className, Qt::CaseInsensitive) == 0
|| QString::compare(path_desktop_name, m_statusName, Qt::CaseInsensitive) == 0) {
m_desktopfilePath = fileInfo.filePath();
break;
}