GSM-Gnokii
view release on metacpan or search on metacpan
examples/kgnokii-sms view on Meta::CPAN
},
birthday => "2001-02-03", # TODO
date => "2011-02-03", # TODO
ext_group => 3, # TODO
e_mail => "miranda\@hotmail.com",
home_address => "Kerkstraat 3", # Doesn't work
nickname => "Mirrie",
note => "Notitie",
# tel_none => "+31600000000", # FAIL
# tel_common => "+31600000001", # FAIL
tel_home => "+31612345678",
tel_cell => "+31612345678",
tel_fax => "+31612345678",
tel_work => "+31612345678",
# tel_general => "+31600000010", # FAIL
company => "Vrienden & co.",
url => "http://maak.nieuwe.vrienden.nl",
};
if ($t_idx >= 0) {
DDumper { idx => $t_idx, pb => $pb[$t_idx] };
$c = { %{$pb[$t_idx]{entry}} }; # Make a copy
}
my $cw = $mw->Toplevel;
my $ef = $cw->Frame->pack (qw( -side top -fill both -expand 1 ));
my $bf = $cw->Frame->pack (qw( -side bottom -fill x -expand 0 ));
my $eg = $ef->Frame->grid (qw( -sticky nw ));
$eg->gridRowconfigure (0, -weight => 1); # allow expansion in both ...
$eg->gridColumnconfigure (0, -weight => 1); # ... X and Y dimensions
my @ga = (-borderwidth => 0, -highlightthickness => 0);
my @la = (@ga, -font => $font{label}, -foreground => "Green4", -anchor => "w");
my @ea = (@ga, -font => $font{entry}, -background => "White");
my @gg = (-sticky => "news");
for ( [ 0, 0, "Location", \$c->{location}, ],
[ 0, 2, "Memory", \$c->{memorytype}, ],
[ 1, 2, "Number", \$c->{number}, ],
[ 2, 2, "Cell", \$c->{tel_cell}, ],
[ 3, 2, "Home", \$c->{tel_home}, ],
[ 4, 2, "Work", \$c->{tel_work}, ],
[ 5, 2, "Fax", \$c->{tel_fax}, ],
[ 1, 0, "Name", \$c->{name}, ],
[ 2, 0, " Family", \$c->{person}{family_name}, ],
[ 3, 0, " Given", \$c->{person}{given_name}, ],
[ 4, 0, " Nick", \$c->{nickname}, ],
[ 5, 0, "Adress", \$c->{home_address}, ],
[ 6, 0, " Street", \$c->{address}{street}, ],
[ 7, 0, " City", \$c->{address}{city}, ],
[ 8, 0, " Postal", \$c->{address}{postal}, ],
[ 6, 2, "Company", \$c->{company}, ],
[ 7, 2, "Birth", \$c->{birthday}, ],
[ 8, 2, "Date", \$c->{date}, ],
[ 10, 0, "URL", \$c->{url}, ],
[ 10, 2, "e-mail", \$c->{e_mail}, ],
[ 11, 0, "Note", \$c->{note}, 3 ],
) {
my ($row, $col, $label, $field, $cs) = (@$_, 1);
$eg->Label (-text => $label, @la)->grid (-row => $row, -column => $col, @gg);
$eg->Entry (-textvariable => $field, @ea)->grid (-row => $row, -column => $col + 1, -columnspan => $cs, @gg);
}
$bf->Button (
-text => "Save",
-command => sub {
my $cuh;
$cuh = sub {
my $h = shift;
my $n = 0;
foreach my $k (keys %$h) {
unless (defined $h->{$k}) {
delete $h->{$k};
next;
}
$n++;
if (ref $h->{$k}) {
unless ($cuh->($h->{$k})) {
delete $h->{$k};
$n--;
}
next;
}
$h->{$k} =~ s/\s+$//;
$h->{$k} =~ s/^\s+//;
unless (length $h->{$k}) {
delete $h->{$k};
$n--;
}
}
return $n;
}; # cuh
$cuh->($c);
DDumper { Writing => $c };
my $err = $gsm->WritePhonebookEntry ($c);
if (defined $err and $err == 0) {
status "Phonebook updated", "#00a000";
get_pb ();
$be->delete (0, "end");
$be->insert ("end", $_) for map { $_->{summ} } @pb;
}
else {
status (($gsm->{ERROR} || "ERROR: ".DPeek $err), "#d00000");
}
},
)->pack (qw( -side left -expand 0 -fill both -anchor w ));
$bf->Button (
-text => "Clear",
-command => sub { clear_hash ($c) },
)->pack (qw( -side left -expand 0 -fill both -anchor w ));
$bf->Button (
-text => "Cancel",
-command => sub { $cw->destroy; },
)->pack (qw( -side left -expand 0 -fill both -anchor w ));
} # add_contact
MainLoop;
( run in 0.420 second using v1.01-cache-2.11-cpan-d7f47b0818f )