Merge branch '2.0'

This commit is contained in:
Felix Geyer 2015-10-11 10:44:30 +02:00
commit dc7b6623a9
18 changed files with 197 additions and 27 deletions

View file

@ -20,6 +20,7 @@
#include <QCloseEvent>
#include <QShortcut>
#include <QTimer>
#include "autotype/AutoType.h"
#include "core/Config.h"
@ -449,7 +450,7 @@ void MainWindow::changeEvent(QEvent *event)
&& isTrayIconEnabled() && config()->get("GUI/MinimizeToTray").toBool())
{
event->ignore();
hide();
QTimer::singleShot(0, this, SLOT(hide()));
}
else {
QMainWindow::changeEvent(event);
@ -575,10 +576,12 @@ void MainWindow::trayIconTriggered(QSystemTrayIcon::ActivationReason reason)
void MainWindow::toggleWindow()
{
if (QApplication::activeWindow() == this) {
if ((QApplication::activeWindow() == this) && isVisible() && !isMinimized()) {
hide();
}
else {
ensurePolished();
setWindowState(windowState() & ~Qt::WindowMinimized);
show();
raise();
activateWindow();
@ -597,6 +600,11 @@ void MainWindow::lockDatabasesAfterInactivity()
bool MainWindow::isTrayIconEnabled() const
{
#ifdef Q_OS_MAC
// systray not useful on OS X
return false;
#else
return config()->get("GUI/ShowTrayIcon").toBool()
&& QSystemTrayIcon::isSystemTrayAvailable();
#endif
}