From 947271ac87fbcf504bfd1a9946e47ab6d46f348c Mon Sep 17 00:00:00 2001 From: Gerhard Gonter <ggonter@gmail.com> Date: Mon, 15 Jan 2018 09:48:43 +0100 Subject: [PATCH] allow notebooks to be present in multiple notebooks (see discussion about tomboy-ng) --- perl/Gnome-Tomboy/lib/Tomboy/Directory.pm | 1 + perl/Gnome-Tomboy/lib/Tomboy/Note/Simple.pm | 12 +++++++++--- perl/Gnome-Tomboy/tom | 2 ++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/perl/Gnome-Tomboy/lib/Tomboy/Directory.pm b/perl/Gnome-Tomboy/lib/Tomboy/Directory.pm index d8276a3..1c48383 100644 --- a/perl/Gnome-Tomboy/lib/Tomboy/Directory.pm +++ b/perl/Gnome-Tomboy/lib/Tomboy/Directory.pm @@ -162,6 +162,7 @@ print __LINE__, " scan_dir: quick=[$quick]\n"; # print "n: ", main::Dumper ($n); my %rec= map { $_ => $n->{$_} } @TB_note_attrs; + $rec{'notebook'}= join (';', @{$rec{notebook}}) if ($rec{notebook}); $rec{'uuid'}= $fnm_uuid; $rec{'mtime'}= $st[9]; $rec{'size'}= $st[7]; diff --git a/perl/Gnome-Tomboy/lib/Tomboy/Note/Simple.pm b/perl/Gnome-Tomboy/lib/Tomboy/Note/Simple.pm index 4fce3e6..bd68103 100755 --- a/perl/Gnome-Tomboy/lib/Tomboy/Note/Simple.pm +++ b/perl/Gnome-Tomboy/lib/Tomboy/Note/Simple.pm @@ -256,7 +256,7 @@ sub parse } elsif ($tag =~ m#system:notebook:(.+)#) { - $note->{'notebook'}= $1; + push (@{$note->{'notebook'}} => $1); } # TODO: maybe there other tags as well... } @@ -528,7 +528,7 @@ sub save $note->update() unless ($note->{'flg_lines'}); my ($title, $uuid, $lines, $ts_updated, $ts_md_updated, $ts_created, - $e_updated, $is_template, $nb_name)= + $e_updated, $is_template, $nb_list)= map { $note->{$_} } qw(title uuid lines last-change-date last-metadata-change-date create-date e_updated is_template notebook); @@ -549,7 +549,13 @@ sub save # print "tags: ", Dumper ($note->{'tags'}); my @tags= (); push (@tags, 'system:template') if ($is_template); - push (@tags, 'system:notebook:'. $nb_name) if ($nb_name); + if ($nb_list) + { + foreach my $nb_name (@$nb_list) + { + push (@tags, 'system:notebook:'. $nb_name) + } + } unless (defined ($fnm_out)) { diff --git a/perl/Gnome-Tomboy/tom b/perl/Gnome-Tomboy/tom index 4ec857d..3de6b8a 100755 --- a/perl/Gnome-Tomboy/tom +++ b/perl/Gnome-Tomboy/tom @@ -17,6 +17,7 @@ do stuff with Tomboy files --note-path <dir> -d <dir> ... full path of Tomboy notes directory -e ... edit note (used with find) + -v ... same as -e, use Vi as editor =head1 OP-CODES @@ -106,6 +107,7 @@ while (my $arg= shift (@ARGV)) elsif ($a eq 'T') { $verbosity= 'title'; } elsif ($a eq 'e') { $start_tb= 1; } elsif ($a eq 'v') { $start_visual_editor= 1; } + # elsif ($a eq 'l') { $show_note= 1; } elsif ($a eq 'D') { $dump_note= 1; } else { -- GitLab