Commit 034153b5 authored by Ahmad Samir's avatar Ahmad Samir
Browse files

src/uiserver/*command: port to PMF signal/slot syntax

parent e40e8f84
Pipeline #182453 passed with stage
in 2 minutes and 19 seconds
......@@ -68,10 +68,8 @@ int CreateChecksumsCommand::doStart()
d->controller->setFiles(fileNames());
connect(d->controller.get(), SIGNAL(done()),
this, SLOT(done()), Qt::QueuedConnection);
connect(d->controller.get(), SIGNAL(error(int,QString)),
this, SLOT(done(int,QString)), Qt::QueuedConnection);
connect(d->controller.get(), &Controller::done, this, [this]() { done(); }, Qt::QueuedConnection);
connect(d->controller.get(), &Controller::error, this, [this](int err, const QString &details) { done(err, details); }, Qt::QueuedConnection);
d->controller->start();
......
......@@ -109,10 +109,8 @@ int DecryptVerifyCommandEMailBase::doStart()
if (informativeSenders()) {
d->controller->setInformativeSenders(senders());
}
QObject::connect(d->controller.get(), SIGNAL(done()),
d.get(), SLOT(slotDone()), Qt::QueuedConnection);
QObject::connect(d->controller.get(), SIGNAL(error(int,QString)),
d.get(), SLOT(slotError(int,QString)), Qt::QueuedConnection);
QObject::connect(d->controller.get(), &Controller::done, d.get(), &Private::slotDone, Qt::QueuedConnection);
QObject::connect(d->controller.get(), &Controller::error, d.get(), &Private::slotError, Qt::QueuedConnection);
QObject::connect(d->controller.get(), &DecryptVerifyEMailController::verificationResult,
d.get(), &Private::verificationResult, Qt::QueuedConnection);
......
......@@ -105,10 +105,8 @@ int DecryptVerifyCommandFilesBase::doStart()
d->controller->setOperation(operation());
d->controller->setFiles(fileNames());
QObject::connect(d->controller.get(), SIGNAL(done()),
d.get(), SLOT(slotDone()), Qt::QueuedConnection);
QObject::connect(d->controller.get(), SIGNAL(error(int,QString)),
d.get(), SLOT(slotError(int,QString)), Qt::QueuedConnection);
QObject::connect(d->controller.get(), &Controller::done, d.get(), &Private::slotDone, Qt::QueuedConnection);
QObject::connect(d->controller.get(), &Controller::error, d.get(), &Private::slotError, Qt::QueuedConnection);
QObject::connect(d->controller.get(), &DecryptVerifyFilesController::verificationResult,
d.get(), &Private::verificationResult, Qt::QueuedConnection);
......
......@@ -42,6 +42,7 @@ public:
private:
void checkForErrors() const;
void connectController();
private Q_SLOTS:
void slotDone();
......@@ -113,13 +114,12 @@ void EncryptCommand::Private::checkForErrors() const
}
static void connectController(const QObject *controller, const QObject *d)
void EncryptCommand::Private::connectController()
{
QObject::connect(controller, SIGNAL(certificatesResolved()), d, SLOT(slotRecipientsResolved()));
QObject::connect(controller, SIGNAL(done()), d, SLOT(slotDone()));
QObject::connect(controller, SIGNAL(error(int,QString)), d, SLOT(slotError(int,QString)));
auto ptr = controller.get();
connect(ptr, &NewSignEncryptEMailController::certificatesResolved, this, &EncryptCommand::Private::slotRecipientsResolved);
connect(ptr, &Controller::done, this, &EncryptCommand::Private::slotDone);
connect(ptr, &Controller::error, this, &EncryptCommand::Private::slotError);
}
int EncryptCommand::doStart()
......@@ -132,7 +132,7 @@ int EncryptCommand::doStart()
if (seec && seec->isEncrypting()) {
// reuse the controller from a previous PREP_ENCRYPT, if available:
d->controller = seec;
connectController(seec.get(), d.get());
d->connectController();
removeMemento(NewSignEncryptEMailController::mementoName());
d->controller->setExecutionContext(shared_from_this());
if (seec->areCertificatesResolved()) {
......@@ -152,7 +152,7 @@ int EncryptCommand::doStart()
d->controller->setEncrypting(true);
d->controller->setSigning(false);
d->controller->setProtocol(checkProtocol(EMail));
connectController(d->controller.get(), d.get());
d->connectController();
d->controller->startResolveCertificates(recipients(), senders());
}
......
......@@ -37,6 +37,7 @@ public:
private:
void checkForErrors() const;
void connectController();
public Q_SLOTS:
void slotSignersResolved();
......@@ -86,10 +87,11 @@ void PrepSignCommand::Private::checkForErrors() const
}
static void connectController(const QObject *controller, const QObject *d)
void PrepSignCommand::Private::connectController()
{
QObject::connect(controller, SIGNAL(certificatesResolved()), d, SLOT(slotSignersResolved()));
QObject::connect(controller, SIGNAL(error(int,QString)), d, SLOT(slotError(int,QString)));
auto ptr = controller.get();
connect(ptr, &NewSignEncryptEMailController::certificatesResolved, this, &PrepSignCommand::Private::slotSignersResolved);
connect(ptr, &Controller::error, this, &PrepSignCommand::Private::slotError);
}
int PrepSignCommand::doStart()
......@@ -102,7 +104,7 @@ int PrepSignCommand::doStart()
if (seec && seec->isSigning()) {
// reuse the controller from a previous PREP_ENCRYPT --expect-sign, if available:
d->controller = seec;
connectController(seec.get(), d.get());
d->connectController();
seec->setExecutionContext(shared_from_this());
if (seec->areCertificatesResolved()) {
QTimer::singleShot(0, d.get(), &Private::slotSignersResolved);
......@@ -126,7 +128,7 @@ int PrepSignCommand::doStart()
d->controller->setEncrypting(false);
d->controller->setSigning(true);
connectController(d->controller.get(), d.get());
d->connectController();
d->controller->startResolveCertificates(recipients(), senders());
}
......
......@@ -41,6 +41,8 @@ public:
private:
void checkForErrors() const;
void connectController();
private Q_SLOTS:
void slotSignersResolved();
......@@ -108,12 +110,13 @@ void SignCommand::Private::checkForErrors() const
}
static void connectController(const QObject *controller, const QObject *d)
void SignCommand::Private::connectController()
{
QObject::connect(controller, SIGNAL(certificatesResolved()), d, SLOT(slotSignersResolved()));
QObject::connect(controller, SIGNAL(reportMicAlg(QString)), d, SLOT(slotMicAlgDetermined(QString)));
QObject::connect(controller, SIGNAL(done()), d, SLOT(slotDone()));
QObject::connect(controller, SIGNAL(error(int,QString)), d, SLOT(slotError(int,QString)));
NewSignEncryptEMailController *ptr = controller.get();
QObject::connect(ptr, &NewSignEncryptEMailController::certificatesResolved, this, &SignCommand::Private::slotSignersResolved);
QObject::connect(ptr, &NewSignEncryptEMailController::reportMicAlg, this, &SignCommand::Private::slotMicAlgDetermined);
QObject::connect(ptr, &Controller::done, this, &SignCommand::Private::slotDone);
QObject::connect(ptr, &Controller::error, this, &SignCommand::Private::slotError);
}
int SignCommand::doStart()
......@@ -126,7 +129,7 @@ int SignCommand::doStart()
if (seec && seec->isSigning()) {
// reuse the controller from a previous PREP_ENCRYPT --expect-sign, if available:
d->controller = seec;
connectController(seec.get(), d.get());
d->connectController();
if (!seec->isEncrypting()) {
removeMemento(NewSignEncryptEMailController::mementoName());
}
......@@ -148,7 +151,7 @@ int SignCommand::doStart()
d->controller->setSigning(true);
d->controller->setEncrypting(false);
d->controller->setProtocol(checkProtocol(EMail, AssuanCommand::AllowProtocolMissing));
connectController(d->controller.get(), d.get());
d->connectController();
d->controller->startResolveCertificates(recipients(), senders());
}
......
......@@ -106,8 +106,8 @@ int SignEncryptFilesCommand::doStart()
d->controller->setOperationMode(op);
d->controller->setFiles(fileNames());
QObject::connect(d->controller.get(), SIGNAL(done()), d.get(), SLOT(slotDone()), Qt::QueuedConnection);
QObject::connect(d->controller.get(), SIGNAL(error(int,QString)), d.get(), SLOT(slotError(int,QString)), Qt::QueuedConnection);
QObject::connect(d->controller.get(), &Controller::done, d.get(), &Private::slotDone, Qt::QueuedConnection);
QObject::connect(d->controller.get(), &Controller::error, d.get(), &Private::slotError, Qt::QueuedConnection);
d->controller->start();
......
......@@ -68,10 +68,8 @@ int VerifyChecksumsCommand::doStart()
d->controller->setFiles(fileNames());
QObject::connect(d->controller.get(), SIGNAL(done()),
this, SLOT(done()), Qt::QueuedConnection);
QObject::connect(d->controller.get(), SIGNAL(error(int,QString)),
this, SLOT(done(int,QString)), Qt::QueuedConnection);
QObject::connect(d->controller.get(), &Controller::done, this, [this]() { done(); }, Qt::QueuedConnection);
QObject::connect(d->controller.get(), &Controller::error, this, [this](int err, const QString &details) { done(err, details); }, Qt::QueuedConnection);
d->controller->start();
......
......@@ -43,8 +43,6 @@ private Q_SLOTS:
private:
class Private;
kdtools::pimpl_ptr<Private> d;
//Q_PRIVATE_SLOT( this, void done() )
//Q_PRIVATE_SLOT( this, void done(int,QString) )
};
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment