[Qt-interest] How to open Outlook when 'email' button is clicked

Rainer Wiesenfarth Rainer.Wiesenfarth at inpho.de
Sat Jan 3 11:33:46 CET 2009


 
From: Avishek_Sharma
>   I am sorry,I forgot to mention that the application I have 
> been working on was  designed using Qt 3.3. Also,am working 
> on Linux platform.
> I guess,since it was designed using Qt 3,3,I won't be able to 
> use QDesktopServices as it's available for Qt 4.2 onwards,right.
> Also,it seems there's no default email client in Linux(came 
> to know that in qtcentre.org). 

Not a solution for your latest problem, but maybe one for the initial
question. Here is a code snippet of what we are using. Currently works with
Qt 4.x, but should compile under Qt 3.3 also, maybe after some changes
concerning QProcess.

It calls the default e-mail client, browser, PDF reader, ... (depending on
the file type) on Windows and Linux (KDE and Gnome desktops).

void DocumentLauncher::show (const QString &document)
{
#ifdef NT
    ShellExecute (0, "open", document.latin1 (), 0, 0, SW_SHOWNORMAL);
#else
    QString     program;
    QStringList args;

    if (QString (getenv ("KDE_FULL_SESSION")) == "true")
    {
        program = "kfmclient";
        args << "exec";
    }
    else if(! QString(getenv("GNOME_DESKTOP_SESSION_ID")).isEmpty())
    {
        program = "gnome-open";
    }

    if(! program.isEmpty())
    {
        QProcess   *proc = new QProcess ();

        args << document;
        connect (proc, SIGNAL(finished(int,QProcess::ExitStatus))
            , this, SLOT(processExited(int,QProcess::ExitStatus)));

        proc->start (program, args);
    }
#endif
}

void DocumentLauncher::processExited (int /*exitCode*/, QProcess::ExitStatus
/*exitStatus*/)
{
    sender ()->deleteLater ();
}


Best Regards / Mit freundlichen Grüßen
Rainer Wiesenfarth

-- 
INPHO GmbH * Smaragdweg 1 * 70174 Stuttgart * Germany
phone: +49 711 2288 10 * fax: +49 711 2288 111 * web: www.inpho.de
place of business: Stuttgart * managing director: Johannes Saile
commercial register: Stuttgart, HRB 9586
Leader in Photogrammetry and Digital Surface Modelling
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3359 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090103/a9af9c78/attachment.bin 


More information about the Qt-interest-old mailing list