Accepting request 811676 from home:jirislaby:branches:network

- add
  0001-avoid-using-deprecated-qs-rand.patch
  0001-gui-datovka-annotate-fall-through-cases.patch
  0001-Fixed-compilation-using-Qt-5.15.0.patch

OBS-URL: https://build.opensuse.org/request/show/811676
OBS-URL: https://build.opensuse.org/package/show/network/datovka?expand=0&rev=38
This commit is contained in:
Marcus Meissner 2020-06-06 06:52:01 +00:00 committed by Git OBS Bridge
parent de3fec77ec
commit 1fcbbb5884
5 changed files with 224 additions and 2 deletions

View File

@ -0,0 +1,27 @@
From: Karel Slany <karel.slany@nic.cz>
Date: Fri, 5 Jun 2020 08:55:23 +0200
Subject: Fixed compilation using Qt-5.15.0.
Patch-mainline: yes
Git-commit: d98edca9cf17ae087b743c17e9922cbbd08f94fa
References: qt 5.15
Addresses #462.
---
src/delegates/tag_item.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/delegates/tag_item.cpp b/src/delegates/tag_item.cpp
index 39aa32e60e42..c0b43d9d5166 100644
--- a/src/delegates/tag_item.cpp
+++ b/src/delegates/tag_item.cpp
@@ -23,6 +23,7 @@
#include <algorithm> /* std::sort */
#include <QPainter>
+#include <QPainterPath>
#include "src/datovka_shared/localisation/localisation.h"
#include "src/datovka_shared/log/log.h"
--
2.27.0

View File

@ -0,0 +1,148 @@
From: Jiri Slaby <jslaby@suse.cz>
Date: Fri, 5 Jun 2020 09:06:29 +0200
Subject: avoid using deprecated qs?rand
Patch-mainline: no
References: qs?rand
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
src/datovka_shared/crypto/crypto_wrapped.cpp | 13 +++++++++++++
src/datovka_shared/utility/strings.cpp | 11 +++++++++++
src/main.cpp | 2 ++
src/main_cli.cpp | 2 ++
.../gui/dialogue_stored_files.cpp | 13 ++++++++++++-
5 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/src/datovka_shared/crypto/crypto_wrapped.cpp b/src/datovka_shared/crypto/crypto_wrapped.cpp
index b875e00f9174..a5ff23a32c7d 100644
--- a/src/datovka_shared/crypto/crypto_wrapped.cpp
+++ b/src/datovka_shared/crypto/crypto_wrapped.cpp
@@ -25,15 +25,28 @@
#include "src/datovka_shared/crypto/crypto_pwd.h"
#include "src/datovka_shared/crypto/crypto_wrapped.h"
+#include <QtGlobal>
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
+ #include <QRandomGenerator>
+#endif
+
QByteArray randomSalt(unsigned int len)
{
QByteArray salt;
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
+ salt.resize(len);
+
+ Q_ASSERT((len % sizeof(quint32)) == 0);
+
+ QRandomGenerator::global()->fillRange((quint32 *)salt.data(), len / sizeof(quint32));
+#else
/* Make sure that random generator is initialised. */
for (unsigned int i = 0; i < len; ++i) {
salt.append(qrand() % 256);
}
+#endif
return salt;
}
diff --git a/src/datovka_shared/utility/strings.cpp b/src/datovka_shared/utility/strings.cpp
index 8b6f25d4be18..01c40c1595c0 100644
--- a/src/datovka_shared/utility/strings.cpp
+++ b/src/datovka_shared/utility/strings.cpp
@@ -23,6 +23,10 @@
#include <QtGlobal> /* qrand() */
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
+ #include <QRandomGenerator>
+#endif
+
#include "src/datovka_shared/utility/strings.h"
QString Utility::generateRandomString(int length)
@@ -34,9 +38,16 @@ QString Utility::generateRandomString(int length)
"!#$%&()*+,-.:=?@[]_{|}~");
QString randomString;
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
+ QRandomGenerator *rnd = QRandomGenerator::global();
+#endif
for (int i = 0; i < length; ++i) {
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
+ int index = rnd->bounded(possibleCharacters.length());
+#else
int index = qrand() % possibleCharacters.length();
+#endif
QChar nextChar = possibleCharacters.at(index);
randomString.append(nextChar);
}
diff --git a/src/main.cpp b/src/main.cpp
index 0d3fee1b0320..810d85ddb264 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -96,8 +96,10 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
+#if (QT_VERSION < QT_VERSION_CHECK(5, 10, 0))
/* Set random generator. */
qsrand(QDateTime::currentDateTime().toTime_t());
+#endif
/* Log warnings. */
GlobInstcs::logPtr->setLogLevelBits(LogDevice::LF_STDERR, LOGSRC_ANY,
diff --git a/src/main_cli.cpp b/src/main_cli.cpp
index d46d93a51880..4bdf36ea8cc3 100644
--- a/src/main_cli.cpp
+++ b/src/main_cli.cpp
@@ -61,8 +61,10 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
+#if (QT_VERSION < QT_VERSION_CHECK(5, 10, 0))
/* Set random generator. */
qsrand(QDateTime::currentDateTime().toTime_t());
+#endif
/* Log warnings. */
GlobInstcs::logPtr->setLogLevelBits(LogDevice::LF_STDERR, LOGSRC_ANY,
diff --git a/tests/records_management_app/gui/dialogue_stored_files.cpp b/tests/records_management_app/gui/dialogue_stored_files.cpp
index b030ff3481a2..78a752bdb7cd 100644
--- a/tests/records_management_app/gui/dialogue_stored_files.cpp
+++ b/tests/records_management_app/gui/dialogue_stored_files.cpp
@@ -27,6 +27,10 @@
#include <QtGlobal> // qrand
#include <QTime>
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
+ #include <QRandomGenerator>
+#endif
+
#include "src/datovka_shared/records_management/conversion.h"
#include "tests/records_management_app/gui/dialogue_stored_files.h"
#include "ui_dialogue_stored_files.h"
@@ -143,11 +147,18 @@ void generateIdentifiers(QWidget *parent, QLineEdit &lineEdit)
return;
}
- qsrand((uint)QTime::currentTime().msec());
QStringList strIds;
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
+ auto rnd = QRandomGenerator::global();
+ for (int i = 0; i < num; ++i) {
+ strIds.append(QString::number(rnd->generate()));
+ }
+#else
+ qsrand((uint)QTime::currentTime().msec());
for (int i = 0; i < num; ++i) {
strIds.append(QString::number(qrand()));
}
+#endif
lineEdit.setText(strIds.join(SEPARATOR));
}
--
2.27.0

