summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-09-21 08:09:49 +0200
committerMontel Laurent <[email protected]>2017-09-21 08:09:49 +0200
commit0c0138d05048b5347a686cef6f690406ddb99a53 (patch)
tree900086b2cb0f29c4a1da26d1072ef4b81d5bcab7
parent0dbec00c758a9415d21c2c6f7227cff084147a5d (diff)
Not necessary to create a private class here
-rw-r--r--kmailtransport/sendmail/sendmailjob.cpp41
-rw-r--r--kmailtransport/sendmail/sendmailjob.h5
2 files changed, 16 insertions, 30 deletions
diff --git a/kmailtransport/sendmail/sendmailjob.cpp b/kmailtransport/sendmail/sendmailjob.cpp
index aa9c80e..0e9fbb8 100644
--- a/kmailtransport/sendmail/sendmailjob.cpp
+++ b/kmailtransport/sendmail/sendmailjob.cpp
@@ -31,48 +31,35 @@
using namespace MailTransport;
-/**
- * Private class that helps to provide binary compatibility between releases.
- * @internal
- */
-class SendMailJobPrivate
-{
-public:
- QProcess *process = nullptr;
- QString lastError;
-};
-
SendmailJob::SendmailJob(Transport *transport, QObject *parent)
: TransportJob(transport, parent)
- , d(new SendMailJobPrivate)
{
- d->process = new QProcess(this);
- connect(d->process,
+ mProcess = new QProcess(this);
+ connect(mProcess,
SIGNAL(finished(int,QProcess::ExitStatus)),
SLOT(sendmailExited(int,QProcess::ExitStatus)));
- connect(d->process, SIGNAL(error(QProcess::ProcessError)),
+ connect(mProcess, SIGNAL(error(QProcess::ProcessError)),
SLOT(receivedError()));
- connect(d->process, SIGNAL(readyReadStandardError()),
+ connect(mProcess, SIGNAL(readyReadStandardError()),
SLOT(receivedStdErr()));
}
SendmailJob::~SendmailJob()
{
- delete d;
}
void SendmailJob::doStart()
{
const QStringList arguments = QStringList() << QLatin1String("-i") << QLatin1String("-f") << sender() << to() << cc() << bcc();
- d->process->start(transport()->host(), arguments);
+ mProcess->start(transport()->host(), arguments);
- if (!d->process->waitForStarted()) {
+ if (!mProcess->waitForStarted()) {
setError(UserDefinedError);
setErrorText(i18n("Failed to execute mailer program %1", transport()->host()));
emitResult();
} else {
- d->process->write(buffer()->readAll());
- d->process->closeWriteChannel();
+ mProcess->write(buffer()->readAll());
+ mProcess->closeWriteChannel();
}
}
@@ -80,10 +67,10 @@ void SendmailJob::sendmailExited(int exitCode, QProcess::ExitStatus exitStatus)
{
if (exitStatus != 0 || exitCode != 0) {
setError(UserDefinedError);
- if (d->lastError.isEmpty()) {
+ if (mLastError.isEmpty()) {
setErrorText(i18n("Sendmail exited abnormally."));
} else {
- setErrorText(i18n("Sendmail exited abnormally: %1", d->lastError));
+ setErrorText(i18n("Sendmail exited abnormally: %1", mLastError));
}
}
emitResult();
@@ -91,17 +78,17 @@ void SendmailJob::sendmailExited(int exitCode, QProcess::ExitStatus exitStatus)
void SendmailJob::receivedError()
{
- d->lastError += d->process->errorString();
+ mLastError += mProcess->errorString();
}
void SendmailJob::receivedStdErr()
{
- d->lastError += QLatin1String(d->process->readAllStandardError());
+ mLastError += QLatin1String(mProcess->readAllStandardError());
}
bool SendmailJob::doKill()
{
- delete d->process;
- d->process = nullptr;
+ delete mProcess;
+ mProcess = nullptr;
return true;
}
diff --git a/kmailtransport/sendmail/sendmailjob.h b/kmailtransport/sendmail/sendmailjob.h
index 697fab8..d1e03b5 100644
--- a/kmailtransport/sendmail/sendmailjob.h
+++ b/kmailtransport/sendmail/sendmailjob.h
@@ -28,8 +28,6 @@
#include <QtCore/QProcess>
-class SendMailJobPrivate;
-
namespace MailTransport {
/**
Mail transport job for sendmail.
@@ -62,7 +60,8 @@ private Q_SLOTS:
void receivedStdErr();
private:
- SendMailJobPrivate *const d;
+ QString mLastError;
+ QProcess *mProcess = nullptr;
};
} // namespace MailTransport