[FIX] #191467 【蓝牙】蓝牙文件发送功能测试-文件选择

note:
文件操作层会设置QApplication是否在关闭所有窗口时退出,这个流程不应该影响peony以外的应用
This commit is contained in:
Yue-Lan 2023-09-14 14:21:04 +08:00
parent cc4bbcc2e0
commit 2905b8c89e
2 changed files with 17 additions and 16 deletions

View File

@ -316,32 +316,32 @@ void FileOperationManager::startOperation(FileOperation *operation, bool addToHi
}
start:
static bool oldQuitOnLastWindow = QApplication::quitOnLastWindowClosed();
QApplication::setQuitOnLastWindowClosed(false);
connect(operation, &FileOperation::operationFinished, this, [=]() {
operation->notifyFileWatcherOperationFinished();
auto settings = GlobalSettings::getInstance();
bool runbackend = settings->getInstance()->getValue(RESIDENT_IN_BACKEND).toBool();
QApplication::setQuitOnLastWindowClosed(!runbackend);
QTimer::singleShot(1000, this, [=]() {
int last_op_count = m_thread_pool->children().count();
if (last_op_count == 0) {
if (qApp->allWidgets().isEmpty()) {
if (!runbackend) {
qApp->quit();
if (qApp->property("isPeony").toBool()) {
auto settings = GlobalSettings::getInstance();
bool runbackend = settings->getInstance()->getValue(RESIDENT_IN_BACKEND).toBool();
QApplication::setQuitOnLastWindowClosed(!runbackend);
QTimer::singleShot(1000, this, [=]() {
int last_op_count = m_thread_pool->children().count();
if (last_op_count == 0) {
if (qApp->allWidgets().isEmpty()) {
if (!runbackend) {
qApp->quit();
}
}
}
}
});
});
} else {
QApplication::setQuitOnLastWindowClosed(oldQuitOnLastWindow);
}
}, Qt::BlockingQueuedConnection);
bool allowParallel = m_allow_parallel;
connect(operation, &FileOperation::operationTotalFileSize, this, [=](const qint64& total_file_size) {
// fix #171449
if (m_progressbar->isHidden()) {

View File

@ -110,6 +110,7 @@ int main(int argc, char *argv[])
}
PeonyApplication app(argc, argv, "peony-qt");
qApp->setProperty("isPeony", true);
Peony::XdgPortalHelper::getInstance()->tryResetPortal();
if (app.isSecondary())
return 0;