[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Device Link on Desktop and Service Menu
From: Thomas Kadauke <tkadauke () gmx ! de>
Date: 2005-12-21 18:05:46
Message-ID: 200512211905.46675.tkadauke () gmx ! de
[Download RAW message or body]
Hi!
I had this same problem and my solution works quite well (see attached files).
You will have to change a bit in the files, however I hope this could help
you.
If you have any questions about the desktop-file of shell script, please
ask :)
--Thomas
P.S.: I'm sending this to kde-devel, too, in case someone is interested :)
Am Wednesday 21 December 2005 16:01 schrieb Vincent Tassy:
> Hello everyone,
>
> Could anyone give me a hint about how one might add service menu
> entries to Device Icons that are on the desktop ?
>
> I have looked into the actual servicemenu desktop files in
> /usr/share/apps/konqueror/servicemenus but it seems what you put there
> doesn't affect the device icons on the Desktop. It does work when
> accessing devices through the media:/ name space in Konqueror though
> ...
>
> I also have tried to modify directly the desktop files for those
> devices and add my own actions and yes it works ... But the state of
> the device (mounted/unmounted) doesn't affect the presence of my
> actions ...
>
> What I'm trying to achieve is an equivalent to Mount/Unmount entries
> that take care of setting up encryption with the devicemapper of the
> kernel ... So I'd like to see either my CryptoMount entry or
> CryptoUnmount entry in the context menu of those Device Icons.
>
> Any clues ?
>
> How do the Mount/Unmount get there in the first place for those devices ?
>
> Thanks very much in advance,
>
> Vince.
>
> >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to
> >> unsubscribe <<
["Safe" (application/x-desktop)]
["safe_key" (application/x-shellscript)]
#!/bin/bash
die()
{
if [ kde_running ]; then
kdialog --error "$1"
else
echo "$1" >&2
fi
exit 0
}
usage()
{
echo "Usage: $0 {open|close} safe"
exit 0
}
[ "$2" != "" ] || usage
SAFE="$2"
LOOP_DEVICE="/dev/loop0"
SAFE_FILE="$HOME/${SAFE}"
MAPPER_DEVICE="${SAFE}"
MOUNT_POINT="$HOME/mnt/${SAFE}"
case $1 in
open)
if ! sudo /sbin/losetup ${LOOP_DEVICE}; then
sudo /sbin/losetup ${LOOP_DEVICE} ${SAFE_FILE} || die "Konnte Loopback device \
nicht initialisieren" fi
if [ "`sudo /usr/bin/cryptsetup status ${MAPPER_DEVICE} | grep inactive`" != "" ]; \
then if [ kde_running ]; then
PASSWORD=`kdialog --password "Bitte Passwort eingeben"`
if [ "$?" == "0" ]; then
echo "${PASSWORD}" | sudo /usr/bin/cryptsetup create ${MAPPER_DEVICE} \
${LOOP_DEVICE} || die "Konnte mapper device nicht initialisieren" else
exit 0
fi
else
sudo /usr/bin/cryptsetup create ${MAPPER_DEVICE} ${LOOP_DEVICE} || die "Konnte \
mapper device nicht initialisieren" fi
fi
if [ "`mount | grep /dev/mapper/${MAPPER_DEVICE}`" == "" ]; then
sudo mount -o umask=077 /dev/mapper/${MAPPER_DEVICE} ${MOUNT_POINT} || die \
"Mounten ist fehlgeschlagen" fi
;;
close)
sudo umount /dev/mapper/${MAPPER_DEVICE} || die "Unmounten fehlgeschlagen"
sudo /usr/bin/cryptsetup remove ${MAPPER_DEVICE} || die "Konnte mapper device nicht \
entfernen" sudo /sbin/losetup -d ${LOOP_DEVICE} || die "Konnte loopback device nicht \
entfernen" ;;
*)
usage
;;
esac
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic