40 Commits

Author SHA1 Message Date
816cb0c3ed Reduce code duplication
Avoid code for determining the publicName of a folder.
2020-05-18 00:23:14 +02:00
965639e6f2 Add the concept of Folder Settings
This contains the default editor / view / sortingMode / etc. For now the
folder settings are shared among all Folders. But the idea is that we
should be able to set different settings per folder (real or virtual)
2020-03-31 11:16:04 +02:00
b252f037b3 Rename NotesFolder -> NotesFolderFS
And NotesFolderReadOnly to NotesFolder. It just makes more sense this
way as we're now getting more and more different "types" of
NotesFolders.
2020-03-15 02:01:07 +01:00
494d866686 Make the home screen show all the notes
It can show call the notes recursively, instead of showing just the root
folder. This makes it much easier to access a note recently modified.
2020-03-12 01:35:48 +01:00
627427a881 NotesFolder: Listen to the proper Note's signal 2020-03-11 13:07:45 +01:00
f0eeefe125 SortedNotesFolder: Avoid calling sort again and again
For long lists of notes this could get very very expensive.
2020-03-08 04:00:27 +01:00
9a65686f1e NotesFolder: Add more debug information when loading
This will help better diagnose why files don't sometimes show up
2020-03-08 00:42:19 +01:00
e1d19fc8c2 Optimize building of the NotesCache 2020-03-05 01:36:58 +01:00
78d7e6cef0 Integrate the NotesCache
It doesn't make any difference as -

1. The sort order shown our SortedNotesFolder is different
2. Rebuilds of the tree affect everything. Even the elements which
should be in the correct place.
2020-02-28 14:55:52 +01:00
215dfc2cec NotesCache: Add a simple way to build the cache 2020-02-28 14:29:07 +01:00
020c65e132 Minor cleanup 2020-02-28 14:16:05 +01:00
39cc1bc0ce NotesFolder: sort the sub-folders
This really isn't a good way of doing this as now the folder
inserted/removed notifications will not be correct. But at least the
folders will be sorted.
2020-02-14 07:56:53 +01:00
12122be7fe AppState.notesFolder: Avoid changing the object
We're accessing appState.notesFolder directly in the parent. Ideally it
would be nice if we passed it down via the Provider, but that doesn't
seem to be working for me. I've spent over 30 minutes. I now give up.
2020-02-11 19:57:57 +01:00
7fd2546334 Add as NotesFolderReadOnly interface
This simplifies the implementation of VirtualNotesFolder and
NotesFolder.
2020-02-09 19:11:01 +01:00
49192026a7 NotesFolder: Do not allow changes in the folderPath
Otherwise the NotesFolder can reach an inconsistent state.
2020-02-09 17:08:31 +01:00
143a1d95c7 First iteration of animating the JournalList
Now on adding / removing elements, the list is animated. It looks
slightly better.
2020-02-06 01:29:30 +01:00
9d29710d59 NotesFolder: Implement more fine grained notifications 2020-02-06 01:28:50 +01:00
670a0ff12d Remove NoteFSEntity - It's easier to just keep Notes/Folders separate 2020-02-02 16:02:41 +01:00
2711f1c4c9 Add a NotesFolderNotifier
This also implements the ChangeNotifier, but additional provides more
fine grained notifications. We neeed this in order to animate the list
of notes / folders when they change.
2020-02-01 13:20:29 +01:00
0fd7892e40 Avoid loading all the Notes in one go
This can sometimes lead to too many files being opened in parallel and
then failing because there aren't any file descriptors left. This patch
isn't perfect as given the directory structure we could still be loading
too many in one go, but it's a quick workaround for now.

