Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions src/plugins/cooperation/core/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023-2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -179,27 +179,29 @@ void MainWindow::closeEvent(QCloseEvent *event)
if (qApp->property("onlyTransfer").toBool())
QApplication::quit();

showCloseDialog();
event->ignore();
if (showCloseDialog())
event->ignore();
}

void MainWindow::showCloseDialog()
bool MainWindow::showCloseDialog()
{
QString option = CooperationUtil::closeOption();
if (option == "Minimise") {
minimizedAPP();
return;
return true;
}
if (option == "Exit")
if (option == "Exit") {
QApplication::quit();
return false;
}

CooperationDialog dlg(qApp->activeWindow());
dlg.setFixedSize(360, 260);

QVBoxLayout *layout = new QVBoxLayout();
QCheckBox *op1 = new QCheckBox(tr("Minimise to system tray"));
op1->setChecked(true);
QCheckBox *op2 = new QCheckBox(tr("Exit"));
op2->setChecked(true);

connect(op1, &QCheckBox::stateChanged, op1, [op2](int state) {
op2->setChecked(state != Qt::Checked);
Expand Down Expand Up @@ -246,10 +248,15 @@ void MainWindow::showCloseDialog()
}

if (isExit)
{
QApplication::quit();
else
return false;
} else {
minimizedAPP();
return true;
}
}
return false;
}

void MainWindow::minimizedAPP()
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/cooperation/core/gui/mainwindow.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023-2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand Down Expand Up @@ -30,7 +30,7 @@ class MainWindow : public CooperationMainWindow
#endif
void closeEvent(QCloseEvent *event) override;

void showCloseDialog();
bool showCloseDialog();
void minimizedAPP();
public Q_SLOTS:
void setFirstTipVisible();
Expand Down
Loading