Skip to content

Commit 6b683b7

Browse files
author
Lauris Kaplinski
committed
Merge branch 'libcdoc' of github.com:lauris71/DigiDoc4-Client into libcdoc
2 parents a6b5241 + 6195a68 commit 6b683b7

29 files changed

Lines changed: 309 additions & 234 deletions

COPYING

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ client/pkcs11.h
6161

6262

6363
_______________________________________________________________________________
64-
client/fonts/Open_Sans
64+
client/fonts
6565

6666
Apache License
6767
Version 2.0, January 2004

client/Application.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -949,10 +949,9 @@ void Application::showClient(QStringList files, bool crypto, bool sign, bool new
949949
if(files.isEmpty())
950950
return;
951951
QMetaObject::invokeMethod(w, [&] {
952-
using enum ria::qdigidoc4::Pages;
953952
if(sign)
954953
sign = files.size() != 1 || !CONTAINER_EXT.contains(QFileInfo(files.value(0)).suffix(), Qt::CaseInsensitive);
955-
w->selectPage(crypto && !sign ? CryptoIntro : SignIntro);
954+
w->selectPage(crypto && !sign ? MainWindow::CryptoIntro : MainWindow::SignIntro);
956955
w->openFiles(std::move(files), false, sign);
957956
});
958957
}

client/MainWindow.cpp

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ using namespace std::chrono;
5252

5353
MainWindow::MainWindow( QWidget *parent )
5454
: QWidget( parent )
55-
, ui( new Ui::MainWindow )
55+
, ui(std::make_unique<Ui::MainWindow>())
5656
{
5757
setAttribute(Qt::WA_DeleteOnClose, true);
5858
setAcceptDrops( true );
@@ -127,12 +127,7 @@ MainWindow::MainWindow( QWidget *parent )
127127
updateMyEid(qApp->signer()->smartcard()->data());
128128
}
129129

130-
MainWindow::~MainWindow()
131-
{
132-
digiDoc.reset();
133-
cryptoDoc.reset();
134-
delete ui;
135-
}
130+
MainWindow::~MainWindow() noexcept = default;
136131

