13#include <QtCore/QCoreApplication>
14#include <QtCore/QFileInfo>
17#include "kdsingleapplication_localsocket_p.h"
21class KDSingleApplicationPrivate
31 bool isPrimaryInstance()
const
33 return m_impl.isPrimaryInstance();
36 bool sendMessage(
const QByteArray &message,
int timeout)
38 return m_impl.sendMessage(message, timeout);
47 KDSingleApplicationLocalSocket m_impl;
50KDSingleApplicationPrivate::KDSingleApplicationPrivate(
const QString &name, KDSingleApplication::Options options,
KDSingleApplication *q)
53 , m_impl(name, options)
56 qFatal(
"KDSingleApplication requires a non-empty application name");
58 if (isPrimaryInstance()) {
76 , d_ptr(new KDSingleApplicationPrivate(name,
Option::IncludeUsernameInSocketName |
Option::IncludeSessionInSocketName, this))
82 , d_ptr(new KDSingleApplicationPrivate(name, options, this))
95 return d->isPrimaryInstance();
108 return d->sendMessage(message, timeout);
bool sendMessage(const QByteArray &message)
bool sendMessageWithTimeout(const QByteArray &message, int timeout)
void messageReceived(const QByteArray &message)
KDSingleApplication(QObject *parent=nullptr)
static QString extractExecutableName(const QString &applicationFilePath)
QString fileName() const const
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
bool isEmpty() const const