diff --git a/src/AndroidFileResource.h b/src/AndroidFileResource.h index 07b7d2e..a7869c6 100644 --- a/src/AndroidFileResource.h +++ b/src/AndroidFileResource.h @@ -7,8 +7,8 @@ #ifndef MIRAI_ANDROID_FILE_RESOURCE_H #define MIRAI_ANDROID_FILE_RESOURCE_H -#include "QFile" #include "QDebug" +#include "QFile" #include "core/BaseFileResource.h" #include "core/TodoMd.h" @@ -48,7 +48,6 @@ class AndroidFileResource : public BaseFileResource return; } QString content = file.readAll(); - qDebug() << "Content " << content; file.close(); auto result = TodoMdFormat::parse(content.toStdString()); diff --git a/src/Backend.cpp b/src/Backend.cpp index 3d5f605..f7e3081 100644 --- a/src/Backend.cpp +++ b/src/Backend.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -29,8 +30,8 @@ Backend::Backend() : todoView(&mirai) std::cout << "Backend created" << std::endl; cpputils::debug::Timer readConfigDuration; - QDir().mkdir(QDir::homePath() + "/.config/mirai"); - QFile loadFile(QDir::homePath() + "/.config/mirai/config.json"); + QDir().mkpath(getConfigFilePath()); + QFile loadFile(getConfigFilePath()); readConfigDuration.printTimeElapsed("Read config duration"); if (loadFile.open(QIODevice::ReadOnly)) { @@ -341,7 +342,7 @@ void Backend::saveConfig() } rootJson["tags"] = tagsJson; - QFile configFile(QDir::homePath() + "/.config/mirai/config.json"); + QFile configFile(getConfigFilePath()); if (!configFile.open(QIODevice::WriteOnly)) { qWarning() << "Cannot save config"; return; @@ -350,3 +351,9 @@ void Backend::saveConfig() configFile.close(); qDebug() << "Config file saved"; } + +QString Backend::getConfigFilePath() const +{ + QString configFolder = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation); + return configFolder + "/config.json"; +} diff --git a/src/Backend.h b/src/Backend.h index 05d9631..3753725 100644 --- a/src/Backend.h +++ b/src/Backend.h @@ -67,6 +67,7 @@ class Backend : public QObject QVariant getActiveResourcesFilter(); bool shouldHideCompletedTasks(); void saveConfig(); + QString getConfigFilePath() const; mirai::Mirai mirai; // Both Todo and Calendar view use the todoView for now. diff --git a/src/qml/MainPanel.qml b/src/qml/MainPanel.qml index 896a2f4..b13c7c4 100644 --- a/src/qml/MainPanel.qml +++ b/src/qml/MainPanel.qml @@ -74,7 +74,6 @@ Rectangle { Component { id: calendarViewComponent CalendarView { - } } diff --git a/src/qml/forms/FilesForm.qml b/src/qml/forms/FilesForm.qml index 49c92d2..66587d3 100644 --- a/src/qml/forms/FilesForm.qml +++ b/src/qml/forms/FilesForm.qml @@ -42,7 +42,6 @@ ColumnLayout { FileDialog { id: fileDialog - currentFolder: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0] onAccepted: { console.log(selectedFile.toString()) internal.paths = [...internal.paths, selectedFile.toString().replace(/^file:\/\//, "")]