Flameshot: fix for dbus

This commit is contained in:
Gerasim Troeglazov
2020-12-30 23:26:39 +10:00
parent 329a7c959f
commit 60ba8c3138
2 changed files with 77 additions and 4 deletions

View File

@@ -9,7 +9,7 @@ DESCRIPTION="Features
HOMEPAGE="https://github.com/lupoDharkael/flameshot/" HOMEPAGE="https://github.com/lupoDharkael/flameshot/"
COPYRIGHT="2020 lupoDharkael" COPYRIGHT="2020 lupoDharkael"
LICENSE="GNU GPL v3" LICENSE="GNU GPL v3"
REVISION="3" REVISION="4"
SOURCE_URI="https://github.com/lupoDharkael/flameshot/archive/v$portVersion.tar.gz" SOURCE_URI="https://github.com/lupoDharkael/flameshot/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="f820c1f8cd464988cfcfc1af1fbcea2a3d0e5c4fb32accc3f54d93a8b5e1e890" CHECKSUM_SHA256="f820c1f8cd464988cfcfc1af1fbcea2a3d0e5c4fb32accc3f54d93a8b5e1e890"
PATCHES="flameshot-$portVersion.patchset" PATCHES="flameshot-$portVersion.patchset"

View File

@@ -1,4 +1,4 @@
From 6edb054d5e751c55aba3edb2c65dc1166cc423d2 Mon Sep 17 00:00:00 2001 From 24a735fc878e61a74fe83ddc0473983a55430058 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com> From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 6 Dec 2020 00:08:29 +1000 Date: Sun, 6 Dec 2020 00:08:29 +1000
Subject: Add support for autolaunch Subject: Add support for autolaunch
@@ -42,12 +42,84 @@ index ee50acb..0a0a144 100644
2.28.0 2.28.0
From 6448f4ca232b98ce195dd9c9b289cfcc14cc9eae Mon Sep 17 00:00:00 2001 From 4b818982fc484de02d324b579ee15981e5355416 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com> From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 6 Dec 2020 00:09:32 +1000 Date: Sun, 6 Dec 2020 00:09:32 +1000
Subject: Fix locale Subject: DBus autostart
diff --git a/src/main.cpp b/src/main.cpp
index 2d44f54..314642f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -30,6 +30,7 @@
#include <QTextStream>
#include <QTimer>
#include <QTranslator>
+#include <QProcess>
#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
#include "src/core/flameshotdbusadapter.h"
@@ -48,6 +49,28 @@ int main(int argc, char* argv[])
// no arguments, just launch Flameshot
if (argc == 1) {
SingleApplication app(argc, argv);
+
+#ifdef Q_OS_HAIKU
+ int status=0;
+ QProcess dbusProcess;
+ QString exec = "/bin/dbus-launch";
+ QStringList params;
+ dbusProcess.start(exec, params);
+ dbusProcess.waitForFinished();
+ QString output(dbusProcess.readAllStandardOutput());
+
+ QFile file ("/tmp/flameshot_session");
+ if (file.open(QFile::WriteOnly | QFile::Truncate)) {
+ QTextStream outstream(&file);
+ outstream << output;
+ file.close();
+ }
+
+ QStringList list = output.split("\n", QString::SkipEmptyParts);
+ foreach (const QString &str, list)
+ putenv(str.toLatin1().data());
+#endif
+
QApplication::setStyle(new StyleOverride);
QTranslator translator, qtTranslator;
@@ -89,10 +112,30 @@ int main(int argc, char* argv[])
// Exporting captures must be connected after the dbus interface
// or the dbus signal gets blocked until we end the exports.
c->enableExports();
+#ifdef Q_OS_HAIKU
+ status = app.exec();
+ system("kill -3 $DBUS_SESSION_BUS_PID");
+ return status;
+#else
return app.exec();
+#endif
}
#ifndef Q_OS_WIN
+
+#ifdef Q_OS_HAIKU
+QFile inputFile("/tmp/flameshot_session");
+if (inputFile.open(QIODevice::ReadOnly))
+{
+ QTextStream in(&inputFile);
+ while (!in.atEnd())
+ {
+ QString line = in.readLine();
+ putenv(line.toLatin1().data());
+ }
+ inputFile.close();
+}
+#endif
/*--------------|
* CLI parsing |
* ------------*/
diff --git a/src/utils/filenamehandler.cpp b/src/utils/filenamehandler.cpp diff --git a/src/utils/filenamehandler.cpp b/src/utils/filenamehandler.cpp
index e3eb0e7..fb64d60 100644 index e3eb0e7..fb64d60 100644
--- a/src/utils/filenamehandler.cpp --- a/src/utils/filenamehandler.cpp
@@ -88,3 +160,4 @@ index b0cf0b3..07c06ff 100644
-- --
2.28.0 2.28.0