diff --git a/frontend/mainwindow.cpp b/frontend/mainwindow.cpp index 0e223b1..cbea3d2 100644 --- a/frontend/mainwindow.cpp +++ b/frontend/mainwindow.cpp @@ -105,10 +105,10 @@ MainWindow::~MainWindow() { delete m_askDialog; m_askDialog = NULL; } - if(m_askTimer) { - delete m_askTimer; - m_askTimer = NULL; - } +// if(m_askTimer) { +// delete m_askTimer; +// m_askTimer = NULL; +// } if(m_searchGsettings) { delete m_searchGsettings; m_searchGsettings = NULL; @@ -312,9 +312,19 @@ double MainWindow::getTransparentData() { } void MainWindow::initTimer() { - m_askTimer = new QTimer; + m_askTimer = new QTimer(this); m_askTimer->setInterval(ASK_INDEX_TIME); connect(m_askTimer, &QTimer::timeout, this, [ = ]() { + QWindow *modal = QGuiApplication::modalWindow(); + if(modal) { + m_askTimer->stop(); + connect(modal, &QWindow::visibleChanged, this, [ & ](bool visible){ + if(!visible) { + m_askTimer->start(); + } + }, Qt::UniqueConnection); + return; + } if(this->isVisible()) { m_isAskDialogVisible = true; kdk::UkuiStyleHelper::self()->removeHeader(m_askDialog); diff --git a/libsearch/index/file-search-plugin.cpp b/libsearch/index/file-search-plugin.cpp index dee2401..11b2e3d 100644 --- a/libsearch/index/file-search-plugin.cpp +++ b/libsearch/index/file-search-plugin.cpp @@ -92,11 +92,11 @@ void FileSearchPlugin::openAction(int actionkey, QString key, int type) case 0: if(FileUtils::openFile(key) == -1) { QMessageBox msgBox(m_detailPage); - msgBox.setWindowModality(Qt::WindowModal); + msgBox.setModal(true); msgBox.addButton(tr("Yes"), QMessageBox::YesRole); msgBox.setIcon(QMessageBox::Information); msgBox.setText(tr("Can not get a default application for opening %1.").arg(key)); - msgBox.exec(); + msgBox.open(); } break; case 1: @@ -203,11 +203,11 @@ void FileSearchPlugin::initDetailPage() connect(m_actionLabel1, &ActionLabel::actionTriggered, [ & ](){ if(FileUtils::openFile(m_currentActionKey) == -1) { QMessageBox msgBox(m_detailPage); - msgBox.setWindowModality(Qt::WindowModal); + msgBox.setModal(true); msgBox.addButton(tr("Yes"), QMessageBox::YesRole); msgBox.setIcon(QMessageBox::Information); msgBox.setText(tr("Can not get a default application for opening %1.").arg(m_currentActionKey)); - msgBox.exec(); + msgBox.open(); } }); connect(m_actionLabel2, &ActionLabel::actionTriggered, [ & ](){