Открыть боковую панель
vmkspv
plasma-applet-csputils
Коммиты
06acf6c5
Коммит
06acf6c5
создал
Янв 04, 2025
по автору
vmkspv
Просмотр файлов
Added expiration tracker
владелец
84ce888c
Изменения
1
Скрыть пробелы
Построчно
Рядом
contents/ui/main.qml
Просмотр файла @
06acf6c5
...
...
@@ -19,8 +19,14 @@ Item {
property
string
certOwner
:
""
property
string
issueDate
:
""
property
string
expiryDate
:
""
property
int
daysUntilExpiry
:
0
property
int
busyCounter
:
0
readonly
property
bool
busy
:
busyCounter
!=
0
property
bool
notificationShown
:
false
property
var
notificationSource
:
PlasmaCore.DataSource
{
engine
:
"
notifications
"
connectedSources
:
[
"
notifications
"
]
}
PlasmaCore.DataSource
{
id
:
executeSource
...
...
@@ -49,6 +55,8 @@ Item {
let
expiryMatch
=
stdout
.
match
(
/Истекает
\s
*:
\s
*
(
.+
)
/
)
expiryDate
=
expiryMatch
?
expiryMatch
[
1
]
:
""
checkExpiryDate
()
disconnectSource
(
sourceName
)
}
else
{
updateAll
()
...
...
@@ -361,6 +369,41 @@ Item {
}
}
function
checkExpiryDate
()
{
if
(
!
expiryDate
)
{
return
;
}
let
[
datePart
,
timePart
]
=
expiryDate
.
split
(
'
'
);
let
[
day
,
month
,
year
]
=
datePart
.
split
(
'
/
'
);
let
[
hours
,
minutes
,
seconds
]
=
timePart
.
split
(
'
:
'
);
let
expiryTime
=
new
Date
(
year
,
month
-
1
,
day
,
hours
,
minutes
,
seconds
);
let
currentTime
=
new
Date
();
daysUntilExpiry
=
Math
.
ceil
((
expiryTime
-
currentTime
)
/
(
1000
*
60
*
60
*
24
));
if
(
!
notificationShown
&&
daysUntilExpiry
<=
30
&&
daysUntilExpiry
>
0
)
{
showExpiryNotification
();
notificationShown
=
true
;
}
}
function
showExpiryNotification
()
{
var
service
=
notificationSource
.
serviceForSource
(
"
notifications
"
);
var
operation
=
service
.
operationDescription
(
"
createNotification
"
);
operation
.
appName
=
"
Управление КриптоПро
"
;
operation
.
appIcon
=
"
document-edit-encrypt
"
;
operation
.
summary
=
i18n
(
"
Сертификат скоро истекает
"
);
operation
.
body
=
i18n
(
"
Ваш сертификат ЭП истекает через %1 дней
"
,
daysUntilExpiry
);
operation
.
eventId
=
"
certExpiry
"
;
operation
.
persistent
=
true
;
operation
.
urgency
=
2
;
service
.
startOperationCall
(
operation
);
}
Timer
{
id
:
certCheckTimer
interval
:
2000
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать