KEMailClientLauncherJob Class

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

Public Functions

KEMailClientLauncherJob(QObject *parent = nullptr)
virtual ~KEMailClientLauncherJob() override
void setAttachments(const QList<QUrl> &urls)
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

@class KEMailClientLauncherJob kemailclientlauncherjob.h <KEMailClientLauncherJob>

@brief KEMailClientLauncherJob starts a mail client in order to compose a new mail.

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 @code job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this)); @endcode

@since 5.87

Member Function Documentation

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

Creates a KEMailClientLauncherJob. @param 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 @param urls URLs of the attachments for the email Remember to use QUrl::fromLocalFile() to construct those URLs from local file paths.

void KEMailClientLauncherJob::setBcc(const QStringList &bcc)

Sets the email address(es) that will be used in the Bcc field for the email @param bcc recipients; each entry can use the format "someone@example.com" or "John Doe <someone@example.com>" @since 5.96

void KEMailClientLauncherJob::setBody(const QString &body)

Sets the body for the email @param 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 @param 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. @param 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 @param 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 @param 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.