QtPass  1.2.0-pre
Multi-platform GUI for pass, the standard unix password manager.
singleapplication.h
Go to the documentation of this file.
1 #ifndef SINGLEAPPLICATION_H_
2 #define SINGLEAPPLICATION_H_
3 
4 #include <QApplication>
5 #include <QLocalServer>
6 #include <QSharedMemory>
7 
14 class SingleApplication : public QApplication {
15  Q_OBJECT
16 public:
17  SingleApplication(int &argc, char *argv[], const QString uniqueKey);
18  bool isRunning();
19  bool sendMessage(const QString &message);
20 
21 public slots:
22  void receiveMessage();
23 
24 signals:
29  void messageAvailable(QString message);
30 
31 private:
32  bool _isRunning;
33  QString _uniqueKey;
34  QSharedMemory sharedMemory;
35  QScopedPointer<QLocalServer> localServer;
36 
37  static const int timeout = 1000;
38 };
39 
40 #endif // SINGLEAPPLICATION_H_
bool isRunning()
SingleApplication::isRunning is there already a QtPass instance running, to check wether to be server...
bool sendMessage(const QString &message)
SingleApplication::sendMessage send a message (from commandline) to an already running QtPass instanc...
void messageAvailable(QString message)
messageAvailable notification from commandline
SingleApplication(int &argc, char *argv[], const QString uniqueKey)
SingleApplication::SingleApplication this replaces the QApplication allowing for local socket based c...
The SingleApplication class is used for commandline intergration.
void receiveMessage()
SingleApplication::receiveMessage we have received (a command line) message.