fix: 获取到应用程序的预览图后删除产生的临时文件

通过KWin接口获取到应用的缩略图后及时删除临时文件,避免临时文件过多占用硬盘空间

Log: 修复/tmp目录下有很多Kwin的截图的问题
Bug: https://pms.uniontech.com/bug-view-113822.html
Influence: 预览时不会在tmp目录产生临时文件
Change-Id: I258425279b6cb7448d9636308e2a1e65eec010fe
This commit is contained in:
chenjun 2022-02-28 19:08:05 +08:00
parent 49d37a6c06
commit b377b0136c

View File

@ -222,8 +222,14 @@ void AppSnapshot::fetchSnapshot()
QDBusReply<QString> reply = interface.callWithArgumentList(QDBus::Block,QStringLiteral("screenshotForWindowExtend"), args);
if(reply.isValid()){
m_snapshot.load(reply.value());
qDebug() << "reply: "<<reply.value();
const QString tmpFile = reply.value();
if (QFile::exists(tmpFile)) {
m_snapshot.load(tmpFile);
qDebug() << "reply: " << tmpFile;
QFile::remove(tmpFile);
} else {
qDebug() << "get current workspace bckground error, file does not exist : " << tmpFile;
}
} else {
qDebug() << "get current workspace bckground error: "<< reply.error().message();
}