Commit 2d23b170 authored by Martin Straka's avatar Martin Straka

Added zfo database size limit to settings

parent 5bb5b23c
......@@ -362,9 +362,9 @@ int main(int argc, char *argv[])
}
/* true = zfo db store in disk, false = to memory */
if (!globZfoDbPtr->openDb(ZFO_DB_NAME, true)) {
if (!globZfoDbPtr->openDb(ZFO_DB_NAME, (globSet.zfoDbSizeMBs > 0))) {
qDebug() << "ERROR: zfo db not found!";
return EXIT_FAILURE;
/* TODO - delete and create new db */
}
/* load UI (QML) */
......
......@@ -45,6 +45,7 @@ Settings::Settings(void)
pinCode(),
pinInactTimeoutInSecs(DEFAULT_PIN_INACT_TIMEOUT),
dbsLocation(),
zfoDbSizeMBs(DEFAULT_ZFO_LIMIT_MB),
m_lastUpdate()
{
}
......@@ -60,6 +61,7 @@ void Settings::saveToSettings(QSettings &settings) const
settings.setValue(SETTINGS_COMPLETE_MSG, downloadCompleteMsgs);
settings.setValue(SETTINGS_MSG_LIFETIME_IN_DAYS, msgLifeTimeInDays);
settings.setValue(SETTINGS_FILE_LIFETIME_IN_DAYS, fileLifeTimeInDays);
settings.setValue(SETTINGS_ZFO_LIMIT_MB, zfoDbSizeMBs);
if (!_pinVal.isEmpty()) {
//settings.setValue(SETTINGS_PIN_VAL,
......@@ -110,6 +112,9 @@ void Settings::loadFromSettings(const QSettings &settings)
fileLifeTimeInDays = settings.value(
SETTINGS_GLOBAL_GROUP "/" SETTINGS_FILE_LIFETIME_IN_DAYS,
DEFAULT_FILE_LIFETIME).toInt();
zfoDbSizeMBs = settings.value(
SETTINGS_GLOBAL_GROUP "/" SETTINGS_ZFO_LIMIT_MB,
DEFAULT_ZFO_LIMIT_MB).toInt();
//_pinVal = QString::fromUtf8(QByteArray::fromBase64(
// settings.value(SETTINGS_GLOBAL_GROUP "/" SETTINGS_PIN_VAL,
......
......@@ -37,6 +37,7 @@
* attachment files stored in local database (in days)*/
#define DEFAULT_MSG_LIFETIME 90
#define DEFAULT_FILE_LIFETIME 10
#define DEFAULT_ZFO_LIMIT_MB 200
#define DEFAULT_PIN_INACT_TIMEOUT 0
/* Names of setting items in GLOBALS group in the datovka.conf file */
#define SETTINGS_GLOBAL_GROUP "GLOBALS"
......@@ -44,6 +45,7 @@
#define SETTINGS_COMPLETE_MSG "complete_msgs"
#define SETTINGS_MSG_LIFETIME_IN_DAYS "msg_lifetime"
#define SETTINGS_FILE_LIFETIME_IN_DAYS "file_lifetime"
#define SETTINGS_ZFO_LIMIT_MB "zfo_db_max_size"
//#define SETTINGS_PIN_VAL "pin_val" // Don't store readable PIN value into settings.
#define SETTINGS_PIN_ALG "pin_alg"
#define SETTINGS_PIN_SALT "pin_salt"
......@@ -125,7 +127,8 @@ public:
QByteArray pinSalt; /*!< Salt value used to generate PIN hash. */
QByteArray pinCode; /*!< Hashed PIN code. */
int pinInactTimeoutInSecs; /*!< Inactivity locking interval. */
QString dbsLocation;
QString dbsLocation; /*!< Path to databses location. */
int zfoDbSizeMBs; /*!< Zfo database max size in MB. */
private:
QString m_lastUpdate;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment