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

@ -45,12 +45,18 @@ public:
Application::Application(int& argc, char** argv)
: QApplication(argc, argv)
, m_mainWindow(Q_NULLPTR)
{
#if defined(Q_OS_UNIX) && !defined(Q_OS_OSX)
installNativeEventFilter(new XcbEventFilter());
#endif
}
void Application::setMainWindow(QWidget* mainWindow)
{
m_mainWindow = mainWindow;
}
bool Application::event(QEvent* event)
{
// Handle Apple QFileOpenEvent from finder (double click on .kdbx file)
@ -58,6 +64,16 @@ bool Application::event(QEvent* event)
Q_EMIT openFile(static_cast<QFileOpenEvent*>(event)->file());
return true;
}
#ifdef Q_OS_MAC
// restore main window when clicking on the docker icon
else if ((event->type() == QEvent::ApplicationActivate) && m_mainWindow) {
m_mainWindow->ensurePolished();
m_mainWindow->setWindowState(m_mainWindow->windowState() & ~Qt::WindowMinimized);
m_mainWindow->show();
m_mainWindow->raise();
m_mainWindow->activateWindow();
}
#endif
return QApplication::event(event);
}