diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index d690d1c84..14eb25ba2 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -286,7 +286,6 @@ jobs:
with:
patterns: |
-**/*autogen*/**
- -**/common/qtsingleapplication/**
-**:cpp/loop-variable-changed
-**:cpp/poorly-documented-function
input: sarif-results/cpp.sarif
diff --git a/COPYING b/COPYING
index cfe0d3216..ec4b028b8 100644
--- a/COPYING
+++ b/COPYING
@@ -1,49 +1,3 @@
-qtsingleapplication
-
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-Nokia Qt LGPL Exception version 1.1
-
-As an additional permission to the GNU Lesser General Public License
-version 2.1, the object code form of a "work that uses the Library"
-may incorporate material from a header file that is part of the
-Library. You may distribute such object code under terms of your
-choice, provided that:
-(i) the header files of the Library have not been modified; and
-(ii) the incorporated material is limited to numerical parameters,
-data structure layouts, accessors, macros, inline functions and
-templates; and
-(iii) you comply with the terms of Section 6 of the GNU
-Lesser General Public License version 2.1.
-
-Moreover, you may apply this exception to a modified version of the
-Library, provided that such modification does not involve copying
-material from the Library into the modified Library?s header files
-unless such material is limited to (i) numerical parameters; (ii) data
-structure layouts; (iii) accessors; and (iv) small macros, templates
-and inline functions of five lines or less in length.
-
-Furthermore, you are not required to apply this additional permission
-to a modified version of the Library.
-
-_______________________________________________________________________________
client/pkcs11.h
pkcs11.h
diff --git a/client/Application.cpp b/client/Application.cpp
index 66b4107d5..363f9a18b 100644
--- a/client/Application.cpp
+++ b/client/Application.cpp
@@ -48,13 +48,12 @@ class MacMenuBar {};
#include
#include
-#include
-
#include
#include
#include
#include
#include
+#include
#include
#include
#include
@@ -301,6 +300,7 @@ class Application::Private
QTranslator appTranslator, qtTranslator;
QString lang;
QTimer lastWindowTimer;
+ std::unique_ptr lockFile;
volatile bool ready = false;
#ifdef Q_OS_WIN
QStringList tempFiles;
@@ -312,7 +312,7 @@ class Application::Private
};
Application::Application( int &argc, char **argv )
- : BaseApplication(argc, argv)
+ : QApplication(argc, argv)
, d(new Private)
{
setApplicationName(QStringLiteral("qdigidoc4"));
@@ -339,12 +339,20 @@ Application::Application( int &argc, char **argv )
QStringList args = arguments();
args.removeFirst();
#ifndef Q_OS_MAC
- if( isRunning() )
- {
- sendMessage(args.join(QStringLiteral("\", \"")));
+ d->lockFile = Common::acquireInstanceLock(args);
+ if(!d->lockFile)
return;
- }
- connect(this, &Application::messageReceived, this, qOverload(&Application::parseArgs));
+ if(!Common::startLocalServer(this, [this](const QStringList &msg) {
+ QStringList params;
+ params.reserve(msg.size());
+ for(const QString ¶m: msg)
+ {
+ QUrl url(param, QUrl::StrictMode);
+ params.append(param != QLatin1String("-crypto") && !url.toLocalFile().isEmpty() ? url.toLocalFile() : param);
+ }
+ parseArgs(std::move(params));
+ }))
+ qWarning() << "Failed to start local server for activation messages";
#endif
QPalette p = palette();
@@ -527,13 +535,11 @@ Application::~Application()
#endif // Q_OS_WIN
#ifndef Q_OS_MAC
- if( isRunning() )
+ if(!d->lockFile)
{
delete d;
return;
}
- if(auto *obj = findChild())
- delete obj;
#else
deinitMacEvents();
#endif
@@ -659,9 +665,9 @@ bool Application::event(QEvent *event)
// Load here because cocoa NSApplication overides events
case QEvent::ApplicationActivate:
initMacEvents();
- return BaseApplication::event(event);
+ return QApplication::event(event);
#endif
- default: return BaseApplication::event(event);
+ default: return QApplication::event(event);
}
}
@@ -843,17 +849,6 @@ void Application::openHelp()
QDesktopServices::openUrl(QUrl(tr("https://www.id.ee/en/id-help/")));
}
-void Application::parseArgs( const QString &msg )
-{
- QStringList params;
- for(const QString ¶m: msg.split(QStringLiteral("\", \""), Qt::SkipEmptyParts))
- {
- QUrl url( param, QUrl::StrictMode );
- params.append(param != QLatin1String("-crypto") && !url.toLocalFile().isEmpty() ? url.toLocalFile() : param);
- }
- parseArgs(std::move(params));
-}
-
void Application::parseArgs(QStringList args)
{
bool crypto = args.removeAll(QStringLiteral("-crypto")) > 0;
@@ -886,7 +881,7 @@ uint Application::readTSLVersion(const QString &path)
int Application::run()
{
#ifndef Q_OS_MAC
- if( isRunning() ) return 0;
+ if(!d->lockFile) return 0;
#endif
return exec();
}
diff --git a/client/Application.h b/client/Application.h
index c458af40a..f065f812c 100644
--- a/client/Application.h
+++ b/client/Application.h
@@ -19,15 +19,7 @@
#pragma once
-#include
-
-#ifdef Q_OS_MAC
#include
-using BaseApplication = QApplication;
-#else
-#include "qtsingleapplication/src/QtSingleApplication"
-using BaseApplication = QtSingleApplication;
-#endif
#if defined(qApp)
#undef qApp
@@ -38,7 +30,7 @@ namespace digidoc { class Exception; }
class Configuration;
class QAction;
class QSigner;
-class Application final: public BaseApplication
+class Application final: public QApplication
{
Q_OBJECT
@@ -90,7 +82,6 @@ private Q_SLOTS:
bool event(QEvent *event) final;
static void closeWindow();
static void msgHandler(QtMsgType type, const QMessageLogContext &ctx, const QString &msg);
- static void parseArgs(const QString &msg = {});
static void parseArgs(QStringList args);
static void showWarning(const QString &title, const digidoc::Exception &e);
#if defined(Q_OS_MAC)
diff --git a/common b/common
index 78d45ae98..c36e005fa 160000
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 78d45ae983ed2c0d9bc4de5d31f78cd46d13a48c
+Subproject commit c36e005fa82b992bb8059d81beb7619953642d4a