mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-20 10:45:33 -05:00
implement a (nonperfect) hide-to-tray on win close
This commit is contained in:
parent
6b7f7bb777
commit
5982763bed
5 changed files with 35 additions and 2 deletions
|
|
@ -71,6 +71,8 @@ MainWindow::MainWindow()
|
|||
: m_ui(new Ui::MainWindow())
|
||||
, m_trayIcon(Q_NULLPTR)
|
||||
{
|
||||
appExitCalled = false;
|
||||
|
||||
m_ui->setupUi(this);
|
||||
|
||||
m_countDefaultAttributes = m_ui->menuEntryCopyAttribute->actions().size();
|
||||
|
|
@ -202,7 +204,7 @@ MainWindow::MainWindow()
|
|||
SLOT(importKeePass1Database()));
|
||||
connect(m_ui->actionLockDatabases, SIGNAL(triggered()), m_ui->tabWidget,
|
||||
SLOT(lockDatabases()));
|
||||
connect(m_ui->actionQuit, SIGNAL(triggered()), SLOT(close()));
|
||||
connect(m_ui->actionQuit, SIGNAL(triggered()), SLOT(appExit()));
|
||||
|
||||
m_actionMultiplexer.connect(m_ui->actionEntryNew, SIGNAL(triggered()),
|
||||
SLOT(createEntry()));
|
||||
|
|
@ -249,6 +251,12 @@ MainWindow::~MainWindow()
|
|||
{
|
||||
}
|
||||
|
||||
void MainWindow::appExit()
|
||||
{
|
||||
appExitCalled = true;
|
||||
close();
|
||||
}
|
||||
|
||||
void MainWindow::updateLastDatabasesMenu()
|
||||
{
|
||||
m_ui->menuRecentDatabases->clear();
|
||||
|
|
@ -462,6 +470,13 @@ void MainWindow::databaseTabChanged(int tabIndex)
|
|||
|
||||
void MainWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
if (config()->get("GUI/MinimizeOnClose").toBool() && !appExitCalled)
|
||||
{
|
||||
event->ignore();
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
bool accept = saveLastDatabases();
|
||||
|
||||
if (accept) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue