QtPass 1.6.0
Multi-platform GUI for pass, the standard unix password manager.
Loading...
Searching...
No Matches
SingleApplication Class Reference

Provide single-instance application behavior and inter-process messaging using a unique key. More...

#include <singleapplication.h>

Inheritance diagram for SingleApplication:
Collaboration diagram for SingleApplication:

Public Slots

void receiveMessage ()
 SingleApplication::receiveMessage we have received (a command line) message.

Signals

void messageAvailable (const QString &message)
 messageAvailable notification from commandline

Public Member Functions

 SingleApplication (int &argc, char *argv[], QString uniqueKey)
 SingleApplication::SingleApplication this replaces the QApplication allowing for local socket based communications.
auto isRunning () -> bool
 SingleApplication::isRunning is there already a QtPass instance running, to check wether to be server or client.
auto sendMessage (const QString &message) -> bool
 SingleApplication::sendMessage send a message (from commandline) to an already running QtPass instance.

Detailed Description

Provide single-instance application behavior and inter-process messaging using a unique key.

This QApplication subclass detects whether another instance with the same unique key is already running and enables sending and receiving textual messages between instances (typically to forward command-line arguments to the already-running instance).

Parameters
argcReference to program argc forwarded to QApplication.
argvProgram argv forwarded to QApplication.
uniqueKeyIdentifier used to scope the single-instance mechanism and the local IPC resources.

Query whether another instance of the application is already running.

Returns
true if an instance with the same unique key is already running, false otherwise.

Send a textual message to the running instance identified by the unique key.

The message is delivered to the existing instance; intended use is to forward command-line arguments.

Parameters
messageText to send to the running instance.
Returns
true if the message was successfully delivered, false otherwise.

Slot invoked when an incoming message is received on the local server.

Emits messageAvailable() with the received payload.

Notification emitted when a textual message from another process is received.

Parameters
messageThe message payload (for example, forwarded command-line arguments).

Definition at line 56 of file singleapplication.h.

Constructor & Destructor Documentation

◆ SingleApplication()

SingleApplication::SingleApplication ( int & argc,
char * argv[],
QString uniqueKey )

SingleApplication::SingleApplication this replaces the QApplication allowing for local socket based communications.

Parameters
argc
argv
uniqueKey

Definition at line 17 of file singleapplication.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ isRunning()

auto SingleApplication::isRunning ( ) -> bool

SingleApplication::isRunning is there already a QtPass instance running, to check wether to be server or client.

Returns

Definition at line 66 of file singleapplication.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ messageAvailable

void SingleApplication::messageAvailable ( const QString & message)
signal

messageAvailable notification from commandline

Parameters
messageargs sent to qtpass executable
Here is the caller graph for this function:

◆ receiveMessage

void SingleApplication::receiveMessage ( )
slot

SingleApplication::receiveMessage we have received (a command line) message.

Definition at line 46 of file singleapplication.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendMessage()

auto SingleApplication::sendMessage ( const QString & message) -> bool

SingleApplication::sendMessage send a message (from commandline) to an already running QtPass instance.

Parameters
message
Returns

Definition at line 74 of file singleapplication.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: