[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [coldsync-hackers] categories in p5-Palm



On Thu, 31 Aug 2000, Jim Gifford wrote:
> On Thu, Aug 31, 2000 at 04:37:34PM -0400, Andrew Arensburger wrote:
> > On 31 Aug 2000, Bobby de Vos wrote:
> > 	my $pdb = new Palm::Address;
> > 	my $categories = $pdb->{appinfo}{categories};
> > 
> > 	# manipulate @{$categories} to your heart's content.
> 
> Andrew, I've been doing this in p5-Palm 1.1.12 for a few days now.

	Yeah, except that I redid StdAppInfo.pm in p5-Palm (which is why
it's version 1.2 instead of 1.1.13: I had to make some changes
incompatible with the old API).
	Under 1.1, the AppInfo block for a StdAppInfo contained an array
called "categories", another array called "uniqueIDs", and so forth. I did
it that way because that's the way this data is represented in the PDB
file.
	Under 1.2, it's much more natural: there's an array
@{$pdb->{appinfo}{categories}}. This array contains 16 hashes (one per
category), with entries for "name", "id" and "renamed".

> I've even been manipulating the $PDB->{attributes}{"AppInfo dirty"}
> flag.  It appears to work just fine.  The only real problem is that
> coldsync doesn't yet sync appinfo block (at least, that I've been
> able to determine).

	Yup. That's because ColdSync can't reliably sync the AppInfo block
in every case, so it wimps out and doesn't do anything.
	The newly-introduced 'sync' conduit type is there to allow you to
write conduits that can talk directly to the Palm. One side effect of this
is that you can sync the AppInfo block if you know its format.
	I'm working on a conduit to sync the standard category list, but
it's kinda slow going.

> Also, there's the @{$PDB->{appinfo}{uniqueIDs}}
> array that seems to be intimately related to the
> @{$PDB->{appinfo}{categories}} array.

	Yes: a category has a name, a numerical ID, and a flag that
indicates whether it has been renamed or not. Names are unique; IDs are
also unique. As for why there's both a name and an ID, imagine that you
have:

		On the Palm:	On the desktop:
Name:		Work		Business
ID:		4		4
Renamed:	Yes		No

Since the two categories have the same ID, presumably they refer to the
same category. But one has the "renamed" flag set. So in this case, the
correct thing to do is to rename "Business" on the desktop to "Work".

> > Each record should contain a field giving its category index:
> > 
> > 	my $record = $pdb->{records}[0];
> > 	$record->{category};		# Or something like this. I don't
> > 					# have the source with me right
> > 					# now.
> > 
> > $record->{category} is an index into @{$pdb->{appinfo}{categories}}.
> 
> Is there an easy way to do the reverse mapping of this?  For
> instance, being able to look up something like $category{"Work"}
> and get the index number (4 in my case).  Just a thought...

	How about:

	$index = (grep
		{ $pdb->{appinfo}{categories}[$i] eq "Work" }
		(0..$#{$pdb->{appinfo}{categories}})
		)[0]

> I would like to see the current work put out (even if it is just
> beta).  I'm finding p5-Palm quite useful, and would like to start
> pusing the envelope so to speak.

	Okay, I'll upload a newer snapshot later tonight.

> Also, is there a newer snapshot of 1.3.0 of coldsync than the
> 20000811 one?

	Sorry, no. Though I hope to finish integrating Sumant's patches
tonight, at which point I'll upload a new snapshot.

-- 
Andrew Arensburger                      Actually, these _do_ represent the
arensb@ooblick.com                      opinions of ooblick.com!
                        Generic Tagline V 6.01




--
This message was sent through the coldsync-hackers mailing list.  To remove
yourself from this mailing list, send a message to majordomo@thedotin.net
with the words "unsubscribe coldsync-hackers" in the message body.  For more
information on Coldsync, send mail to coldsync-hackers-owner@thedotin.net.