The proper solution is to only load the Notes which need to be displayed
instead of loading all of them at startup.
2020-01-31 23:25:28 +01:00
f9a2f4c875 Add some FIXMEs 2020-01-31 16:17:30 +01:00
95dce61479 Allow the new folder for notes to be configurable
This is currently disabled as it requires a substantial change in the
JournalList.
2020-01-31 16:16:12 +01:00
046c08cb67 Folder rename: Only udpate 'folderPath' once rename is successfull 2019-12-27 00:37:26 +01:00
3657a88ce5 FolderListing: Show the full path of subfolders
It's confusing otherwise, though this doesn't look very pretty.
2019-12-14 12:18:52 +01:00
6096ef8054 Sort Folders based on name
Eventually this sorting should be configurable.
2019-12-14 12:10:20 +01:00
abb6029798 Allow Folders to be deleted
For safety we're only allowing non-empty folders to be deleted. Ideally,
we should have some kind of undo button. Or some kind of history - since
we do have that with git.

Related to #18
2019-12-11 21:43:08 +01:00
b0b7da5291 Move storage classes into core
The Git functionality is fairly core!
2019-12-09 01:19:44 +01:00
ca83cb79a6 JournalListing: Remove recursive option
We aren't using it, and if we implement a recursive option it should
somehow showcase which folder it is under. Evernote does it in an
interesting way.
2019-12-09 00:53:53 +01:00
8a49d948f0 StateContainer: Do not call setState when the notesFolder changes
The NotesFolder is now a listenable and is always accessed via Provider,
and therefore doesn't need setState to be called when it is modified.
2019-12-08 02:58:56 +01:00
ee9d38e420 NotesFolder: Make sure listeners are always added/removed
Also make sure the _entities and _entityMap are always in sync.

The NotesFolder is complex enough that it could really use some proper
unit testing. Though since it is so tightly coupled to the FileSystem,
it would be quite an elaborate test to write.
2019-12-08 02:26:35 +01:00
1eb9611140 Do not reparse every note on any change
Earlier whenever anything changed we would discard all the Notes +
NotesFolders in memory, and reconstruct the hierarchy. This would means
Notes which haven't changed at all, still need to parsed all over again.

Now we only reload what has actually changed.

This should result in a huge performance boost.

We still shouldn't be loading everything on boot, but that's a different
problem.
2019-12-08 01:56:59 +01:00
92f0109733 NotesFolder: Allow only one folder to be loaded
We don't always need to load everything recursively.
2019-12-08 01:26:20 +01:00
9e2d59f3fa NotesFolder: Listen to changes of the subFolders and Notes
A NotesFolder doesn't only change when a note/folder is added or
removed. It is also changed when the contents of the Notes/Folders it
contains have changed.
2019-12-08 01:04:28 +01:00
644ef47076 NotesFolder rename: Actually update the filePath
The filePath was still the old one, this was causing all kinds of
errors.
2019-12-07 17:06:46 +01:00
6288a7cfa0 NotesFolder: Notify listeners on rename 2019-12-07 16:30:39 +01:00
8c6a33456a Allow folders to be renamed
This is a huge change which involves -
* Implementing Folder renames on the FS + Git level
* Implementing the concept of selecting an item in the FoldersListView,
  this feature isn't provided by default, and even now I'm not sure if
  the semantics which I've implemented are correct. I haven't
  implemented multiple folder selection for now.

Related to issue #18

Also, we're now one step closer to allowing notes to be renamed (#23)
2019-12-06 21:32:41 +01:00
a51f8f170f Make Note and NotesFolder ChangeNotifiers
This will allow us for finer grained notifications of when things change
so we don't have to rebuild everything, like we do currently.
2019-12-06 01:22:57 +01:00
f08d72bb00 FolderListing: Show the number of notes per folder 2019-12-05 17:48:31 +01:00
975b235df3 Add Folder creation
Folders for now can only be created under the root folder. I cannot seem
to figure out how to design a good interface for designing how to choose
the parent folder.
2019-12-05 17:08:02 +01:00
10d65cd6fb Rename NoteFolder -> NotesFolder 2019-12-04 15:33:27 +01:00