#! /bin/sh
# The clock might be wrong and we know that we need to update the icon
# cache so we just force it.

gtk-update-icon-cache -f /usr/share/icons/hicolor

# Now that the icon cache is uptodate, we move the .desktop file into
# place.  Doing this only now prevents the Task navigator from
# reconstructing the menu before the icon is available.  This trick is
# not really necessary when using maemo-select-menu-location (as we do
# below), since maemo-select-menu-location will trigger the
# reconstructing of the Taks navigator menu as well.

# ( cd /usr/share/applications/hildon/ && mv phonelink.inactive phonelink.desktop )

# Now we are ready to let the user move the entry around, but only if
# this is a new install

oldversion="$2"
if [ -z "$oldversion" ]; then
  maemo-select-menu-location phonelink.desktop
fi

GNOKII_CONF=/home/user/.gnokiirc
if [ ! -f $GNOKII_CONF ]; then
  PHONE_MAC_ADDR=`gconftool-2 -g /system/osso/connectivity/BT/preferred`
  if [ ! -z "${PHONE_MAC_ADDR}" ]; then
    cat >$GNOKII_CONF <<EOF
[global]
port = $PHONE_MAC_ADDR
model = AT
rfcomm_channel = 2
initlength = default
connection = bluetooth
use_locking = yes
serial_baudrate = 19200
smsc_timeout = 10

[gnokiid]
bindir = /usr/sbin/

[connect_script]
TELEPHONE = 12345678

[disconnect_script]

[logging]
debug = off
rlpdebug = off
xdebug = off
EOF
    chown user:users $GNOKII_CONF
  fi
fi
                         
#DEBHELPER#

exit 0
