From 4752378edc9199bb7f5ad198ca3e986ba58e893b Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Tue, 26 Nov 2024 16:02:07 +0200 Subject: [PATCH] Show Info message Signed-off-by: Raul Metsma --- client/translations/en.ts | 4 ++++ client/translations/et.ts | 4 ++++ client/translations/ru.ts | 4 ++++ client/widgets/FileList.cpp | 2 ++ client/widgets/Item.cpp | 32 ++++++++++++++++++++++++++++++++ client/widgets/Item.h | 14 ++++++++++++++ 6 files changed, 60 insertions(+) diff --git a/client/translations/en.ts b/client/translations/en.ts index 534570f49..41b2faa79 100644 --- a/client/translations/en.ts +++ b/client/translations/en.ts @@ -958,6 +958,10 @@ %1 already exists.<br />Do you want replace it? %1 already exists.<br />Do you want replace it? + + To view container content please decrypt encrypted container! + + FirstRun diff --git a/client/translations/et.ts b/client/translations/et.ts index 141f4edc2..f50155d40 100644 --- a/client/translations/et.ts +++ b/client/translations/et.ts @@ -958,6 +958,10 @@ %1 already exists.<br />Do you want replace it? %1 on juba olemas.<br />Soovid asendada? + + To view container content please decrypt encrypted container! + + FirstRun diff --git a/client/translations/ru.ts b/client/translations/ru.ts index 893f6ba7a..973aa9143 100644 --- a/client/translations/ru.ts +++ b/client/translations/ru.ts @@ -958,6 +958,10 @@ %1 already exists.<br />Do you want replace it? %1 уже существует.<br />Заменить? + + To view container content please decrypt encrypted container! + + FirstRun diff --git a/client/widgets/FileList.cpp b/client/widgets/FileList.cpp index 9aab95d6f..159c226df 100644 --- a/client/widgets/FileList.cpp +++ b/client/widgets/FileList.cpp @@ -210,6 +210,8 @@ void FileList::setModel(DocumentModel *documentModel) auto count = documentModel->rowCount(); for(int i = 0; i < count; i++) addFile(documentModel->data(i)); + if(state == EncryptedContainer && count == 0) + addWidget(new LabelItem(tr("To view container content please decrypt encrypted container!"))); } void FileList::stateChange(ria::qdigidoc4::ContainerState state) diff --git a/client/widgets/Item.cpp b/client/widgets/Item.cpp index d8d2a83f6..0385dd3c0 100644 --- a/client/widgets/Item.cpp +++ b/client/widgets/Item.cpp @@ -19,6 +19,38 @@ #include "Item.h" +#include +#include + void Item::idChanged(const SslCertificate & /* cert */) {} void Item::initTabOrder(QWidget * /* item */) {} QWidget* Item::lastTabWidget() { return this; } + +LabelItem::LabelItem(const QString &text, QWidget *parent) + : Item(parent) +{ + setObjectName(QStringLiteral("LabelItem")); + setStyleSheet(QStringLiteral(R"( +QWidget { +font-family: Roboto, Helvetica; +font-size: 14px; +} +#LabelItem { +border-bottom: 1px solid rgba(217, 217, 216, 0.45); +} +#label { +color: #07142A; +} +)")); + setLayout(new QVBoxLayout); + layout()->setContentsMargins(8, 16, 8, 16); + layout()->addWidget(label = new QLabel(text, this)); + label->setObjectName("label"); + label->setFocusPolicy(Qt::TabFocus); +} + +void LabelItem::initTabOrder(QWidget *item) +{ + setTabOrder(item, label); + setTabOrder(label, lastTabWidget()); +} diff --git a/client/widgets/Item.h b/client/widgets/Item.h index a35d4ce03..54eedcdf2 100644 --- a/client/widgets/Item.h +++ b/client/widgets/Item.h @@ -21,6 +21,7 @@ #include "widgets/StyledWidget.h" +class QLabel; class SslCertificate; class Item : public StyledWidget @@ -38,3 +39,16 @@ class Item : public StyledWidget void add(Item* item); void remove(Item* item); }; + + +class LabelItem : public Item +{ + Q_OBJECT + +public: + LabelItem(const QString &text, QWidget *parent = nullptr); + void initTabOrder(QWidget *item) override; + +private: + QLabel *label; +};