Commit 8745b4c6 authored by Ahmad Samir's avatar Ahmad Samir
Browse files

src/commands/*: use PMF/Functor signal/slot syntax

- ReloadKeysCommand: use KeyCache::instance() instead of mutableInstance() in
  connect call.
parent f364040b
......@@ -171,8 +171,8 @@ void AuthenticatePIVCardApplicationCommand::Private::ensureDialogCreated()
i18n("Please enter the PIV Card Application Administration Key in hex-encoded form.") :
prompt);
connect(dialog, SIGNAL(accepted()), q, SLOT(slotDialogAccepted()));
connect(dialog, SIGNAL(rejected()), q, SLOT(slotDialogRejected()));
connect(dialog, &QDialog::accepted, q, [this]() { slotDialogAccepted(); });
connect(dialog, &QDialog::rejected, q, [this]() { slotDialogRejected(); });
}
void AuthenticatePIVCardApplicationCommand::Private::slotDialogAccepted()
......
......@@ -37,8 +37,6 @@ private:
class Private;
inline Private *d_func();
inline const Private *d_func() const;
Q_PRIVATE_SLOT(d_func(), void slotDialogAccepted())
Q_PRIVATE_SLOT(d_func(), void slotDialogRejected())
Q_PRIVATE_SLOT(d_func(), void slotResult(GpgME::Error))
};
......
......@@ -166,7 +166,7 @@ void CertifyCertificateCommand::doStart()
auto cmd = new Commands::NewCertificateCommand();
cmd->setParentWidget(d->parentWidgetOrView());
cmd->setProtocol(GpgME::OpenPGP);
loop.connect(cmd, SIGNAL(finished()), SLOT(quit()));
connect(cmd, &Command::finished, &loop, &QEventLoop::quit);
QMetaObject::invokeMethod(cmd, &Commands::NewCertificateCommand::start, Qt::QueuedConnection);
loop.exec();
} else {
......@@ -285,8 +285,8 @@ void CertifyCertificateCommand::Private::ensureDialogCreated()
dialog = new CertifyCertificateDialog;
applyWindowID(dialog);
connect(dialog, SIGNAL(rejected()), q, SLOT(slotDialogRejected()));
connect(dialog, SIGNAL(accepted()), q, SLOT(slotCertificationPrepared()));
connect(dialog, &QDialog::rejected, q, [this]() { slotDialogRejected(); });
connect(dialog, &QDialog::accepted, q, [this]() { slotCertificationPrepared(); });
}
void CertifyCertificateCommand::Private::createJob()
......@@ -306,8 +306,7 @@ void CertifyCertificateCommand::Private::createJob()
connect(j, &Job::progress,
q, &Command::progress);
connect(j, SIGNAL(result(GpgME::Error)),
q, SLOT(slotResult(GpgME::Error)));
connect(j, &SignKeyJob::result, q, [this](const GpgME::Error &result) { slotResult(result); });
job = j;
}
......
......@@ -45,9 +45,6 @@ private:
class Private;
inline Private *d_func();
inline const Private *d_func() const;
Q_PRIVATE_SLOT(d_func(), void slotResult(GpgME::Error))
Q_PRIVATE_SLOT(d_func(), void slotDialogRejected())
Q_PRIVATE_SLOT(d_func(), void slotCertificationPrepared())
};
}
......
......@@ -167,8 +167,8 @@ void ChangeExpiryCommand::Private::ensureDialogCreated(ExpiryDialog::Mode mode)
applyWindowID(dialog);
dialog->setAttribute(Qt::WA_DeleteOnClose);
connect(dialog, SIGNAL(accepted()), q, SLOT(slotDialogAccepted()));
connect(dialog, SIGNAL(rejected()), q, SLOT(slotDialogRejected()));
connect(dialog, &QDialog::accepted, q, [this]() { slotDialogAccepted(); });
connect(dialog, &QDialog::rejected, q, [this]() { slotDialogRejected(); });
}
void ChangeExpiryCommand::Private::createJob()
......
......@@ -45,9 +45,6 @@ private:
class Private;
inline Private *d_func();
inline const Private *d_func() const;
Q_PRIVATE_SLOT(d_func(), void slotResult(GpgME::Error))
Q_PRIVATE_SLOT(d_func(), void slotDialogAccepted())
Q_PRIVATE_SLOT(d_func(), void slotDialogRejected())
};
}
......
......@@ -192,8 +192,8 @@ void ChangeOwnerTrustCommand::Private::ensureDialogCreated()
applyWindowID(dialog);
dialog->setAttribute(Qt::WA_DeleteOnClose);
connect(dialog, SIGNAL(accepted()), q, SLOT(slotDialogAccepted()));
connect(dialog, SIGNAL(rejected()), q, SLOT(slotDialogRejected()));
connect(dialog, &QDialog::accepted, q, [this]() { slotDialogAccepted(); });
connect(dialog, &QDialog::rejected, q, [this]() { slotDialogRejected(); });
}
void ChangeOwnerTrustCommand::Private::createJob()
......@@ -212,8 +212,7 @@ void ChangeOwnerTrustCommand::Private::createJob()
connect(j, &Job::progress,
q, &Command::progress);
connect(j, SIGNAL(result(GpgME::Error)),
q, SLOT(slotResult(GpgME::Error)));
connect(j, &ChangeOwnerTrustJob::result, q, [this](const GpgME::Error &result) { slotResult(result); });
job = j;
}
......
......@@ -38,9 +38,6 @@ private:
class Private;
inline Private *d_func();
inline const Private *d_func() const;
Q_PRIVATE_SLOT(d_func(), void slotResult(GpgME::Error))
Q_PRIVATE_SLOT(d_func(), void slotDialogAccepted())
Q_PRIVATE_SLOT(d_func(), void slotDialogRejected())
};
}
......
......@@ -175,8 +175,7 @@ void ChangePassphraseCommand::Private::createJob()
connect(j, &Job::progress,
q, &Command::progress);
connect(j, SIGNAL(result(GpgME::Error)),
q, SLOT(slotResult(GpgME::Error)));
connect(j, &ChangePasswdJob::result, q, [this](const GpgME::Error &result) { slotResult(result); });
job = j;
}
......
......@@ -38,7 +38,6 @@ private:
class Private;
inline Private *d_func();
inline const Private *d_func() const;
Q_PRIVATE_SLOT(d_func(), void slotResult(GpgME::Error))
};
}
......
......@@ -61,7 +61,7 @@ private:
void init()
{
q->setWarnWhenRunningAtShutdown(false);
connect(this, SIGNAL(finished()), q_func(), SLOT(slotOperationFinished()));
connect(this, &QThread::finished, this, &ChangeRootTrustCommand::Private::slotOperationFinished);
}
void run() override;
......
......@@ -47,7 +47,6 @@ private:
class Private;
inline Private *d_func();
inline const Private *d_func() const;
Q_PRIVATE_SLOT(d_func(), void slotOperationFinished())
};
class TrustRootCommand : public ChangeRootTrustCommand
......
......@@ -115,8 +115,8 @@ ChecksumVerifyFilesCommand::ChecksumVerifyFilesCommand(const QStringList &files,
void ChecksumVerifyFilesCommand::Private::init()
{
controller.setExecutionContext(shared_qq);
connect(&controller, SIGNAL(done()), q, SLOT(slotControllerDone()));
connect(&controller, SIGNAL(error(int,QString)), q, SLOT(slotControllerError(int,QString)));
connect(&controller, &Controller::done, q, [this]() { slotControllerDone(); });
connect(&controller, &Controller::error, q, [this](int err, const QString &details) { slotControllerError(err, details); });
}
ChecksumVerifyFilesCommand::~ChecksumVerifyFilesCommand()
......
......@@ -42,8 +42,6 @@ private:
class Private;
inline Private *d_func();
inline const Private *d_func() const;
Q_PRIVATE_SLOT(d_func(), void slotControllerDone())
Q_PRIVATE_SLOT(d_func(), void slotControllerError(int, QString))
};
}
......
......@@ -174,8 +174,9 @@ void CreateCSRForCardKeyCommand::Private::slotDialogAccepted()
Job::context(job)->setArmor(true);
connect(job, SIGNAL(result(const GpgME::KeyGenerationResult &, const QByteArray &)),
q, SLOT(slotResult(const GpgME::KeyGenerationResult &, const QByteArray &)));
connect(job, &KeyGenerationJob::result, q, [this](const GpgME::KeyGenerationResult &result, const QByteArray &pubKeyData) {
slotResult(result, pubKeyData);
});
KeyParameters keyParameters(KeyParameters::CMS);
keyParameters.setKeyType(QString::fromStdString(keyRef));
......@@ -266,8 +267,8 @@ void CreateCSRForCardKeyCommand::Private::ensureDialogCreated()
applyWindowID(dialog);
dialog->setAttribute(Qt::WA_DeleteOnClose);
connect(dialog, SIGNAL(accepted()), q, SLOT(slotDialogAccepted()));
connect(dialog, SIGNAL(rejected()), q, SLOT(slotDialogRejected()));
connect(dialog, &QDialog::accepted, q, [this]() { slotDialogAccepted(); });
connect(dialog, &QDialog::rejected, q, [this]() { slotDialogRejected(); });
}
CreateCSRForCardKeyCommand::CreateCSRForCardKeyCommand(const std::string &keyRef, const std::string &serialNumber, const std::string &appName, QWidget *parent)
......
......@@ -32,9 +32,6 @@ private:
class Private;
inline Private *d_func();
inline const Private *d_func() const;
Q_PRIVATE_SLOT(d_func(), void slotDialogAccepted())
Q_PRIVATE_SLOT(d_func(), void slotDialogRejected())
Q_PRIVATE_SLOT(d_func(), void slotResult(const GpgME::KeyGenerationResult &, const QByteArray &))
};
} // namespace Commands
......
......@@ -148,8 +148,7 @@ void CreateOpenPGPKeyFromCardKeysCommand::Private::slotDialogAccepted()
return;
}
connect(job, SIGNAL(result(GpgME::Error)),
q, SLOT(slotResult(GpgME::Error)));
connect(job, &QGpgME::QuickJob::result, q, [this](const GpgME::Error &error) { slotResult(error); });
const QString userID = Formatting::prettyNameAndEMail(OpenPGP, QString(), dialog->name(), dialog->email());
const QDateTime expires = QDateTime();
......@@ -185,8 +184,8 @@ void CreateOpenPGPKeyFromCardKeysCommand::Private::ensureDialogCreated()
applyWindowID(dialog);
dialog->setAttribute(Qt::WA_DeleteOnClose);
connect(dialog, SIGNAL(accepted()), q, SLOT(slotDialogAccepted()));
connect(dialog, SIGNAL(rejected()), q, SLOT(slotDialogRejected()));
connect(dialog, &QDialog::accepted, q, [this]() { slotDialogAccepted(); });
connect(dialog, &QDialog::rejected, q, [this]() { slotDialogRejected(); });
}
CreateOpenPGPKeyFromCardKeysCommand::CreateOpenPGPKeyFromCardKeysCommand(const std::string &serialNumber, const std::string &appName, QWidget *parent)
......
......@@ -34,9 +34,6 @@ private:
class Private;
inline Private *d_func();
inline const Private *d_func() const;
Q_PRIVATE_SLOT(d_func(), void slotDialogAccepted())
Q_PRIVATE_SLOT(d_func(), void slotDialogRejected())
Q_PRIVATE_SLOT(d_func(), void slotResult(GpgME::Error))
};
} // namespace Commands
......
......@@ -104,8 +104,8 @@ DecryptVerifyClipboardCommand::DecryptVerifyClipboardCommand(QAbstractItemView *
void DecryptVerifyClipboardCommand::Private::init()
{
controller.setExecutionContext(shared_qq);
connect(&controller, SIGNAL(done()), q, SLOT(slotControllerDone()));
connect(&controller, SIGNAL(error(int,QString)), q, SLOT(slotControllerError(int,QString)));
connect(&controller, &Controller::done, q, [this]() { slotControllerDone(); });
connect(&controller, &Controller::error, q, [this](int err, const QString &details) { slotControllerError(err, details); });
}
DecryptVerifyClipboardCommand::~DecryptVerifyClipboardCommand()
......
......@@ -38,8 +38,6 @@ private:
class Private;
inline Private *d_func();
inline const Private *d_func() const;
Q_PRIVATE_SLOT(d_func(), void slotControllerDone())
Q_PRIVATE_SLOT(d_func(), void slotControllerError(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