Add SingleApplication::currentUser()

This commit is contained in:
Leander Schulten 2020-03-27 08:00:14 +01:00
parent 49c282a64c
commit 5fff2202b5
4 changed files with 25 additions and 0 deletions

View File

@ -1,6 +1,11 @@
Changelog Changelog
========= =========
__3.1.1a__
----------
* Added currentUser() method that returns the user the current instance is running as.
__3.1.0a__ __3.1.0a__
---------- ----------

View File

@ -214,6 +214,14 @@ QString SingleApplication::primaryUser()
Returns the username the primary instance is running as. Returns the username the primary instance is running as.
---
```cpp
QString SingleApplication::currentUser()
```
Returns the username the current instance is running as.
### Signals ### Signals
```cpp ```cpp

View File

@ -178,6 +178,12 @@ QString SingleApplication::primaryUser()
return d->primaryUser(); return d->primaryUser();
} }
QString SingleApplication::currentUser()
{
Q_D(SingleApplication);
return d->getUsername();
}
bool SingleApplication::sendMessage( QByteArray message, int timeout ) bool SingleApplication::sendMessage( QByteArray message, int timeout )
{ {
Q_D(SingleApplication); Q_D(SingleApplication);

View File

@ -118,6 +118,12 @@ public:
*/ */
QString primaryUser(); QString primaryUser();
/**
* @brief Returns the username of the current user
* @returns {QString}
*/
QString currentUser();
/** /**
* @brief Sends a message to the primary instance. Returns true on success. * @brief Sends a message to the primary instance. Returns true on success.
* @param {int} timeout - Timeout for connecting * @param {int} timeout - Timeout for connecting