[PyKDE] Implement MailTo in QT

David Boddie david at boddie.org.uk
Thu Nov 16 13:40:48 GMT 2006

On Thursday 16 November 2006 17:23:37 +0700, Keo Sophon wrote: 

> On Wednesday 15 November 2006 16:36, Andreas Pakulat wrote:

> > With Qt4.2 you could use QDesktopServices and run openUrl with
> > mailto:foobar at somename.com.
> >
> > With Qt4.1/Qt3 you have to write platform-dependent code.

> I am using Qt4.1. The problem has been solved already. The following is part 
> of code:


>         def handleLinkClicked(self, url):
>         '''slot to handle when anchorClicked (an email address), and open a
>         webbrowser and a mail client'''
>         self.sender().setSource(QtCore.QUrl())
>         try:
>             import webbrowser
>             webbrowser.open(unicode(url.toString()))
>             return
>         except:
>             pass

For Qt 4.1-based code, you could also use the desktop module to open URLs:


It aims to do much the same as what you want, but takes users' preferences
into account when choosing which WWW browser to open.


More information about the PyQt mailing list