summaryrefslogtreecommitdiff
path: root/packages/opie-taskbar/opie-taskbar/c7x0/qpe-suspend-resume
blob: be37519512b7feace6c301b69c5a943afca3e1ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh

QTDIR=/opt/QtPalmtop
LD_LIBRARY_PATH=$QTDIR
export LD_LIBRARY_PATH QTDIR
LOGGING=0
log() {
  if [ $LOGGING -eq 1 ]; then
    echo "$(date +%y/%m/%d-%H:%m:%S): $@" >> /var/log/qte.log
  fi
}

retcode=1
tries=3

if [ "$1" = suspend ]; then
    while [ $retcode -ne 0 -a $tries -gt 0 ]; do
      log "-> $QTDIR/bin/qcop QPE/System 'aboutToSuspend()'"
      $QTDIR/bin/qcop QPE/System 'aboutToSuspend()'
      retcode=$?
      tries=`expr $tries - 1`
      log "<- Result $retcode"
    done
elif [ "$1" = resume ]; then
    while [ $retcode -ne 0 -a $tries -gt 0 ]; do
      log "-> $QTDIR/bin/qcop QPE/System 'returnFromSuspend()'"
      $QTDIR/bin/qcop QPE/System 'returnFromSuspend()'
      retcode=$?
      tries=`expr $tries - 1`
      log "<- Result $retcode"
    done
fi