View File

@ -0,0 +1,37 @@
From: Jiri Slaby <jslaby@suse.cz>
Date: Fri, 5 Jun 2020 09:22:07 +0200
Subject: gui/datovka: annotate fall through cases
Patch-mainline: no
References: qs?rand
So that compiler won't complain:
warning: this statement may fall through
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
src/gui/datovka.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/gui/datovka.cpp b/src/gui/datovka.cpp
index b55b31acf8e7..ee28080e3ad9 100644
--- a/src/gui/datovka.cpp
+++ b/src/gui/datovka.cpp
@@ -5843,6 +5843,7 @@ void MainWindow::showImportZFOActionDialog(void)
switch (locationType) {
case DlgImportZFO::IMPORT_FROM_SUBDIR:
includeSubdir = true;
+ /* fallthrough */
case DlgImportZFO::IMPORT_FROM_DIR:
importDir = QFileDialog::getExistingDirectory(this,
tr("Select directory"), m_import_zfo_path,
@@ -7140,6 +7141,7 @@ void MainWindow::prepareMsgTmstmpExpir(enum DlgTimestampExpir::Action action)
case DlgTimestampExpir::CHECK_DIR_SUB:
includeSubdir = true;
+ /* fallthrough */
case DlgTimestampExpir::CHECK_DIR:
importDir = QFileDialog::getExistingDirectory(this,
tr("Select directory"), m_import_zfo_path,
--
2.27.0

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri Jun 5 07:25:55 UTC 2020 - Jiri Slaby <jslaby@suse.com>
- add
0001-avoid-using-deprecated-qs-rand.patch
0001-gui-datovka-annotate-fall-through-cases.patch
0001-Fixed-compilation-using-Qt-5.15.0.patch
-------------------------------------------------------------------
Mon Mar 9 07:09:54 UTC 2020 - Jiri Slaby <jslaby@suse.com>

View File

@ -27,6 +27,9 @@ Source0: https://secure.nic.cz/files/datove_schranky/%{version}/%{name}-%
Source1: https://secure.nic.cz/files/datove_schranky/%{version}/%{name}-%{version}.tar.xz.sha256
# PATCH-FIX-UPSTREAM: remove some issues with current .pro file
Patch0: datovka-fix-pro.patch
Patch1: 0001-Fixed-compilation-using-Qt-5.15.0.patch
Patch2: 0001-avoid-using-deprecated-qs-rand.patch
Patch3: 0001-gui-datovka-annotate-fall-through-cases.patch
BuildRequires: libqt5-linguist
BuildRequires: openssl-devel
BuildRequires: pkgconfig
@ -57,8 +60,7 @@ Data Box Information System) SOAPservices as defined in Czech ISDS Act
%{?lang_package}
%prep
%setup -q
%patch0 -p1
%autosetup -p1
sed -i \
-e 's:lrelease:lrelease-qt5:g' \
%{name}.pro