QtPass $ENV{QTPASS_VERSION}
Multi-platform GUI for pass, the standard unix password manager.
Loading...
Searching...
No Matches
singleapplication.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2014 Anne Jan Brouwer
2// SPDX-License-Identifier: GPL-3.0-or-later
3#ifndef SRC_SINGLEAPPLICATION_H_
4#define SRC_SINGLEAPPLICATION_H_
5
6#include <QApplication>
7#include <QLocalServer>
8#include <QSharedMemory>
9
56class SingleApplication : public QApplication {
57 Q_OBJECT
58public:
59 SingleApplication(int &argc, char *argv[], QString uniqueKey);
60 auto isRunning() -> bool;
61 auto sendMessage(const QString &message) -> bool;
62
63public slots:
64 void receiveMessage();
65
66signals:
71 void messageAvailable(const QString &message);
72
73private:
74 bool _isRunning;
75 QString _uniqueKey;
76 QSharedMemory sharedMemory;
77 QScopedPointer<QLocalServer> localServer;
78
79 static const int timeout = 1000;
80};
81
82#endif // SRC_SINGLEAPPLICATION_H_
Provide single-instance application behavior and inter-process messaging using a unique key.
void receiveMessage()
SingleApplication::receiveMessage we have received (a command line) message.
auto isRunning() -> bool
SingleApplication::isRunning is there already a QtPass instance running, to check wether to be server...
void messageAvailable(const QString &message)
messageAvailable notification from commandline
auto sendMessage(const QString &message) -> bool
SingleApplication::sendMessage send a message (from commandline) to an already running QtPass instanc...
#define SingleApplication
Definition mainwindow.h:17