|
|
@ -4,8 +4,8 @@ |
|
|
|
. "$(dirname "$0")/sxmo_common.sh" |
|
|
|
. "$(dirname "$0")/sxmo_common.sh" |
|
|
|
|
|
|
|
|
|
|
|
newcontact() { |
|
|
|
newcontact() { |
|
|
|
name="$(echo | sxmo_dmenu_with_kb.sh -c -l 2 -p "Name")" |
|
|
|
name="$(echo | sxmo_dmenu_with_kb.sh -c -l 2 -p "$icon_usr Name")" |
|
|
|
number="$(echo | sxmo_dmenu_with_kb.sh -c -l 2 -p "Number")" |
|
|
|
number="$(echo | sxmo_dmenu_with_kb.sh -c -l 2 -p "$icon_phl Number")" |
|
|
|
|
|
|
|
|
|
|
|
PICKED="$number $name" # now act like if we picked this new contact |
|
|
|
PICKED="$number $name" # now act like if we picked this new contact |
|
|
|
echo "$PICKED" >> "$CONTACTFILE" |
|
|
|
echo "$PICKED" >> "$CONTACTFILE" |
|
|
@ -18,7 +18,7 @@ editcontactname() { |
|
|
|
ENTRIES="$(printf %b "Old name: $oldname")" |
|
|
|
ENTRIES="$(printf %b "Old name: $oldname")" |
|
|
|
PICKED="$( |
|
|
|
PICKED="$( |
|
|
|
echo "$ENTRIES" | |
|
|
|
echo "$ENTRIES" | |
|
|
|
sxmo_dmenu_with_kb.sh -c -l 3 -p "Edit Contact" |
|
|
|
sxmo_dmenu_with_kb.sh -c -l 3 -p "$icon_edt Edit Contact" |
|
|
|
)" |
|
|
|
)" |
|
|
|
|
|
|
|
|
|
|
|
if ! echo "$PICKED" | grep -q "^Old name: "; then |
|
|
|
if ! echo "$PICKED" | grep -q "^Old name: "; then |
|
|
@ -37,7 +37,7 @@ editcontactnumber() { |
|
|
|
ENTRIES="$(printf %b "Old number: $oldnumber")" |
|
|
|
ENTRIES="$(printf %b "Old number: $oldnumber")" |
|
|
|
PICKED="$( |
|
|
|
PICKED="$( |
|
|
|
echo "$ENTRIES" | |
|
|
|
echo "$ENTRIES" | |
|
|
|
sxmo_dmenu_with_kb.sh -c -l 3 -p "Edit Contact" |
|
|
|
sxmo_dmenu_with_kb.sh -c -l 3 -p "$icon_edt Edit Contact" |
|
|
|
)" |
|
|
|
)" |
|
|
|
|
|
|
|
|
|
|
|
if ! echo "$PICKED" | grep -q "^Old number: "; then |
|
|
|
if ! echo "$PICKED" | grep -q "^Old number: "; then |
|
|
@ -52,28 +52,28 @@ editcontactnumber() { |
|
|
|
deletecontact() { |
|
|
|
deletecontact() { |
|
|
|
name="$(echo "$1" | cut -d" " -f2)" |
|
|
|
name="$(echo "$1" | cut -d" " -f2)" |
|
|
|
|
|
|
|
|
|
|
|
ENTRIES="$(printf "Yes\nNo")" |
|
|
|
ENTRIES="$(printf "$icon_chk Yes\n$icon_cls No")" |
|
|
|
PICKED="$( |
|
|
|
PICKED="$( |
|
|
|
echo "$ENTRIES" | |
|
|
|
echo "$ENTRIES" | |
|
|
|
dmenu -c -l 3 -p "Delete $name ?" |
|
|
|
dmenu -c -l 3 -p "$icon_del Delete $name ?" |
|
|
|
)" |
|
|
|
)" |
|
|
|
|
|
|
|
|
|
|
|
echo "$PICKED" | grep -q "^Yes" && sed -i "/^$1$/d" "$CONTACTFILE" |
|
|
|
echo "$PICKED" | grep -q "Yes" && sed -i "/^$1$/d" "$CONTACTFILE" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
editcontact() { |
|
|
|
editcontact() { |
|
|
|
number="$(echo "$1" | cut -d" " -f1)" |
|
|
|
number="$(echo "$1" | cut -d" " -f1)" |
|
|
|
name="$(echo "$1" | cut -d" " -f2)" |
|
|
|
name="$(echo "$1" | cut -d" " -f2)" |
|
|
|
ENTRIES="$(printf %b "Cancel\nName: $name\nNumber: $number")" |
|
|
|
ENTRIES="$(printf %b "$icon_ret Cancel\n$icon_usr Name: $name\n$icon_phl Number: $number")" |
|
|
|
|
|
|
|
|
|
|
|
PICKED="$( |
|
|
|
PICKED="$( |
|
|
|
echo "$ENTRIES" | |
|
|
|
echo "$ENTRIES" | |
|
|
|
dmenu -c -l 4 -p "Edit Contact" |
|
|
|
dmenu -c -l 4 -p "$icon_edt Edit Contact" |
|
|
|
)" |
|
|
|
)" |
|
|
|
|
|
|
|
|
|
|
|
if echo "$PICKED" | grep -q "^Name: "; then |
|
|
|
if echo "$PICKED" | grep -q "Name: "; then |
|
|
|
editcontactname "$1" |
|
|
|
editcontactname "$1" |
|
|
|
elif echo "$PICKED" | grep -q "^Number: "; then |
|
|
|
elif echo "$PICKED" | grep -q "Number: "; then |
|
|
|
editcontactnumber "$1" |
|
|
|
editcontactnumber "$1" |
|
|
|
else |
|
|
|
else |
|
|
|
showcontact "$1" |
|
|
|
showcontact "$1" |
|
|
@ -83,22 +83,22 @@ editcontact() { |
|
|
|
showcontact() { |
|
|
|
showcontact() { |
|
|
|
number="$(echo "$1" | cut -d" " -f1)" |
|
|
|
number="$(echo "$1" | cut -d" " -f1)" |
|
|
|
name="$(echo "$1" | cut -d" " -f2)" |
|
|
|
name="$(echo "$1" | cut -d" " -f2)" |
|
|
|
ENTRIES="$(printf %b "Cancel\nSend a Message\nCall\nEdit\nDelete")" |
|
|
|
ENTRIES="$(printf %b "$icon_ret Cancel\n$icon_msg Send a Message\n$icon_phn Call\n$icon_edt Edit\n$icon_del Delete")" |
|
|
|
|
|
|
|
|
|
|
|
PICKED="$( |
|
|
|
PICKED="$( |
|
|
|
echo "$ENTRIES" | |
|
|
|
echo "$ENTRIES" | |
|
|
|
dmenu -c -l 5 -p "$name" |
|
|
|
dmenu -c -l 5 -p "$icon_usr $name" |
|
|
|
)" |
|
|
|
)" |
|
|
|
|
|
|
|
|
|
|
|
if echo "$PICKED" | grep -q "^Send a Message"; then |
|
|
|
if echo "$PICKED" | grep -q "Send a Message"; then |
|
|
|
sxmo_modemtext.sh sendtextmenu "$number" |
|
|
|
sxmo_modemtext.sh sendtextmenu "$number" |
|
|
|
exit |
|
|
|
exit |
|
|
|
elif echo "$PICKED" | grep -q "^Call"; then |
|
|
|
elif echo "$PICKED" | grep -q "Call"; then |
|
|
|
sxmo_modemdial.sh "$number" |
|
|
|
sxmo_modemdial.sh "$number" |
|
|
|
exit |
|
|
|
exit |
|
|
|
elif echo "$PICKED" | grep -q "^Edit"; then |
|
|
|
elif echo "$PICKED" | grep -q "Edit"; then |
|
|
|
editcontact "$1" |
|
|
|
editcontact "$1" |
|
|
|
elif echo "$PICKED" | grep -q "^Delete"; then |
|
|
|
elif echo "$PICKED" | grep -q "Delete"; then |
|
|
|
deletecontact "$1" || showcontact "$1" |
|
|
|
deletecontact "$1" || showcontact "$1" |
|
|
|
fi |
|
|
|
fi |
|
|
|
} |
|
|
|
} |
|
|
@ -106,11 +106,11 @@ showcontact() { |
|
|
|
main() { |
|
|
|
main() { |
|
|
|
while true; do |
|
|
|
while true; do |
|
|
|
CONTACTS="$(sed 's/\t/: /g' "$CONTACTFILE")" |
|
|
|
CONTACTS="$(sed 's/\t/: /g' "$CONTACTFILE")" |
|
|
|
ENTRIES="$(echo "$CONTACTS" | xargs -0 printf "Close Menu\nNew Contact\n%s")" |
|
|
|
ENTRIES="$(echo "$CONTACTS" | xargs -0 printf "$icon_ret Close Menu\n$icon_pls New Contact\n%s")" |
|
|
|
|
|
|
|
|
|
|
|
PICKED="$( |
|
|
|
PICKED="$( |
|
|
|
echo "$ENTRIES" | |
|
|
|
echo "$ENTRIES" | |
|
|
|
sxmo_dmenu_with_kb.sh -i -c -l 10 -p "Contacts" |
|
|
|
sxmo_dmenu_with_kb.sh -i -c -l 10 -p "$icon_lst Contacts" |
|
|
|
)" |
|
|
|
)" |
|
|
|
|
|
|
|
|
|
|
|
echo "$PICKED" | grep -q "Close Menu" && exit |
|
|
|
echo "$PICKED" | grep -q "Close Menu" && exit |
|
|
|