Commit 7aa7a664 authored by Laurent Montel's avatar Laurent Montel 😁

Use Q_EMIT

parent d1253295
......@@ -43,7 +43,7 @@ void ConfigFile::write()
void ConfigFile::create()
{
emit info(i18n("Writing config file for %1...", m_name));
Q_EMIT info(i18n("Writing config file for %1...", m_name));
foreach (const Config &c, m_configData) {
KConfigGroup grp = m_config->group(c.group);
......@@ -55,12 +55,12 @@ void ConfigFile::create()
}
m_config->sync();
emit finished(i18n("Config file for %1 is writing.", m_name));
Q_EMIT finished(i18n("Config file for %1 is writing.", m_name));
}
void ConfigFile::destroy()
{
emit info(i18n("Config file for %1 was not changed.", m_name));
Q_EMIT info(i18n("Config file for %1 was not changed.", m_name));
}
void ConfigFile::setName(const QString &name)
......
......@@ -94,7 +94,7 @@ Dialog::Dialog(QWidget *parent, Qt::WindowFlags flags) :
Page *page = qobject_cast<Page *>(currentPage()->widget());
page->enterPageNext();
emit page->pageEnteredNext();
Q_EMIT page->pageEnteredNext();
connect(button(QDialogButtonBox::Cancel), &QPushButton::clicked, this, &Dialog::accept);
}
......@@ -122,11 +122,11 @@ void Dialog::next()
void Dialog::slotNextOk()
{
Page *page = qobject_cast<Page *>(currentPage()->widget());
emit page->pageLeftNext();
Q_EMIT page->pageLeftNext();
KAssistantDialog::next();
page = qobject_cast<Page *>(currentPage()->widget());
page->enterPageNext();
emit page->pageEnteredNext();
Q_EMIT page->pageEnteredNext();
}
void Dialog::back()
......@@ -139,11 +139,11 @@ void Dialog::back()
void Dialog::slotBackOk()
{
Page *page = qobject_cast<Page *>(currentPage()->widget());
emit page->pageLeftBack();
Q_EMIT page->pageLeftBack();
KAssistantDialog::back();
page = qobject_cast<Page *>(currentPage()->widget());
page->enterPageBack();
emit page->pageEnteredBack();
Q_EMIT page->pageEnteredBack();
}
QObject *Dialog::addPage(const QString &uiFile, const QString &title)
......
......@@ -41,7 +41,7 @@ Identity::~Identity()
void Identity::create()
{
emit info(i18n("Setting up identity..."));
Q_EMIT info(i18n("Setting up identity..."));
// store identity information
// TODO now that we have the identity object around anyway we can probably get rid of most of the other members
......@@ -66,7 +66,7 @@ void Identity::create()
m_manager->setAsDefault(m_identity->uoid());
m_manager->commit();
emit finished(i18n("Identity set up."));
Q_EMIT finished(i18n("Identity set up."));
}
QString Identity::identityName() const
......@@ -102,7 +102,7 @@ void Identity::destroy()
m_manager->removeIdentityForced(m_identity->identityName());
m_manager->commit();
m_identity = 0;
emit info(i18n("Identity removed."));
Q_EMIT info(i18n("Identity removed."));
}
void Identity::setIdentityName(const QString &name)
......
......@@ -105,7 +105,7 @@ void Ispdb::slotResult(KJob *job)
}
if (lookupFinished) {
emit finished(false);
Q_EMIT finished(false);
return;
}
lookupInDb();
......@@ -117,7 +117,7 @@ void Ispdb::slotResult(KJob *job)
bool ok = document.setContent(mData);
if (!ok) {
qCDebug(ACCOUNTWIZARD_LOG) << "Could not parse xml" << mData;
emit finished(false);
Q_EMIT finished(false);
return;
}
......@@ -177,7 +177,7 @@ void Ispdb::slotResult(KJob *job)
}
// end section.
emit finished(true);
Q_EMIT finished(true);
}
Server Ispdb::createServer(const QDomElement &n)
......
......@@ -34,7 +34,7 @@ Ldap::~Ldap()
void Ldap::create()
{
emit info(i18n("Setting up LDAP server..."));
Q_EMIT info(i18n("Setting up LDAP server..."));
if (m_server.isEmpty() || m_user.isEmpty()) {
return;
......@@ -86,12 +86,12 @@ void Ldap::create()
group.writeEntry(QStringLiteral("SelectedPwdBind%1").arg(selHosts), m_password);
}
}
emit finished(i18n("LDAP set up."));
Q_EMIT finished(i18n("LDAP set up."));
}
void Ldap::destroy()
{
emit info(i18n("LDAP not configuring."));
Q_EMIT info(i18n("LDAP not configuring."));
}
void Ldap::setUser(const QString &user)
......
......@@ -40,7 +40,7 @@ void LoadPage::enterPageNext()
// FIXME: deletion seems to delete the exported objects as well, killing the entire wizard...
//delete m_action;
m_action = 0;
emit aboutToStart();
Q_EMIT aboutToStart();
const KConfig f(Global::assistant());
KConfigGroup grp(&f, "Wizard");
......
......@@ -56,10 +56,10 @@ void Page::leavePageNext() {}
void Page::leavePageBackRequested()
{
emit leavePageBackOk();
Q_EMIT leavePageBackOk();
}
void Page::leavePageNextRequested()
{
emit leavePageNextOk();
Q_EMIT leavePageNextOk();
}
......@@ -98,7 +98,7 @@ void PersonalDataPage::slotCreateAccountClicked()
} else {
configurePop3Account();
}
emit leavePageNextOk(); // go to the next page
Q_EMIT leavePageNextOk(); // go to the next page
mSetupManager->execute();
}
......@@ -121,7 +121,7 @@ void PersonalDataPage::leavePageNext()
if (ui.checkOnlineGroupBox->isChecked()) {
// since the user can go back and forth, explicitly disable the man page
emit manualWanted(false);
Q_EMIT manualWanted(false);
setCursor(Qt::BusyCursor);
ui.mProgress->start();
qCDebug(ACCOUNTWIZARD_LOG) << "Searching on internet";
......@@ -133,8 +133,8 @@ void PersonalDataPage::leavePageNext()
connect(mIspdb, &Ispdb::finished, this, &PersonalDataPage::ispdbSearchFinished);
} else {
emit manualWanted(true); // enable the manual page
emit leavePageNextOk(); // go to the next page
Q_EMIT manualWanted(true); // enable the manual page
Q_EMIT leavePageNextOk(); // go to the next page
}
}
......@@ -154,8 +154,8 @@ void PersonalDataPage::ispdbSearchFinished(bool ok)
}
} else {
emit manualWanted(true); // enable the manual page
emit leavePageNextOk();
Q_EMIT manualWanted(true); // enable the manual page
Q_EMIT leavePageNextOk();
}
}
......@@ -264,7 +264,7 @@ void PersonalDataPage::automaticConfigureAccount()
configureSmtpAccount();
configureImapAccount();
configurePop3Account();
emit leavePageNextOk(); // go to the next page
Q_EMIT leavePageNextOk(); // go to the next page
mSetupManager->execute();
}
......
......@@ -146,7 +146,7 @@ void ProviderPage::findDesktopAndSetAssistant(const QStringList &list)
m_newPageReady = true;
if (m_newPageWanted) {
qCDebug(ACCOUNTWIZARD_LOG) << "New page was already requested, now we are done, approve it";
emit leavePageNextOk();
Q_EMIT leavePageNextOk();
}
break;
}
......@@ -160,8 +160,8 @@ QTreeView *ProviderPage::treeview() const
void ProviderPage::leavePageBackRequested()
{
emit leavePageBackOk();
emit ghnsNotWanted();
Q_EMIT leavePageBackOk();
Q_EMIT ghnsNotWanted();
}
void ProviderPage::leavePageNextRequested()
......@@ -169,7 +169,7 @@ void ProviderPage::leavePageNextRequested()
m_newPageWanted = true;
if (m_newPageReady) {
qCDebug(ACCOUNTWIZARD_LOG) << "New page requested and we are done, so ok...";
emit leavePageNextOk();
Q_EMIT leavePageNextOk();
} else {
qCDebug(ACCOUNTWIZARD_LOG) << "New page requested, but we are not done yet...";
}
......
......@@ -80,7 +80,7 @@ void Resource::create()
{
const AgentType type = AgentManager::self()->type(m_typeIdentifier);
if (!type.isValid()) {
emit error(i18n("Resource type '%1' is not available.", m_typeIdentifier));
Q_EMIT error(i18n("Resource type '%1' is not available.", m_typeIdentifier));
return;
}
......@@ -90,13 +90,13 @@ void Resource::create()
foreach (const AgentInstance &instance, AgentManager::self()->instances()) {
qCDebug(ACCOUNTWIZARD_LOG) << instance.type().identifier() << (instance.type() == type);
if (instance.type() == type) {
emit finished(i18n("Resource '%1' is already set up.", type.name()));
Q_EMIT finished(i18n("Resource '%1' is already set up.", type.name()));
return;
}
}
}
emit info(i18n("Creating resource instance for '%1'...", type.name()));
Q_EMIT info(i18n("Creating resource instance for '%1'...", type.name()));
AgentInstanceCreateJob *job = new AgentInstanceCreateJob(type, this);
connect(job, &AgentInstanceCreateJob::result, this, &Resource::instanceCreateResult);
job->start();
......@@ -105,17 +105,17 @@ void Resource::create()
void Resource::instanceCreateResult(KJob *job)
{
if (job->error()) {
emit error(i18n("Failed to create resource instance: %1", job->errorText()));
Q_EMIT error(i18n("Failed to create resource instance: %1", job->errorText()));
return;
}
m_instance = qobject_cast<AgentInstanceCreateJob *>(job)->instance();
if (!m_settings.isEmpty()) {
emit info(i18n("Configuring resource instance..."));
Q_EMIT info(i18n("Configuring resource instance..."));
QDBusInterface iface(QLatin1String("org.freedesktop.Akonadi.Resource.") + m_instance.identifier(), QLatin1String("/Settings"));
if (!iface.isValid()) {
emit error(i18n("Unable to configure resource instance."));
Q_EMIT error(i18n("Unable to configure resource instance."));
return;
}
......@@ -130,27 +130,27 @@ void Resource::instanceCreateResult(KJob *job)
QVariant arg = it.value();
const QVariant::Type targetType = argumentType(iface.metaObject(), methodName);
if (!arg.canConvert(targetType)) {
emit error(i18n("Could not convert value of setting '%1' to required type %2.", it.key(), QLatin1String(QVariant::typeToName(targetType))));
Q_EMIT error(i18n("Could not convert value of setting '%1' to required type %2.", it.key(), QLatin1String(QVariant::typeToName(targetType))));
return;
}
arg.convert(targetType);
QDBusReply<void> reply = iface.call(methodName, arg);
if (!reply.isValid()) {
emit error(i18n("Could not set setting '%1': %2", it.key(), reply.error().message()));
Q_EMIT error(i18n("Could not set setting '%1': %2", it.key(), reply.error().message()));
return;
}
}
m_instance.reconfigure();
}
emit finished(i18n("Resource setup completed."));
Q_EMIT finished(i18n("Resource setup completed."));
}
void Resource::destroy()
{
if (m_instance.isValid()) {
AgentManager::self()->removeInstance(m_instance);
emit info(i18n("Removed resource instance for '%1'.", m_instance.type().name()));
Q_EMIT info(i18n("Removed resource instance for '%1'.", m_instance.type().name()));
}
}
......
......@@ -49,15 +49,15 @@ void ServerTest::testFinished(QList< int > list)
{
qCDebug(ACCOUNTWIZARD_LOG) << "types: " << list;
if (list.contains(MailTransport::Transport::EnumEncryption::TLS)) {
emit testResult(QStringLiteral("tls"));
Q_EMIT testResult(QStringLiteral("tls"));
} else if (list.contains(MailTransport::Transport::EnumEncryption::SSL)) {
emit testResult(QStringLiteral("ssl"));
Q_EMIT testResult(QStringLiteral("ssl"));
} else {
KMessageBox::information(0, i18n("There seems to be a problem in reaching this server "
"or choosing a safe way to sent the credentials to server. We advise you to "
"check the settings of the account and adjust it manually if needed."),
i18n("Autodetecting settings failed"));
emit testFail();
Q_EMIT testFail();
}
}
......@@ -162,7 +162,7 @@ void SetupManager::rollback()
m_page->setStatus(i18n("Failed to set up account."));
m_page->setValid(true);
m_rollbackRequested = false;
emit rollbackComplete();
Q_EMIT rollbackComplete();
}
SetupObject *SetupManager::connectObject(SetupObject *obj)
......@@ -236,7 +236,7 @@ void SetupManager::setPersonalDataAvailable(bool available)
void SetupManager::requestRollback()
{
if (m_setupObjects.isEmpty()) {
emit rollbackComplete();
Q_EMIT rollbackComplete();
} else {
m_rollbackRequested = true;
if (!m_currentSetupObject) {
......
......@@ -86,7 +86,7 @@ Transport::Transport(const QString &type, QObject *parent) :
void Transport::create()
{
emit info(i18n("Setting up mail transport account..."));
Q_EMIT info(i18n("Setting up mail transport account..."));
MailTransport::Transport *mt = MailTransport::TransportManager::self()->createTransport();
mt->setName(m_name);
mt->setHost(m_host);
......@@ -107,13 +107,13 @@ void Transport::create()
mt->save();
MailTransport::TransportManager::self()->addTransport(mt);
MailTransport::TransportManager::self()->setDefaultTransport(mt->id());
emit finished(i18n("Mail transport account set up."));
Q_EMIT finished(i18n("Mail transport account set up."));
}
void Transport::destroy()
{
MailTransport::TransportManager::self()->removeTransport(m_transportId);
emit info(i18n("Mail transport account deleted."));
Q_EMIT info(i18n("Mail transport account deleted."));
}
void Transport::setName(const QString &name)
......
......@@ -124,10 +124,10 @@ void FilterManager::Private::slotItemsFetchedForFilter(const Akonadi::Item::List
if ((mTotalProgressCount > 0) && (mCurrentProgressCount != mTotalProgressCount)) {
const QString statusMsg =
i18n("Filtering message %1 of %2", mCurrentProgressCount, mTotalProgressCount);
emit q->progressMessage(statusMsg);
emit q->percent(mCurrentProgressCount * 100 / mTotalProgressCount);
Q_EMIT q->progressMessage(statusMsg);
Q_EMIT q->percent(mCurrentProgressCount * 100 / mTotalProgressCount);
} else {
emit q->percent(0);
Q_EMIT q->percent(0);
}
const bool filterResult = q->process(listMailFilters, item, needsFullPayload, filterSet);
......@@ -138,7 +138,7 @@ void FilterManager::Private::slotItemsFetchedForFilter(const Akonadi::Item::List
}
if (!filterResult) {
emit q->filteringFailed(item);
Q_EMIT q->filteringFailed(item);
// something went horribly wrong (out of space?)
//CommonKernel->emergencyExit( i18n( "Unable to process messages: " ) + QString::fromLocal8Bit( strerror( errno ) ) );
}
......@@ -188,13 +188,13 @@ void FilterManager::Private::itemFetchJobForFilterDone(KJob *job)
}
if (!q->process(items.first(), needsFullPayload, wantedFilter)) {
emit q->filteringFailed(items.first());
Q_EMIT q->filteringFailed(items.first());
}
} else {
const FilterManager::FilterSet set = static_cast<FilterManager::FilterSet>(job->property("filterSet").toInt());
if (!q->process(items.first(), needsFullPayload, set, !resourceId.isEmpty(), resourceId)) {
emit q->filteringFailed(items.first());
Q_EMIT q->filteringFailed(items.first());
}
}
}
......@@ -347,7 +347,7 @@ void FilterManager::readConfig()
d->mInboundFiltersExist = std::find_if(d->mFilters.constBegin(), d->mFilters.constEnd(),
boost::bind(&MailCommon::MailFilter::applyOnInbound, _1)) != d->mFilters.constEnd();
emit filterListUpdated();
Q_EMIT filterListUpdated();
}
void FilterManager::mailCollectionRemoved(const Akonadi::Collection &collection)
......@@ -576,7 +576,7 @@ void FilterManager::dump() const
void FilterManager::applySpecificFilters(const QList< Akonadi::Item > &selectedMessages, SearchRule::RequiredPart requiredPart, const QStringList &listFilters)
{
emit progressMessage(i18n("Filtering messages"));
Q_EMIT progressMessage(i18n("Filtering messages"));
d->mTotalProgressCount = selectedMessages.size();
d->mCurrentProgressCount = 0;
......@@ -601,7 +601,7 @@ void FilterManager::applySpecificFilters(const QList< Akonadi::Item > &selectedM
void FilterManager::applyFilters(const QList<Akonadi::Item> &selectedMessages, FilterSet filterSet)
{
emit progressMessage(i18n("Filtering messages"));
Q_EMIT progressMessage(i18n("Filtering messages"));
d->mTotalProgressCount = selectedMessages.size();
d->mCurrentProgressCount = 0;
......
......@@ -153,14 +153,14 @@ void MailFilterAgent::initialCollectionFetchingDone(KJob *job)
changeRecorder()->setCollectionMonitored(collection, true);
}
}
emit status(AgentBase::Idle, i18n("Ready"));
emit percent(100);
Q_EMIT status(AgentBase::Idle, i18n("Ready"));
Q_EMIT percent(100);
QTimer::singleShot(2000, this, SLOT(clearMessage()));
}
void MailFilterAgent::clearMessage()
{
emit status(AgentBase::Idle, QString());
Q_EMIT status(AgentBase::Idle, QString());
}
void MailFilterAgent::itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection)
......@@ -310,15 +310,15 @@ void MailFilterAgent::emitProgress(int p)
{
if (p == 0) {
mProgressTimer->stop();
emit status(AgentBase::Idle, QString());
Q_EMIT status(AgentBase::Idle, QString());
}
mProgressCounter = p;
emit percent(p);
Q_EMIT percent(p);
}
void MailFilterAgent::emitProgressMessage(const QString &message)
{
emit status(AgentBase::Running, message);
Q_EMIT status(AgentBase::Running, message);
}
QString MailFilterAgent::printCollectionMonitored()
......
......@@ -323,7 +323,7 @@ void JobTracker::triggerReset()
d->jobs.clear();
d->infoList.clear();
emit reset();
Q_EMIT reset();
}