Thursday, April 20, 2006

KDE and Beagle

I have been wating quite a long time to be able to use Google Desktop Search-like in my Linux box. There were two candidates: Beagle and Kat. Until Fedora Core 5, Beagle was crashing all the time, and was hardly performing any indexing. FC5 added Beagle as a part of distribution.
The last thing I needed was some KDE front end - and Kerry is nice enough.
But there was one flaw - I do not like neither Thunderbird nor Evolution. And the way Kerry tried to open emails was resulting in new emails with the content I wanted to read as attachments.
The solution is quite simple - write own wrapper for KMail to handle that. Since I did not know at first wheather the content of the email is piped to the program or just referenced, I make a small script that handles both ways. I hope others will find it usefull.

#!/bin/sh

if [ ! $1 ];
then
TMPFILE=`mktemp -q /tmp/emailpreview.XXXXXX`
if [ $? -ne 0 ]; then
echo "$0: Can’t create temp file, exiting..."
exit 1
fi

while read -u 0 TMP
do
echo "$TMP" >> $TMPFILE
done
else
TMPFILE=$1
fi

/usr/bin/kmail --view "file://$TMPFILE"

if [ ! $1 ]; then
rm -f $TMPFILE
fi

1 comment:

Huahai said...

This tip is very useful. I have been searching a way to read individual message for a couple of days. This is the easiest method. Thanks.