Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ransome
sleek
Commits
44a83a54
Commit
44a83a54
authored
Oct 03, 2021
by
ransome1
Browse files
Optimised filewatcher handling, fixed minor datepicker issue
parent
66401af6
Changes
8
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
44a83a54
...
...
@@ -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
-
English
-
German
-
Hungarian
-
Italian
-
Spanish
-
French
...
...
@@ -111,6 +110,7 @@ A prioritized backlog of new features and known issues can be found <a href="htt
-
Brazilian Portugese
-
Japanese
-
Turkish
-
Hungarian
*
sleek can be minimized to tray
*
Existing todos can be used as templates for new ones
...
...
package.json
View file @
44a83a54
{
"name"
:
"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"
,
"synopsis"
:
"Todo app based on todo.txt for Linux, Windows and MacOS, free and open-source"
,
"category"
:
"ProjectManagement"
,
...
...
src/configs/i18next.config.js
View file @
44a83a54
...
...
@@ -7,7 +7,7 @@ const i18nextOptions = {
fallbackLng
:
"
en
"
,
namespace
:
"
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
,
preload
:
fs
.
readdirSync
(
path
.
join
(
__dirname
,
"
../locales
"
)).
filter
((
fileName
)
=>
{
const
joinedPath
=
path
.
join
(
path
.
join
(
__dirname
,
"
../locales
"
),
fileName
)
...
...
src/js/content.mjs
View file @
44a83a54
...
...
@@ -231,9 +231,6 @@ function setFriendlyLanguageNames() {
case
"
fr
"
:
friendlyLanguageName
=
"
Français
"
break
;
case
"
hu
"
:
friendlyLanguageName
=
"
Magyar
"
break
;
case
"
zh
"
:
friendlyLanguageName
=
"
简体中文
"
break
;
...
...
@@ -246,6 +243,9 @@ function setFriendlyLanguageNames() {
case
"
tr
"
:
friendlyLanguageName
=
"
Türkçe
"
break
;
case
"
hu
"
:
friendlyLanguageName
=
"
Magyar
"
break
;
default
:
return
;
}
...
...
src/js/filters.mjs
View file @
44a83a54
...
...
@@ -365,7 +365,6 @@ function generateFilterData(autoCompleteCategory, autoCompleteValue, autoComplet
// TODO can this be done above already?
// remove empty filter entries
filters
=
filters
.
filter
(
function
(
filter
)
{
//console.log(filter[0]);
if
(
filter
[
0
])
return
filter
;
});
// build filter buttons and add them to a fragment
...
...
src/js/form.mjs
View file @
44a83a54
...
...
@@ -5,7 +5,7 @@ import { _paq } from "./matomo.mjs";
import
{
RecExtension
,
SugarDueExtension
,
ThresholdExtension
}
from
"
./todotxtExtensions.mjs
"
;
import
{
generateFilterData
}
from
"
./filters.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
*
as
recurrencePicker
from
"
./recurrencePicker.mjs
"
;
...
...
@@ -232,7 +232,7 @@ function setPriority(priority) {
}
function
setDueDate
(
days
)
{
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
)
{
todo
.
due
=
undefined
;
todo
.
dueString
=
undefined
;
...
...
@@ -243,6 +243,10 @@ function setDueDate(days) {
todo
.
due
=
new
Date
(
new
Date
().
setDate
(
new
Date
().
getDate
()
+
days
));
todo
.
dueString
=
todo
.
due
.
toISOString
().
substr
(
0
,
10
);
}
datePicker
.
setDate
(
todo
.
due
);
document
.
getElementById
(
"
modalFormInput
"
).
value
=
todo
.
toString
();
return
Promise
.
resolve
(
"
Success: Due date changed to
"
+
todo
.
dueString
)
}
catch
(
error
)
{
...
...
src/js/todos.mjs
View file @
44a83a54
...
...
@@ -46,7 +46,7 @@ marked.use({ renderer });
const
tableContainerContent
=
document
.
createDocumentFragment
();
const
todoTableBodyRowTemplate
=
document
.
createElement
(
"
div
"
);
const
todoTableBodyCellCheckboxTemplate
=
document
.
createElement
(
"
div
"
);
const
todoTableBodyCellTextTemplate
=
document
.
createElement
(
"
div
"
);
const
todoTableBodyCellTextTemplate
=
document
.
createElement
(
"
a
"
);
const
tableContainerCategoriesTemplate
=
document
.
createElement
(
"
span
"
);
const
todoTableBodyCellPriorityTemplate
=
document
.
createElement
(
"
div
"
);
const
todoTableBodyCellDueDateTemplate
=
document
.
createElement
(
"
span
"
);
...
...
@@ -94,7 +94,7 @@ function configureTodoTableTemplate() {
todoTableBodyCellCheckboxTemplate
.
setAttribute
(
"
class
"
,
"
cell checkbox
"
);
todoTableBodyCellTextTemplate
.
setAttribute
(
"
class
"
,
"
cell text
"
);
todoTableBodyCellTextTemplate
.
setAttribute
(
"
tabindex
"
,
0
);
//
todoTableBodyCellTextTemplate.setAttribute("href", "#");
todoTableBodyCellTextTemplate
.
setAttribute
(
"
href
"
,
"
#
"
);
tableContainerCategoriesTemplate
.
setAttribute
(
"
class
"
,
"
categories
"
);
todoTableBodyCellDueDateTemplate
.
setAttribute
(
"
class
"
,
"
cell itemDueDate
"
);
todoTableBodyCellRecurrenceTemplate
.
setAttribute
(
"
class
"
,
"
cell recurrence
"
);
...
...
@@ -107,10 +107,6 @@ function configureTodoTableTemplate() {
function
generateItems
(
content
)
{
try
{
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
.
incomplete
=
items
.
objects
.
filter
(
function
(
item
)
{
return
item
.
complete
===
false
});
items
.
objects
=
items
.
objects
.
filter
(
function
(
item
)
{
return
item
.
toString
()
!=
""
});
...
...
src/main.js
View file @
44a83a54
...
...
@@ -5,6 +5,10 @@ const fs = require("fs");
const
chokidar
=
require
(
"
chokidar
"
);
const
Store
=
require
(
"
./configs/store.config.js
"
);
// ########################################################################################################################
// SETUP PROCESS
// ########################################################################################################################
process
.
traceProcessWarnings
=
true
;
// ########################################################################################################################
// SETUP APPIMAGE AUTO UPDATER
// ########################################################################################################################
const
{
AppImageUpdater
}
=
require
(
"
electron-updater
"
);
...
...
@@ -167,7 +171,7 @@ const createWindow = async function() {
break
;
}
}
const
startFileWatcher
=
function
(
file
,
isTabItem
,
resetTab
)
{
const
startFileWatcher
=
async
function
(
file
,
isTabItem
,
resetTab
)
{
try
{
if
(
!
fs
.
existsSync
(
file
))
throw
(
"
Error: File not found on disk
"
)
// skip persisted files and go with ENV if set
...
...
@@ -204,10 +208,11 @@ const createWindow = async function() {
// 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
]);
userData
.
set
(
"
files
"
,
userData
.
data
.
files
);
//userData.data.file = file;
//userData.set("file", file);
// 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
.
on
(
"
add
"
,
function
()
{
...
...
@@ -796,10 +801,10 @@ app
if
(
appData
.
channel
===
"
AppImage
"
)
autoUpdater
.
checkForUpdatesAndNotify
();
})
.
on
(
"
window-all-closed
"
,
()
=>
{
if
(
process
.
platform
!==
"
darwin
"
)
app
.
quit
()
if
(
process
.
platform
!==
"
darwin
"
)
app
.
quit
()
mainWindow
=
null
;
})
.
on
(
"
activate
"
,
()
=>
{
if
(
BrowserWindow
.
getAllWindows
().
length
===
0
)
createWindow
()
if
(
BrowserWindow
.
getAllWindows
().
length
===
0
)
createWindow
()
app
.
show
();
});
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment