Commit 92d7d7c4 authored by Martin Straka's avatar Martin Straka

Added ZFO limit settings into QML

parent 2d23b170
......@@ -66,7 +66,8 @@ Item {
anchors.fill: parent
onClicked: {
settings.updateSettingsStorage(messageLifeSpinBox.val().toString(),
attachLifeSpinBox.val().toString(), dbPathText.text.toString())
attachLifeSpinBox.val().toString(), zfoLifeSpinBox.value.toString(),
dbPathText.text.toString())
settings.saveAllSettings(accountModel)
pageView.pop(StackView.Immediate)
}
......@@ -137,6 +138,30 @@ Item {
}
wrapMode: Text.Wrap
}
Text {
id: zfoLifeLabel
color: datovkaPalette.text
text: qsTr("ZFO storage size in MB")
}
SpinBox {
/* Holds value in days. */
id: zfoLifeSpinBox
height: inputItemHeight
font.pointSize: defaultTextFont.font.pointSize
from: 0
to: 1000
stepSize: 100
}
Text {
color: datovkaPalette.mid
width: parent.width
text: if (zfoLifeSpinBox.value === 0) {
qsTr("Message ZFO data won't be automatically stored.")
} else {
qsTr("Maximum size of stored message ZFO data is set to %1 MB. Default is %2 MB.").arg(zfoLifeSpinBox.value).arg(200)
}
wrapMode: Text.Wrap
}
Text {
id: dbPathLabel
color: datovkaPalette.text
......@@ -209,6 +234,7 @@ Item {
onSendSettingsStorageData: {
messageLifeSpinBox.setVal(msgLifeDays)
attachLifeSpinBox.setVal(fileLifeDays)
zfoLifeSpinBox.value = maxZfoSizeMB
dbPathText.text = dbPath
dbPathLabel.visible = showChangeDbLocation
dbPathText.visible = showChangeDbLocation
......
......@@ -86,8 +86,8 @@ void GlobalSettingsQmlWrapper::loadSettings(const QString &section)
// globSet.fileLifeTimeInDays, globSet.dbsLocation,
// true, showSetDefaulButton);
emit sendSettingsStorageData(globSet.msgLifeTimeInDays,
globSet.fileLifeTimeInDays, globSet.dbsLocation,
false, showSetDefaulButton);
globSet.fileLifeTimeInDays, globSet.zfoDbSizeMBs,
globSet.dbsLocation, false, showSetDefaulButton);
#endif
}
......@@ -113,10 +113,12 @@ void GlobalSettingsQmlWrapper::updateSettingsSync(bool downloadOnlyNewMsgs,
}
void GlobalSettingsQmlWrapper::updateSettingsStorage(const QString &msgLifeDays,
const QString &fileLifeDays, const QString &dbPath)
const QString &fileLifeDays, const QString &maxZfoSizeMB,
const QString &dbPath)
{
globSet.msgLifeTimeInDays = msgLifeDays.toInt();
globSet.fileLifeTimeInDays = fileLifeDays.toInt();
globSet.zfoDbSizeMBs = maxZfoSizeMB.toInt();
globSet.dbsLocation = dbPath;
}
......
......@@ -90,13 +90,15 @@ public:
/*!
* @brief Save storage settings from QML.
*
* @param[in] msgLifeDays - How many days are messages stored in db.
* @param[in] fileLifeDays - How many days are attachments stored in db.
* @param[in] dbPath - Current path to databases.
* @param[in] msgLifeDays How many days are messages stored in db.
* @param[in] fileLifeDays How many days are attachments stored in db.
* @param[in] maxZfoSizeMB Maximal size of zfo storage.
* @param[in] dbPath Current path to databases.
*/
Q_INVOKABLE
void updateSettingsStorage(const QString &msgLifeDays,
const QString &fileLifeDays, const QString &dbPath);
const QString &fileLifeDays, const QString &maxZfoSizeMB,
const QString &dbPath);
/*!
* @brief Save PIN settings from QML.
......@@ -195,15 +197,16 @@ signals:
/*!
* @brief Send current storage settings to QML.
*
* @param[in] msgLifeDays - How many days are messages stored in db.
* @param[in] fileLifeDays - How many days are attachments stored in db.
* @param[in] dbPath - Current path to databases for QML.
* @param[in] showChangeDbLocation - true = Allow changing of database location.
* @param[in] showSetDefaulButton - true = Show setDefaultLocation button.
* @param[in] msgLifeDays How many days are messages stored in db.
* @param[in] fileLifeDays How many days are attachments stored in db.
* @param[in] maxZfoSizeMB Maximal size of zfo storage.
* @param[in] dbPath Current path to databases for QML.
* @param[in] showChangeDbLocation True = Allow changing of database location.
* @param[in] showSetDefaulButton True = Show setDefaultLocation button.
*/
void sendSettingsStorageData(int msgLifeDays,
int fileLifeDays, QString dbPath, bool showChangeDbLocation,
bool showSetDefaulButton);
int fileLifeDays, int maxZfoSizeMB, QString dbPath,
bool showChangeDbLocation, bool showSetDefaulButton);
/*!
* @brief Send PIN verification result to QML.
......
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