137132
void MainWindow::adjustDrops()
138133
{
@@ -675,27 +670,34 @@ void MainWindow::updateMyEid(const QSmartCardData &data)
675670
return;
676671
bool pin1Blocked = data.retryCount(QSmartCardData::Pin1Type) == 0;
677672
bool pin2Blocked = data.retryCount(QSmartCardData::Pin2Type) == 0;
673+
bool pin1Locked = data.pinLocked(QSmartCardData::Pin1Type);
678674
bool pin2Locked = data.pinLocked(QSmartCardData::Pin2Type);
679675
ui->myEid->warningIcon(
680-
pin1Blocked ||
676+
pin1Blocked || pin1Locked ||
681677
pin2Blocked || pin2Locked ||
682678
data.retryCount(QSmartCardData::PukType) == 0);
683679
ui->signContainerPage->cardChanged(data.signCert(), pin2Blocked || pin2Locked);
684-
ui->cryptoContainerPage->cardChanged(data.authCert(), pin1Blocked);
685-
686-
if(pin1Blocked)
687-
ui->warnings->showWarning({WarningType::UnblockPin1Warning, 0,
688-
[this]{ changePinClicked(QSmartCardData::Pin1Type, QSmartCard::UnblockWithPuk); }});
689-
690-
if(pin2Locked && pin2Blocked)
691-
ui->warnings->showWarning({WarningType::ActivatePin2WithPUKWarning, 0,
692-
[this]{ changePinClicked(QSmartCardData::Pin2Type, QSmartCard::ActivateWithPuk); }});
693-
else if(pin2Blocked)
694-
ui->warnings->showWarning({WarningType::UnblockPin2Warning, 0,
695-
[this]{ changePinClicked(QSmartCardData::Pin2Type, QSmartCard::UnblockWithPuk); }});
696-
else if(pin2Locked)
697-
ui->warnings->showWarning({WarningType::ActivatePin2Warning, 0,
698-
[this]{ changePinClicked(QSmartCardData::Pin2Type, QSmartCard::ActivateWithPin); }});
680+
ui->cryptoContainerPage->cardChanged(data.authCert(), pin1Blocked || pin1Locked);
681+
682+
using enum WarningText::WarningType;
683+
if(pin1Locked)
684+
ui->warnings->showWarning({LockedCardWarning});
685+
else
686+
{
687+
if(pin1Blocked)
688+
ui->warnings->showWarning({UnblockPin1Warning, 0,
689+
[this]{ changePinClicked(QSmartCardData::Pin1Type, QSmartCard::UnblockWithPuk); }});
690+
691+
if(pin2Locked && pin2Blocked)
692+
ui->warnings->showWarning({ActivatePin2WithPUKWarning, 0,
693+
[this]{ changePinClicked(QSmartCardData::Pin2Type, QSmartCard::ActivateWithPuk); }});
694+
else if(pin2Blocked)
695+
ui->warnings->showWarning({UnblockPin2Warning, 0,
696+
[this]{ changePinClicked(QSmartCardData::Pin2Type, QSmartCard::UnblockWithPuk); }});
697+
else if(pin2Locked)
698+
ui->warnings->showWarning({ActivatePin2Warning, 0,
699+
[this]{ changePinClicked(QSmartCardData::Pin2Type, QSmartCard::ActivateWithPin); }});
700+
}
699701

700702
const qint64 DAY = 24 * 60 * 60;
701703
qint64 expiresIn = 106 * DAY;
@@ -707,12 +709,12 @@ void MainWindow::updateMyEid(const QSmartCardData &data)
707709
if(expiresIn <= 0)
708710
{
709711
ui->myEid->invalidIcon(true);
710-
ui->warnings->showWarning({WarningType::CertExpiredError});
712+
ui->warnings->showWarning({CertExpiredError});
711713
}
712714
else if(expiresIn <= 105 * DAY)
713715
{
714716
ui->myEid->warningIcon(true);
715-
ui->warnings->showWarning({WarningType::CertExpiryWarning});
717+
ui->warnings->showWarning({CertExpiryWarning});
716718
}
717719
}
718720

client/MainWindow.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,18 @@ class MainWindow final : public QWidget
3737
Q_OBJECT
3838

3939
public:
40+
enum Pages : unsigned char {
41+
SignIntro,
42+
SignDetails,
43+
CryptoIntro,
44+
CryptoDetails,
45+
MyEid
46+
};
4047
explicit MainWindow(QWidget *parent = nullptr);
41-
~MainWindow() final;
48+
~MainWindow() noexcept final;
4249

4350
void openFiles(QStringList files, bool addFile = false, bool forceCreate = false);
44-
void selectPage(ria::qdigidoc4::Pages page);
51+
void selectPage(Pages page);
4552
void showSettings(int page);
4653

4754
protected:
@@ -58,7 +65,7 @@ class MainWindow final : public QWidget
5865
void changePinClicked(QSmartCardData::PinType type, QSmartCard::PinAction action);
5966
void convertToCDoc();
6067
ria::qdigidoc4::ContainerState currentState();
61-
void navigateToPage( ria::qdigidoc4::Pages page, const QStringList &files = QStringList(), bool create = true );
68+
void navigateToPage(Pages page, const QStringList &files = QStringList(), bool create = true);
6269
void onCryptoAction(int action, const QString &id, const QString &phone);
6370
void onSignAction(int action, const QString &idCode, const QString &info2);
6471
void openContainer(bool signature);
@@ -76,5 +83,5 @@ class MainWindow final : public QWidget
7683

7784
std::unique_ptr<CryptoDoc> cryptoDoc;
7885
std::unique_ptr<DigiDoc> digiDoc;
79-
Ui::MainWindow *ui;
86+
std::unique_ptr<Ui::MainWindow> ui;
8087
};

client/QSmartCard.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ bool THALESCard::updateCounters(QSmartCardDataPrivate *d) const
480480
{
481481
d->retry[QSmartCardData::PinType(type)] = quint8(retry.data[0]);
482482
auto changed = info[0xDF2F];
483-
d->locked[QSmartCardData::PinType(type)] = changed && changed.data[0] == 0;
483+
d->locked[QSmartCardData::PinType(type)] = (changed && changed.data[0] == 0);
484484
}
485485
else
486486
return false;

client/common_enums.h

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -56,34 +56,4 @@ enum Actions : unsigned char {
5656
EncryptLT
5757
};
5858

59-
enum Pages : unsigned char {
60-
SignIntro,
61-
SignDetails,
62-
CryptoIntro,
63-
CryptoDetails,
64-
MyEid
65-
};
66-
67-
enum WarningType : unsigned char {
68-
NoWarning = 0,
69-
70-
CertExpiredError,
71-
CertExpiryWarning,
72-
UnblockPin1Warning,
73-
UnblockPin2Warning,
74-
ActivatePin2Warning,
75-
ActivatePin1WithPUKWarning,
76-
ActivatePin2WithPUKWarning,
77-
78-
InvalidSignatureError,
79-
InvalidTimestampError,
80-
UnknownSignatureWarning,
81-
UnknownTimestampWarning,
82-
UnsupportedAsicSWarning,
83-
UnsupportedAsicCadesWarning,
84-
UnsupportedDDocWarning,
85-
UnsupportedCDocWarning,
86-
EmptyFileWarning,
87-
};
88-
8959
}

client/dialogs/CertificateDetails.ui

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,14 @@ font-size: 22px;
115115
</size>
116116
</property>
117117
<property name="styleSheet">
118-
<string notr="true">QHeaderView::section {
118+
<string notr="true">QTableWidget {
119+
background-color: #FFFFFF;
120+
}
121+
QTableWidget::item:selected {
122+
background-color: #E7EAEF;
123+
color: #07142A;
124+
}
125+
QHeaderView::section {
119126
border: 1px solid #E7EAEF;
120127
border-width: 0px 0px 1px 0px;
121128
padding: 0px 0px 8px 5px;

client/dialogs/CertificateHistory.ui

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ background-color: #FFFFFF;
7575
font-family: Roboto, Helvetica;
7676
font-size: 12px;
7777
color: #07142A;
78+
background-color: #FFFFFF;
7879
}
7980
QHeaderView::section {
8081
font-family: Roboto, Helvetica;
@@ -83,6 +84,10 @@ border: none;
8384
border-bottom: 1px solid #E7EAEF;
8485
background-color: #FFFFFF;
8586
}
87+
QTreeWidget::item:selected {
88+
background-color: #E7EAEF;
89+
color: #07142A;
90+
}
8691
QHeaderView::up-arrow,
8792
QHeaderView::down-arrow {
8893
subcontrol-origin: padding;
@@ -139,7 +144,7 @@ QHeaderView::down-arrow {
139144
<string>Expiry date</string>
140145
</property>
141146
<property name="textAlignment">
142-
<set>AlignCenter</set>
147+
<set>AlignLeading|AlignVCenter</set>
143148
</property>
144149
</column>
145150
</widget>

client/dialogs/FirstRun.ui

Lines changed: 34 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -113,65 +113,49 @@ color: #041E42;
113113
</property>
114114
<property name="styleSheet">
115115
<string notr="true">QComboBox {
116-
padding: 0px 10px;
117-
image: none;
118-
border: 1px solid #8E969D;
119-
border-radius: 2px;
120-
background-color: #FFFFFF;
121-
color: #353739;
122-
padding: 0px;
123-
padding-left:12px;
116+
padding: 0px 14px;
117+
border: 1px solid #C4CBD8;
118+
border-radius: 4px;
119+
background-color: #FFFFFF;
120+
color: #07142A;
121+
font-size: 16px;
124122
}
125-
126-
/* list */
127123
QComboBox QWidget#popup {
128-
background-color: transparent;
124+
background-color: transparent;
129125
}
130126
QComboBox QWidget#content {
131-
border: 1px solid #8E969D;
132-
border-radius: 2px;
133-
background-color: #FFFFFF;
127+
border: 1px solid #C4CBD8;
128+
border-radius: 4px;
129+
background-color: #FFFFFF;
134130
}
135-
136-
/* rows */
137131
QComboBox QPushButton {
138-
margin: 3px;
139-
padding: 0px 8px 0px 4px;
140-
border: 0px;
141-
color: #353739;
142-
background-color: #FFFFFF;
143-
text-align: left;
144-
qproperty-iconSize: 14px 9px;
145-
qproperty-layoutDirection: RightToLeft;
132+
margin: 3px;
133+
padding: 0px 12px 0px 4px;
134+
border: 0px;
135+
color: #07142A;
136+
background-color: #FFFFFF;
137+
text-align: left;
138+
font-weight: normal;
139+
font-size: 16px;
140+
qproperty-iconSize: 14px 9px;
141+
qproperty-layoutDirection: RightToLeft;
146142
}
147143
QComboBox QPushButton#selected {
148-
qproperty-icon: url(:/images/arrow_up.svg);
149-
}
150-
151-
/* hover row */
152-
QComboBox QPushButton:hover, QComboBox QPushButton:focus {
153-
background-color: #006EB5;
154-
color: #FFFFFF;
144+
qproperty-icon: url(:/images/arrow_up.svg);
155145
}
156146
QComboBox QPushButton:hover#selected, QComboBox QPushButton:focus#selected {
157-
qproperty-icon: url(:/images/arrow_up_white.svg);
147+
qproperty-icon: url(:/images/arrow_up_white.svg);
158148
}
159-
160-
/* drop-down button*/
161149
QComboBox::drop-down {
162-
background-color: #FFFFFF;
163-
width: 25px;
150+
background-color: #FFFFFF;
151+
width: 25px;
164152
}
165-
166-
/* drop-down button image*/
167153
QComboBox::down-arrow {
168-
image: url(:/images/arrow_down.svg);
154+
image: url(:/images/arrow_down.svg);
169155
}
170-
171-
/* drop-down button image on clicked*/
172156
QComboBox::down-arrow:on {
173-
top: 1px;
174-
left: 1px;
157+
top: 1px;
158+
left: 1px;
175159
}</string>
176160
</property>
177161
<property name="maxVisibleItems">
@@ -640,7 +624,7 @@ border-radius: 3px;</string>
640624
<x>363</x>
641625
<y>500</y>
642626
<width>298</width>
643-
<height>30</height>
627+
<height>32</height>
644628
</rect>
645629
</property>
646630
<property name="cursor">
@@ -657,9 +641,9 @@ border-radius: 3px;</string>
657641
<property name="geometry">
658642
<rect>
659643
<x>363</x>
660-
<y>535</y>
644+
<y>537</y>
661645
<width>298</width>
662-
<height>30</height>
646+
<height>32</height>
663647
</rect>
664648
</property>
665649
<property name="cursor">
@@ -1083,9 +1067,9 @@ border-radius: 3px;</string>
10831067
<property name="geometry">
10841068
<rect>
10851069
<x>363</x>
1086-
<y>535</y>
1070+
<y>537</y>
10871071
<width>298</width>
1088-
<height>30</height>
1072+
<height>32</height>
10891073
</rect>
10901074
</property>
10911075
<property name="cursor">
@@ -1104,7 +1088,7 @@ border-radius: 3px;</string>
11041088
<x>363</x>
11051089
<y>500</y>
11061090
<width>298</width>
1107-
<height>30</height>
1091+
<height>32</height>
11081092
</rect>
11091093
</property>
11101094
<property name="cursor">
@@ -1340,7 +1324,7 @@ border-radius: 3px;</string>
13401324
<x>363</x>
13411325
<y>500</y>
13421326
<width>298</width>
1343-
<height>30</height>
1327+
<height>32</height>
13441328
</rect>
13451329
</property>
13461330
<property name="cursor">

client/dialogs/KeyDialog.ui

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ background-color: #82A9D3;
8484
</property>
8585
<item>
8686
<widget class="QTreeWidget" name="view">
87+
<property name="styleSheet">
88+
<string notr="true">QWidget { background-color: #FFFFFF; }</string>
89+
</property>
8790
<property name="frameShape">
8891
<enum>QFrame::NoFrame</enum>
8992
</property>

0 commit comments

Comments
 (0)