Raise existing instance

Closes #193
This commit is contained in:
VukoDrakkeinen 2016-07-25 06:41:13 +02:00 committed by Anton Gulenko
parent 9f819061cd
commit d1310b3337
5 changed files with 87 additions and 1 deletions

View file

@ -20,6 +20,8 @@
#define KEEPASSX_APPLICATION_H
#include <QApplication>
#include <QtNetwork/QLocalServer>
class QLockFile;
class QSocketNotifier;
@ -30,12 +32,15 @@ class Application : public QApplication
public:
Application(int& argc, char** argv);
QWidget* mainWindow() const;
~Application();
void setMainWindow(QWidget* mainWindow);
bool event(QEvent* event) override;
bool isAlreadyRunning() const;
signals:
void openFile(const QString& filename);
void anotherInstanceStarted();
private slots:
#if defined(Q_OS_UNIX)
@ -54,6 +59,9 @@ private:
static void handleUnixSignal(int sig);
static int unixSignalSocket[2];
#endif
bool alreadyRunning;
QLockFile* lock;
QLocalServer server;
};
#endif // KEEPASSX_APPLICATION_H