check if recurring file exists
This commit is contained in:
@@ -1332,9 +1332,9 @@ void MainWindow::setupTransactionsTab() {
|
||||
// Set up context menu on transactions tab
|
||||
auto theme = Settings::getInstance()->get_theme_name();
|
||||
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->setWordWrap(true);
|
||||
|
||||
@@ -319,7 +319,7 @@ QString Recurring::writeableFile() {
|
||||
auto filename = QStringLiteral("recurringpayments.json");
|
||||
|
||||
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||
if (!dir.exists())
|
||||
if (dir.exists())
|
||||
QDir().mkpath(dir.absolutePath());
|
||||
|
||||
if (Settings::getInstance()->isTestnet()) {
|
||||
@@ -353,6 +353,9 @@ void Recurring::removeRecurringInfo(QString hash) {
|
||||
|
||||
|
||||
void Recurring::readFromStorage() {
|
||||
|
||||
if (writeableFile().isEmpty())
|
||||
{
|
||||
QFile file(writeableFile());
|
||||
file.open(QIODevice::ReadOnly);
|
||||
|
||||
@@ -365,10 +368,14 @@ void Recurring::readFromStorage() {
|
||||
auto p = RecurringPaymentInfo::fromJson(k.toObject());
|
||||
payments.insert(p.getHash(), p);
|
||||
}
|
||||
}else{}
|
||||
}
|
||||
|
||||
|
||||
void Recurring::writeToStorage() {
|
||||
|
||||
if (writeableFile().isEmpty())
|
||||
{
|
||||
QFile file(writeableFile());
|
||||
file.open(QIODevice::ReadWrite | QIODevice::Truncate);
|
||||
|
||||
@@ -381,6 +388,7 @@ void Recurring::writeToStorage() {
|
||||
out << QJsonDocument(arr).toJson();
|
||||
|
||||
file.close();
|
||||
}else{}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user