Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
KAlarm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PIM
KAlarm
Commits
4c9eb4c1
Commit
4c9eb4c1
authored
Oct 12, 2011
by
David Jarvie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move KAlarm library classes into KAlarm namespace.
Don't inherit KARecurrence from KCalCore::Recurrence.
parent
7c6e12f9
Changes
61
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
61 changed files
with
1077 additions
and
523 deletions
+1077
-523
akonadi/akonadi_serializer_kalarm.cpp
akonadi/akonadi_serializer_kalarm.cpp
+2
-1
akonadi/akonadi_serializer_kalarm.h
akonadi/akonadi_serializer_kalarm.h
+1
-2
akonadi/common/kalarmresourcecommon.cpp
akonadi/common/kalarmresourcecommon.cpp
+6
-6
akonadi/common/kalarmresourcecommon.h
akonadi/common/kalarmresourcecommon.h
+4
-2
akonadi/kaeventformatter.h
akonadi/kaeventformatter.h
+1
-1
akonadi/kalarm/kalarmresource.cpp
akonadi/kalarm/kalarmresource.cpp
+10
-9
akonadi/kalarm/kalarmresource.h
akonadi/kalarm/kalarmresource.h
+4
-4
akonadi/kalarmdir/kalarmdirresource.cpp
akonadi/kalarmdir/kalarmdirresource.cpp
+16
-16
akonadi/kalarmdir/kalarmdirresource.h
akonadi/kalarmdir/kalarmdirresource.h
+3
-1
akonadimodel.cpp
akonadimodel.cpp
+11
-11
akonadimodel.h
akonadimodel.h
+10
-7
alarmcalendar.cpp
alarmcalendar.cpp
+13
-13
alarmcalendar.h
alarmcalendar.h
+2
-0
alarmtimewidget.cpp
alarmtimewidget.cpp
+0
-2
alarmtimewidget.h
alarmtimewidget.h
+4
-2
birthdaydlg.cpp
birthdaydlg.cpp
+1
-0
birthdaydlg.h
birthdaydlg.h
+1
-0
birthdaymodel.cpp
birthdaymodel.cpp
+3
-0
cal/alarmtext.h
cal/alarmtext.h
+2
-1
cal/collectionattribute.cpp
cal/collectionattribute.cpp
+27
-27
cal/collectionattribute.h
cal/collectionattribute.h
+8
-8
cal/compatibilityattribute.cpp
cal/compatibilityattribute.cpp
+10
-10
cal/compatibilityattribute.h
cal/compatibilityattribute.h
+2
-2
cal/kacalendar.cpp
cal/kacalendar.cpp
+26
-26
cal/kacalendar.h
cal/kacalendar.h
+1
-1
cal/kaevent.cpp
cal/kaevent.cpp
+113
-112
cal/kaevent.h
cal/kaevent.h
+24
-20
cal/karecurrence.cpp
cal/karecurrence.cpp
+352
-118
cal/karecurrence.h
cal/karecurrence.h
+289
-15
calendarcompat.cpp
calendarcompat.cpp
+10
-10
calendarcompat.h
calendarcompat.h
+2
-2
calendarmigrator.cpp
calendarmigrator.cpp
+4
-4
collectionmodel.cpp
collectionmodel.cpp
+2
-2
collectionmodel.h
collectionmodel.h
+3
-3
commandoptions.h
commandoptions.h
+2
-0
dbushandler.h
dbushandler.h
+3
-1
deferdlg.cpp
deferdlg.cpp
+0
-1
deferdlg.h
deferdlg.h
+8
-6
editdlg.cpp
editdlg.cpp
+0
-1
editdlg.h
editdlg.h
+8
-4
eventlistmodel.cpp
eventlistmodel.cpp
+2
-2
eventlistmodel.h
eventlistmodel.h
+6
-4
functions.h
functions.h
+1
-1
kalarmapp.cpp
kalarmapp.cpp
+0
-2
kalarmapp.h
kalarmapp.h
+4
-0
kamail.h
kamail.h
+2
-0
messagewin.cpp
messagewin.cpp
+0
-1
messagewin.h
messagewin.h
+8
-4
recurrenceedit.h
recurrenceedit.h
+4
-2
recurrenceedit_p.h
recurrenceedit_p.h
+2
-0
resources/alarmresource.cpp
resources/alarmresource.cpp
+25
-25
resources/alarmresource.h
resources/alarmresource.h
+10
-9
resources/alarmresources.h
resources/alarmresources.h
+3
-2
resources/resourcelocal.cpp
resources/resourcelocal.cpp
+2
-2
resources/resourcelocaldir.cpp
resources/resourcelocaldir.cpp
+10
-10
resourceselector.cpp
resourceselector.cpp
+4
-4
templatemenuaction.h
templatemenuaction.h
+1
-1
templatepickdlg.h
templatepickdlg.h
+2
-1
traywindow.h
traywindow.h
+1
-1
undo.h
undo.h
+1
-0
wakedlg.h
wakedlg.h
+1
-1
No files found.
akonadi/akonadi_serializer_kalarm.cpp
View file @
4c9eb4c1
...
...
@@ -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
\n
PRODID:"
;
head
+=
KA
larm
::
Calendar
::
icalProductId
();
head
+=
KACalendar
::
icalProductId
();
head
+=
"
\n
VERSION:2.0
\n
X-KDE-KALARM-VERSION:"
;
head
+=
KAEvent
::
currentCalendarVersionString
();
head
+=
'\n'
;
...
...
akonadi/akonadi_serializer_kalarm.h
View file @
4c9eb4c1
/*
* 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
,
...
...
akonadi/common/kalarmresourcecommon.cpp
View file @
4c9eb4c1
...
...
@@ -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).
*/
KA
larm
::
Calendar
::
Compat
getCompatibility
(
const
FileStorage
::
Ptr
&
fileStorage
,
int
&
version
)
KACalendar
::
Compat
getCompatibility
(
const
FileStorage
::
Ptr
&
fileStorage
,
int
&
version
)
{
QString
versionString
;
version
=
KA
larm
::
Calendar
::
updateVersion
(
fileStorage
,
versionString
);
version
=
KACalendar
::
updateVersion
(
fileStorage
,
versionString
);
switch
(
version
)
{
case
KAlarm
::
IncompatibleFormat
:
return
KA
larm
::
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
KA
larm
::
Calendar
::
Current
;
// calendar is in the current format
return
KACalendar
::
Current
;
// calendar is in the current format
default:
return
KA
larm
::
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
,
KA
larm
::
Calendar
::
Compat
compatibility
,
int
version
)
void
setCollectionCompatibility
(
const
Collection
&
collection
,
KACalendar
::
Compat
compatibility
,
int
version
)
{
kDebug
()
<<
collection
.
id
()
<<
"->"
<<
compatibility
<<
version
;
Collection
col
=
collection
;
...
...
akonadi/common/kalarmresourcecommon.h
View file @
4c9eb4c1
...
...
@@ -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>*);
KA
larm
::
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
&
,
KA
larm
::
Calendar
::
Compat
,
int
version
);
void
setCollectionCompatibility
(
const
Akonadi
::
Collection
&
,
KACalendar
::
Compat
,
int
version
);
enum
ErrorCode
{
...
...
akonadi/kaeventformatter.h
View file @
4c9eb4c1
...
...
@@ -25,7 +25,7 @@
#include <QString>
class
KAEvent
;
using
KAlarm
::
KAEvent
;
class
KAEventFormatter
{
...
...
akonadi/kalarm/kalarmresource.cpp
View file @
4c9eb4c1
...
...
@@ -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
(
KA
larm
::
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.
KA
larm
::
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
;
KA
larm
::
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.
KA
larm
::
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
!=
KA
larm
::
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
;
KA
larm
::
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
=
KA
larm
::
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
!=
KA
larm
::
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
!=
KA
larm
::
Calendar
::
Current
)
if
(
mCompatibility
!=
KACalendar
::
Current
)
{
kWarning
()
<<
"Calendar not in current format"
;
cancelTask
(
errorMessage
(
KAlarmResourceCommon
::
NotCurrentFormat
));
...
...
akonadi/kalarm/kalarmresource.h
View file @
4c9eb4c1
...
...
@@ -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
;
KA
larm
::
Calendar
::
Compat
mCompatibility
;
int
mVersion
;
// calendar format version
AlarmTypeRadioWidget
*
mTypeSelector
;
KA
Calendar
::
Compat
mCompatibility
;
int
mVersion
;
// calendar format version
};
#endif
...
...
akonadi/kalarmdir/kalarmdirresource.cpp
View file @
4c9eb4c1
...
...
@@ -74,7 +74,7 @@ KAlarmDirResource::KAlarmDirResource(const QString& id)
:
ResourceBase
(
id
),
mSettings
(
new
Settings
(
componentData
().
config
())),
mCollectionId
(
-
1
),
mCompatibility
(
KA
larm
::
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.
KA
larm
::
Calendar
::
Compat
okCompat
(
KAlarm
::
Calendar
::
Current
|
KAlarm
::
Calendar
::
Convertible
);
KA
Calendar
::
Compat
okCompat
(
KACalendar
::
Current
|
KA
Calendar
::
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
()
==
KA
larm
::
Calendar
::
Convertible
)
if
(
event
.
compatibility
()
==
KACalendar
::
Convertible
)
{
if
(
writeToFile
(
event
))
event
.
setCompatibility
(
KA
larm
::
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
=
KA
larm
::
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
;
KA
larm
::
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
(
KA
larm
::
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
()
!=
KA
larm
::
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
(
KA
larm
::
Calendar
::
Current
);
if
(
mCompatibility
!=
KA
larm
::
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"
)));
KA
larm
::
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
KA
larm
::
Calendar
::
Compat
AllCompat
(
KAlarm
::
Calendar
::
Current
|
KAlarm
::
Calendar
::
Convertible
|
KAlarm
::
Calendar
::
Incompatible
);
static
const
KA
Calendar
::
Compat
AllCompat
(
KACalendar
::
Current
|
KACalendar
::
Convertible
|
KA
Calendar
::
Incompatible
);
const
KA
larm
::
Calendar
::
Compat
oldCompatibility
=
mCompatibility
;
const
KACalendar
::
Compat
oldCompatibility
=
mCompatibility
;
const
int
oldVersion
=
mVersion
;
if
(
mEvents
.
isEmpty
())
mCompatibility
=
KA
larm
::
Calendar
::
Current
;
mCompatibility
=
KACalendar
::
Current
;
else
{
mCompatibility
=
KA
larm
::
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
==
KA
larm
::
Calendar
::
Current
)
?
KAlarm
::
CurrentFormat
:
KAlarm
::
MixedFormat
;
mVersion
=
(
mCompatibility
==
KACalendar
::
Current
)
?
KAlarm
::
CurrentFormat
:
KAlarm
::
MixedFormat
;
if
(
writeAttr
&&
(
mCompatibility
!=
oldCompatibility
||
mVersion
!=
oldVersion
))
{
const
Collection
c
(
mCollectionId
);
...
...
akonadi/kalarmdir/kalarmdirresource.h
View file @
4c9eb4c1
...
...
@@ -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
KA
larm
::
Calendar
::
Compat
mCompatibility
;
KA
Calendar
::
Compat
mCompatibility
;
int
mVersion
;
// calendar format version
QStringList
mChangedFiles
;
// files being written to
bool
mCollectionFetched
;
// mCollectionId has been initialised
...
...
akonadimodel.cpp
View file @
4c9eb4c1
...
...
@@ -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
)
{
KA
larm
::
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
==
KA
larm
::
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
()
==
KA
larm
::
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
)
{
KA
larm
::
Calendar
::
Compat
format
;
KACalendar
::
Compat
format
;
return
isWritable
(
collection
,
format
);
}
int
AkonadiModel
::
isWritable
(
const
Akonadi
::
Collection
&
collection
,
KA
larm
::
Calendar
::
Compat
&
format
)
int
AkonadiModel
::
isWritable
(
const
Akonadi
::
Collection
&
collection
,
KACalendar
::
Compat
&
format
)
{
format
=
KA
larm
::
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
=
KA
larm
::
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
KA
larm
::
Calendar
::
Current
:
case
KACalendar
::
Current
:
return
1
;
case
KA
larm
::
Calendar
::
Converted
:
case
KA
larm
::
Calendar
::
Convertible
:
case
KACalendar
::
Converted
:
case
KACalendar
::
Convertible
:
return
0
;
default:
return
-
1
;
...
...
akonadimodel.h
View file @
4c9eb4c1
...
...
@@ -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, = KA
larm::
Calendar::Current;
* if unknown format, = KA
larm::
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 == KA
larm::
Calendar::Current), or
* -1 = read-only (if @p compat == KACalendar::Current), or
* incompatible format otherwise.
*/
static
int
isWritable
(
const
Akonadi
::
Collection
&
,
KA
larm
::
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
&
);
...
...
alarmcalendar.cpp
View file @
4c9eb4c1
...
...
@@ -63,7 +63,7 @@ using namespace KCal;
#endif
#ifdef USE_AKONADI
static
KA
larm
::
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
);
KA
larm
::
Calendar
::
setProductId
(
KALARM_NAME
,
KALARM_VERSION
);
CalFormat
::
setApplication
(
QLatin1String
(
KALARM_NAME
),
QString
::
fromLatin1
(
KA
larm
::
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
(
&
KA
larm
::
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
KA
larm
::
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
KA
larm
::
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
==
KA
larm
::
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
;
}
}
KA
larm
::
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) != KA
larm::
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.
*/
KA
larm
::
Calendar
::
Compat
fix
(
const
FileStorage
::
Ptr
&
fileStorage
)
KACalendar
::
Compat
fix
(
const
FileStorage
::
Ptr
&
fileStorage
)
{
QString
versionString
;
int
version
=
KA
larm
::
Calendar
::
updateVersion
(
fileStorage
,
versionString
);
int
version
=
KACalendar
::
updateVersion
(
fileStorage
,
versionString
);
if
(
version
==
KAlarm
::
IncompatibleFormat
)
return
KA
larm
::
Calendar
::
Incompatible
;
// calendar was created by another program, or an unknown version of KAlarm
return
KA
larm
::
Calendar
::
Current
;
return
KACalendar
::
Incompatible
;
// calendar was created by another program, or an unknown version of KAlarm
return
KACalendar
::
Current
;
}
#endif
...
...
alarmcalendar.h
View file @
4c9eb4c1
...
...
@@ -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
...
...
alarmtimewidget.cpp
View file @
4c9eb4c1
...
...
@@ -41,8 +41,6 @@
#include <QGridLayout>
#include <QLabel>
using
KAlarm
::
DateTime
;
static
const
QTime
time_23_59
(
23
,
59
);
...
...
alarmtimewidget.h
View file @
4c9eb4c1
...
...
@@ -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
);
...
...
birthdaydlg.cpp
View file @
4c9eb4c1
...
...
@@ -57,6 +57,7 @@
#include <QVBoxLayout>
using
namespace
KCal
;
using
KAlarm
::
KARecurrence
;
BirthdayDlg
::
BirthdayDlg
(
QWidget
*
parent
)
...
...
birthdaydlg.h
View file @
4c9eb4c1
...
...
@@ -38,6 +38,7 @@ class Reminder;
class
BLineEdit
;
class
BirthdaySortModel
;
using
KAlarm
::
KAEvent
;
class
BirthdayDlg
:
public
KDialog
{
...
...
birthdaymodel.cpp
View file @
4c9eb4c1
...
...
@@ -33,6 +33,9 @@
#include <kglobal.h>
#include <klocale.h>
using
KAlarm
::
KAEvent
;
using
KAlarm
::
KARecurrence
;
BirthdayModel
*
BirthdayModel
::
mInstance
=
0
;
...
...
cal/alarmtext.h
View file @
4c9eb4c1
...
...
@@ -32,11 +32,12 @@ namespace KCal { class Todo; }
#include <QString>