Changeset View
Changeset View
Standalone View
Standalone View
resources/kolab/kolabhelpers.cpp
Show All 23 Lines | |||||
#include <Akonadi/ItemFetchJob> | #include <Akonadi/ItemFetchJob> | ||||
#include <Akonadi/ItemFetchScope> | #include <Akonadi/ItemFetchScope> | ||||
#include <akonadi/notes/noteutils.h> | #include <akonadi/notes/noteutils.h> | ||||
#include <kolabobject.h> | #include <kolabobject.h> | ||||
#include <errorhandler.h> | #include <errorhandler.h> | ||||
#include <KLocalizedString> | #include <KLocalizedString> | ||||
#include "tracer.h" | #include "tracer.h" | ||||
bool KolabHelpers::checkForErrors(const Akonadi::Item &item) | bool KolabHelpers::checkForErrors(const Akonadi::Item &item) | ||||
{ | { | ||||
if (!Kolab::ErrorHandler::instance().errorOccured()) { | if (!Kolab::ErrorHandler::instance().errorOccured()) { | ||||
Kolab::ErrorHandler::instance().clear(); | Kolab::ErrorHandler::instance().clear(); | ||||
return false; | return false; | ||||
} | } | ||||
QString errorMsg; | QString errorMsg; | ||||
▲ Show 20 Lines • Show All 382 Lines • ▼ Show 20 Lines | QByteArray KolabHelpers::getFolderTypeAnnotation(const QMap< QByteArray, QByteArray > &annotations) | ||||
if (annotations.contains("/shared" KOLAB_FOLDER_TYPE_ANNOTATION) && !annotations.value("/shared" KOLAB_FOLDER_TYPE_ANNOTATION).isEmpty()) { | if (annotations.contains("/shared" KOLAB_FOLDER_TYPE_ANNOTATION) && !annotations.value("/shared" KOLAB_FOLDER_TYPE_ANNOTATION).isEmpty()) { | ||||
return annotations.value("/shared" KOLAB_FOLDER_TYPE_ANNOTATION); | return annotations.value("/shared" KOLAB_FOLDER_TYPE_ANNOTATION); | ||||
}else if (annotations.contains("/private" KOLAB_FOLDER_TYPE_ANNOTATION) && !annotations.value("/private" KOLAB_FOLDER_TYPE_ANNOTATION).isEmpty()) { | }else if (annotations.contains("/private" KOLAB_FOLDER_TYPE_ANNOTATION) && !annotations.value("/private" KOLAB_FOLDER_TYPE_ANNOTATION).isEmpty()) { | ||||
return annotations.value("/private" KOLAB_FOLDER_TYPE_ANNOTATION); | return annotations.value("/private" KOLAB_FOLDER_TYPE_ANNOTATION); | ||||
} | } | ||||
return annotations.value(KOLAB_FOLDER_TYPE_ANNOTATION); | return annotations.value(KOLAB_FOLDER_TYPE_ANNOTATION); | ||||
} | } | ||||
QColor KolabHelpers::getFolderColor(const QMap< QByteArray, QByteArray > &annotations) | |||||
{ | |||||
if (annotations.contains("/shared" KOLAB_COLOR_ANNOTATION) && !annotations.value("/shared" KOLAB_COLOR_ANNOTATION).isEmpty()) { | |||||
return QColor(QLatin1String("#") + annotations.value("/shared" KOLAB_COLOR_ANNOTATION)); | |||||
} else if (annotations.contains("/private" KOLAB_COLOR_ANNOTATION) && !annotations.value("/private" KOLAB_COLOR_ANNOTATION).isEmpty()) { | |||||
return QColor(QLatin1String("#") + annotations.value("/private" KOLAB_COLOR_ANNOTATION)); | |||||
} | |||||
return QColor(); | |||||
} | |||||
void KolabHelpers::setFolderTypeAnnotation(QMap< QByteArray, QByteArray >& annotations, const QByteArray& value) | void KolabHelpers::setFolderTypeAnnotation(QMap< QByteArray, QByteArray >& annotations, const QByteArray& value) | ||||
{ | { | ||||
annotations["/shared" KOLAB_FOLDER_TYPE_ANNOTATION] = value; | annotations["/shared" KOLAB_FOLDER_TYPE_ANNOTATION] = value; | ||||
} | } | ||||
QString KolabHelpers::getIcon(Kolab::FolderType type) | QString KolabHelpers::getIcon(Kolab::FolderType type) | ||||
{ | { | ||||
switch (type) { | switch (type) { | ||||
▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines |