From 60ba8c313884c97db4d6c850426f2177d7e4d816 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Wed, 30 Dec 2020 23:26:39 +1000 Subject: [PATCH] Flameshot: fix for dbus --- media-gfx/flameshot/flameshot-0.8.5.recipe | 2 +- .../patches/flameshot-0.8.5.patchset | 79 ++++++++++++++++++- 2 files changed, 77 insertions(+), 4 deletions(-) diff --git a/media-gfx/flameshot/flameshot-0.8.5.recipe b/media-gfx/flameshot/flameshot-0.8.5.recipe index 33fa20de9..20e2f7202 100644 --- a/media-gfx/flameshot/flameshot-0.8.5.recipe +++ b/media-gfx/flameshot/flameshot-0.8.5.recipe @@ -9,7 +9,7 @@ DESCRIPTION="Features HOMEPAGE="https://github.com/lupoDharkael/flameshot/" COPYRIGHT="2020 lupoDharkael" LICENSE="GNU GPL v3" -REVISION="3" +REVISION="4" SOURCE_URI="https://github.com/lupoDharkael/flameshot/archive/v$portVersion.tar.gz" CHECKSUM_SHA256="f820c1f8cd464988cfcfc1af1fbcea2a3d0e5c4fb32accc3f54d93a8b5e1e890" PATCHES="flameshot-$portVersion.patchset" diff --git a/media-gfx/flameshot/patches/flameshot-0.8.5.patchset b/media-gfx/flameshot/patches/flameshot-0.8.5.patchset index 420c5e52d..697102c9c 100644 --- a/media-gfx/flameshot/patches/flameshot-0.8.5.patchset +++ b/media-gfx/flameshot/patches/flameshot-0.8.5.patchset @@ -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> Date: Sun, 6 Dec 2020 00:08:29 +1000 Subject: Add support for autolaunch @@ -42,12 +42,84 @@ index ee50acb..0a0a144 100644 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> 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 + #include + #include ++#include + + #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 index e3eb0e7..fb64d60 100644 --- a/src/utils/filenamehandler.cpp @@ -88,3 +160,4 @@ index b0cf0b3..07c06ff 100644 -- 2.28.0 +