Commit 44a83a54 authored by ransome1's avatar ransome1
Browse files

Optimised filewatcher handling, fixed minor datepicker issue

parent 66401af6
...@@ -103,7 +103,6 @@ A prioritized backlog of new features and known issues can be found <a href="htt ...@@ -103,7 +103,6 @@ A prioritized backlog of new features and known issues can be found <a href="htt
* Multiple languages are either detected or can be set by hand to * Multiple languages are either detected or can be set by hand to
- English - English
- German - German
- Hungarian
- Italian - Italian
- Spanish - Spanish
- French - French
...@@ -111,6 +110,7 @@ A prioritized backlog of new features and known issues can be found <a href="htt ...@@ -111,6 +110,7 @@ A prioritized backlog of new features and known issues can be found <a href="htt
- Brazilian Portugese - Brazilian Portugese
- Japanese - Japanese
- Turkish - Turkish
- Hungarian
* sleek can be minimized to tray * sleek can be minimized to tray
* Existing todos can be used as templates for new ones * Existing todos can be used as templates for new ones
......
{ {
"name": "sleek", "name": "sleek",
"productName": "sleek", "productName": "sleek",
"version": "1.1.2-rc.2", "version": "1.1.2-rc.3",
"description": "Todo app based on todo.txt for Linux, Windows and MacOS, free and open-source", "description": "Todo app based on todo.txt for Linux, Windows and MacOS, free and open-source",
"synopsis": "Todo app based on todo.txt for Linux, Windows and MacOS, free and open-source", "synopsis": "Todo app based on todo.txt for Linux, Windows and MacOS, free and open-source",
"category": "ProjectManagement", "category": "ProjectManagement",
......
...@@ -7,7 +7,7 @@ const i18nextOptions = { ...@@ -7,7 +7,7 @@ const i18nextOptions = {
fallbackLng: "en", fallbackLng: "en",
namespace: "translation", namespace: "translation",
defaultNS: "translation", defaultNS: "translation",
supportedLngs: ["de", "en", "it", "es", "fr", "hu", "zh", "pt", "jp", "tr"], supportedLngs: ["de", "en", "it", "es", "fr", "zh", "pt", "jp", "tr", "hu"],
debug: false, debug: false,
preload: fs.readdirSync(path.join(__dirname, "../locales")).filter((fileName) => { preload: fs.readdirSync(path.join(__dirname, "../locales")).filter((fileName) => {
const joinedPath = path.join(path.join(__dirname, "../locales"), fileName) const joinedPath = path.join(path.join(__dirname, "../locales"), fileName)
......
...@@ -231,9 +231,6 @@ function setFriendlyLanguageNames() { ...@@ -231,9 +231,6 @@ function setFriendlyLanguageNames() {
case "fr": case "fr":
friendlyLanguageName = "Français" friendlyLanguageName = "Français"
break; break;
case "hu":
friendlyLanguageName = "Magyar"
break;
case "zh": case "zh":
friendlyLanguageName = "简体中文" friendlyLanguageName = "简体中文"
break; break;
...@@ -246,6 +243,9 @@ function setFriendlyLanguageNames() { ...@@ -246,6 +243,9 @@ function setFriendlyLanguageNames() {
case "tr": case "tr":
friendlyLanguageName = "Türkçe" friendlyLanguageName = "Türkçe"
break; break;
case "hu":
friendlyLanguageName = "Magyar"
break;
default: default:
return; return;
} }
......
...@@ -365,7 +365,6 @@ function generateFilterData(autoCompleteCategory, autoCompleteValue, autoComplet ...@@ -365,7 +365,6 @@ function generateFilterData(autoCompleteCategory, autoCompleteValue, autoComplet
// TODO can this be done above already? // TODO can this be done above already?
// remove empty filter entries // remove empty filter entries
filters = filters.filter(function(filter) { filters = filters.filter(function(filter) {
//console.log(filter[0]);
if(filter[0]) return filter; if(filter[0]) return filter;
}); });
// build filter buttons and add them to a fragment // build filter buttons and add them to a fragment
......
...@@ -5,7 +5,7 @@ import { _paq } from "./matomo.mjs"; ...@@ -5,7 +5,7 @@ import { _paq } from "./matomo.mjs";
import { RecExtension, SugarDueExtension, ThresholdExtension } from "./todotxtExtensions.mjs"; import { RecExtension, SugarDueExtension, ThresholdExtension } from "./todotxtExtensions.mjs";
import { generateFilterData } from "./filters.mjs"; import { generateFilterData } from "./filters.mjs";
import { items, item, setTodoComplete } from "./todos.mjs"; import { items, item, setTodoComplete } from "./todos.mjs";
import { datePickerInput } from "./datePicker.mjs"; import { datePickerInput, datePicker } from "./datePicker.mjs";
import { createModalJail } from "../configs/modal.config.mjs"; import { createModalJail } from "../configs/modal.config.mjs";
import * as recurrencePicker from "./recurrencePicker.mjs"; import * as recurrencePicker from "./recurrencePicker.mjs";
...@@ -232,7 +232,7 @@ function setPriority(priority) { ...@@ -232,7 +232,7 @@ function setPriority(priority) {
} }
function setDueDate(days) { function setDueDate(days) {
try { try {
const todo = new TodoTxtItem(document.getElementById("modalFormInput").value, [ new DueExtension() ]); const todo = new TodoTxtItem(document.getElementById("modalFormInput").value, [ new DueExtension(), new HiddenExtension(), new RecExtension(), new ThresholdExtension() ]);
if(days===0) { if(days===0) {
todo.due = undefined; todo.due = undefined;
todo.dueString = undefined; todo.dueString = undefined;
...@@ -243,6 +243,10 @@ function setDueDate(days) { ...@@ -243,6 +243,10 @@ function setDueDate(days) {
todo.due = new Date(new Date().setDate(new Date().getDate() + days)); todo.due = new Date(new Date().setDate(new Date().getDate() + days));
todo.dueString = todo.due.toISOString().substr(0, 10); todo.dueString = todo.due.toISOString().substr(0, 10);
} }
datePicker.setDate( todo.due );
document.getElementById("modalFormInput").value = todo.toString(); document.getElementById("modalFormInput").value = todo.toString();
return Promise.resolve("Success: Due date changed to " + todo.dueString) return Promise.resolve("Success: Due date changed to " + todo.dueString)
} catch(error) { } catch(error) {
......
...@@ -46,7 +46,7 @@ marked.use({ renderer }); ...@@ -46,7 +46,7 @@ marked.use({ renderer });
const tableContainerContent = document.createDocumentFragment(); const tableContainerContent = document.createDocumentFragment();
const todoTableBodyRowTemplate = document.createElement("div"); const todoTableBodyRowTemplate = document.createElement("div");
const todoTableBodyCellCheckboxTemplate = document.createElement("div"); const todoTableBodyCellCheckboxTemplate = document.createElement("div");
const todoTableBodyCellTextTemplate = document.createElement("div"); const todoTableBodyCellTextTemplate = document.createElement("a");
const tableContainerCategoriesTemplate = document.createElement("span"); const tableContainerCategoriesTemplate = document.createElement("span");
const todoTableBodyCellPriorityTemplate = document.createElement("div"); const todoTableBodyCellPriorityTemplate = document.createElement("div");
const todoTableBodyCellDueDateTemplate = document.createElement("span"); const todoTableBodyCellDueDateTemplate = document.createElement("span");
...@@ -94,7 +94,7 @@ function configureTodoTableTemplate() { ...@@ -94,7 +94,7 @@ function configureTodoTableTemplate() {
todoTableBodyCellCheckboxTemplate.setAttribute("class", "cell checkbox"); todoTableBodyCellCheckboxTemplate.setAttribute("class", "cell checkbox");
todoTableBodyCellTextTemplate.setAttribute("class", "cell text"); todoTableBodyCellTextTemplate.setAttribute("class", "cell text");
todoTableBodyCellTextTemplate.setAttribute("tabindex", 0); todoTableBodyCellTextTemplate.setAttribute("tabindex", 0);
//todoTableBodyCellTextTemplate.setAttribute("href", "#"); todoTableBodyCellTextTemplate.setAttribute("href", "#");
tableContainerCategoriesTemplate.setAttribute("class", "categories"); tableContainerCategoriesTemplate.setAttribute("class", "categories");
todoTableBodyCellDueDateTemplate.setAttribute("class", "cell itemDueDate"); todoTableBodyCellDueDateTemplate.setAttribute("class", "cell itemDueDate");
todoTableBodyCellRecurrenceTemplate.setAttribute("class", "cell recurrence"); todoTableBodyCellRecurrenceTemplate.setAttribute("class", "cell recurrence");
...@@ -107,10 +107,6 @@ function configureTodoTableTemplate() { ...@@ -107,10 +107,6 @@ function configureTodoTableTemplate() {
function generateItems(content) { function generateItems(content) {
try { try {
items = { objects: TodoTxt.parse(content, [ new DueExtension(), new HiddenExtension(), new RecExtension(), new ThresholdExtension() ]) } items = { objects: TodoTxt.parse(content, [ new DueExtension(), new HiddenExtension(), new RecExtension(), new ThresholdExtension() ]) }
// items.objects = items.objects.filter(function(item) {
// if(!item.text && !item.h) return false;
// return true;
// });
items.complete = items.objects.filter(function(item) { return item.complete === true }); items.complete = items.objects.filter(function(item) { return item.complete === true });
items.incomplete = items.objects.filter(function(item) { return item.complete === false }); items.incomplete = items.objects.filter(function(item) { return item.complete === false });
items.objects = items.objects.filter(function(item) { return item.toString() != "" }); items.objects = items.objects.filter(function(item) { return item.toString() != "" });
......
...@@ -5,6 +5,10 @@ const fs = require("fs"); ...@@ -5,6 +5,10 @@ const fs = require("fs");
const chokidar = require("chokidar"); const chokidar = require("chokidar");
const Store = require("./configs/store.config.js"); const Store = require("./configs/store.config.js");
// ######################################################################################################################## // ########################################################################################################################
// SETUP PROCESS
// ########################################################################################################################
process.traceProcessWarnings = true;
// ########################################################################################################################
// SETUP APPIMAGE AUTO UPDATER // SETUP APPIMAGE AUTO UPDATER
// ######################################################################################################################## // ########################################################################################################################
const { AppImageUpdater } = require("electron-updater"); const { AppImageUpdater } = require("electron-updater");
...@@ -167,7 +171,7 @@ const createWindow = async function() { ...@@ -167,7 +171,7 @@ const createWindow = async function() {
break; break;
} }
} }
const startFileWatcher = function(file, isTabItem, resetTab) { const startFileWatcher = async function(file, isTabItem, resetTab) {
try { try {
if(!fs.existsSync(file)) throw("Error: File not found on disk") if(!fs.existsSync(file)) throw("Error: File not found on disk")
// skip persisted files and go with ENV if set // skip persisted files and go with ENV if set
...@@ -204,10 +208,11 @@ const createWindow = async function() { ...@@ -204,10 +208,11 @@ const createWindow = async function() {
// only push new path if it is not already in the user data // only push new path if it is not already in the user data
if((!fileFound || !userData.data.files) && file) userData.data.files.push([1, file, 1]); if((!fileFound || !userData.data.files) && file) userData.data.files.push([1, file, 1]);
userData.set("files", userData.data.files); userData.set("files", userData.data.files);
//userData.data.file = file;
//userData.set("file", file);
// TODO describe // TODO describe
if(fileWatcher) fileWatcher.close(); if(fileWatcher) {
fileWatcher.close().then(() => console.log("Info: Filewatcher instance closed"));
await fileWatcher.unwatch();
}
fileWatcher = chokidar.watch(file); fileWatcher = chokidar.watch(file);
fileWatcher fileWatcher
.on("add", function() { .on("add", function() {
...@@ -796,10 +801,10 @@ app ...@@ -796,10 +801,10 @@ app
if(appData.channel==="AppImage") autoUpdater.checkForUpdatesAndNotify(); if(appData.channel==="AppImage") autoUpdater.checkForUpdatesAndNotify();
}) })
.on("window-all-closed", () => { .on("window-all-closed", () => {
if (process.platform !== "darwin") app.quit() if(process.platform !== "darwin") app.quit()
mainWindow = null; mainWindow = null;
}) })
.on("activate", () => { .on("activate", () => {
if (BrowserWindow.getAllWindows().length===0) createWindow() if(BrowserWindow.getAllWindows().length===0) createWindow()
app.show(); app.show();
}); });
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