Commit 4c9eb4c1 authored by David Jarvie's avatar David Jarvie

Move KAlarm library classes into KAlarm namespace.

Don't inherit KARecurrence from KCalCore::Recurrence.
parent 7c6e12f9
......@@ -35,6 +35,7 @@
#include <QtCore/qplugin.h>
using namespace Akonadi;
using KAlarm::KACalendar;
// Convert from backend data stream to a KAEvent, and set it into the item's payload.
......@@ -98,7 +99,7 @@ void SerializerPluginKAlarm::serialize(const Item& item, const QByteArray& label
KCalCore::Event::Ptr kcalEvent(new KCalCore::Event);
e.updateKCalEvent(kcalEvent, KAEvent::UID_SET);
QByteArray head = "BEGIN:VCALENDAR\nPRODID:";
head += KAlarm::Calendar::icalProductId();
head += KACalendar::icalProductId();
head += "\nVERSION:2.0\nX-KDE-KALARM-VERSION:";
head += KAEvent::currentCalendarVersionString();
head += '\n';
......
/*
* akonadi_serializer_kalarm.h - Akonadi resource serializer for KAlarm
* Program: kalarm
* Copyright © 2009,2010 by David Jarvie <djarvie@kde.org>
* Copyright © 2009-2011 by David Jarvie <djarvie@kde.org>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Library General Public License as published by
......@@ -30,7 +30,6 @@
#include <QtCore/QObject>
class KAEvent;
namespace Akonadi { class AbstractDifferencesReporter; }
class SerializerPluginKAlarm : public QObject,
......
......@@ -95,18 +95,18 @@ QStringList mimeTypes(const QString& id)
* Find the compatibility of an existing calendar file, and convert it in
* memory to the current KAlarm format (if possible).
*/
KAlarm::Calendar::Compat getCompatibility(const FileStorage::Ptr& fileStorage, int& version)
KACalendar::Compat getCompatibility(const FileStorage::Ptr& fileStorage, int& version)
{
QString versionString;
version = KAlarm::Calendar::updateVersion(fileStorage, versionString);
version = KACalendar::updateVersion(fileStorage, versionString);
switch (version)
{
case KAlarm::IncompatibleFormat:
return KAlarm::Calendar::Incompatible; // calendar is not in KAlarm format, or is in a future format
return KACalendar::Incompatible; // calendar is not in KAlarm format, or is in a future format
case KAlarm::CurrentFormat:
return KAlarm::Calendar::Current; // calendar is in the current format
return KACalendar::Current; // calendar is in the current format
default:
return KAlarm::Calendar::Convertible; // calendar is in an out of date format
return KACalendar::Convertible; // calendar is in an out of date format
}
}
......@@ -160,7 +160,7 @@ KAEvent checkItemChanged(const Akonadi::Item& item, QString& errorMsg)
* are written by the application. This avoids the resource and application
* overwriting each other's changes if they attempt simultaneous updates.
*/
void setCollectionCompatibility(const Collection& collection, KAlarm::Calendar::Compat compatibility, int version)
void setCollectionCompatibility(const Collection& collection, KACalendar::Compat compatibility, int version)
{
kDebug() << collection.id() << "->" << compatibility << version;
Collection col = collection;
......
......@@ -31,16 +31,18 @@ namespace Akonadi {
class Collection;
class Item;
}
using KAlarm::KAEvent;
using KAlarm::KACalendar;
namespace KAlarmResourceCommon
{
void initialise(QObject* parent);
QStringList mimeTypes(const QString& id);
// void customizeConfigDialog(SingleFileResourceConfigDialog<Settings>*);
KAlarm::Calendar::Compat getCompatibility(const KCalCore::FileStorage::Ptr&, int& version);
KACalendar::Compat getCompatibility(const KCalCore::FileStorage::Ptr&, int& version);
Akonadi::Item retrieveItem(const Akonadi::Item&, KAEvent&);
KAEvent checkItemChanged(const Akonadi::Item&, QString& errorMsg);
void setCollectionCompatibility(const Akonadi::Collection&, KAlarm::Calendar::Compat, int version);
void setCollectionCompatibility(const Akonadi::Collection&, KACalendar::Compat, int version);
enum ErrorCode
{
......
......@@ -25,7 +25,7 @@
#include <QString>
class KAEvent;
using KAlarm::KAEvent;
class KAEventFormatter
{
......
......@@ -38,11 +38,12 @@
using namespace Akonadi;
using namespace Akonadi_KAlarm_Resource;
using KAlarmResourceCommon::errorMessage;
using KAlarm::KAEvent;
KAlarmResource::KAlarmResource(const QString& id)
: ICalResourceBase(id),
mCompatibility(KAlarm::Calendar::Incompatible),
mCompatibility(KACalendar::Incompatible),
mVersion(KAlarm::MixedFormat)
{
kDebug() << id;
......@@ -109,12 +110,12 @@ bool KAlarmResource::readFromFile(const QString& fileName)
if (calendar()->incidences().isEmpty())
{
// It's a new file. Set up the KAlarm custom property.
KAlarm::Calendar::setKAlarmVersion(calendar());
KACalendar::setKAlarmVersion(calendar());
}
// Find the calendar file's compatibility with the current KAlarm format,
// and if necessary convert it in memory to the current version.
int version;
KAlarm::Calendar::Compat compat = KAlarmResourceCommon::getCompatibility(fileStorage(), version);
KACalendar::Compat compat = KAlarmResourceCommon::getCompatibility(fileStorage(), version);
if (compat != mCompatibility || version != mVersion)
{
mCompatibility = compat;
......@@ -140,7 +141,7 @@ bool KAlarmResource::writeToFile(const QString& fileName)
if (calendar()->incidences().isEmpty())
{
// It's an empty file. Set up the KAlarm custom property.
KAlarm::Calendar::setKAlarmVersion(calendar());
KACalendar::setKAlarmVersion(calendar());
}
return ICalResourceBase::writeToFile(fileName);
}
......@@ -200,7 +201,7 @@ void KAlarmResource::settingsChanged()
{
// This is a flag to request that the backend calendar storage format should
// be updated to the current KAlarm format.
if (mCompatibility != KAlarm::Calendar::Convertible)
if (mCompatibility != KACalendar::Convertible)
kWarning() << "Either incompatible storage format or nothing to update: compat=" << mCompatibility;
else if (mSettings->readOnly())
kWarning() << "Cannot update storage format for a read-only resource";
......@@ -209,7 +210,7 @@ void KAlarmResource::settingsChanged()
// Update the backend storage format to the current KAlarm format
QString filename = fileStorage()->fileName();
kDebug() << "Updating storage for" << filename;
KAlarm::Calendar::setKAlarmVersion(fileStorage()->calendar());
KACalendar::setKAlarmVersion(fileStorage()->calendar());
if (!writeToFile(filename))
kWarning() << "Error updating calendar storage format";
else
......@@ -218,7 +219,7 @@ void KAlarmResource::settingsChanged()
// would replace the current Collection by a new one.
mCurrentHash = calculateHash(filename);
mCompatibility = KAlarm::Calendar::Current;
mCompatibility = KACalendar::Current;
Collection c;
c.setParentCollection(Collection::root());
c.setRemoteId(mSettings->path());
......@@ -239,7 +240,7 @@ void KAlarmResource::itemAdded(const Akonadi::Item& item, const Akonadi::Collect
{
if (!checkItemAddedChanged<KAEvent>(item, CheckForAdded))
return;
if (mCompatibility != KAlarm::Calendar::Current)
if (mCompatibility != KACalendar::Current)
{
kWarning() << "Calendar not in current format";
cancelTask(errorMessage(KAlarmResourceCommon::NotCurrentFormat));
......@@ -266,7 +267,7 @@ void KAlarmResource::itemChanged(const Akonadi::Item& item, const QSet<QByteArra
if (!checkItemAddedChanged<KAEvent>(item, CheckForChanged))
return;
QString errorMsg;
if (mCompatibility != KAlarm::Calendar::Current)
if (mCompatibility != KACalendar::Current)
{
kWarning() << "Calendar not in current format";
cancelTask(errorMessage(KAlarmResourceCommon::NotCurrentFormat));
......
......@@ -26,8 +26,8 @@
#include <icalresourcebase.h>
class KJob;
class KAEvent;
class AlarmTypeRadioWidget;
using KAlarm::KACalendar;
class KAlarmResource : public ICalResourceBase
{
......@@ -54,9 +54,9 @@ class KAlarmResource : public ICalResourceBase
void settingsChanged();
private:
AlarmTypeRadioWidget* mTypeSelector;
KAlarm::Calendar::Compat mCompatibility;
int mVersion; // calendar format version
AlarmTypeRadioWidget* mTypeSelector;
KACalendar::Compat mCompatibility;
int mVersion; // calendar format version
};
#endif
......
......@@ -74,7 +74,7 @@ KAlarmDirResource::KAlarmDirResource(const QString& id)
: ResourceBase(id),
mSettings(new Settings(componentData().config())),
mCollectionId(-1),
mCompatibility(KAlarm::Calendar::Incompatible),
mCompatibility(KACalendar::Incompatible),
mCollectionFetched(true)
{
kDebug() << id;
......@@ -324,7 +324,7 @@ kDebug()<<"Monitored changed";
{
// This is a flag to request that the backend calendar storage format should
// be updated to the current KAlarm format.
KAlarm::Calendar::Compat okCompat(KAlarm::Calendar::Current | KAlarm::Calendar::Convertible);
KACalendar::Compat okCompat(KACalendar::Current | KACalendar::Convertible);
if (mCompatibility & ~okCompat)
kWarning() << "Either incompatible storage format or nothing to update";
else if (mSettings->readOnly())
......@@ -336,10 +336,10 @@ kDebug()<<"Monitored changed";
for (QHash<QString, EventFile>::iterator it = mEvents.begin(); it != mEvents.end(); ++it)
{
KAEvent& event = it.value().event;
if (event.compatibility() == KAlarm::Calendar::Convertible)
if (event.compatibility() == KACalendar::Convertible)
{
if (writeToFile(event))
event.setCompatibility(KAlarm::Calendar::Current);
event.setCompatibility(KACalendar::Current);
else
{
kWarning() << "Error updating storage format for event id" << event.id();
......@@ -349,7 +349,7 @@ kDebug()<<"Monitored changed";
}
if (ok)
{
mCompatibility = KAlarm::Calendar::Current;
mCompatibility = KACalendar::Current;
mVersion = KAlarm::CurrentFormat;
const Collection c(mCollectionId);
if (c.isValid())
......@@ -457,7 +457,7 @@ KAEvent KAlarmDirResource::loadFile(const QString& path, const QString& file)
}
// Convert event in memory to current KAlarm format if possible
int version;
KAlarm::Calendar::Compat compat = KAlarmResourceCommon::getCompatibility(fileStorage, version);
KACalendar::Compat compat = KAlarmResourceCommon::getCompatibility(fileStorage, version);
KAEvent event(kcalEvent);
const QString mime = KAlarm::CalEvent::mimeType(event.category());
if (mime.isEmpty())
......@@ -539,7 +539,7 @@ void KAlarmDirResource::itemAdded(const Akonadi::Item& item, const Akonadi::Coll
changeProcessed();
return;
}
event.setCompatibility(KAlarm::Calendar::Current);
event.setCompatibility(KACalendar::Current);
setCompatibility();
if (!writeToFile(event))
......@@ -571,7 +571,7 @@ void KAlarmDirResource::itemChanged(const Akonadi::Item& item, const QSet<QByteA
cancelTask(errorMessage(KAlarmResourceCommon::EventReadOnly, item.remoteId()));
return;
}
if (it.value().event.compatibility() != KAlarm::Calendar::Current)
if (it.value().event.compatibility() != KACalendar::Current)
{
kWarning() << "Event not in current format:" << item.remoteId();
cancelTask(errorMessage(KAlarmResourceCommon::EventNotCurrentFormat, item.remoteId()));
......@@ -599,8 +599,8 @@ void KAlarmDirResource::itemChanged(const Akonadi::Item& item, const QSet<QByteA
return;
}
#endif
event.setCompatibility(KAlarm::Calendar::Current);
if (mCompatibility != KAlarm::Calendar::Current)
event.setCompatibility(KACalendar::Current);
if (mCompatibility != KACalendar::Current)
setCompatibility();
if (!writeToFile(event))
......@@ -672,7 +672,7 @@ bool KAlarmDirResource::writeToFile(const KAEvent& event)
Event::Ptr kcalEvent(new Event);
event.updateKCalEvent(kcalEvent, KAEvent::UID_SET);
MemoryCalendar::Ptr calendar(new MemoryCalendar(QLatin1String("UTC")));
KAlarm::Calendar::setKAlarmVersion(calendar); // set the KAlarm custom property
KACalendar::setKAlarmVersion(calendar); // set the KAlarm custom property
calendar->addIncidence(kcalEvent);
mChangedFiles += event.id(); // suppress KDirWatch processing for this write
......@@ -1090,15 +1090,15 @@ QString KAlarmDirResource::fileName(const QString& path) const
*/
void KAlarmDirResource::setCompatibility(bool writeAttr)
{
static const KAlarm::Calendar::Compat AllCompat(KAlarm::Calendar::Current | KAlarm::Calendar::Convertible | KAlarm::Calendar::Incompatible);
static const KACalendar::Compat AllCompat(KACalendar::Current | KACalendar::Convertible | KACalendar::Incompatible);
const KAlarm::Calendar::Compat oldCompatibility = mCompatibility;
const KACalendar::Compat oldCompatibility = mCompatibility;
const int oldVersion = mVersion;
if (mEvents.isEmpty())
mCompatibility = KAlarm::Calendar::Current;
mCompatibility = KACalendar::Current;
else
{
mCompatibility = KAlarm::Calendar::Unknown;
mCompatibility = KACalendar::Unknown;
foreach (const EventFile& data, mEvents)
{
const KAEvent& event = data.event;
......@@ -1107,7 +1107,7 @@ void KAlarmDirResource::setCompatibility(bool writeAttr)
break;
}
}
mVersion = (mCompatibility == KAlarm::Calendar::Current) ? KAlarm::CurrentFormat : KAlarm::MixedFormat;
mVersion = (mCompatibility == KACalendar::Current) ? KAlarm::CurrentFormat : KAlarm::MixedFormat;
if (writeAttr && (mCompatibility != oldCompatibility || mVersion != oldVersion))
{
const Collection c(mCollectionId);
......
......@@ -27,6 +27,8 @@
#include <QHash>
namespace Akonadi_KAlarm_Dir_Resource { class Settings; }
using KAlarm::KAEvent;
using KAlarm::KACalendar;
class KAlarmDirResource : public Akonadi::ResourceBase, public Akonadi::AgentBase::Observer
{
......@@ -92,7 +94,7 @@ class KAlarmDirResource : public Akonadi::ResourceBase, public Akonadi::AgentBas
QHash<QString, QString> mFileEventIds; // alarm IDs, indexed by file name
Akonadi_KAlarm_Dir_Resource::Settings* mSettings;
Akonadi::Collection::Id mCollectionId; // ID of this resource's collection
KAlarm::Calendar::Compat mCompatibility;
KACalendar::Compat mCompatibility;
int mVersion; // calendar format version
QStringList mChangedFiles; // files being written to
bool mCollectionFetched; // mCollectionId has been initialised
......
......@@ -62,11 +62,11 @@
#include <QTimer>
using namespace Akonadi;
using KAlarm::DateTime;
using KAlarm::AlarmText;
using KAlarm::CollectionAttribute;
using KAlarm::CompatibilityAttribute;
using KAlarm::EventAttribute;
using KAlarm::KARecurrence;
static Collection::Rights writableRights = Collection::CanChangeItem | Collection::CanCreateItem | Collection::CanDeleteItem;
......@@ -981,7 +981,7 @@ QString AkonadiModel::tooltip(const Collection& collection, KAlarm::CalEvent::Ty
*/
QString AkonadiModel::readOnlyTooltip(const Collection& collection)
{
KAlarm::Calendar::Compat compat;
KACalendar::Compat compat;
switch (AkonadiModel::isWritable(collection, compat))
{
case 1:
......@@ -989,7 +989,7 @@ QString AkonadiModel::readOnlyTooltip(const Collection& collection)
case 0:
return i18nc("@info/plain", "Read-only (old format)");
default:
if (compat == KAlarm::Calendar::Current)
if (compat == KACalendar::Current)
return i18nc("@info/plain", "Read-only");
return i18nc("@info/plain", "Read-only (other format)");
}
......@@ -1826,7 +1826,7 @@ Collection AkonadiModel::collectionForItem(Item::Id id) const
bool AkonadiModel::isCompatible(const Collection& collection)
{
return collection.hasAttribute<CompatibilityAttribute>()
&& collection.attribute<CompatibilityAttribute>()->compatibility() == KAlarm::Calendar::Current;
&& collection.attribute<CompatibilityAttribute>()->compatibility() == KACalendar::Current;
}
/******************************************************************************
......@@ -1834,20 +1834,20 @@ bool AkonadiModel::isCompatible(const Collection& collection)
*/
int AkonadiModel::isWritable(const Akonadi::Collection& collection)
{
KAlarm::Calendar::Compat format;
KACalendar::Compat format;
return isWritable(collection, format);
}
int AkonadiModel::isWritable(const Akonadi::Collection& collection, KAlarm::Calendar::Compat& format)
int AkonadiModel::isWritable(const Akonadi::Collection& collection, KACalendar::Compat& format)
{
format = KAlarm::Calendar::Incompatible;
format = KACalendar::Incompatible;
if (!collection.isValid())
return -1;
Collection col = collection;
instance()->refresh(col); // update with latest data
if ((col.rights() & writableRights) != writableRights)
{
format = KAlarm::Calendar::Current;
format = KACalendar::Current;
return -1;
}
if (!col.hasAttribute<CompatibilityAttribute>())
......@@ -1855,10 +1855,10 @@ int AkonadiModel::isWritable(const Akonadi::Collection& collection, KAlarm::Cale
format = col.attribute<CompatibilityAttribute>()->compatibility();
switch (format)
{
case KAlarm::Calendar::Current:
case KACalendar::Current:
return 1;
case KAlarm::Calendar::Converted:
case KAlarm::Calendar::Convertible:
case KACalendar::Converted:
case KACalendar::Convertible:
return 0;
default:
return -1;
......
......@@ -37,9 +37,12 @@ namespace Akonadi {
}
class QPixmap;
class KJob;
namespace KAlarm { class DateTime; }
class CalendarMigrator;
using KAlarm::KAEvent;
using KAlarm::KACalendar;
using KAlarm::DateTime;
class AkonadiModel : public Akonadi::EntityTreeModel
{
......@@ -173,15 +176,15 @@ class AkonadiModel : public Akonadi::EntityTreeModel
* calendar format.
*
* @param format Updated to contain the backend calendar storage format.
* If read-only, = KAlarm::Calendar::Current;
* if unknown format, = KAlarm::Calendar::Incompatible;
* If read-only, = KACalendar::Current;
* if unknown format, = KACalendar::Incompatible;
* otherwise = the backend calendar storage format.
* @return 1 = fully writable,
* 0 = writable except that backend calendar is in an old KAlarm format,
* -1 = read-only (if @p compat == KAlarm::Calendar::Current), or
* -1 = read-only (if @p compat == KACalendar::Current), or
* incompatible format otherwise.
*/
static int isWritable(const Akonadi::Collection&, KAlarm::Calendar::Compat& format);
static int isWritable(const Akonadi::Collection&, KACalendar::Compat& format);
static KAlarm::CalEvent::Types types(const Akonadi::Collection&);
......@@ -270,8 +273,8 @@ class AkonadiModel : public Akonadi::EntityTreeModel
};
AkonadiModel(Akonadi::ChangeRecorder*, QObject* parent);
QString alarmTimeText(const KAlarm::DateTime&) const;
QString timeToAlarmText(const KAlarm::DateTime&) const;
QString alarmTimeText(const DateTime&) const;
QString timeToAlarmText(const DateTime&) const;
void signalDataChanged(bool (*checkFunc)(const Akonadi::Item&), int startColumn, int endColumn, const QModelIndex& parent);
void setCollectionChanged(const Akonadi::Collection&, const QSet<QByteArray>&, bool rowInserted);
void queueItemModifyJob(const Akonadi::Item&);
......
......@@ -63,7 +63,7 @@ using namespace KCal;
#endif
#ifdef USE_AKONADI
static KAlarm::Calendar::Compat fix(const KCalCore::FileStorage::Ptr&);
static KACalendar::Compat fix(const KCalCore::FileStorage::Ptr&);
#endif
static const QString displayCalendarName = QLatin1String("displaying.ics");
......@@ -101,8 +101,8 @@ bool AlarmCalendar::initialiseCalendars()
#endif
mResourcesCalendar = new AlarmCalendar();
mDisplayCalendar = new AlarmCalendar(displayCal, KAlarm::CalEvent::DISPLAYING);
KAlarm::Calendar::setProductId(KALARM_NAME, KALARM_VERSION);
CalFormat::setApplication(QLatin1String(KALARM_NAME), QString::fromLatin1(KAlarm::Calendar::icalProductId()));
KACalendar::setProductId(KALARM_NAME, KALARM_VERSION);
CalFormat::setApplication(QLatin1String(KALARM_NAME), QString::fromLatin1(KACalendar::icalProductId()));
return true;
}
......@@ -166,7 +166,7 @@ AlarmCalendar::AlarmCalendar()
SLOT(slotCollectionStatusChanged(Akonadi::Collection,AkonadiModel::Change,QVariant,bool)));
#else
AlarmResources* resources = AlarmResources::instance();
resources->setCalIDFunction(&KAlarm::Calendar::setKAlarmVersion);
resources->setCalIDFunction(&KACalendar::setKAlarmVersion);
resources->setFixFunction(&CalendarCompat::fix);
resources->setCustomEventFunction(&updateResourceKAEvents);
connect(resources, SIGNAL(resourceStatusChanged(AlarmResource*,AlarmResources::Change)), SLOT(slotResourceChange(AlarmResource*,AlarmResources::Change)));
......@@ -897,11 +897,11 @@ bool AlarmCalendar::importAlarms(QWidget* parent, AlarmResource* resource)
else
{
#ifdef USE_AKONADI
KAlarm::Calendar::Compat caltype = fix(calStorage);
KACalendar::Compat caltype = fix(calStorage);
KAlarm::CalEvent::Types wantedTypes = collection && collection->isValid() ? KAlarm::CalEvent::types(collection->contentMimeTypes()) : KAlarm::CalEvent::EMPTY;
Collection activeColl, archiveColl, templateColl;
#else
KAlarm::Calendar::Compat caltype = CalendarCompat::fix(cal, filename);
KACalendar::Compat caltype = CalendarCompat::fix(cal, filename);
KAlarm::CalEvent::Type wantedType = resource ? resource->alarmType() : KAlarm::CalEvent::EMPTY;
AlarmResources* resources = AlarmResources::instance();
AlarmResource* activeRes = 0;
......@@ -929,7 +929,7 @@ bool AlarmCalendar::importAlarms(QWidget* parent, AlarmResource* resource)
if (type == KAlarm::CalEvent::TEMPLATE)
{
// If we know the event was not created by KAlarm, don't treat it as a template
if (caltype == KAlarm::Calendar::Incompatible)
if (caltype == KACalendar::Incompatible)
type = KAlarm::CalEvent::ACTIVE;
}
#ifdef USE_AKONADI
......@@ -1078,7 +1078,7 @@ bool AlarmCalendar::exportAlarms(const KAEvent::List& events, QWidget* parent)
return false;
}
}
KAlarm::Calendar::setKAlarmVersion(calendar);
KACalendar::setKAlarmVersion(calendar);
// Add the alarms to the calendar
bool ok = true;
......@@ -1987,7 +1987,7 @@ bool AlarmCalendar::eventReadOnly(Item::Id id) const
if (!CollectionControlModel::isWritableEnabled(collection, event.category()))
return true;
return !event.isValid() || event.isReadOnly();
// || compatibility(event) != KAlarm::Calendar::Current;
// || compatibility(event) != KACalendar::Current;
}
#else
bool AlarmCalendar::eventReadOnly(const QString& uniqueID) const
......@@ -2241,13 +2241,13 @@ void AlarmCalendar::adjustStartOfDay()
* Find the version of KAlarm which wrote the calendar file, and do any
* necessary conversions to the current format.
*/
KAlarm::Calendar::Compat fix(const FileStorage::Ptr& fileStorage)
KACalendar::Compat fix(const FileStorage::Ptr& fileStorage)
{
QString versionString;
int version = KAlarm::Calendar::updateVersion(fileStorage, versionString);
int version = KACalendar::updateVersion(fileStorage, versionString);
if (version == KAlarm::IncompatibleFormat)
return KAlarm::Calendar::Incompatible; // calendar was created by another program, or an unknown version of KAlarm
return KAlarm::Calendar::Current;
return KACalendar::Incompatible; // calendar was created by another program, or an unknown version of KAlarm
return KACalendar::Current;
}
#endif
......
......@@ -45,6 +45,8 @@ class AlarmResource;
class ProgressDialog;
#endif
using KAlarm::KAEvent;
/** Provides read and write access to calendar files and resources.
* Either vCalendar or iCalendar files may be read, but the calendar is saved
......
......@@ -41,8 +41,6 @@
#include <QGridLayout>
#include <QLabel>
using KAlarm::DateTime;
static const QTime time_23_59(23, 59);
......
......@@ -35,6 +35,8 @@ class TimeEdit;
class TimeSpinBox;
class TimeZoneCombo;
using KAlarm::DateTime;
class AlarmTimeWidget : public QFrame
{
......@@ -48,10 +50,10 @@ class AlarmTimeWidget : public QFrame
AlarmTimeWidget(const QString& groupBoxTitle, Mode, QWidget* parent = 0);
explicit AlarmTimeWidget(Mode, QWidget* parent = 0);
KDateTime getDateTime(int* minsFromNow = 0, bool checkExpired = true, bool showErrorMessage = true, QWidget** errorWidget = 0) const;
void setDateTime(const KAlarm::DateTime&);
void setDateTime(const DateTime&);
void setMinDateTimeIsCurrent();
void setMinDateTime(const KDateTime& = KDateTime());
void setMaxDateTime(const KAlarm::DateTime& = KAlarm::DateTime());
void setMaxDateTime(const DateTime& = DateTime());
const KDateTime& maxDateTime() const { return mMaxDateTime; }
KDateTime::Spec timeSpec() const { return mTimeSpec; }
void setReadOnly(bool);
......
......@@ -57,6 +57,7 @@
#include <QVBoxLayout>
using namespace KCal;
using KAlarm::KARecurrence;
BirthdayDlg::BirthdayDlg(QWidget* parent)
......
......@@ -38,6 +38,7 @@ class Reminder;
class BLineEdit;
class BirthdaySortModel;
using KAlarm::KAEvent;
class BirthdayDlg : public KDialog
{
......
......@@ -33,6 +33,9 @@
#include <kglobal.h>
#include <klocale.h>
using KAlarm::KAEvent;
using KAlarm::KARecurrence;
BirthdayModel* BirthdayModel::mInstance = 0;
......
......@@ -32,11 +32,12 @@ namespace KCal { class Todo; }
#include <QString>