Commit 6de5fc2b9c339584e5b4ff96f861f08d8fe335af

Authored by Silvan Calarco
1 parent 7d4de2c7ec
Exists in master

kickoffcfg: former fix locally forgotten

Showing 1 changed file with 1 additions and 1 deletions Inline Diff

1 #!/bin/sh 1 #!/bin/sh
2 if [ `id -u` -eq 0 ]; then 2 if [ `id -u` -eq 0 ]; then
3 CONFDIR=/opt/kde/share/config 3 CONFDIR=/opt/kde/share/config
4 else 4 else
5 CONFDIR=~/.kde4/share/config 5 CONFDIR=~/.kde4/share/config
6 fi 6 fi
7 FAVORITES=`/opt/kde/bin/kreadconfig --file $CONFDIR/kickoffrc --group Favorites --key FavoriteURLs 2>/dev/null` 7 FAVORITES=`/opt/kde/bin/kreadconfig --file $CONFDIR/kickoffrc --group Favorites --key FavoriteURLs 2>/dev/null`
8 8
9 [ "$1" -a "$2" ] || { 9 [ "$1" -a "$2" ] || {
10 echo "KDE4 kickoff configuration tool" 10 echo "KDE4 kickoff configuration tool"
11 echo 11 echo
12 echo "Usage: kickoffcfg {--add-favorite|--del-favorite} /path/to/desktopfile.desktop" 12 echo "Usage: kickoffcfg {--add-favorite|--del-favorite} /path/to/desktopfile.desktop"
13 echo 13 echo
14 echo "Current favorites:" 14 echo "Current favorites:"
15 echo $FAVORITES 15 echo $FAVORITES
16 exit 1 16 exit 1
17 } 17 }
18 18
19 if [ "$1" = "--add-favorite" ]; then 19 if [ "$1" = "--add-favorite" ]; then
20 # ADD 20 # ADD
21 echo "$FAVORITES" | grep $2 >/dev/null || { 21 echo "$FAVORITES" | grep $2 >/dev/null || {
22 if [ "$FAVORITES" ]; then 22 if [ "$FAVORITES" ]; then
23 FAVORITES="$FAVORITES,$2" 23 FAVORITES="$FAVORITES,$2"
24 else 24 else
25 FAVORITES="$2" 25 FAVORITES="$2"
26 fi 26 fi
27 /opt/kde/bin/kwriteconfig --file $CONFDIR/kickoffrc --group Favorites --key FavoriteURLs $FAVORITES 27 /opt/kde/bin/kwriteconfig --file $CONFDIR/kickoffrc --group Favorites --key FavoriteURLs $FAVORITES
28 } 28 }
29 elif [ "$1" = "--del-favorite" ]; then 29 elif [ "$1" = "--del-favorite" ]; then
30 # DELETE 30 # DELETE
31 MODFAVORITES=`echo "$FAVORITES" | sed "s|$2||" | sed "s| ,||" | sed "s|,,|,|"` 31 MODFAVORITES=`echo "$FAVORITES" | sed "s|$2||;s|^,||;s|,,|,|"`
32 if [ ! "$MODFAVORITES" ]; then 32 if [ ! "$MODFAVORITES" ]; then
33 /opt/kde/bin/kwriteconfig --file $CONFDIR/kickoffrc --group Favorites --key FavoriteURLs '' 33 /opt/kde/bin/kwriteconfig --file $CONFDIR/kickoffrc --group Favorites --key FavoriteURLs ''
34 elif [ "$FAVORITES" != "$MODFAVORITES" ]; then 34 elif [ "$FAVORITES" != "$MODFAVORITES" ]; then
35 /opt/kde/bin/kwriteconfig --file $CONFDIR/kickoffrc --group Favorites --key FavoriteURLs $MODFAVORITES 35 /opt/kde/bin/kwriteconfig --file $CONFDIR/kickoffrc --group Favorites --key FavoriteURLs $MODFAVORITES
36 fi 36 fi
37 else 37 else
38 echo "Invalid option $1; aborting." 38 echo "Invalid option $1; aborting."
39 exit 1 39 exit 1
40 fi 40 fi
41 exit 0 41 exit 0
42 42