Commit c544f06b authored by Laurent Montel's avatar Laurent Montel 😁

Minor optimization

parent d2d2a124
......@@ -26,7 +26,7 @@
#include <AkonadiCore/ItemFetchJob>
#include <AkonadiCore/ItemFetchScope>
KolabChangeTagTask::KolabChangeTagTask(ResourceStateInterface::Ptr resource, QSharedPointer<TagConverter> tagConverter, QObject *parent)
KolabChangeTagTask::KolabChangeTagTask(ResourceStateInterface::Ptr resource, const QSharedPointer<TagConverter> &tagConverter, QObject *parent)
: KolabRelationResourceTask(resource, parent)
, mSession(0)
, mTagConverter(tagConverter)
......
......@@ -29,7 +29,7 @@ class KolabChangeTagTask : public KolabRelationResourceTask
{
Q_OBJECT
public:
explicit KolabChangeTagTask(ResourceStateInterface::Ptr resource, QSharedPointer<TagConverter> tagConverter, QObject *parent = Q_NULLPTR);
explicit KolabChangeTagTask(ResourceStateInterface::Ptr resource, const QSharedPointer<TagConverter> &tagConverter, QObject *parent = Q_NULLPTR);
protected:
virtual void startRelationTask(KIMAP::Session *session);
......
......@@ -326,16 +326,16 @@ Akonadi::Item KolabHelpers::translateToImap(const Akonadi::Item &item, bool &ok)
QByteArray KolabHelpers::kolabTypeForMimeType(const QStringList &contentMimeTypes)
{
if (contentMimeTypes.contains(KContacts::Addressee::mimeType())) {
return "contact";
return QByteArrayLiteral("contact");
} else if (contentMimeTypes.contains(KCalCore::Event::eventMimeType())) {
return "event";
return QByteArrayLiteral("event");
} else if (contentMimeTypes.contains(KCalCore::Todo::todoMimeType())) {
return "task";
return QByteArrayLiteral("task");
} else if (contentMimeTypes.contains(KCalCore::Journal::journalMimeType())) {
return "journal";
return QByteArrayLiteral("journal");
} else if (contentMimeTypes.contains(QStringLiteral("application/x-vnd.akonadi.note")) ||
contentMimeTypes.contains(QStringLiteral("text/x-vnd.akonadi.note"))) {
return "note";
return QByteArrayLiteral("note");
}
return QByteArray();
}
......@@ -459,8 +459,8 @@ QString KolabHelpers::getIcon(Kolab::FolderType type)
case Kolab::ConfigurationType:
case Kolab::FreebusyType:
case Kolab::FileType:
default:
break;
case Kolab::LastType:
return QString();
}
return QString();
}
......@@ -478,8 +478,8 @@ bool KolabHelpers::isHandledType(Kolab::FolderType type)
case Kolab::ConfigurationType:
case Kolab::FreebusyType:
case Kolab::FileType:
default:
break;
case Kolab::LastType:
return false;
}
return false;
}
......
......@@ -106,7 +106,7 @@ void KolabRelationResourceTask::onCreateDone(KJob *job)
setMetadataJob->setServerCapability(KIMAP::MetaDataJobBase::Annotatemore);
}
setMetadataJob->setMailBox(QStringLiteral("Configuration"));
setMetadataJob->addMetaData("/shared/vendor/kolab/folder-type", "configuration.default");
setMetadataJob->addMetaData(QByteArrayLiteral("/shared/vendor/kolab/folder-type"), QByteArrayLiteral("configuration.default"));
connect(setMetadataJob, &KJob::result,
this, &KolabRelationResourceTask::onSetMetaDataDone);
setMetadataJob->start();
......
......@@ -825,19 +825,18 @@ void MaildirResource::fsWatchFileFetchResult(KJob *job)
const Maildir md(path);
QString entry = fileName;
Item item(items.at(0));
const qint64 entrySize = md.size(entry);
const qint64 entrySize = md.size(fileName);
if (entrySize >= 0) {
item.setSize(entrySize);
}
Item::Flags flags = md.readEntryFlags(entry);
Item::Flags flags = md.readEntryFlags(fileName);
Q_FOREACH (const Item::Flag &flag, flags) {
item.setFlag(flag);
}
const QByteArray data = md.readEntry(entry);
const QByteArray data = md.readEntry(fileName);
KMime::Message *mail = new KMime::Message();
mail->setContent(KMime::CRLFtoLF(data));
mail->parse();
......@@ -852,7 +851,7 @@ void MaildirResource::fsWatchFileFetchResult(KJob *job)
void MaildirResource::fsWatchFileModifyResult(KJob *job)
{
if (job->error()) {
qCDebug(MAILDIRRESOURCE_LOG) << job->errorString();
qCDebug(MAILDIRRESOURCE_LOG) << " MaildirResource::fsWatchFileModifyResult error: "<< job->errorString();
return;
}
}
......
......@@ -60,6 +60,7 @@ void RetrieveItemsJob::doStart()
void RetrieveItemsJob::localListDone(KJob *job)
{
if (job->error()) {
qCDebug(MAILDIRRESOURCE_LOG) << "Error during RetrieveItemsJob::localListDone " << job->errorString();
return; // handled by base class
}
......
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