KEMailClientLauncherJob Class

KEMailClientLauncherJob starts a mail client in order to compose a new mail. More...

Header: #include <KEMailClientLauncherJob>
CMake: find_package(KF6 REQUIRED COMPONENTS KIO)
target_link_libraries(mytarget PRIVATE KIOGui)
Since: KDE Frameworks 5.87
Inherits: KJob

Public Functions

KEMailClientLauncherJob(QObject *parent = nullptr)
virtual ~KEMailClientLauncherJob() override
void setAttachments(const QList<QUrl> &urls)
(since 5.96) void setBcc(const QStringList &bcc)
void setBody(const QString &body)
void setCc(const QStringList &cc)
void setStartupId(const QByteArray &startupId)
void setSubject(const QString &subject)
void setTo(const QStringList &to)

Reimplemented Public Functions

virtual void start() override

Detailed Description

It creates a startup notification and finishes it on success or on error (for the taskbar). It also emits an error message if necessary (e.g. "program not found").

The job finishes when the application is successfully started. For error handling, either connect to the result() signal, or for a simple messagebox on error, you can do

job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));

Member Function Documentation

[explicit] KEMailClientLauncherJob::KEMailClientLauncherJob(QObject *parent = nullptr)

Creates a KEMailClientLauncherJob.

parent the parent QObject

[override virtual noexcept] KEMailClientLauncherJob::~KEMailClientLauncherJob()

Destructor

Note that jobs auto-delete themselves after emitting result

void KEMailClientLauncherJob::setAttachments(const QList<QUrl> &urls)

Sets attachments for the email

urls URLs of the attachments for the email

Remember to use QUrl::fromLocalFile() to construct those URLs from local file paths.

[since 5.96] void KEMailClientLauncherJob::setBcc(const QStringList &bcc)

Sets the email address(es) that will be used in the Bcc field for the email

bcc recipients; each entry can use the format "someone@example.com" or "John Doe <someone@example.com>"

This function was introduced in KDE Frameworks 5.96.

void KEMailClientLauncherJob::setBody(const QString &body)

Sets the body for the email

body the email body

void KEMailClientLauncherJob::setCc(const QStringList &cc)

Sets the email address(es) that will be used in the CC field for the email

cc recipients; each entry can use the format "someone@example.com" or "John Doe <someone@example.com>"

void KEMailClientLauncherJob::setStartupId(const QByteArray &startupId)

Sets the platform-specific startup id of the mail client launch.

startupId startup id, if any (otherwise "").

For X11, this would be the id for the Startup Notification protocol.

For Wayland, this would be the token for the XDG Activation protocol.

void KEMailClientLauncherJob::setSubject(const QString &subject)

Sets the subject for the email

subject the email subject

void KEMailClientLauncherJob::setTo(const QStringList &to)

Sets the email address(es) that will be used in the To field for the email

to recipients; each entry can use the format "someone@example.com" or "John Doe <someone@example.com>"

[override virtual] void KEMailClientLauncherJob::start()

Reimplements: KJob::start().

Starts the job.

You must call this, after having called all the necessary setters.