Commit ed466b42 authored by Morgan McMillian's avatar Morgan McMillian

add ability to load todo.txt from any shared location, resolves #4

parent 778ab326
......@@ -181,46 +181,60 @@ Page {
}
}
}
// Divider {}
// Container {
// layout: DockLayout {}
// horizontalAlignment: HorizontalAlignment.Fill
// Container {
// leftPadding: 30.0
// rightPadding: 30.0
// DropDown {
// title: "Storage:"
// preferredWidth: 1440.0
// onSelectedIndexChanged: {
// if (sync != selectedValue) {
// modifySetting("sync", selectedValue)
// }
// }
// Option {
// text: "Local only"
// value: "local"
// selected: sync == "local"
// }
// }
// }
// }
// Container {
// layout: DockLayout {}
// horizontalAlignment: HorizontalAlignment.Fill
// Container {
// leftPadding: 30.0
// rightPadding: 30.0
// topPadding: 10.0
// TextField {
// id: dboxPath
// hintText: "Dropbox location"
// text: dboxpath
// visible: sync == "dropbox"
// onTextChanged: {
// if (dboxPath.text.length > 0) {
// modifySetting("dbox_path", dboxPath.text)
// }
// }
// }
// }
// }
Divider {}
Container {
layout: DockLayout {}
horizontalAlignment: HorizontalAlignment.Fill
Container {
leftPadding: 30.0
rightPadding: 30.0
DropDown {
title: "Storage:"
preferredWidth: 1440.0
onSelectedIndexChanged: {
if (sync != selectedValue) {
modifySetting("sync", selectedValue)
}
}
Option {
text: "Local only"
value: "local"
selected: sync == "local"
}
}
}
}
Container {
layout: DockLayout {}
horizontalAlignment: HorizontalAlignment.Fill
Container {
leftPadding: 30.0
rightPadding: 30.0
topPadding: 10.0
TextField {
id: dboxPath
hintText: "Dropbox location"
text: dboxpath
visible: sync == "dropbox"
onTextChanged: {
if (dboxPath.text.length > 0) {
modifySetting("dbox_path", dboxPath.text)
}
}
leftPadding: 30.0
rightPadding: 30.0
Button {
preferredWidth: 1440.0
text: "Open shared todo.txt"
onClicked: {
sharedPicker.open()
}
}
}
......@@ -267,6 +281,16 @@ Page {
console.log("FileSelected signal received : " + selectedFiles);
taskModel.exportFiles(selectedFiles)
}
},
FilePicker {
id: sharedPicker
title: "Select shared todo.txt"
type: FileType.Document
viewMode: FilePickerViewMode.ListView
onFileSelected: {
console.log("FileSelected signal: " + selectedFiles);
taskModel.openSharedFiles(selectedFiles);
}
}
]
}
......@@ -268,6 +268,14 @@ void TaskModel::exportFiles(const QStringList &files) {
exportto.saveArchive(done);
}
void TaskModel::openSharedFiles(QString filepath) {
QRegExp pathrgx("^/accounts/1000/");
QRegExp filergx("/(todo|done).txt$");
filepath.replace(pathrgx, "");
filepath.replace(filergx, "");
modifySetting("path", filepath);
}
void TaskModel::promptPurgeSandbox() {
dialog = new SystemDialog("PURGE", "CANCEL");
dialog->setTitle("Purge local sandbox");
......
......@@ -59,6 +59,7 @@ public:
Q_INVOKABLE QString formatDate(const QDateTime &date) const;
Q_INVOKABLE void promptPurgeSandbox();
Q_INVOKABLE void exportFiles(const QStringList &files);
Q_INVOKABLE void openSharedFiles(QString filepath);
Q_SLOT void setView();
Q_SLOT void setValue(int idx, const QString &key, const QVariant &value);
Q_SLOT void updateTask(int idx, const QString &task);
......
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