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
Kalendar
Commits
85d9893f
Commit
85d9893f
authored
Aug 29, 2022
by
Volker Krause
Browse files
Require the latest stable version of the Akonadi and PIM APIs
Allows to clean up a ton of preprocessor conditionals.
parent
5f560cea
Pipeline
#225437
passed with stage
in 4 minutes and 5 seconds
Changes
16
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
85d9893f
...
...
@@ -14,7 +14,7 @@ project(kalendar VERSION ${RELEASE_SERVICE_VERSION})
set
(
QT_MIN_VERSION
"5.15.2"
)
set
(
KF5_MIN_VERSION
"5.96.0"
)
set
(
PIM_VERSION
"5.1
9
.0"
)
set
(
PIM_VERSION
"5.
2
1.0"
)
include
(
FeatureSummary
)
...
...
autotests/incidenceoccurrencemodeltest.cpp
View file @
85d9893f
...
...
@@ -3,12 +3,7 @@
#include
"../src/models/incidenceoccurrencemodel.h"
#include
<akonadi-calendar_version.h>
#if AKONADICALENDAR_VERSION > QT_VERSION_CHECK(5, 19, 41)
#include
<Akonadi/IncidenceChanger>
#else
#include
<Akonadi/Calendar/IncidenceChanger>
#endif
#include
<KCalendarCore/Incidence>
#include
<KCheckableProxyModel>
#include
<KFormat>
...
...
autotests/todosortfilterproxymodeltest.cpp
View file @
85d9893f
...
...
@@ -3,12 +3,7 @@
#include
"../src/models/todosortfilterproxymodel.h"
#include
<akonadi-calendar_version.h>
#if AKONADICALENDAR_VERSION > QT_VERSION_CHECK(5, 19, 41)
#include
<Akonadi/IncidenceChanger>
#else
#include
<Akonadi/Calendar/IncidenceChanger>
#endif
#include
<KCalendarCore/Incidence>
#include
<KCheckableProxyModel>
...
...
src/calendarmanager.cpp
View file @
85d9893f
...
...
@@ -32,12 +32,7 @@
#include
<Akonadi/ItemModifyJob>
#include
<Akonadi/ItemMoveJob>
#include
<Akonadi/Monitor>
#include
<akonadi_version.h>
#if AKONADICALENDAR_VERSION > QT_VERSION_CHECK(5, 19, 41)
#include
<Akonadi/History>
#else
#include
<Akonadi/Calendar/History>
#endif
#include
<CalendarSupport/KCalPrefs>
#include
<CalendarSupport/Utils>
#include
<EventViews/Prefs>
...
...
@@ -48,11 +43,6 @@
#include
<QPointer>
#include
<models/todosortfilterproxymodel.h>
#if AKONADICALENDAR_VERSION > QT_VERSION_CHECK(5, 19, 41)
#else
#include
<etmcalendar.h>
#endif
#include
<colorproxymodel.h>
#include
<incidencewrapper.h>
#include
<sortedcollectionproxymodel.h>
...
...
@@ -148,11 +138,7 @@ protected:
QVariant
data
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
const
override
{
if
(
role
==
Qt
::
ToolTipRole
)
{
#if AKONADI_VERSION < QT_VERSION_CHECK(5, 20, 41)
const
Akonadi
::
Collection
col
=
CalendarSupport
::
collectionFromIndex
(
index
);
#else
const
Akonadi
::
Collection
col
=
Akonadi
::
CollectionUtils
::
fromIndex
(
index
);
#endif
return
CalendarSupport
::
toolTipString
(
col
);
}
...
...
@@ -253,11 +239,7 @@ CalendarManager::CalendarManager(QObject *parent)
auto
refreshColors
=
[
=
]()
{
for
(
auto
i
=
0
;
i
<
m_flatCollectionTreeModel
->
rowCount
();
i
++
)
{
auto
idx
=
m_flatCollectionTreeModel
->
index
(
i
,
0
,
{});
#if AKONADI_VERSION < QT_VERSION_CHECK(5, 20, 41)
colorProxy
->
getCollectionColor
(
CalendarSupport
::
collectionFromIndex
(
idx
));
#else
colorProxy
->
getCollectionColor
(
Akonadi
::
CollectionUtils
::
fromIndex
(
idx
));
#endif
}
};
connect
(
m_flatCollectionTreeModel
,
&
QSortFilterProxyModel
::
rowsInserted
,
this
,
refreshColors
);
...
...
src/calendarmanager.h
View file @
85d9893f
...
...
@@ -6,14 +6,8 @@
#include
<QObject>
#include
<akonadi-calendar_version.h>
#if AKONADICALENDAR_VERSION > QT_VERSION_CHECK(5, 19, 41)
#include
<Akonadi/ETMCalendar>
#include
<Akonadi/IncidenceChanger>
#else
#include
<Akonadi/Calendar/ETMCalendar>
#include
<Akonadi/Calendar/IncidenceChanger>
#endif
#include
<Akonadi/CollectionFilterProxyModel>
#include
<KConfigWatcher>
...
...
src/contacts/contactgroupeditor.cpp
View file @
85d9893f
...
...
@@ -3,11 +3,9 @@
// SPDX-License-Identifier: LGPL-2.0-or-later
#include
"contactgroupeditor.h"
#include
<KStatefulBrush>
#include
<kconfigwidgets_version.h>
#include
<qobjectdefs.h>
#if KCONFIGWIDGETS_VERSION >= QT_VERSION_CHECK(5, 93, 0)
#include
<KStatefulBrush>
// was moved to own header in 5.93.0
#endif
#include
"contactgroupmodel.h"
...
...
src/contacts/contactmanager.cpp
View file @
85d9893f
...
...
@@ -21,22 +21,9 @@
#include
<Akonadi/Monitor>
#include
<Akonadi/SelectionProxyModel>
#include
<QSortFilterProxyModel>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include
<akonadi_version.h>
#if AKONADI_VERSION >= QT_VERSION_CHECK(5, 19, 40)
#include
<Akonadi/ContactsFilterProxyModel>
#include
<Akonadi/ContactsTreeModel>
#include
<Akonadi/EmailAddressSelectionModel>
#else
#include
<Akonadi/Contact/ContactsFilterProxyModel>
#include
<Akonadi/Contact/ContactsTreeModel>
#include
<Akonadi/Contact/EmailAddressSelectionModel>
#endif
#else
#include
<Akonadi/ContactsFilterProxyModel>
#include
<Akonadi/ContactsTreeModel>
#include
<Akonadi/EmailAddressSelectionModel>
#endif
#include
"contactcollectionmodel.h"
#include
"globalcontactmodel.h"
#include
"kalendar_contact_debug.h"
...
...
src/contacts/contactsmodel.cpp
View file @
85d9893f
...
...
@@ -4,22 +4,9 @@
#include
"contactsmodel.h"
#include
<akonadi/entitytreemodel.h>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include
<akonadi_version.h>
#if AKONADI_VERSION >= QT_VERSION_CHECK(5, 19, 40)
#include
<Akonadi/ContactsFilterProxyModel>
#include
<Akonadi/ContactsTreeModel>
#include
<Akonadi/EmailAddressSelectionModel>
#else
#include
<Akonadi/Contact/ContactsFilterProxyModel>
#include
<Akonadi/Contact/ContactsTreeModel>
#include
<Akonadi/Contact/EmailAddressSelectionModel>
#endif
#else
#include
<Akonadi/ContactsFilterProxyModel>
#include
<Akonadi/ContactsTreeModel>
#include
<Akonadi/EmailAddressSelectionModel>
#endif
#include
<KDescendantsProxyModel>
#include
<Akonadi/EntityMimeTypeFilterModel>
#include
<KContacts/Addressee>
...
...
src/contacts/globalcontactmodel.cpp
View file @
85d9893f
...
...
@@ -9,12 +9,7 @@
#include
"globalcontactmodel.h"
#include
<Akonadi/ChangeRecorder>
#include
<akonadi-calendar_version.h>
#if AKONADICALENDAR_VERSION > QT_VERSION_CHECK(5, 19, 41)
#include
<Akonadi/ContactsTreeModel>
#else
#include
<Akonadi/Contact/ContactsTreeModel>
#endif
#include
<Akonadi/EntityDisplayAttribute>
#include
<Akonadi/ItemFetchScope>
#include
<Akonadi/Session>
...
...
src/kalendarapplication.h
View file @
85d9893f
...
...
@@ -7,14 +7,8 @@
#include
"kalendarconfig.h"
#include
"models/actionsmodel.h"
#include
<akonadi-calendar_version.h>
#if AKONADICALENDAR_VERSION > QT_VERSION_CHECK(5, 19, 41)
#include
<Akonadi/ETMCalendar>
#include
<Akonadi/ICalImporter>
#else
#include
<Akonadi/Calendar/ETMCalendar>
#include
<Akonadi/Calendar/ICalImporter>
#endif
#include
<KActionCollection>
#include
<QActionGroup>
...
...
src/lib/colorproxymodel.cpp
View file @
85d9893f
...
...
@@ -11,10 +11,6 @@
#include
<Akonadi/CollectionUtils>
#include
<Akonadi/EntityDisplayAttribute>
#include
<CalendarSupport/KCalPrefs>
#include
<akonadi_version.h>
#if AKONADI_VERSION < QT_VERSION_CHECK(5, 20, 41)
#include
<CalendarSupport/Utils>
#endif
#include
<KConfigGroup>
#include
<KLocalizedString>
#include
<KSharedConfig>
...
...
@@ -75,11 +71,7 @@ QVariant ColorProxyModel::data(const QModelIndex &index, int role) const
}
if
(
role
==
Qt
::
DecorationRole
)
{
#if AKONADI_VERSION < QT_VERSION_CHECK(5, 20, 41)
const
Akonadi
::
Collection
collection
=
CalendarSupport
::
collectionFromIndex
(
index
);
#else
const
Akonadi
::
Collection
collection
=
Akonadi
::
CollectionUtils
::
fromIndex
(
index
);
#endif
if
(
hasCompatibleMimeTypes
(
collection
))
{
if
(
collection
.
hasAttribute
<
Akonadi
::
EntityDisplayAttribute
>
()
&&
!
collection
.
attribute
<
Akonadi
::
EntityDisplayAttribute
>
()
->
iconName
().
isEmpty
())
{
...
...
@@ -87,11 +79,7 @@ QVariant ColorProxyModel::data(const QModelIndex &index, int role) const
}
}
}
else
if
(
role
==
Qt
::
FontRole
)
{
#if AKONADI_VERSION < QT_VERSION_CHECK(5, 20, 41)
const
Akonadi
::
Collection
collection
=
CalendarSupport
::
collectionFromIndex
(
index
);
#else
const
Akonadi
::
Collection
collection
=
Akonadi
::
CollectionUtils
::
fromIndex
(
index
);
#endif
if
(
!
collection
.
contentMimeTypes
().
isEmpty
()
&&
isStandardCalendar
(
collection
.
id
())
&&
collection
.
rights
()
&
Akonadi
::
Collection
::
CanCreateItem
)
{
auto
font
=
qvariant_cast
<
QFont
>
(
QSortFilterProxyModel
::
data
(
index
,
Qt
::
FontRole
));
font
.
setBold
(
true
);
...
...
@@ -102,11 +90,7 @@ QVariant ColorProxyModel::data(const QModelIndex &index, int role) const
return
font
;
}
}
else
if
(
role
==
Qt
::
DisplayRole
)
{
#if AKONADI_VERSION < QT_VERSION_CHECK(5, 20, 41)
const
Akonadi
::
Collection
collection
=
CalendarSupport
::
collectionFromIndex
(
index
);
#else
const
Akonadi
::
Collection
collection
=
Akonadi
::
CollectionUtils
::
fromIndex
(
index
);
#endif
const
Akonadi
::
Collection
::
Id
colId
=
collection
.
id
();
const
Akonadi
::
AgentInstance
instance
=
Akonadi
::
AgentManager
::
self
()
->
instance
(
collection
.
resource
());
...
...
@@ -117,11 +101,7 @@ QVariant ColorProxyModel::data(const QModelIndex &index, int role) const
return
i18nc
(
"@item this is the default calendar"
,
"%1 (Default)"
,
collection
.
displayName
());
}
}
else
if
(
role
==
Qt
::
BackgroundRole
)
{
#if AKONADI_VERSION < QT_VERSION_CHECK(5, 20, 41)
auto
color
=
getCollectionColor
(
CalendarSupport
::
collectionFromIndex
(
index
));
#else
auto
color
=
getCollectionColor
(
Akonadi
::
CollectionUtils
::
fromIndex
(
index
));
#endif
// Otherwise QML will get black
if
(
color
.
isValid
())
{
return
color
;
...
...
@@ -129,11 +109,7 @@ QVariant ColorProxyModel::data(const QModelIndex &index, int role) const
return
{};
}
}
else
if
(
role
==
isResource
)
{
#if AKONADI_VERSION < QT_VERSION_CHECK(5, 20, 41)
return
Akonadi
::
CollectionUtils
::
isResource
(
CalendarSupport
::
collectionFromIndex
(
index
));
#else
return
Akonadi
::
CollectionUtils
::
isResource
(
Akonadi
::
CollectionUtils
::
fromIndex
(
index
));
#endif
}
return
QSortFilterProxyModel
::
data
(
index
,
role
);
...
...
src/models/attendeesmodel.cpp
View file @
85d9893f
...
...
@@ -14,16 +14,7 @@
#include
<Akonadi/ItemFetchScope>
#include
<Akonadi/SearchQuery>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include
<akonadi_version.h>
#if AKONADI_VERSION >= QT_VERSION_CHECK(5, 19, 40)
#include
<Akonadi/ContactSearchJob>
#else
#include
<Akonadi/Contact/ContactSearchJob>
#endif
#else
#include
<Akonadi/ContactSearchJob>
#endif
AttendeeStatusModel
::
AttendeeStatusModel
(
QObject
*
parent
)
:
QAbstractListModel
(
parent
)
...
...
src/models/incidenceoccurrencemodel.h
View file @
85d9893f
...
...
@@ -8,12 +8,7 @@
#pragma once
#include
<QObject>
#include
<akonadi-calendar_version.h>
#if AKONADICALENDAR_VERSION > QT_VERSION_CHECK(5, 19, 41)
#include
<Akonadi/ETMCalendar>
#else
#include
<Akonadi/Calendar/ETMCalendar>
#endif
#include
<KConfigWatcher>
#include
<KFormat>
...
...
src/models/infinitecalendarviewmodel.h
View file @
85d9893f
...
...
@@ -5,12 +5,7 @@
#include
"hourlyincidencemodel.h"
#include
"multidayincidencemodel.h"
#include
<akonadi-calendar_version.h>
#if AKONADICALENDAR_VERSION > QT_VERSION_CHECK(5, 19, 41)
#include
<Akonadi/ETMCalendar>
#else
#include
<Akonadi/Calendar/ETMCalendar>
#endif
#include
<QLocale>
class
InfiniteCalendarViewModel
:
public
QAbstractListModel
...
...
src/models/todosortfilterproxymodel.cpp
View file @
85d9893f
...
...
@@ -7,11 +7,7 @@ TodoSortFilterProxyModel::TodoSortFilterProxyModel(QObject *parent)
:
QSortFilterProxyModel
(
parent
)
{
const
QString
todoMimeType
=
QStringLiteral
(
"application/x-vnd.akonadi.calendar.todo"
);
#if AKONADICALENDAR_VERSION < QT_VERSION_CHECK(5, 20, 41)
m_todoTreeModel
=
new
IncidenceTreeModel
(
QStringList
()
<<
todoMimeType
,
this
);
#else
m_todoTreeModel
=
new
Akonadi
::
IncidenceTreeModel
(
QStringList
()
<<
todoMimeType
,
this
);
#endif
const
auto
pref
=
EventViews
::
PrefsPtr
(
new
EventViews
::
Prefs
);
m_baseTodoModel
=
new
TodoModel
(
pref
,
this
);
m_baseTodoModel
->
setSourceModel
(
m_todoTreeModel
);
...
...
@@ -92,11 +88,7 @@ QVariant TodoSortFilterProxyModel::data(const QModelIndex &index, int role) cons
}
auto
collectionId
=
todoItem
.
parentCollection
().
id
();
#if AKONADICALENDAR_VERSION < QT_VERSION_CHECK(5, 20, 42)
auto
todoPtr
=
CalendarSupport
::
todo
(
todoItem
);
#else
auto
todoPtr
=
Akonadi
::
CalendarUtils
::
todo
(
todoItem
);
#endif
if
(
!
todoPtr
)
{
return
{};
...
...
@@ -142,11 +134,7 @@ QVariant TodoSortFilterProxyModel::data(const QModelIndex &index, int role) cons
}
else
if
(
role
==
Roles
::
IncidenceTypeIconRole
)
{
return
todoPtr
->
iconName
();
}
else
if
(
role
==
Roles
::
IncidencePtrRole
)
{
#if AKONADICALENDAR_VERSION < QT_VERSION_CHECK(5, 20, 42)
return
QVariant
::
fromValue
(
CalendarSupport
::
incidence
(
todoItem
));
#else
return
QVariant
::
fromValue
(
Akonadi
::
CalendarUtils
::
incidence
(
todoItem
));
#endif
}
else
if
(
role
==
Roles
::
TagsRole
)
{
return
QVariant
::
fromValue
(
todoItem
.
tags
());
}
else
if
(
role
==
Roles
::
ItemRole
)
{
...
...
src/models/todosortfilterproxymodel.h
View file @
85d9893f
...
...
@@ -3,23 +3,10 @@
#pragma once
#include
<QObject>
#include
<akonadi-calendar_version.h>
#if AKONADICALENDAR_VERSION > QT_VERSION_CHECK(5, 19, 41)
#include
<Akonadi/ETMCalendar>
#else
#include
<Akonadi/Calendar/ETMCalendar>
#endif
#include
<CalendarSupport/KCalPrefs>
#if AKONADICALENDAR_VERSION < QT_VERSION_CHECK(5, 20, 42)
#include
<CalendarSupport/Utils>
#else
#include
<Akonadi/CalendarUtils>
#endif
#if AKONADICALENDAR_VERSION < QT_VERSION_CHECK(5, 20, 41)
#include
<EventViews/IncidenceTreeModel>
#else
#include
<Akonadi/IncidenceTreeModel>
#endif
#include
<EventViews/TodoModel>
#include
<KConfigWatcher>
#include
<KFormat>
...
...
@@ -142,11 +129,7 @@ private:
int
compareCompletion
(
const
QModelIndex
&
left
,
const
QModelIndex
&
right
)
const
;
Akonadi
::
ETMCalendar
::
Ptr
m_calendar
;
#if AKONADICALENDAR_VERSION < QT_VERSION_CHECK(5, 20, 41)
IncidenceTreeModel
*
m_todoTreeModel
=
nullptr
;
#else
Akonadi
::
IncidenceTreeModel
*
m_todoTreeModel
=
nullptr
;
#endif
TodoModel
*
m_baseTodoModel
=
nullptr
;
Akonadi
::
IncidenceChanger
*
m_lastSetChanger
=
nullptr
;
QHash
<
QString
,
QColor
>
m_colors
;
...
...
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