Commit 00c9b5ad authored by Allen Winter's avatar Allen Winter

move the statics for the Formats out of the KAlarm::Calendar class

so they can be found at link time.
CCMAIL: djarvie@kde.org
parent 49594b8b
......@@ -101,9 +101,9 @@ KAlarm::Calendar::Compat getCompatibility(const FileStorage::Ptr& fileStorage, i
version = KAlarm::Calendar::updateVersion(fileStorage, versionString);
switch (version)
{
case KAlarm::Calendar::IncompatibleFormat:
case KAlarm::IncompatibleFormat:
return KAlarm::Calendar::Incompatible; // calendar is not in KAlarm format, or is in a future format
case KAlarm::Calendar::CurrentFormat:
case KAlarm::CurrentFormat:
return KAlarm::Calendar::Current; // calendar is in the current format
default:
return KAlarm::Calendar::Convertible; // calendar is in an out of date format
......
......@@ -43,7 +43,7 @@ using KAlarmResourceCommon::errorMessage;
KAlarmResource::KAlarmResource(const QString& id)
: ICalResourceBase(id),
mCompatibility(KAlarm::Calendar::Incompatible),
mVersion(KAlarm::Calendar::MixedFormat)
mVersion(KAlarm::MixedFormat)
{
kDebug() << id;
KAlarmResourceCommon::initialise(this);
......@@ -338,7 +338,7 @@ void KAlarmResource::doRetrieveItems(const Akonadi::Collection& collection)
kWarning() << "KAEvent has no alarms:" << event.id();
continue; // event has no usable alarms
}
Item item(mime);
item.setRemoteId(kcalEvent->uid());
item.setPayload(event);
......
......@@ -130,8 +130,8 @@ void KAlarmDirResource::collectionsReceived(const Akonadi::Collection::List& col
// Set collection's format compatibility flag now that the collection
// and its attributes have been fetched.
KAlarmResourceCommon::setCollectionCompatibility(collections[i], mCompatibility,
(mCompatibility == KAlarm::Calendar::Current ? KAlarm::Calendar::CurrentFormat
: KAlarm::Calendar::MixedFormat));
(mCompatibility == KAlarm::Calendar::Current ? KAlarm::CurrentFormat
: KAlarm::MixedFormat));
break;
}
}
......@@ -354,7 +354,7 @@ kDebug()<<"Monitored changed";
mCompatibility = KAlarm::Calendar::Current;
const Collection c(mCollectionId);
if (c.isValid())
KAlarmResourceCommon::setCollectionCompatibility(c, mCompatibility, KAlarm::Calendar::CurrentFormat);
KAlarmResourceCommon::setCollectionCompatibility(c, mCompatibility, KAlarm::CurrentFormat);
}
}
mSettings->setUpdateStorageFormat(false);
......@@ -750,8 +750,8 @@ void KAlarmDirResource::retrieveItems(const Akonadi::Collection& collection)
// Set the collection's compatibility status
KAlarmResourceCommon::setCollectionCompatibility(collection, mCompatibility,
(mCompatibility == KAlarm::Calendar::Current ? KAlarm::Calendar::CurrentFormat
: KAlarm::Calendar::MixedFormat));
(mCompatibility == KAlarm::Calendar::Current ? KAlarm::CurrentFormat
: KAlarm::MixedFormat));
// Fetch the list of valid mime types
const QStringList mimeTypes = mSettings->alarmTypes();
......@@ -1109,8 +1109,8 @@ void KAlarmDirResource::setCompatibility(bool writeAttr)
const Collection c(mCollectionId);
if (c.isValid())
KAlarmResourceCommon::setCollectionCompatibility(c, mCompatibility,
(mCompatibility == KAlarm::Calendar::Current ? KAlarm::Calendar::CurrentFormat
: KAlarm::Calendar::MixedFormat));
(mCompatibility == KAlarm::Calendar::Current ? KAlarm::CurrentFormat
: KAlarm::MixedFormat));
}
}
......
......@@ -48,7 +48,7 @@ void CompatibilityAttribute::deserialize(const QByteArray& data)
{
// Set default values
mCompatibility = KAlarm::Calendar::Incompatible;
mVersion = KAlarm::Calendar::IncompatibleFormat;
mVersion = KAlarm::IncompatibleFormat;
bool ok;
const QList<QByteArray> items = data.simplified().split(' ');
......
......@@ -40,8 +40,8 @@ class KALARM_CAL_EXPORT CompatibilityAttribute : public Akonadi::Attribute
{
public:
CompatibilityAttribute()
: mCompatibility(KAlarm::Calendar::Incompatible),
mVersion(KAlarm::Calendar::IncompatibleFormat) { }
: mCompatibility(KAlarm::Calendar::Incompatible),
mVersion(KAlarm::IncompatibleFormat) { }
/** Return the compatibility status for the entity. */
KAlarm::Calendar::Compat compatibility() const { return mCompatibility; }
......
......@@ -44,6 +44,16 @@ namespace KCal {
}
#endif
namespace KAlarm {
// Special calendar storage format version codes.
// Positive version values are actual KAlarm format version numbers.
static const int CurrentFormat = 0; // current KAlarm format
static const int IncompatibleFormat = -1; // not written by KAlarm, or a newer KAlarm version
#ifdef USE_AKONADI
static const int MixedFormat = -2; // calendar may contain more than one version
#endif
}
namespace KAlarm
{
......@@ -117,16 +127,8 @@ class KALARM_CAL_EXPORT Calendar
};
#endif
// Special calendar storage format version codes.
// Positive version values are actual KAlarm format version numbers.
static const int CurrentFormat = 0; // current KAlarm format
static const int IncompatibleFormat = -1; // not written by KAlarm, or a newer KAlarm version
#ifdef USE_AKONADI
static const int MixedFormat = -2; // calendar may contain more than one version
#endif
/** Check the version of KAlarm which wrote a calendar file, and convert
* it in memory to the current KAlarm format if possible. The storage
* it in memory to the current KAlarm format if possible. The storage
* file is not updated. The compatibility of the calendar format is
* indicated by the return value.
*
......@@ -148,7 +150,7 @@ class KALARM_CAL_EXPORT Calendar
/** Whether the fix function should convert old format KAlarm calendars. */
enum FixFunc { PROMPT, PROMPT_PART, CONVERT, NO_CONVERT };
static Compat fix(const KCalCore::FileStorage::Ptr&,
static Compat fix(const KCalCore::FileStorage::Ptr&,
const Akonadi::Collection& = Akonadi::Collection(),
FixFunc = PROMPT, bool* wrongType = 0);
......
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