Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/core/flameshotdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,12 @@ void FlameshotDaemon::createPin(const QPixmap& capture, QRect geometry)

void FlameshotDaemon::copyToClipboard(const QPixmap& capture)
{
#if defined(Q_OS_MACOS) && defined(USE_KDSINGLEAPPLICATION)
auto kdsa = KDSingleApplication(QStringLiteral("org.flameshot.Flameshot"));
if (kdsa.isPrimaryInstance() && instance()) {
#else
if (instance()) {
#endif
instance()->attachScreenshotToClipboard(capture);
return;
}
Expand All @@ -151,7 +156,9 @@ void FlameshotDaemon::copyToClipboard(const QPixmap& capture)

#if defined(USE_KDSINGLEAPPLICATION) && \
(defined(Q_OS_MACOS) || defined(Q_OS_WIN))
#if defined(Q_OS_WIN)
auto kdsa = KDSingleApplication(QStringLiteral("org.flameshot.Flameshot"));
#endif
stream << QStringLiteral("attachScreenshotToClipboard") << capture;
kdsa.sendMessage(data);
#else
Expand All @@ -167,14 +174,21 @@ void FlameshotDaemon::copyToClipboard(const QPixmap& capture)
void FlameshotDaemon::copyToClipboard(const QString& text,
const QString& notification)
{
#if defined(Q_OS_MACOS) && defined(USE_KDSINGLEAPPLICATION)
auto kdsa = KDSingleApplication(QStringLiteral("org.flameshot.Flameshot"));
if (kdsa.isPrimaryInstance() && instance()) {
#else
if (instance()) {
#endif
instance()->attachTextToClipboard(text, notification);
return;
}

#if defined(USE_KDSINGLEAPPLICATION) && \
(defined(Q_OS_MACOS) || defined(Q_OS_WIN))
#if defined(Q_OS_WIN)
auto kdsa = KDSingleApplication(QStringLiteral("org.flameshot.Flameshot"));
#endif
QByteArray data;
QDataStream stream(&data, QIODevice::WriteOnly);
stream << QStringLiteral("attachTextToClipboard") << text << notification;
Expand Down
Loading