Commit 28e405d0 authored by Laurent Montel's avatar Laurent Montel 😁

More optimization

parent 463e0fcf
......@@ -102,7 +102,6 @@ EwsConfigDialog::EwsConfigDialog(EwsResource *parentResource, EwsClient &client,
mUi->tryConnectButton->setEnabled(!baseUrlEmpty);
mTryConnectNeeded = baseUrlEmpty;
QString password;
connect(mSettings.data(), &EwsSettings::passwordRequestFinished, mUi->passwordEdit,
&KPasswordLineEdit::setPassword);
mSettings->requestPassword(false);
......@@ -290,10 +289,8 @@ void EwsConfigDialog::dialogAccepted()
i18n("Autodiscovery failed. This can be caused by incorrect parameters. Do you still want to save your settings?"),
i18n("Exchange server autodiscovery")) == KMessageBox::Yes) {
accept();
return;
} else {
return;
}
return;
}
}
......@@ -317,10 +314,8 @@ void EwsConfigDialog::dialogAccepted()
i18n("Connecting to Exchange failed. This can be caused by incorrect parameters. Do you still want to save your settings?"),
i18n("Exchange server connection")) == KMessageBox::Yes) {
accept();
return;
} else {
return;
}
return;
} else {
accept();
}
......
......@@ -337,7 +337,7 @@ bool EwsFetchFoldersIncrJobPrivate::processRemoteFolders()
bool reparentPassNeeded = false;
/* Iterate over all changed folders. */
for (auto it = mFolderHash.begin(); it != mFolderHash.end(); ++it) {
for (auto it = mFolderHash.begin(), end = mFolderHash.end(); it != end; ++it) {
qCDebugNC(EWSRES_LOG) << QStringLiteral("Processing: ") << it.key();
if (it->isModified()) {
......@@ -426,7 +426,7 @@ bool EwsFetchFoldersIncrJobPrivate::processRemoteFolders()
}
/* Build the resulting collection list. */
for (auto it = mFolderHash.begin(); it != mFolderHash.end(); ++it) {
for (auto it = mFolderHash.begin(), end = mFolderHash.end(); it != end; ++it) {
if (it->isRemoved()) {
q->mDeletedFolders.append(it->collection);
} else if (it->isProcessed()) {
......
......@@ -182,7 +182,7 @@ void EwsFetchFoldersJobPrivate::remoteFolderIdFullFetchDone(KJob *job)
shape << EwsPropertyField(QStringLiteral("folder:ParentFolderId"));
mPendingFetchJobs = 0;
for (int i = 0; i < mRemoteFolderIds.size(); i += fetchBatchSize) {
for (int i = 0, total = mRemoteFolderIds.size(); i < total; i += fetchBatchSize) {
EwsGetFolderRequest *req = new EwsGetFolderRequest(mClient, this);
req->setFolderIds(mRemoteFolderIds.mid(i, fetchBatchSize));
req->setFolderShape(shape);
......
......@@ -410,7 +410,7 @@ void EwsFetchItemsJob::itemDetailFetchDone(KJob *job)
mChangedItems += detailJob->changedItems();
}
if (subjobs().size() == 0) {
if (subjobs().isEmpty()) {
emitResult();
} else {
subjobs().first()->start();
......
......@@ -84,7 +84,8 @@ QHash<EwsPropertyField, QVariant> EwsItemHandler::writeFlags(const QSet<QByteArr
propertyHash.insert(EwsResource::flagsProperty, QVariant());
} else {
QStringList flagList;
Q_FOREACH (const QByteArray &flag, flags) {
flagList.reserve(flags.count());
for (const QByteArray &flag : flags) {
flagList.append(QString::fromLatin1(flag));
}
propertyHash.insert(EwsResource::flagsProperty, flagList);
......
......@@ -42,7 +42,7 @@ void EwsFetchTaskDetailJob::processItems(const QList<EwsGetItemRequest::Response
{
Item::List::iterator it = mChangedItems.begin();
Q_FOREACH (const EwsGetItemRequest::Response &resp, responses) {
for (const EwsGetItemRequest::Response &resp : responses) {
Item &item = *it;
if (!resp.isSuccess()) {
......
Markdown is supported
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