patch to allow exporting of notepads to sdcard

13 views
Skip to first unread message

Fergal Daly

unread,
Nov 24, 2010, 8:11:40 AM11/24/10
to aedict...@googlegroups.com
Attached patch is against 790:36f07fccac90.

It exports to multiple files in /sdcard/aedict. If there is a single
notepad it will be notepad.txt, if there are multiple categories, it
will be notepad-${category}.txt. The format is from
DictEntry.toExternalList,

F

--
Fergal Daly
Google Ireland Ltd
Gordon House, Barrow Street
Dublin 4, Ireland
Registered in Dublin, Ireland
Registration Number: 368047

export-notepad.diff

Martin Vysny

unread,
Nov 24, 2010, 8:30:30 AM11/24/10
to aedict...@googlegroups.com
Hi Fergal,
thanks for the patch! I just realized that saving each category to a
different file is not a good idea - it will fail if you do as follows:
1. back up the categories
2. rename a category
3. try to restore the notepad - the code will fail with
notepad-OLD_CATEGORY.txt file missing.

Can you please rework your patch to include also category names in a
file (may be a separate file, e.g. notepadcategories.txt). Upon notepad
restore all categories would be deleted and the original ones would be
restored.
What do you think?

Fergal Daly

unread,
Nov 24, 2010, 10:41:34 AM11/24/10
to aedict...@googlegroups.com
2010/11/24 Martin Vysny <vy...@baka.sk>:

> Hi Fergal,
>  thanks for the patch! I just realized that saving each category to a
> different file is not a good idea - it will fail if you do as follows:
> 1. back up the categories
> 2. rename a category
> 3. try to restore the notepad - the code will fail with
> notepad-OLD_CATEGORY.txt file missing.
>
> Can you please rework your patch to include also category names in a
> file (may be a separate file, e.g. notepadcategories.txt). Upon notepad
> restore all categories would be deleted and the original ones would be
> restored.
> What do you think?

OK, so you want a file that says "at backup time, the categories
were..." and then when someone wants to restore, it only looks for
those filenames. Seem reasonable.

That said, I'm not sure that replacing the current categories with the
sdcard files is what I'd want to do. For my own case, I was using 1
phone but the screen cracked so I used an old one for a while. Now I
have my nicer phone back. I don't want to delete my notepad entries on
the nicer phone, I want to merge the entries from the old phone and
have all the entries on the nicer one,

F

martin.vysny

unread,
Nov 26, 2010, 5:38:14 AM11/26/10
to aedict-users
I understand your use case. There could be two options when restoring
the notepad from the backup:
- Complete replace,
- Merge
The only problem with Merge is that it could introduce more than 4
categories (which is the current maximum). I have to check whether the
TabView component (which is basically a pretty screwed class, an
exception generator) supports more than 4 tabs.

Fergal Daly

unread,
Nov 26, 2010, 6:10:24 AM11/26/10
to aedict...@googlegroups.com
2010/11/26 martin.vysny <martin...@gmail.com>:

> I understand your use case. There could be two options when restoring
> the notepad from the backup:
> - Complete replace,

This seems fairly simple. I might take a stab at it as a second patch
(although I don't promise anything, my free time is quite small and
occurs at random intervals).

> - Merge

Once you have Complete replace, it's not that hard for a user to do
the merge in a text editor and then do a replace with the resulting
file, so I guess complete replace should be the priority.

> The only problem with Merge is that it could introduce more than 4
> categories (which is the current maximum). I have to check whether the
> TabView component (which is basically a pretty screwed class, an
> exception generator) supports more than 4 tabs.

I saw some interesting comments in the code :)

So how about just having a drop-down list of categories instead of this TabView.

TBH I am more a fan of thinking in terms of tags than categories but I
am not offering to implement anything here so this is just idle
chatter,

F

Reply all
Reply to author
Forward
0 new messages