Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenFlipper-Free
OpenFlipper
Commits
18c05600
Commit
18c05600
authored
Nov 19, 2015
by
Daniel Gotzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Read/write to ini by using OpenFlipperSettings
parent
44fedaaf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
23 deletions
+10
-23
LicenseManager/LicenseManagerActive.cc
LicenseManager/LicenseManagerActive.cc
+10
-23
No files found.
LicenseManager/LicenseManagerActive.cc
View file @
18c05600
...
...
@@ -84,7 +84,6 @@ License File format:
#include <QCryptographicHash>
#include <QNetworkInterface>
#include <OpenFlipper/BasePlugin/INIInterface.hh>
#include <limits>
...
...
@@ -136,38 +135,30 @@ void LicenseManager::blockSignals( bool _state) {
bool
LicenseManager
::
timestampOk
()
{
QString
inifile
=
OpenFlipper
::
Options
::
configDirStr
()
+
OpenFlipper
::
Options
::
dirSeparator
()
+
"OpenFlipper.ini"
;
INIFile
ini
;
if
(
!
ini
.
connect
(
inifile
,
true
)
)
{
//emit log(LOGERR,tr("Can not create user ini file"));
return
false
;
}
bool
notExpired
=
false
;
bool
gotTimestampEntry
=
false
;
quint64
timestamp
=
QDateTime
::
currentMSecsSinceEpoch
();
quint64
lastTimestamp
=
timestamp
;
quint64
timestampEntry
=
0
;
QString
lastTimestampEntry
;
std
::
vector
<
QString
>
lastTimestampEntryVec
;
quint64
lastTimestampEntryNum
=
0
;
bool
gotTimestampEntry
=
false
;
// ===============================================================================================
// Read last Timestemp
// ===============================================================================================
if
(
ini
.
get_entry
(
lastTimestampEntryVec
,
"Timestamp"
,
pluginFileName
()
)
){
lastTimestampEntry
=
lastTimestampEntryVec
[
0
];
lastTimestampEntryNum
=
lastTimestampEntry
.
toULongLong
(
&
gotTimestampEntry
,
16
);
}
else
{
QString
title
=
"Timestamp/"
+
pluginFileName
();
QString
lastTimestampEntry
=
OpenFlipperSettings
().
value
(
title
,
"empty"
).
toString
();
if
(
lastTimestampEntry
==
QString
(
"empty"
)){
notExpired
=
true
;
}
else
{
lastTimestampEntryNum
=
lastTimestampEntry
.
toULongLong
(
&
gotTimestampEntry
,
16
);
}
// ===============================================================================================
// Decrypt last Timestamp
// ===============================================================================================
...
...
@@ -212,11 +203,7 @@ bool LicenseManager::timestampOk() {
// Write new Timestemp
// ===============================================================================================
ini
.
add_entry
(
"Timestamp"
,
pluginFileName
(),
QString
::
number
(
timestampEntry
,
16
));
//ini.add_entry("Timestamp","Read", QString::number(lastTimestamp));
//ini.add_entry("Timestamp","Write", QString::number(QDateTime::currentMSecsSinceEpoch()));
ini
.
disconnect
();
OpenFlipperSettings
().
setValue
(
title
,
QString
::
number
(
timestampEntry
,
16
)
);
return
notExpired
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment