<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffcc" text="#000066">
<br>
<br>
Donatas G. wrote:
<blockquote id="mid_200911250822_19248_dgvirtual_akl_lt"
 cite="mid:200911250822.19248.dgvirtual@akl.lt" type="cite">
  <pre wrap="">On 2009 m. Lapkritis 24 d., antradienis 16:39:46 Alvin wrote:
  </pre>
  <blockquote id="StationeryCiteGenerated_1" type="cite">
    <pre wrap="">On Tuesday 24 November 2009 15:29:45 Donatas G. wrote:
    </pre>
    <blockquote id="StationeryCiteGenerated_2" type="cite">
      <pre wrap="">On 2009 m. Lapkritis 24 d., antradienis 15:56:02 Alvin wrote:
      </pre>
      <blockquote id="StationeryCiteGenerated_3" type="cite">
        <pre wrap="">On Tuesday 24 November 2009 12:59:40 Donatas G. wrote:
        </pre>
        <blockquote id="StationeryCiteGenerated_4" type="cite">
          <pre wrap="">I am trying to write a Dolphin service menu that would allow to
attach a file to an email, but with a twist: I want the service menu
to be universal enough to guess which email program the user is
using.

For that I need to find out how to get the name of the default email
 program via shell.

Any ideas? Is there any dbus call I could make?

If it were just kmail, the desktop file contents would look like
this:

[...]
If I could get the default email program by executing some program in
 command line I could proceed...
          </pre>
        </blockquote>
        <pre wrap="">Take a look at xdg-email (in xdg-utils).
        </pre>
      </blockquote>
      <pre wrap="">OK, thank you, I see /usr/bin/xdg-email uses kreadconfig tool, but the
 script is evidently wrong; upon trying to use it I get an error, and the
 particular line

kreadconfig --file emaildefaults --group PROFILE_Default --key
EmailClient

produces empty output.
And I could find no clues online on how to use kreadconfig in KDE 4...
I will have to dig deeper.
      </pre>
    </blockquote>
    <pre wrap="">kreadconfig also gives empty output here.

I just tried xdg-email and it doesn't work. It says to install
 kmailservice. You need to install kdelibs4c2a for that.

After installation, xdg-email works:
$ xdg-email --subject "test" --body "test" <a class="moz-txt-link-abbreviated" href="mailto:kubuntu-users@lists.ubuntu.com">kubuntu-users@lists.ubuntu.com</a>
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Yes, but kdelibs4c2a is from kde3... 

So I deviced a possibly better idea: I found out that if the default email 
client in KDE is not kmail, then the file ~/.kde/share/config/emaildefaults 
contains a variable EmailClient with the program name.

I am attaching a desktop file and a script that seem to make a potentially 
universal "send by email" service menu. The *.sh script goes to /usr/bin (and 
needs to be made executable), and the *.desktop file goes to 
/usr/share/kde4/services/ServiceMenu/

The service menu appears under „actions“ in the Dolphin context menu. 

Could someone using thunderbird test it? I do not have it configured currently, 
and am lazy to configure it just to test the script...

Limitations: 

* no internationalization for the Subject: line (it would be possible if sh 
script is not used, and the command for a particular email client be written 
in the *.desktop file itself).
* only thunderbird and kmail supported. Other clients would result in a 
kdialog message warning the user that their default email is not supported.
* some advanced configurations are not supported (like thunderbird launched 
with a particular profile - the script would launch using the default 
profile...)

If anyone sends me proper command line strings for attaching files to other 
email clients, I will gladly update the script.

If this service menu idea turns interesting to others, I will put it into kde-
apps.org.

Donatas G.
  </pre>
</blockquote>
It does start Thunderbird compose window, but it does not seem to <br>
include the attachment.  I could be missing something here, however,<br>
I always thought that the attachment would be showing just like it<br>
does after manually adding it to a message; that is not the case here.<br>
<br>
Tom Bell<br>
<br>
<pre class="moz-signature" cols="50"> Quis custodiet ipsos custodes?  -- Decimus Iunius Iuvenalis (Juvenal), Roman Poet, late 1st, early 2nd century AD
("Who will protect us from the protectors?")
</pre>
<br>
</body>
</html>