rwdaddresses 1.01 → 1.02
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.txt +5 -0
- data/code/01rwdcore/01rwdcore.rb +15 -13
- data/code/01rwdcore/openhelpwindow.rb +26 -26
- data/code/01rwdcore/returntomain.rb +8 -8
- data/code/01rwdcore/rwdtinkerversion.rb +12 -13
- data/code/01rwdcore/rwdwindowreturn.rb +3 -5
- data/code/01rwdcore/test_cases.rb +115 -0
- data/code/01rwdcore/test_harness.rb +12 -0
- data/code/01rwdcore/uploadreturns.rb +60 -59
- data/code/superant.com.rwdaddresses/attachtmpcontactphoto.rb +23 -23
- data/code/superant.com.rwdaddresses/clearscreendisplay.rb +14 -15
- data/code/superant.com.rwdaddresses/createnewnamerecord.rb +19 -18
- data/code/superant.com.rwdaddresses/deletecontactrecord.rb +22 -21
- data/code/superant.com.rwdaddresses/deleterwdaddressesupdatefiles.rb +15 -16
- data/code/superant.com.rwdaddresses/downloadrwdaddressfiles.rb +34 -32
- data/code/superant.com.rwdaddresses/listnamerecord.rb +14 -14
- data/code/superant.com.rwdaddresses/listvcardrecord.rb +15 -0
- data/code/superant.com.rwdaddresses/loadconfigurationrecord.rb +45 -44
- data/code/superant.com.rwdaddresses/loadconfigurationvariables.rb +14 -13
- data/code/superant.com.rwdaddresses/loadnamerecord.rb +29 -29
- data/code/superant.com.rwdaddresses/openhelpwindowrwdaddresses.rb +25 -25
- data/code/superant.com.rwdaddresses/renamecontact.rb +14 -15
- data/code/superant.com.rwdaddresses/returntomain.rb +8 -8
- data/code/superant.com.rwdaddresses/runaddresseswindow.rb +8 -8
- data/code/superant.com.rwdaddresses/runrwdaddressesmenu1.rb +31 -31
- data/code/superant.com.rwdaddresses/runrwdaddresssyncbackwindow.rb +8 -8
- data/code/superant.com.rwdaddresses/rwdaddressesbackwindow.rb +8 -8
- data/code/superant.com.rwdaddresses/rwdaddresseshelpabout.rb +10 -11
- data/code/superant.com.rwdaddresses/saveconfigurationrecord.rb +20 -20
- data/code/superant.com.rwdaddresses/savevcardrecord.rb +76 -0
- data/code/superant.com.rwdaddresses/syncrwdaddress.rb +24 -26
- data/code/superant.com.rwdaddresses/uploadrwdaddressfiles.rb +28 -28
- data/code/superant.com.rwdaddresses/viewaddressconfiguration.rb +21 -21
- data/code/superant.com.rwdaddresses/viewnamedata.rb +27 -26
- data/code/superant.com.rwdaddresses/viewphoto.rb +4 -4
- data/code/superant.com.rwdaddresses/viewrwdaddressesconfiguration.rb +23 -21
- data/code/superant.com.rwdaddresses/viewtmpcontactphoto.rb +6 -6
- data/code/superant.com.rwdaddresses/viewvcarddata.rb +22 -0
- data/code/superant.com.rwdtinkerbackwindow/controlclient.rb +89 -92
- data/code/superant.com.rwdtinkerbackwindow/diagnostictab.rb +15 -20
- data/code/superant.com.rwdtinkerbackwindow/installapplet.rb +19 -18
- data/code/superant.com.rwdtinkerbackwindow/installgemapplet.rb +20 -19
- data/code/superant.com.rwdtinkerbackwindow/installremotegem.rb +19 -18
- data/code/superant.com.rwdtinkerbackwindow/listgemdirs.rb +7 -7
- data/code/superant.com.rwdtinkerbackwindow/listgemzips.rb +48 -49
- data/code/superant.com.rwdtinkerbackwindow/listinstalledfiles.rb +8 -7
- data/code/superant.com.rwdtinkerbackwindow/listzips.rb +22 -26
- data/code/superant.com.rwdtinkerbackwindow/loadconfigurationrecord.rb +32 -31
- data/code/superant.com.rwdtinkerbackwindow/loadconfigurationvariables.rb +14 -13
- data/code/superant.com.rwdtinkerbackwindow/network.rb +82 -82
- data/code/superant.com.rwdtinkerbackwindow/openappletname.rb +18 -17
- data/code/superant.com.rwdtinkerbackwindow/openhelpwindowtinkerwin2.rb +37 -37
- data/code/superant.com.rwdtinkerbackwindow/remotegemlist.rb +20 -20
- data/code/superant.com.rwdtinkerbackwindow/removeapplet.rb +33 -32
- data/code/superant.com.rwdtinkerbackwindow/runrwdtinkerbackwindow.rb +8 -9
- data/code/superant.com.rwdtinkerbackwindow/rwdtinkerwin2version.rb +10 -11
- data/code/superant.com.rwdtinkerbackwindow/saveconfigurationrecord.rb +19 -18
- data/code/superant.com.rwdtinkerbackwindow/viewappletcontents.rb +21 -20
- data/code/superant.com.rwdtinkerbackwindow/viewgemappletcontents.rb +23 -20
- data/configuration/language.dist +1 -1
- data/configuration/rwdaddresses.dist +2 -2
- data/configuration/rwdtinker.dist +2 -2
- data/configuration/tinkerwin2variables.dist +1 -1
- data/extras/vpim/date.rb +198 -0
- data/extras/vpim/dirinfo.rb +229 -0
- data/extras/vpim/enumerator.rb +29 -0
- data/extras/vpim/field.rb +497 -0
- data/extras/vpim/maker/vcard.rb +312 -0
- data/extras/vpim/rfc2425.rb +244 -0
- data/extras/vpim/rrule.rb +482 -0
- data/extras/vpim/time.rb +42 -0
- data/extras/vpim/vcard.rb +151 -0
- data/extras/vpim/vpim.rb +94 -0
- data/gui/frontwindow0/superant.com.rwdaddresses/16editrecord.rwd +5 -0
- data/gui/frontwindow0/superant.com.rwdaddresses/17viewvcardrecord.rwd +32 -0
- data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/3copyright.rwd +1 -1
- data/gui/tinkerbackwindows/superant.com.rwdaddressessyncbackwindow/70rwddiagnostics.rwd +1 -11
- data/init.rb +231 -228
- data/names/Angelina Jolie.vcf +8 -0
- data/rwd_files/HowTo_Addresses.txt +5 -0
- data/rwd_files/HowTo_Tinker.txt +14 -0
- data/rwdconfig.dist +6 -2
- data/tests/makedist.rb +36 -7
- metadata +23 -21
- data/extras/cmdline_parse +0 -47
- data/extras/config_file +0 -69
- data/extras/errorMsg +0 -19
- data/extras/makePlaylist +0 -34
- data/extras/mp3controld +0 -289
- data/extras/playlist +0 -186
- data/extras/plugins/Network +0 -237
- data/extras/showHelp +0 -18
- data/gui/frontwindowselections/superant.com.rwdaddressesselectiontab/rwdaddressessyncselectiontab.rwd +0 -12
- data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/1appname.rwd +0 -4
- data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/3copyright.rwd +0 -3
- data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/5version.rwd +0 -10
- data/installed/rwdaddressesdata2.inf +0 -8
- data/rwd_files/tinker.png +0 -0
@@ -0,0 +1,229 @@
|
|
1
|
+
=begin
|
2
|
+
$Id: dirinfo.rb,v 1.19 2004/11/17 05:06:27 sam Exp $
|
3
|
+
|
4
|
+
Copyright (C) 2005 Sam Roberts
|
5
|
+
|
6
|
+
This library is free software; you can redistribute it and/or modify it
|
7
|
+
under the same terms as the ruby language itself, see the file COPYING for
|
8
|
+
details.
|
9
|
+
=end
|
10
|
+
|
11
|
+
require 'extras/vpim/enumerator'
|
12
|
+
require 'extras/vpim/field'
|
13
|
+
require 'extras/vpim/rfc2425'
|
14
|
+
require 'extras/vpim/vpim'
|
15
|
+
|
16
|
+
module Vpim
|
17
|
+
# An RFC 2425 directory info object.
|
18
|
+
#
|
19
|
+
# A directory information object is a sequence of fields. The basic
|
20
|
+
# structure of the object, and the way in which it is broken into fields
|
21
|
+
# is common to all profiles of the directory info type.
|
22
|
+
#
|
23
|
+
# A vCard, for example, is a specialization of a directory info object.
|
24
|
+
#
|
25
|
+
# [RFC2425] the directory information framework (ftp://ftp.ietf.org/rfc/rfc2425.txt)
|
26
|
+
class DirectoryInfo
|
27
|
+
include Enumerable
|
28
|
+
|
29
|
+
private_class_method :new
|
30
|
+
|
31
|
+
# Initialize a DirectoryInfo object from +fields+. If +profile+ is
|
32
|
+
# specified, check the BEGIN/END fields.
|
33
|
+
def initialize(fields, profile = nil) #:nodoc:
|
34
|
+
if fields.detect { |f| ! f.kind_of? DirectoryInfo::Field }
|
35
|
+
raise ArgumentError, 'fields must be an array of DirectoryInfo::Field objects'
|
36
|
+
end
|
37
|
+
|
38
|
+
@string = nil # this is used as a flag to indicate that recoding will be necessary
|
39
|
+
@fields = fields
|
40
|
+
|
41
|
+
check_begin_end(profile) if profile
|
42
|
+
end
|
43
|
+
|
44
|
+
# Decode +card+ into a DirectoryInfo object.
|
45
|
+
#
|
46
|
+
# +card+ may either be a something that is convertible to a string using
|
47
|
+
# #to_str or an array of objects that can be joined into a string using
|
48
|
+
# #join("\n"), or an IO object (which will be read to end-of-file).
|
49
|
+
#
|
50
|
+
# The lines in the string may be delimited using IETF (CRLF) or Unix (LF) conventions.
|
51
|
+
#
|
52
|
+
# A DirectoryInfo is mutable, you can add new fields to it, see
|
53
|
+
# Vpim::DirectoryInfo::Field#create() for how to create a new Field.
|
54
|
+
#
|
55
|
+
# TODO: I don't believe this is ever used, maybe I can remove it.
|
56
|
+
def DirectoryInfo.decode(card) #:nodoc:
|
57
|
+
if card.respond_to? :to_str
|
58
|
+
string = card.to_str
|
59
|
+
elsif card.kind_of? Array
|
60
|
+
string = card.join("\n")
|
61
|
+
elsif card.kind_of? IO
|
62
|
+
string = card.read(nil)
|
63
|
+
else
|
64
|
+
raise ArgumentError, "DirectoryInfo cannot be created from a #{card.type}"
|
65
|
+
end
|
66
|
+
|
67
|
+
fields = Vpim.decode(string)
|
68
|
+
|
69
|
+
new(fields)
|
70
|
+
end
|
71
|
+
|
72
|
+
# Create a new DirectoryInfo object. The +fields+ are an optional array of
|
73
|
+
# DirectoryInfo::Field objects to add to the new object, between the
|
74
|
+
# BEGIN/END. If the +profile+ string is not nil, then it is the name of
|
75
|
+
# the directory info profile, and the BEGIN:+profile+/END:+profile+ fields
|
76
|
+
# will be added.
|
77
|
+
#
|
78
|
+
# A DirectoryInfo is mutable, you can add new fields to it using #push(),
|
79
|
+
# and see Field#create().
|
80
|
+
def DirectoryInfo.create(fields = [], profile = nil)
|
81
|
+
|
82
|
+
if profile
|
83
|
+
p = profile.to_str
|
84
|
+
f = [ Field.create('BEGIN', p) ]
|
85
|
+
f.concat fields
|
86
|
+
f.push Field.create('END', p)
|
87
|
+
fields = f
|
88
|
+
end
|
89
|
+
|
90
|
+
new(fields, profile)
|
91
|
+
end
|
92
|
+
|
93
|
+
# The first field named +name+, or nil if no
|
94
|
+
# match is found.
|
95
|
+
def field(name)
|
96
|
+
enum_by_name(name).each { |f| return f }
|
97
|
+
nil
|
98
|
+
end
|
99
|
+
|
100
|
+
# The value of the first field named +name+, or nil if no
|
101
|
+
# match is found.
|
102
|
+
def [](name)
|
103
|
+
enum_by_name(name).each { |f| return f.value }
|
104
|
+
nil
|
105
|
+
end
|
106
|
+
|
107
|
+
# An array of all the values of fields named +name+, converted to text
|
108
|
+
# (using Field#to_text()).
|
109
|
+
#
|
110
|
+
# TODO - call this #texts(), as in the plural?
|
111
|
+
def text(name)
|
112
|
+
enum_by_name(name).map { |f| f.to_text }
|
113
|
+
end
|
114
|
+
|
115
|
+
# Array of all the Field#group()s.
|
116
|
+
def groups
|
117
|
+
@fields.collect { |f| f.group } .compact.uniq
|
118
|
+
end
|
119
|
+
|
120
|
+
# All fields, frozen.
|
121
|
+
def fields #:nodoc:
|
122
|
+
@fields.dup.freeze
|
123
|
+
end
|
124
|
+
|
125
|
+
# Yields for each Field for which +cond+.call(field) is true. The
|
126
|
+
# (default) +cond+ of nil is considered true for all fields, so
|
127
|
+
# this acts like a normal #each() when called with no arguments.
|
128
|
+
def each(cond = nil) # :yields: Field
|
129
|
+
@fields.each do |field|
|
130
|
+
if(cond == nil || cond.call(field))
|
131
|
+
yield field
|
132
|
+
end
|
133
|
+
end
|
134
|
+
self
|
135
|
+
end
|
136
|
+
|
137
|
+
# Returns an Enumerator for each Field for which #name?(+name+) is true.
|
138
|
+
#
|
139
|
+
# For example, to get an Array of all the email addresses in the card, you
|
140
|
+
# could do:
|
141
|
+
#
|
142
|
+
# card.enum_by_name('email').collect { |f| f.value }
|
143
|
+
def enum_by_name(name)
|
144
|
+
Enumerator.new(self, Proc.new { |field| field.name?(name) })
|
145
|
+
end
|
146
|
+
|
147
|
+
# Returns an Enumerator for each Field for which #group?(+group+) is true.
|
148
|
+
#
|
149
|
+
# For example, to print all the fields, sorted by group, you could do:
|
150
|
+
#
|
151
|
+
# card.groups.sort.each do |group|
|
152
|
+
# card.enum_by_group(group).each do |field|
|
153
|
+
# puts "#{group} -> #{field.name}"
|
154
|
+
# end
|
155
|
+
# end
|
156
|
+
#
|
157
|
+
# or to get an array of all the fields in group 'agroup', you could do:
|
158
|
+
#
|
159
|
+
# card.enum_by_group('agroup').to_a
|
160
|
+
def enum_by_group(group)
|
161
|
+
Enumerator.new(self, Proc.new { |field| field.group?(group) })
|
162
|
+
end
|
163
|
+
|
164
|
+
# Returns an Enumerator for each Field for which +cond+.call(field) is true.
|
165
|
+
def enum_by_cond(cond)
|
166
|
+
Enumerator.new(self, cond )
|
167
|
+
end
|
168
|
+
|
169
|
+
# Append +field+ to the fields. Note that it won't be literally appended
|
170
|
+
# to the fields, it will be inserted before the closing END field.
|
171
|
+
def push(field)
|
172
|
+
@fields[-1,0] = field
|
173
|
+
self
|
174
|
+
end
|
175
|
+
|
176
|
+
alias << push
|
177
|
+
|
178
|
+
# Push +field+ onto the fields, unless there is already a field
|
179
|
+
# with this name.
|
180
|
+
def push_unique(field)
|
181
|
+
push(field) unless @fields.detect { |f| f.name? field.name }
|
182
|
+
self
|
183
|
+
end
|
184
|
+
|
185
|
+
# Append +field+ to the end of all the fields. This isn't usually what you
|
186
|
+
# want to do, usually a DirectoryInfo's first and last fields are a
|
187
|
+
# BEGIN/END pair, see #push().
|
188
|
+
def push_end(field)
|
189
|
+
@fields << field
|
190
|
+
self
|
191
|
+
end
|
192
|
+
|
193
|
+
# The string encoding of the DirectoryInfo. See Field#encode for information
|
194
|
+
# about the width parameter.
|
195
|
+
def encode(width=nil)
|
196
|
+
unless @string
|
197
|
+
@string = @fields.collect { |f| f.encode(width) } . join ""
|
198
|
+
end
|
199
|
+
@string
|
200
|
+
end
|
201
|
+
|
202
|
+
alias to_s encode
|
203
|
+
|
204
|
+
# Check that the DirectoryInfo object is correctly delimited by a BEGIN
|
205
|
+
# and END, that their profile values match, and if +profile+ is specified, that
|
206
|
+
# they are the specified profile.
|
207
|
+
def check_begin_end(profile=nil) #:nodoc:
|
208
|
+
unless @fields.first
|
209
|
+
raise "No fields to check"
|
210
|
+
end
|
211
|
+
unless @fields.first.name? "begin"
|
212
|
+
raise "Needs BEGIN, found: #{@fields.first.encode nil}"
|
213
|
+
end
|
214
|
+
unless @fields.last.name? "end"
|
215
|
+
raise "Needs END, found: #{@fields.last.encode nil}"
|
216
|
+
end
|
217
|
+
unless @fields.last.value? @fields.first.value
|
218
|
+
raise "BEGIN/END mismatch: (#{@fields.first.value.downcase} != #{@fields.last.value.downcase}"
|
219
|
+
end
|
220
|
+
if profile
|
221
|
+
if ! @fields.first.value? profile
|
222
|
+
raise "Mismatched profile"
|
223
|
+
end
|
224
|
+
end
|
225
|
+
true
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
=begin
|
2
|
+
$Id: enumerator.rb,v 1.2 2004/11/17 05:06:27 sam Exp $
|
3
|
+
|
4
|
+
Copyright (C) 2005 Sam Roberts
|
5
|
+
|
6
|
+
This library is free software; you can redistribute it and/or modify it
|
7
|
+
under the same terms as the ruby language itself, see the file COPYING for
|
8
|
+
details.
|
9
|
+
=end
|
10
|
+
|
11
|
+
module Vpim
|
12
|
+
# This is a way for an object to have multiple ways of being enumerated via
|
13
|
+
# argument to it's #each() method. An Enumerator mixes in Enumerable, so the
|
14
|
+
# standard APIS such as Enumerable#map(), Enumerable#to_a(), and
|
15
|
+
# Enumerable#find_all() can be used on it.
|
16
|
+
class Enumerator
|
17
|
+
include Enumerable
|
18
|
+
|
19
|
+
def initialize(obj, *args)
|
20
|
+
@obj = obj
|
21
|
+
@args = args
|
22
|
+
end
|
23
|
+
|
24
|
+
def each(&block)
|
25
|
+
@obj.each(*@args, &block)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|