Skip to content
Open
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ jobs:
with:
patterns: |
-**/*autogen*/**
-**/common/qtsingleapplication/**
-**:cpp/loop-variable-changed
-**:cpp/poorly-documented-function
input: sarif-results/cpp.sarif
Expand Down
46 changes: 0 additions & 46 deletions COPYING
Original file line number Diff line number Diff line change
@@ -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. <http://fsf.org/>
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
Expand Down
45 changes: 20 additions & 25 deletions client/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,12 @@ class MacMenuBar {};
#include <digidocpp/XmlConf.h>
#include <digidocpp/crypto/X509Cert.h>

#include <qtsingleapplication/src/qtlocalpeer.h>

#include <QAction>
#include <QtCore/QFileInfo>
#include <QtCore/QJsonArray>
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject>
#include <QtCore/QLockFile>
#include <QtCore/QProcess>
#include <QtCore/QRegularExpression>
#include <QtCore/QTimer>
Expand Down Expand Up @@ -301,6 +300,7 @@ class Application::Private
QTranslator appTranslator, qtTranslator;
QString lang;
QTimer lastWindowTimer;
std::unique_ptr<QLockFile> lockFile;
volatile bool ready = false;
#ifdef Q_OS_WIN
QStringList tempFiles;
Expand All @@ -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"));
Expand All @@ -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<const QString&>(&Application::parseArgs));
if(!Common::startLocalServer(this, [this](const QStringList &msg) {
QStringList params;
params.reserve(msg.size());
for(const QString &param: 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();
Expand Down Expand Up @@ -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<QtLocalPeer*>())
delete obj;
#else
deinitMacEvents();
#endif
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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 &param: 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;
Expand Down Expand Up @@ -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();
}
Expand Down
11 changes: 1 addition & 10 deletions client/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,7 @@

#pragma once

#include <QtCore/QtGlobal>

#ifdef Q_OS_MAC
#include <QtWidgets/QApplication>
using BaseApplication = QApplication;
#else
#include "qtsingleapplication/src/QtSingleApplication"
using BaseApplication = QtSingleApplication;
#endif

#if defined(qApp)
#undef qApp
Expand All @@ -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

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion common
Submodule common updated 57 files
+0 −4 CMakeLists.txt
+144 −4 Common.cpp
+8 −1 Common.h
+5 −2 Configuration.cpp
+1 −0 Configuration.h
+0 −254 qtsingleapplication/INSTALL.TXT
+0 −23 qtsingleapplication/LGPL_EXCEPTION.txt
+0 −674 qtsingleapplication/LICENSE.GPL3
+0 −504 qtsingleapplication/LICENSE.LGPL
+0 −33 qtsingleapplication/README.TXT
+0 −13 qtsingleapplication/buildlib/buildlib.pro
+0 −6 qtsingleapplication/common.pri
+0 −25 qtsingleapplication/configure
+0 −80 qtsingleapplication/configure.bat
+0 −284 qtsingleapplication/doc/html/classic.css
+ qtsingleapplication/doc/html/images/qt-logo.png
+0 −48 qtsingleapplication/doc/html/index.html
+0 −175 qtsingleapplication/doc/html/qtsingleapplication-example-loader.html
+0 −101 qtsingleapplication/doc/html/qtsingleapplication-example-trivial.html
+0 −235 qtsingleapplication/doc/html/qtsingleapplication-members.html
+0 −31 qtsingleapplication/doc/html/qtsingleapplication-obsolete.html
+0 −40 qtsingleapplication/doc/html/qtsingleapplication.dcf
+0 −162 qtsingleapplication/doc/html/qtsingleapplication.html
+0 −90 qtsingleapplication/doc/html/qtsingleapplication.index
+0 −53 qtsingleapplication/doc/html/qtsingleapplication.qhp
+0 −118 qtsingleapplication/doc/html/qtsinglecoreapplication-example-console.html
+0 −126 qtsingleapplication/doc/html/qtsinglecoreapplication-members.html
+0 −98 qtsingleapplication/doc/html/qtsinglecoreapplication.html
+ qtsingleapplication/doc/images/qt-logo.png
+0 −87 qtsingleapplication/doc/index.qdoc
+0 −5 qtsingleapplication/examples/console/console.pro
+0 −65 qtsingleapplication/examples/console/console.qdoc
+0 −89 qtsingleapplication/examples/console/main.cpp
+0 −4 qtsingleapplication/examples/examples.pro
+0 −1 qtsingleapplication/examples/loader/file1.qsl
+0 −1 qtsingleapplication/examples/loader/file2.qsl
+0 −6 qtsingleapplication/examples/loader/loader.pro
+0 −81 qtsingleapplication/examples/loader/loader.qdoc
+0 −152 qtsingleapplication/examples/loader/main.cpp
+0 −78 qtsingleapplication/examples/trivial/main.cpp
+0 −5 qtsingleapplication/examples/trivial/trivial.pro
+0 −76 qtsingleapplication/examples/trivial/trivial.qdoc
+0 −5 qtsingleapplication/qtsingleapplication.pro
+0 −1 qtsingleapplication/src/QtLockedFile
+0 −1 qtsingleapplication/src/QtSingleApplication
+0 −205 qtsingleapplication/src/qtlocalpeer.cpp
+0 −77 qtsingleapplication/src/qtlocalpeer.h
+0 −193 qtsingleapplication/src/qtlockedfile.cpp
+0 −97 qtsingleapplication/src/qtlockedfile.h
+0 −115 qtsingleapplication/src/qtlockedfile_unix.cpp
+0 −211 qtsingleapplication/src/qtlockedfile_win.cpp
+0 −347 qtsingleapplication/src/qtsingleapplication.cpp
+0 −105 qtsingleapplication/src/qtsingleapplication.h
+0 −17 qtsingleapplication/src/qtsingleapplication.pri
+0 −149 qtsingleapplication/src/qtsinglecoreapplication.cpp
+0 −71 qtsingleapplication/src/qtsinglecoreapplication.h
+0 −10 qtsingleapplication/src/qtsinglecoreapplication.pri
Loading