check if recurring file exists
This commit is contained in:
@@ -1332,9 +1332,9 @@ void MainWindow::setupTransactionsTab() {
|
|||||||
// Set up context menu on transactions tab
|
// Set up context menu on transactions tab
|
||||||
auto theme = Settings::getInstance()->get_theme_name();
|
auto theme = Settings::getInstance()->get_theme_name();
|
||||||
if (theme == "Dark" || theme == "Midnight") {
|
if (theme == "Dark" || theme == "Midnight") {
|
||||||
ui->listChat->setStyleSheet("background-image: url(:/icons/res/SDLogo.png) ;background-attachment: fixed ;background-position: center center ;background-repeat: no-repeat;background-size: cover");
|
ui->listChat->setStyleSheet("background-image: url(:/icons/res/SDLogo.png) ;background-attachment: fixed ;background-position: center center ;background-repeat: no-repeat");
|
||||||
}
|
}
|
||||||
if (theme == "Default") {ui->listChat->setStyleSheet("background-image: url(:/icons/res/sdlogo2.png) ;background-attachment: fixed ;background-position: center center ;background-repeat: no-repeat;background-size: cover");}
|
if (theme == "Default") {ui->listChat->setStyleSheet("background-image: url(:/icons/res/sdlogo2.png) ;background-attachment: fixed ;background-position: center center ;background-repeat: no-repeat");}
|
||||||
|
|
||||||
ui->listChat->setResizeMode(QListView::Adjust);
|
ui->listChat->setResizeMode(QListView::Adjust);
|
||||||
ui->listChat->setWordWrap(true);
|
ui->listChat->setWordWrap(true);
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ QString Recurring::writeableFile() {
|
|||||||
auto filename = QStringLiteral("recurringpayments.json");
|
auto filename = QStringLiteral("recurringpayments.json");
|
||||||
|
|
||||||
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||||
if (!dir.exists())
|
if (dir.exists())
|
||||||
QDir().mkpath(dir.absolutePath());
|
QDir().mkpath(dir.absolutePath());
|
||||||
|
|
||||||
if (Settings::getInstance()->isTestnet()) {
|
if (Settings::getInstance()->isTestnet()) {
|
||||||
@@ -353,6 +353,9 @@ void Recurring::removeRecurringInfo(QString hash) {
|
|||||||
|
|
||||||
|
|
||||||
void Recurring::readFromStorage() {
|
void Recurring::readFromStorage() {
|
||||||
|
|
||||||
|
if (writeableFile().isEmpty())
|
||||||
|
{
|
||||||
QFile file(writeableFile());
|
QFile file(writeableFile());
|
||||||
file.open(QIODevice::ReadOnly);
|
file.open(QIODevice::ReadOnly);
|
||||||
|
|
||||||
@@ -365,10 +368,14 @@ void Recurring::readFromStorage() {
|
|||||||
auto p = RecurringPaymentInfo::fromJson(k.toObject());
|
auto p = RecurringPaymentInfo::fromJson(k.toObject());
|
||||||
payments.insert(p.getHash(), p);
|
payments.insert(p.getHash(), p);
|
||||||
}
|
}
|
||||||
|
}else{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Recurring::writeToStorage() {
|
void Recurring::writeToStorage() {
|
||||||
|
|
||||||
|
if (writeableFile().isEmpty())
|
||||||
|
{
|
||||||
QFile file(writeableFile());
|
QFile file(writeableFile());
|
||||||
file.open(QIODevice::ReadWrite | QIODevice::Truncate);
|
file.open(QIODevice::ReadWrite | QIODevice::Truncate);
|
||||||
|
|
||||||
@@ -381,6 +388,7 @@ void Recurring::writeToStorage() {
|
|||||||
out << QJsonDocument(arr).toJson();
|
out << QJsonDocument(arr).toJson();
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
|
}else{}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user