Merge branch 'develop' into feature/macos-minimize-onclose

This commit is contained in:
Janek Bevendorff 2017-05-19 18:08:40 +02:00 committed by GitHub
commit 379e17c3bc
39 changed files with 830 additions and 69 deletions

View file

@ -103,9 +103,9 @@ const QString MainWindow::BaseWindowTitle = "KeePassXC";
MainWindow::MainWindow()
: m_ui(new Ui::MainWindow())
, m_trayIcon(nullptr)
, m_appExitCalled(false)
, m_appExiting(false)
{
appExitCalled = false;
m_ui->setupUi(this);
// Setup the search widget in the toolbar
@ -329,6 +329,9 @@ MainWindow::MainWindow()
connect(m_ui->tabWidget, SIGNAL(messageTab(QString,MessageWidget::MessageType)), this, SLOT(displayTabMessage(QString, MessageWidget::MessageType)));
connect(m_ui->tabWidget, SIGNAL(messageDismissTab()), this, SLOT(hideTabMessage()));
m_screenLockListener = new ScreenLockListener(this);
connect(m_screenLockListener, SIGNAL(screenLocked()), SLOT(handleScreenLock()));
updateTrayIcon();
if (config()->hasAccessError()) {
@ -344,7 +347,7 @@ MainWindow::~MainWindow()
void MainWindow::appExit()
{
appExitCalled = true;
m_appExitCalled = true;
close();
}
@ -660,9 +663,15 @@ void MainWindow::databaseTabChanged(int tabIndex)
void MainWindow::closeEvent(QCloseEvent* event)
{
// ignore double close events (happens on macOS when closing from the dock)
if (m_appExiting) {
event->accept();
return;
}
bool minimizeOnClose = isTrayIconEnabled() &&
config()->get("GUI/MinimizeOnClose").toBool();
if (minimizeOnClose && !appExitCalled)
if (minimizeOnClose && !m_appExitCalled)
{
event->ignore();
hideWindow();
@ -677,6 +686,7 @@ void MainWindow::closeEvent(QCloseEvent* event)
bool accept = saveLastDatabases();
if (accept) {
m_appExiting = true;
saveWindowInformation();
event->accept();
@ -963,3 +973,10 @@ void MainWindow::hideYubiKeyPopup()
hideGlobalMessage();
setEnabled(true);
}
void MainWindow::handleScreenLock()
{
if (config()->get("security/lockdatabasescreenlock").toBool()){
lockDatabasesAfterInactivity();
}
}