Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KAlarm
Commits
638e35d1
Commit
638e35d1
authored
Oct 26, 2011
by
David Jarvie
Browse files
Replace ConstEventPtr, ConstAlarmPtr with Event::Ptr, Alarm::Ptr
parent
d31c6067
Changes
6
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
638e35d1
...
...
@@ -74,7 +74,6 @@ install(FILES
kaevent.h
kalarmcal_export.h
karecurrence.h
kcalcore_constptr.h
repetition.h
version.h
DESTINATION
${
INCLUDE_INSTALL_DIR
}
/kalarmcal
...
...
kacalendar.cpp
View file @
638e35d1
...
...
@@ -404,7 +404,7 @@ QString uid(const QString& id, Type status)
* Do not call this function for the displaying alarm calendar.
*/
#ifndef USE_KRESOURCES
Type
status
(
const
Const
EventPtr
&
event
,
QString
*
param
)
Type
status
(
const
Event
::
Ptr
&
event
,
QString
*
param
)
#else
Type
status
(
const
Event
*
event
,
QString
*
param
)
#endif
...
...
kacalendar.h
View file @
638e35d1
...
...
@@ -25,7 +25,6 @@
#include
"kalarmcal_export.h"
#ifndef USE_KRESOURCES
#include
"kcalcore_constptr.h"
#include
<kcalcore/filestorage.h>
#include
<kcalcore/calendar.h>
#include
<kcalcore/event.h>
...
...
@@ -171,7 +170,7 @@ namespace CalEvent
KALARMCAL_EXPORT
QString
uid
(
const
QString
&
id
,
Type
);
#ifndef USE_KRESOURCES
KALARMCAL_EXPORT
Type
status
(
const
KCalCore
::
Const
EventPtr
&
,
QString
*
param
=
0
);
KALARMCAL_EXPORT
Type
status
(
const
KCalCore
::
Event
::
Ptr
&
,
QString
*
param
=
0
);
KALARMCAL_EXPORT
void
setStatus
(
const
KCalCore
::
Event
::
Ptr
&
,
Type
,
const
QString
&
param
=
QString
());
/** Return the alarm Type for a mime type string. */
...
...
kaevent.cpp
View file @
638e35d1
...
...
@@ -22,9 +22,6 @@
#include
"kaevent.h"
#ifdef USE_KRESOURCES
//#include "alarmresource.h"
#endif
#include
"alarmtext.h"
#include
"identities.h"
#include
"version.h"
...
...
@@ -150,7 +147,7 @@ class KAEvent::Private : public QSharedData
struct
AlarmData
{
#ifndef USE_KRESOURCES
Const
AlarmPtr
alarm
;
Alarm
::
Ptr
alarm
;
#else
const
Alarm
*
alarm
;
#endif
...
...
@@ -181,7 +178,7 @@ class KAEvent::Private : public QSharedData
Private
(
const
KDateTime
&
,
const
QString
&
message
,
const
QColor
&
bg
,
const
QColor
&
fg
,
const
QFont
&
f
,
SubAction
,
int
lateCancel
,
Flags
flags
,
bool
changesPending
=
false
);
#ifndef USE_KRESOURCES
explicit
Private
(
const
KCalCore
::
Const
EventPtr
&
);
explicit
Private
(
const
KCalCore
::
Event
::
Ptr
&
);
#else
explicit
Private
(
const
KCal
::
Event
*
);
#endif
...
...
@@ -189,7 +186,7 @@ class KAEvent::Private : public QSharedData
~
Private
()
{
delete
mRecurrence
;
}
Private
&
operator
=
(
const
Private
&
e
)
{
if
(
&
e
!=
this
)
copy
(
e
);
return
*
this
;
}
#ifndef USE_KRESOURCES
void
set
(
const
KCalCore
::
Const
EventPtr
&
);
void
set
(
const
KCalCore
::
Event
::
Ptr
&
);
#else
void
set
(
const
KCal
::
Event
*
);
#endif
...
...
@@ -207,7 +204,7 @@ class KAEvent::Private : public QSharedData
void
cancelDefer
();
#ifndef USE_KRESOURCES
bool
setDisplaying
(
const
Private
&
,
KAAlarm
::
Type
,
Akonadi
::
Collection
::
Id
,
const
KDateTime
&
dt
,
bool
showEdit
,
bool
showDefer
);
void
reinstateFromDisplaying
(
const
KCalCore
::
Const
EventPtr
&
,
Akonadi
::
Collection
::
Id
&
,
bool
&
showEdit
,
bool
&
showDefer
);
void
reinstateFromDisplaying
(
const
KCalCore
::
Event
::
Ptr
&
,
Akonadi
::
Collection
::
Id
&
,
bool
&
showEdit
,
bool
&
showDefer
);
#else
bool
setDisplaying
(
const
Private
&
,
KAAlarm
::
Type
,
const
QString
&
resourceID
,
const
KDateTime
&
dt
,
bool
showEdit
,
bool
showDefer
);
void
reinstateFromDisplaying
(
const
KCal
::
Event
*
,
QString
&
resourceID
,
bool
&
showEdit
,
bool
&
showDefer
);
...
...
@@ -256,9 +253,9 @@ class KAEvent::Private : public QSharedData
#ifndef USE_KRESOURCES
static
bool
convertRepetition
(
const
KCalCore
::
Event
::
Ptr
&
);
static
bool
convertStartOfDay
(
const
KCalCore
::
Event
::
Ptr
&
);
static
DateTime
readDateTime
(
const
KCalCore
::
Const
EventPtr
&
,
bool
dateOnly
,
DateTime
&
start
);
static
void
readAlarms
(
const
KCalCore
::
Const
EventPtr
&
,
void
*
alarmMap
,
bool
cmdDisplay
=
false
);
static
void
readAlarm
(
const
KCalCore
::
Const
AlarmPtr
&
,
AlarmData
&
,
bool
audioMain
,
bool
cmdDisplay
=
false
);
static
DateTime
readDateTime
(
const
KCalCore
::
Event
::
Ptr
&
,
bool
dateOnly
,
DateTime
&
start
);
static
void
readAlarms
(
const
KCalCore
::
Event
::
Ptr
&
,
void
*
alarmMap
,
bool
cmdDisplay
=
false
);
static
void
readAlarm
(
const
KCalCore
::
Alarm
::
Ptr
&
,
AlarmData
&
,
bool
audioMain
,
bool
cmdDisplay
=
false
);
#else
static
bool
convertRepetition
(
KCal
::
Event
*
);
static
bool
convertStartOfDay
(
KCal
::
Event
*
);
...
...
@@ -609,7 +606,7 @@ KAEvent::Private::Private(const KDateTime& dt, const QString& message, const QCo
}
#ifndef USE_KRESOURCES
KAEvent
::
KAEvent
(
const
Const
EventPtr
&
e
)
KAEvent
::
KAEvent
(
const
Event
::
Ptr
&
e
)
#else
KAEvent
::
KAEvent
(
const
Event
*
e
)
#endif
...
...
@@ -618,7 +615,7 @@ KAEvent::KAEvent(const Event* e)
}
#ifndef USE_KRESOURCES
KAEvent
::
Private
::
Private
(
const
Const
EventPtr
&
e
)
KAEvent
::
Private
::
Private
(
const
Event
::
Ptr
&
e
)
#else
KAEvent
::
Private
::
Private
(
const
Event
*
e
)
#endif
...
...
@@ -745,7 +742,7 @@ void KAEvent::Private::copy(const KAEvent::Private& event)
}
#ifndef USE_KRESOURCES
void
KAEvent
::
set
(
const
Const
EventPtr
&
e
)
void
KAEvent
::
set
(
const
Event
::
Ptr
&
e
)
#else
void
KAEvent
::
set
(
const
Event
*
e
)
#endif
...
...
@@ -757,7 +754,7 @@ void KAEvent::set(const Event* e)
* Initialise the KAEvent::Private from a KCal::Event.
*/
#ifndef USE_KRESOURCES
void
KAEvent
::
Private
::
set
(
const
Const
EventPtr
&
event
)
void
KAEvent
::
Private
::
set
(
const
Event
::
Ptr
&
event
)
#else
void
KAEvent
::
Private
::
set
(
const
Event
*
event
)
#endif
...
...
@@ -3672,7 +3669,7 @@ bool KAEvent::Private::setDisplaying(const KAEvent::Private& event, KAAlarm::Typ
* Reinstate the original event from the 'displaying' event.
*/
#ifndef USE_KRESOURCES
void
KAEvent
::
reinstateFromDisplaying
(
const
KCalCore
::
Const
EventPtr
&
e
,
Akonadi
::
Collection
::
Id
&
id
,
bool
&
showEdit
,
bool
&
showDefer
)
void
KAEvent
::
reinstateFromDisplaying
(
const
KCalCore
::
Event
::
Ptr
&
e
,
Akonadi
::
Collection
::
Id
&
id
,
bool
&
showEdit
,
bool
&
showDefer
)
#else
void
KAEvent
::
reinstateFromDisplaying
(
const
KCal
::
Event
*
e
,
QString
&
id
,
bool
&
showEdit
,
bool
&
showDefer
)
#endif
...
...
@@ -3681,7 +3678,7 @@ void KAEvent::reinstateFromDisplaying(const KCal::Event* e, QString& id, bool& s
}
#ifndef USE_KRESOURCES
void
KAEvent
::
Private
::
reinstateFromDisplaying
(
const
Const
EventPtr
&
kcalEvent
,
Akonadi
::
Collection
::
Id
&
collectionId
,
bool
&
showEdit
,
bool
&
showDefer
)
void
KAEvent
::
Private
::
reinstateFromDisplaying
(
const
Event
::
Ptr
&
kcalEvent
,
Akonadi
::
Collection
::
Id
&
collectionId
,
bool
&
showEdit
,
bool
&
showDefer
)
#else
void
KAEvent
::
Private
::
reinstateFromDisplaying
(
const
Event
*
kcalEvent
,
QString
&
resourceID
,
bool
&
showEdit
,
bool
&
showDefer
)
#endif
...
...
@@ -4130,7 +4127,7 @@ void KAEvent::Private::dumpDebug() const
* Reply = next main date/time.
*/
#ifndef USE_KRESOURCES
DateTime
KAEvent
::
Private
::
readDateTime
(
const
Const
EventPtr
&
event
,
bool
dateOnly
,
DateTime
&
start
)
DateTime
KAEvent
::
Private
::
readDateTime
(
const
Event
::
Ptr
&
event
,
bool
dateOnly
,
DateTime
&
start
)
#else
DateTime
KAEvent
::
Private
::
readDateTime
(
const
Event
*
event
,
bool
dateOnly
,
DateTime
&
start
)
#endif
...
...
@@ -4173,7 +4170,7 @@ DateTime KAEvent::Private::readDateTime(const Event* event, bool dateOnly, DateT
* Reply = map of alarm data, indexed by KAAlarm::Type
*/
#ifndef USE_KRESOURCES
void
KAEvent
::
Private
::
readAlarms
(
const
Const
EventPtr
&
event
,
void
*
almap
,
bool
cmdDisplay
)
void
KAEvent
::
Private
::
readAlarms
(
const
Event
::
Ptr
&
event
,
void
*
almap
,
bool
cmdDisplay
)
#else
void
KAEvent
::
Private
::
readAlarms
(
const
Event
*
event
,
void
*
almap
,
bool
cmdDisplay
)
#endif
...
...
@@ -4216,7 +4213,7 @@ void KAEvent::Private::readAlarms(const Event* event, void* almap, bool cmdDispl
* Reply = alarm ID (sequence number)
*/
#ifndef USE_KRESOURCES
void
KAEvent
::
Private
::
readAlarm
(
const
Const
AlarmPtr
&
alarm
,
AlarmData
&
data
,
bool
audioMain
,
bool
cmdDisplay
)
void
KAEvent
::
Private
::
readAlarm
(
const
Alarm
::
Ptr
&
alarm
,
AlarmData
&
data
,
bool
audioMain
,
bool
cmdDisplay
)
#else
void
KAEvent
::
Private
::
readAlarm
(
const
Alarm
*
alarm
,
AlarmData
&
data
,
bool
audioMain
,
bool
cmdDisplay
)
#endif
...
...
kaevent.h
View file @
638e35d1
...
...
@@ -31,7 +31,6 @@
#include
"repetition.h"
#ifndef USE_KRESOURCES
#include
"kcalcore_constptr.h"
#include
<akonadi/collection.h>
#include
<akonadi/item.h>
#include
<kcalcore/person.h>
...
...
@@ -346,10 +345,10 @@ class KALARMCAL_EXPORT KAEvent
const
QFont
&
f
,
SubAction
,
int
lateCancel
,
Flags
flags
,
bool
changesPending
=
false
);
#ifndef USE_KRESOURCES
/** Construct an event and initialise it from a KCalCore::Event. */
explicit
KAEvent
(
const
KCalCore
::
Const
EventPtr
&
);
explicit
KAEvent
(
const
KCalCore
::
Event
::
Ptr
&
);
/** Initialise the instance from a KCalCore::Event. */
void
set
(
const
KCalCore
::
Const
EventPtr
&
);
void
set
(
const
KCalCore
::
Event
::
Ptr
&
);
#else
/** Construct an event and initialise it from a KCal::Event. */
explicit
KAEvent
(
const
KCal
::
Event
*
);
...
...
@@ -1122,7 +1121,7 @@ class KALARMCAL_EXPORT KAEvent
* and appropriate adjustments are made to convert it back to the
* original pre-displaying state.
*/
void
reinstateFromDisplaying
(
const
KCalCore
::
Const
EventPtr
&
event
,
Akonadi
::
Collection
::
Id
&
colId
,
bool
&
showEdit
,
bool
&
showDefer
);
void
reinstateFromDisplaying
(
const
KCalCore
::
Event
::
Ptr
&
event
,
Akonadi
::
Collection
::
Id
&
colId
,
bool
&
showEdit
,
bool
&
showDefer
);
#else
void
reinstateFromDisplaying
(
const
KCal
::
Event
*
event
,
QString
&
resourceID
,
bool
&
showEdit
,
bool
&
showDefer
);
#endif
...
...
kcalcore_constptr.h
deleted
100644 → 0
View file @
d31c6067
/*
* kcalcore_constptr.h - ConstPtr types for kcalcore objects
* This file is part of kalarmcal library, which provides access to KAlarm
* calendar data.
* Copyright © 2010 by David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KCALCORE_CONSTPTR_H
#define KCALCORE_CONSTPTR_H
#ifndef USE_KRESOURCES
#include
<QSharedPointer>
#include
<kcalcore/event.h>
#include
<kcalcore/alarm.h>
#include
<kcalcore/person.h>
#if 0
namespace KCalCore
{
class Event;
class Alarm;
class Person;
}
#endif
namespace
KCalCore
{
#if 0
template<class T> class ConstPtrT
{
public:
ConstPtrT() {}
ConstPtrT(const T* e) : cd(e), isConst(true) {} // implicit conversion
ConstPtrT(T* e) : d(e), isConst(false) {} // implicit conversion
ConstPtrT& operator=(const T* e) { cd = e; isConst = true; return *this; }
ConstPtrT& operator=(T* e) { d = e; isConst = false; return *this; }
operator bool() const { return d; }
bool operator!() const { return !d; }
const T* operator->() const { return d; }
T* operator->() { return isConst ? d : d; }
const T& operator*() const { return *d; }
T& operator*() { return isConst ? *cd : *d; }
operator const T*() const { return d; }
operator T*() { return isConst ? cd : d; }
private:
union {
T* d;
const T* cd;
};
bool isConst;
};
#endif
// KCalCore::Event::Ptr is equivalent to KCal::Event*
typedef
QSharedPointer
<
const
Event
>
ConstEventPtr
;
// KCalCore::Alarm::Ptr is equivalent to KCal::Alarm*
typedef
QSharedPointer
<
const
KCalCore
::
Alarm
>
ConstAlarmPtr
;
// KCalCore::Person::Ptr is equivalent to KCal::Person*
typedef
QSharedPointer
<
const
KCalCore
::
Person
>
ConstPersonPtr
;
}
// namespace KCalCore
#endif // USE_KRESOURCES
#endif // KCALCORE_CONSTPTR_H
// vim: et sw=4:
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment