Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Akonadi Calendar
Commits
6f934c2a
Commit
6f934c2a
authored
Jan 25, 2021
by
Laurent Montel
😁
Browse files
modernize code
parent
39b513a9
Pipeline
#48632
failed with stage
in 11 minutes and 20 seconds
Changes
30
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
autotests/calendarbasetest.cpp
View file @
6f934c2a
...
...
@@ -40,7 +40,7 @@ static bool compareUids(const QStringList &_uids, const Incidence::List &inciden
void
CalendarBaseTest
::
fetchCollection
()
{
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
Collection
::
root
(),
auto
job
=
new
CollectionFetchJob
(
Collection
::
root
(),
CollectionFetchJob
::
Recursive
,
this
);
// Get list of collections
...
...
@@ -197,10 +197,10 @@ void CalendarBaseTest::testDelete()
QTestEventLoop
::
instance
().
enterLoop
(
5
);
QVERIFY
(
!
QTestEventLoop
::
instance
().
timeout
());
auto
*
job1
=
new
ItemFetchJob
(
event
,
this
);
auto
*
job2
=
new
ItemFetchJob
(
todo
,
this
);
auto
*
job3
=
new
ItemFetchJob
(
journal
,
this
);
auto
*
job4
=
new
ItemFetchJob
(
incidence
,
this
);
auto
job1
=
new
ItemFetchJob
(
event
,
this
);
auto
job2
=
new
ItemFetchJob
(
todo
,
this
);
auto
job3
=
new
ItemFetchJob
(
journal
,
this
);
auto
job4
=
new
ItemFetchJob
(
incidence
,
this
);
QVERIFY
(
!
job1
->
exec
());
QVERIFY
(
!
job2
->
exec
());
QVERIFY
(
!
job3
->
exec
());
...
...
autotests/etmcalendartest.cpp
View file @
6f934c2a
...
...
@@ -46,7 +46,7 @@ void ETMCalendarTest::createIncidence(const QString &uid)
incidence
->
setDtStart
(
QDateTime
::
currentDateTimeUtc
());
incidence
->
setSummary
(
QStringLiteral
(
"summary"
));
item
.
setPayload
<
KCalendarCore
::
Incidence
::
Ptr
>
(
incidence
);
auto
*
job
=
new
ItemCreateJob
(
item
,
mCollection
,
this
);
auto
job
=
new
ItemCreateJob
(
item
,
mCollection
,
this
);
AKVERIFYEXEC
(
job
);
}
...
...
@@ -62,7 +62,7 @@ void ETMCalendarTest::createTodo(const QString &uid, const QString &parentUid)
todo
->
setSummary
(
QStringLiteral
(
"summary"
));
item
.
setPayload
<
KCalendarCore
::
Incidence
::
Ptr
>
(
todo
);
auto
*
job
=
new
ItemCreateJob
(
item
,
mCollection
,
this
);
auto
job
=
new
ItemCreateJob
(
item
,
mCollection
,
this
);
mIncidencesToAdd
++
;
mIncidencesToChange
++
;
AKVERIFYEXEC
(
job
);
...
...
@@ -70,14 +70,14 @@ void ETMCalendarTest::createTodo(const QString &uid, const QString &parentUid)
void
ETMCalendarTest
::
deleteIncidence
(
const
QString
&
uid
)
{
ItemDeleteJob
*
job
=
new
ItemDeleteJob
(
mCalendar
->
item
(
uid
));
auto
job
=
new
ItemDeleteJob
(
mCalendar
->
item
(
uid
));
mIncidencesToDelete
++
;
AKVERIFYEXEC
(
job
);
}
void
ETMCalendarTest
::
fetchCollection
()
{
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
Collection
::
root
(),
auto
job
=
new
CollectionFetchJob
(
Collection
::
root
(),
CollectionFetchJob
::
Recursive
,
this
);
// Get list of collections
...
...
@@ -148,7 +148,7 @@ void ETMCalendarTest::testCollectionChanged_data()
void
ETMCalendarTest
::
testCollectionChanged
()
{
QFETCH
(
Akonadi
::
Collection
,
noRightsCollection
);
auto
*
job
=
new
CollectionModifyJob
(
mCollection
,
this
);
auto
job
=
new
CollectionModifyJob
(
mCollection
,
this
);
QSignalSpy
spy
(
mCalendar
,
&
ETMCalendar
::
collectionChanged
);
mIncidencesToChange
=
6
;
AKVERIFYEXEC
(
job
);
...
...
@@ -174,7 +174,7 @@ void ETMCalendarTest::testIncidencesModified()
Incidence
::
Ptr
clone
=
Incidence
::
Ptr
(
CalendarUtils
::
incidence
(
item
)
->
clone
());
clone
->
setSummary
(
tr
(
"foo33"
));
item
.
setPayload
(
clone
);
auto
*
job
=
new
ItemModifyJob
(
item
);
auto
job
=
new
ItemModifyJob
(
item
);
mIncidencesToChange
=
1
;
AKVERIFYEXEC
(
job
);
QTestEventLoop
::
instance
().
enterLoop
(
10
);
...
...
@@ -190,7 +190,7 @@ void ETMCalendarTest::testIncidencesDeleted()
const
Item
item
=
mCalendar
->
item
(
tr
(
"a"
));
QVERIFY
(
item
.
isValid
());
QVERIFY
(
item
.
hasPayload
());
auto
*
job
=
new
ItemDeleteJob
(
item
);
auto
job
=
new
ItemDeleteJob
(
item
);
AKVERIFYEXEC
(
job
);
mIncidencesToDelete
=
1
;
QTestEventLoop
::
instance
().
enterLoop
(
10
);
...
...
@@ -353,7 +353,7 @@ void ETMCalendarTest::testSubTodos()
ta
->
setRelatedTo
(
tr
(
"tb"
));
mIncidencesToChange
++
;
auto
*
job
=
new
ItemModifyJob
(
ta_item
);
auto
job
=
new
ItemModifyJob
(
ta_item
);
AKVERIFYEXEC
(
job
);
waitForIt
();
...
...
@@ -400,7 +400,7 @@ void ETMCalendarTest::testSubTodos()
// Delete everything, so we don't have duplicate ids when the next test row runs
Akonadi
::
Item
::
List
itemsToDelete
=
mCalendar
->
items
();
mIncidencesToDelete
=
itemsToDelete
.
count
();
auto
*
deleteJob
=
new
ItemDeleteJob
(
itemsToDelete
);
auto
deleteJob
=
new
ItemDeleteJob
(
itemsToDelete
);
AKVERIFYEXEC
(
deleteJob
);
waitForIt
();
}
...
...
@@ -424,7 +424,7 @@ void ETMCalendarTest::testNotifyObserverBug()
mIncidencesToChange
=
1
;
incidence
->
setSummary
(
QStringLiteral
(
"new-summary"
));
item
.
setPayload
(
incidence
);
auto
*
job
=
new
ItemModifyJob
(
item
);
auto
job
=
new
ItemModifyJob
(
item
);
AKVERIFYEXEC
(
job
);
// The test will now happen inside ETMCalendarTest::calendarIncidenceChanged()
...
...
@@ -446,7 +446,7 @@ void ETMCalendarTest::testUidChange()
QVERIFY
(
item
.
isValid
());
item
.
setPayload
(
clone
);
mIncidencesToChange
=
1
;
auto
*
job
=
new
ItemModifyJob
(
item
);
auto
job
=
new
ItemModifyJob
(
item
);
AKVERIFYEXEC
(
job
);
waitForIt
();
...
...
@@ -501,7 +501,7 @@ void ETMCalendarTest::testShareETM()
createTodo
(
QStringLiteral
(
"uid-123"
),
QString
());
waitForIt
();
auto
*
calendar2
=
new
ETMCalendar
(
mCalendar
,
this
);
auto
calendar2
=
new
ETMCalendar
(
mCalendar
,
this
);
calendar2
->
registerObserver
(
this
);
// Uncheck our calendar
...
...
@@ -535,7 +535,7 @@ void ETMCalendarTest::testFilterInvitations()
incidence
->
addAttendee
(
me
);
item
.
setPayload
<
KCalendarCore
::
Incidence
::
Ptr
>
(
incidence
);
auto
*
job
=
new
ItemCreateJob
(
item
,
mCollection
,
this
);
auto
job
=
new
ItemCreateJob
(
item
,
mCollection
,
this
);
AKVERIFYEXEC
(
job
);
waitForIt
();
// incidence do not pop up in model
...
...
@@ -565,7 +565,7 @@ void ETMCalendarTest::testFilterInvitationsChanged()
item
.
setPayload
<
KCalendarCore
::
Incidence
::
Ptr
>
(
incidence
);
mIncidencesToDelete
=
1
;
auto
*
modifyJob
=
new
ItemModifyJob
(
item
,
this
);
auto
modifyJob
=
new
ItemModifyJob
(
item
,
this
);
AKVERIFYEXEC
(
modifyJob
);
waitForIt
();
QCOMPARE
(
mCalendar
->
model
()
->
rowCount
(),
anz
);
...
...
autotests/fetchjobcalendartest.cpp
View file @
6f934c2a
...
...
@@ -28,13 +28,13 @@ class FetchJobCalendarTest : public QObject
incidence
->
setSummary
(
QStringLiteral
(
"summary"
));
incidence
->
setDtStart
(
QDateTime
::
currentDateTimeUtc
());
item
.
setPayload
<
KCalendarCore
::
Incidence
::
Ptr
>
(
incidence
);
auto
*
job
=
new
ItemCreateJob
(
item
,
mCollection
,
this
);
auto
job
=
new
ItemCreateJob
(
item
,
mCollection
,
this
);
AKVERIFYEXEC
(
job
);
}
void
fetchCollection
()
{
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
Collection
::
root
(),
auto
job
=
new
CollectionFetchJob
(
Collection
::
root
(),
CollectionFetchJob
::
Recursive
,
this
);
// Get list of collections
...
...
autotests/helper.cpp
View file @
6f934c2a
...
...
@@ -16,19 +16,19 @@ using namespace Akonadi;
bool
Helper
::
confirmExists
(
const
Akonadi
::
Item
&
item
)
{
auto
*
job
=
new
ItemFetchJob
(
item
);
auto
job
=
new
ItemFetchJob
(
item
);
return
job
->
exec
()
!=
0
;
}
bool
Helper
::
confirmDoesntExist
(
const
Akonadi
::
Item
&
item
)
{
auto
*
job
=
new
ItemFetchJob
(
item
);
auto
job
=
new
ItemFetchJob
(
item
);
return
job
->
exec
()
==
0
;
}
Akonadi
::
Collection
Helper
::
fetchCollection
()
{
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
Collection
::
root
(),
auto
job
=
new
CollectionFetchJob
(
Collection
::
root
(),
CollectionFetchJob
::
Recursive
);
// Get list of collections
job
->
fetchScope
().
setContentMimeTypes
(
QStringList
()
<<
QStringLiteral
(
"application/x-vnd.akonadi.calendar.event"
));
...
...
autotests/historytest.cpp
View file @
6f934c2a
...
...
@@ -24,7 +24,7 @@ Q_DECLARE_METATYPE(QList<Akonadi::IncidenceChanger::ChangeType>)
static
bool
checkSummary
(
const
Akonadi
::
Item
&
item
,
const
QString
&
expected
)
{
auto
*
job
=
new
ItemFetchJob
(
item
);
auto
job
=
new
ItemFetchJob
(
item
);
job
->
fetchScope
().
fetchFullPayload
();
bool
ok
=
false
;
[
&
]()
{
...
...
@@ -63,7 +63,7 @@ static Akonadi::Item item()
static
Akonadi
::
Item
createItem
(
const
Akonadi
::
Collection
&
collection
)
{
Item
i
=
item
();
auto
*
createJob
=
new
ItemCreateJob
(
i
,
collection
);
auto
createJob
=
new
ItemCreateJob
(
i
,
collection
);
[
&
]()
{
QVERIFY
(
createJob
->
exec
());
QVERIFY
(
createJob
->
item
().
isValid
());
...
...
autotests/incidencechangertest.cpp
View file @
6f934c2a
...
...
@@ -48,7 +48,7 @@ static Akonadi::Item item()
static
Akonadi
::
Item
createItem
(
const
Akonadi
::
Collection
&
collection
)
{
Item
i
=
item
();
auto
*
createJob
=
new
ItemCreateJob
(
i
,
collection
);
auto
createJob
=
new
ItemCreateJob
(
i
,
collection
);
createJob
->
exec
();
return
createJob
->
item
();
...
...
@@ -88,7 +88,7 @@ private Q_SLOTS:
//Control::start(); //TODO: uncomment when using testrunner
qRegisterMetaType
<
Akonadi
::
Item
>
(
"Akonadi::Item"
);
qRegisterMetaType
<
QList
<
Akonadi
::
IncidenceChanger
::
ChangeType
>
>
(
"QList<Akonadi::IncidenceChanger::ChangeType>"
);
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
Collection
::
root
(),
auto
job
=
new
CollectionFetchJob
(
Collection
::
root
(),
CollectionFetchJob
::
Recursive
,
this
);
// Get list of collections
...
...
@@ -212,7 +212,7 @@ private Q_SLOTS:
Item
item
;
QVERIFY
(
mItemIdByChangeId
.
contains
(
changeId
));
item
.
setId
(
mItemIdByChangeId
.
value
(
changeId
));
auto
*
fetchJob
=
new
ItemFetchJob
(
item
,
this
);
auto
fetchJob
=
new
ItemFetchJob
(
item
,
this
);
fetchJob
->
fetchScope
().
fetchFullPayload
();
AKVERIFYEXEC
(
fetchJob
);
QVERIFY
(
!
fetchJob
->
items
().
isEmpty
());
...
...
@@ -239,7 +239,7 @@ private Q_SLOTS:
QTest
::
newRow
(
"Delete empty list"
)
<<
Item
::
List
()
<<
true
<<
true
;
QTest
::
newRow
(
"Delete invalid item"
)
<<
(
Item
::
List
()
<<
Item
())
<<
true
<<
true
;
auto
*
fetchJob
=
new
ItemFetchJob
(
mCollection
);
auto
fetchJob
=
new
ItemFetchJob
(
mCollection
);
fetchJob
->
fetchScope
().
fetchFullPayload
();
AKVERIFYEXEC
(
fetchJob
);
Item
::
List
items
=
fetchJob
->
items
();
...
...
@@ -284,7 +284,7 @@ private Q_SLOTS:
if
(
expectedResultCode
==
IncidenceChanger
::
ResultCodeSuccess
)
{
// Check that the incidence was really deleted
for
(
const
Akonadi
::
Item
&
item
:
qAsConst
(
items
))
{
auto
*
fetchJob
=
new
ItemFetchJob
(
item
,
this
);
auto
fetchJob
=
new
ItemFetchJob
(
item
,
this
);
fetchJob
->
fetchScope
().
fetchFullPayload
();
QVERIFY
(
!
fetchJob
->
exec
());
QVERIFY
(
fetchJob
->
items
().
isEmpty
());
...
...
@@ -312,7 +312,7 @@ private Q_SLOTS:
incidence
->
setUid
(
QStringLiteral
(
"test123uid"
));
incidence
->
setSummary
(
QStringLiteral
(
"summary"
));
item
.
setPayload
<
KCalendarCore
::
Incidence
::
Ptr
>
(
incidence
);
auto
*
job
=
new
ItemCreateJob
(
item
,
mCollection
,
this
);
auto
job
=
new
ItemCreateJob
(
item
,
mCollection
,
this
);
AKVERIFYEXEC
(
job
);
item
=
job
->
item
();
incidence
->
setSummary
(
QStringLiteral
(
"New Summary"
));
...
...
@@ -347,7 +347,7 @@ private Q_SLOTS:
mIncidencesToModify
=
1
;
mExpectedResultByChangeId
.
insert
(
changeId
,
expectedResultCode
);
waitForSignals
();
auto
*
fetchJob
=
new
ItemFetchJob
(
item
,
this
);
auto
fetchJob
=
new
ItemFetchJob
(
item
,
this
);
fetchJob
->
fetchScope
().
fetchFullPayload
();
AKVERIFYEXEC
(
fetchJob
);
QVERIFY
(
fetchJob
->
items
().
count
()
==
1
);
...
...
@@ -374,7 +374,7 @@ private Q_SLOTS:
incidence
->
setOrganizer
(
Person
(
QStringLiteral
(
"orga"
),
QStringLiteral
(
"orga@dev.nul"
)));
incidence
->
setDirtyFields
(
QSet
<
IncidenceBase
::
Field
>
());
item
.
setPayload
<
KCalendarCore
::
Incidence
::
Ptr
>
(
incidence
);
auto
*
job
=
new
ItemCreateJob
(
item
,
mCollection
,
this
);
auto
job
=
new
ItemCreateJob
(
item
,
mCollection
,
this
);
AKVERIFYEXEC
(
job
);
item
=
job
->
item
();
Alarm
::
Ptr
alarm
=
Alarm
::
Ptr
(
new
Alarm
(
incidence
.
data
()));
...
...
@@ -390,7 +390,7 @@ private Q_SLOTS:
mIncidencesToModify
=
1
;
mExpectedResultByChangeId
.
insert
(
changeId
,
IncidenceChanger
::
ResultCodeSuccess
);
waitForSignals
();
auto
*
fetchJob
=
new
ItemFetchJob
(
item
,
this
);
auto
fetchJob
=
new
ItemFetchJob
(
item
,
this
);
fetchJob
->
fetchScope
().
fetchFullPayload
();
AKVERIFYEXEC
(
fetchJob
);
QVERIFY
(
fetchJob
->
items
().
count
()
==
1
);
...
...
@@ -529,7 +529,7 @@ private Q_SLOTS:
QFETCH
(
bool
,
expectReset
);
item
.
setId
(
-
1
);
auto
*
job
=
new
ItemCreateJob
(
item
,
mCollection
,
this
);
auto
job
=
new
ItemCreateJob
(
item
,
mCollection
,
this
);
AKVERIFYEXEC
(
job
);
item
=
job
->
item
();
item
.
setPayload
<
KCalendarCore
::
Incidence
::
Ptr
>
(
event
);
...
...
@@ -543,7 +543,7 @@ private Q_SLOTS:
mIncidencesToModify
=
1
;
mExpectedResultByChangeId
.
insert
(
changeId
,
IncidenceChanger
::
ResultCodeSuccess
);
waitForSignals
();
auto
*
fetchJob
=
new
ItemFetchJob
(
item
,
this
);
auto
fetchJob
=
new
ItemFetchJob
(
item
,
this
);
fetchJob
->
fetchScope
().
fetchFullPayload
();
AKVERIFYEXEC
(
fetchJob
);
QVERIFY
(
fetchJob
->
items
().
count
()
==
1
);
...
...
@@ -589,7 +589,7 @@ private Q_SLOTS:
incidence
->
setUid
(
QStringLiteral
(
"test123uid"
));
incidence
->
setSummary
(
QStringLiteral
(
"summary"
));
item
.
setPayload
<
KCalendarCore
::
Incidence
::
Ptr
>
(
incidence
);
auto
*
job
=
new
ItemCreateJob
(
item
,
mCollection
,
this
);
auto
job
=
new
ItemCreateJob
(
item
,
mCollection
,
this
);
AKVERIFYEXEC
(
job
);
item
=
job
->
item
();
...
...
@@ -622,7 +622,7 @@ private Q_SLOTS:
mIncidencesToModify
=
1
;
mExpectedResultByChangeId
.
insert
(
changeId
,
IncidenceChanger
::
ResultCodeSuccess
);
waitForSignals
();
auto
*
fetchJob
=
new
ItemFetchJob
(
item
,
this
);
auto
fetchJob
=
new
ItemFetchJob
(
item
,
this
);
fetchJob
->
fetchScope
().
fetchFullPayload
();
AKVERIFYEXEC
(
fetchJob
);
QVERIFY
(
fetchJob
->
items
().
count
()
==
1
);
...
...
@@ -636,7 +636,7 @@ private Q_SLOTS:
// Wait for the last one
mExpectedResultByChangeId
.
insert
(
changeId
,
IncidenceChanger
::
ResultCodeSuccess
);
waitForChange
(
changeId
);
auto
*
fetchJob
=
new
ItemFetchJob
(
item
,
this
);
auto
fetchJob
=
new
ItemFetchJob
(
item
,
this
);
fetchJob
->
fetchScope
().
fetchFullPayload
();
AKVERIFYEXEC
(
fetchJob
);
QVERIFY
(
fetchJob
->
items
().
count
()
==
1
);
...
...
@@ -1007,7 +1007,7 @@ private Q_SLOTS:
QVERIFY
(
incidence
);
QVERIFY
(
!
incidence
->
uid
().
isEmpty
());
QVERIFY
(
mItemIdByUid
.
contains
(
incidence
->
uid
()));
ItemFetchJob
*
fJob
=
new
ItemFetchJob
(
Item
(
mItemIdByUid
.
value
(
incidence
->
uid
())));
auto
fJob
=
new
ItemFetchJob
(
Item
(
mItemIdByUid
.
value
(
incidence
->
uid
())));
fJob
->
fetchScope
().
fetchFullPayload
();
AKVERIFYEXEC
(
fJob
);
QCOMPARE
(
fJob
->
items
().
count
(),
1
);
...
...
@@ -1020,13 +1020,13 @@ private Q_SLOTS:
break
;
case
IncidenceChanger
::
ChangeTypeDelete
:
if
(
expectedSuccess
)
{
ItemFetchJob
*
fJob
=
new
ItemFetchJob
(
Item
(
item
.
id
()));
auto
fJob
=
new
ItemFetchJob
(
Item
(
item
.
id
()));
QVERIFY
(
!
fJob
->
exec
());
}
break
;
case
IncidenceChanger
::
ChangeTypeModify
:
if
(
expectedSuccess
)
{
ItemFetchJob
*
fJob
=
new
ItemFetchJob
(
Item
(
item
.
id
()));
auto
fJob
=
new
ItemFetchJob
(
Item
(
item
.
id
()));
fJob
->
fetchScope
().
fetchFullPayload
();
AKVERIFYEXEC
(
fJob
);
QCOMPARE
(
item
.
payload
<
KCalendarCore
::
Incidence
::
Ptr
>
()
->
summary
(),
...
...
autotests/itiphandlertest.cpp
View file @
6f934c2a
...
...
@@ -605,7 +605,7 @@ void ITIPHandlerTest::cleanup()
{
const
Akonadi
::
Item
::
List
items
=
calendarItems
();
for
(
const
Akonadi
::
Item
&
item
:
items
)
{
auto
*
job
=
new
ItemDeleteJob
(
item
);
auto
job
=
new
ItemDeleteJob
(
item
);
AKVERIFYEXEC
(
job
);
}
...
...
autotests/unittestbase.cpp
View file @
6f934c2a
...
...
@@ -59,13 +59,13 @@ void UnitTestBase::createIncidence(const QString &uid)
void
UnitTestBase
::
createIncidence
(
const
Item
&
item
)
{
QVERIFY
(
mCollection
.
isValid
());
auto
*
job
=
new
ItemCreateJob
(
item
,
mCollection
,
this
);
auto
job
=
new
ItemCreateJob
(
item
,
mCollection
,
this
);
QVERIFY
(
job
->
exec
());
}
void
UnitTestBase
::
verifyExists
(
const
QString
&
uid
,
bool
exists
)
{
auto
*
calendar
=
new
FetchJobCalendar
();
auto
calendar
=
new
FetchJobCalendar
();
connect
(
calendar
,
&
FetchJobCalendar
::
loadFinished
,
this
,
&
UnitTestBase
::
onLoadFinished
);
waitForIt
();
calendar
->
deleteLater
();
...
...
src/blockalarmsattribute.cpp
View file @
6f934c2a
...
...
@@ -92,7 +92,7 @@ QByteArray BlockAlarmsAttribute::type() const
BlockAlarmsAttribute
*
BlockAlarmsAttribute
::
clone
()
const
{
auto
*
copy
=
new
BlockAlarmsAttribute
();
auto
copy
=
new
BlockAlarmsAttribute
();
copy
->
d
->
audio
=
d
->
audio
;
copy
->
d
->
display
=
d
->
display
;
copy
->
d
->
email
=
d
->
email
;
...
...
src/calendarbase.cpp
View file @
6f934c2a
...
...
@@ -113,7 +113,7 @@ void CalendarBasePrivate::internalInsert(const Akonadi::Item &item)
incidence
->
setReadOnly
(
!
(
collection
.
rights
()
&
Akonadi
::
Collection
::
CanChangeItem
));
}
else
if
(
!
mCollectionJobs
.
key
(
item
.
storageCollectionId
()))
{
collection
=
Akonadi
::
Collection
(
item
.
storageCollectionId
());
auto
*
job
=
new
Akonadi
::
CollectionFetchJob
(
collection
,
Akonadi
::
CollectionFetchJob
::
Base
,
this
);
auto
job
=
new
Akonadi
::
CollectionFetchJob
(
collection
,
Akonadi
::
CollectionFetchJob
::
Base
,
this
);
QObject
::
connect
(
job
,
&
KJob
::
result
,
this
,
&
CalendarBasePrivate
::
collectionFetchResult
);
mCollectionJobs
.
insert
(
job
,
collection
.
id
());
}
...
...
@@ -154,7 +154,7 @@ void CalendarBasePrivate::collectionFetchResult(KJob *job)
return
;
}
auto
*
fetchJob
=
qobject_cast
<
Akonadi
::
CollectionFetchJob
*>
(
job
);
auto
fetchJob
=
qobject_cast
<
Akonadi
::
CollectionFetchJob
*>
(
job
);
const
Akonadi
::
Collection
collection
=
fetchJob
->
collections
().
at
(
0
);
if
(
collection
.
id
()
!=
colid
)
{
...
...
src/calendarbase.h
View file @
6f934c2a
...
...
@@ -36,7 +36,7 @@ class AKONADI_CALENDAR_EXPORT CalendarBase : public KCalendarCore::MemoryCalenda
{
Q_OBJECT
public:
typedef
QSharedPointer
<
CalendarBase
>
Ptr
;
using
Ptr
=
QSharedPointer
<
CalendarBase
>
;
/**
* Constructs a CalendarBase object.
...
...
src/calendarmodel.cpp
View file @
6f934c2a
...
...
@@ -46,7 +46,7 @@ CalendarModel::CalendarModel(Akonadi::Monitor *monitor)
CalendarModel
::
Ptr
CalendarModel
::
create
(
Monitor
*
monitor
)
{
auto
*
model
=
new
CalendarModel
(
monitor
);
auto
model
=
new
CalendarModel
(
monitor
);
CalendarModel
::
Ptr
modelPtr
=
CalendarModel
::
Ptr
(
model
);
model
->
setWeakPointer
(
modelPtr
.
toWeakRef
());
return
modelPtr
;
...
...
src/calendarmodel_p.h
View file @
6f934c2a
...
...
@@ -18,7 +18,7 @@ class CalendarModel : public Akonadi::EntityTreeModel
{
Q_OBJECT
public:
typedef
QSharedPointer
<
CalendarModel
>
Ptr
;
using
Ptr
=
QSharedPointer
<
CalendarModel
>
;
enum
ItemColumn
{
Summary
=
0
,
Type
,
...
...
src/etmcalendar.cpp
View file @
6f934c2a
...
...
@@ -42,8 +42,8 @@ ETMCalendarPrivate::ETMCalendarPrivate(ETMCalendar *qq)
void
ETMCalendarPrivate
::
init
()
{
if
(
!
mETM
)
{
Akonadi
::
Session
*
session
=
new
Akonadi
::
Session
(
"ETMCalendar"
,
q
);
auto
*
monitor
=
new
Akonadi
::
Monitor
(
q
);
auto
session
=
new
Akonadi
::
Session
(
"ETMCalendar"
,
q
);
auto
monitor
=
new
Akonadi
::
Monitor
(
q
);
monitor
->
setObjectName
(
QStringLiteral
(
"ETMCalendarMonitor"
));
connect
(
monitor
,
QOverload
<
const
Akonadi
::
Collection
&
,
const
QSet
<
QByteArray
>
&>::
of
(
&
Monitor
::
collectionChanged
),
this
,
[
this
](
const
Akonadi
::
Collection
&
cols
,
const
QSet
<
QByteArray
>
&
set
)
{
...
...
@@ -122,7 +122,7 @@ void ETMCalendarPrivate::onCollectionChanged(const Akonadi::Collection &collecti
void
ETMCalendarPrivate
::
setupFilteredETM
()
{
// We're only interested in the CollectionTitle column
auto
*
columnFilterProxy
=
new
KColumnFilterProxyModel
(
this
);
auto
columnFilterProxy
=
new
KColumnFilterProxyModel
(
this
);
columnFilterProxy
->
setSourceModel
(
mETM
.
data
());
columnFilterProxy
->
setVisibleColumn
(
CalendarModel
::
CollectionTitle
);
columnFilterProxy
->
setObjectName
(
QStringLiteral
(
"Remove columns"
));
...
...
@@ -136,7 +136,7 @@ void ETMCalendarPrivate::setupFilteredETM()
mCollectionProxyModel
->
setSourceModel
(
columnFilterProxy
);
// Keep track of selected items.
auto
*
selectionModel
=
new
QItemSelectionModel
(
mCollectionProxyModel
);
auto
selectionModel
=
new
QItemSelectionModel
(
mCollectionProxyModel
);
selectionModel
->
setObjectName
(
QStringLiteral
(
"Calendar Selection Model"
));
// Make item selection work by means of checkboxes.
...
...
@@ -447,7 +447,7 @@ ETMCalendar::ETMCalendar(ETMCalendar *other, QObject *parent)
{
Q_D
(
ETMCalendar
);
auto
*
model
=
qobject_cast
<
Akonadi
::
CalendarModel
*>
(
other
->
entityTreeModel
());
auto
model
=
qobject_cast
<
Akonadi
::
CalendarModel
*>
(
other
->
entityTreeModel
());
if
(
model
)
{
d
->
mETM
=
model
->
weakPointer
().
toStrongRef
();
}
...
...
@@ -590,7 +590,7 @@ void ETMCalendar::setCollectionFilteringEnabled(bool enable)
d
->
mCalFilterProxyModel
->
setSourceModel
(
d
->
mSelectionProxy
);
delete
qobject_cast
<
KDescendantsProxyModel
*>
(
oldModel
);
}
else
{
auto
*
flatner
=
new
KDescendantsProxyModel
(
this
);
auto
flatner
=
new
KDescendantsProxyModel
(
this
);
flatner
->
setSourceModel
(
d
->
mETM
.
data
());
d
->
mCalFilterProxyModel
->
setSourceModel
(
flatner
);
}
...
...
src/etmcalendar.h
View file @
6f934c2a
...
...
@@ -47,7 +47,7 @@ public:
CollectionColumnCount
};
typedef
QSharedPointer
<
ETMCalendar
>
Ptr
;
using
Ptr
=
QSharedPointer
<
ETMCalendar
>
;
/**
* Constructs a new ETMCalendar. Loading begins immediately, asynchronously.
...
...
src/fetchjobcalendar.cpp
View file @
6f934c2a
...
...
@@ -18,7 +18,7 @@ FetchJobCalendarPrivate::FetchJobCalendarPrivate(FetchJobCalendar *qq)
:
CalendarBasePrivate
(
qq
)
,
q
(
qq
)
{
auto
*
job
=
new
IncidenceFetchJob
();
auto
job
=
new
IncidenceFetchJob
();
connect
(
job
,
&
KJob
::
result
,
this
,
&
FetchJobCalendarPrivate
::
slotSearchJobFinished
);
connect
(
this
,
&
CalendarBasePrivate
::
fetchFinished
,
...
...
@@ -31,7 +31,7 @@ FetchJobCalendarPrivate::~FetchJobCalendarPrivate()
void
FetchJobCalendarPrivate
::
slotSearchJobFinished
(
KJob
*
job
)
{
auto
*
searchJob
=
static_cast
<
Akonadi
::
IncidenceFetchJob
*>
(
job
);
auto
searchJob
=
static_cast
<
Akonadi
::
IncidenceFetchJob
*>
(
job
);
m_success
=
true
;
m_errorMessage
=
QString
();
if
(
searchJob
->
error
())
{
...
...
@@ -75,7 +75,7 @@ FetchJobCalendar::~FetchJobCalendar()
bool
FetchJobCalendar
::
isLoaded
()
const
{
auto
*
d
=
static_cast
<
FetchJobCalendarPrivate
*>
(
d_ptr
.
data
());
auto
d
=
static_cast
<
FetchJobCalendarPrivate
*>
(
d_ptr
.
data
());
return
d
->
m_isLoaded
;
}
...
...
src/fetchjobcalendar.h
View file @
6f934c2a
...
...
@@ -31,7 +31,7 @@ class AKONADI_CALENDAR_EXPORT FetchJobCalendar : public Akonadi::CalendarBase
{
Q_OBJECT
public:
typedef
QSharedPointer
<
FetchJobCalendar
>
Ptr
;
using
Ptr
=
QSharedPointer
<
FetchJobCalendar
>
;
/**
* Creates a new FetchJobCalendar. Loading begins asynchronously.
...
...
src/freebusymanager.cpp
View file @
6f934c2a
...
...
@@ -103,7 +103,7 @@ void FbCheckerJob::dataReceived(KIO::Job *, const QByteArray &data)
void
FbCheckerJob
::
onGetJobFinished
(
KJob
*
job
)
{
auto
*
transferJob
=
static_cast
<
KIO
::
TransferJob
*>
(
job
);
auto
transferJob
=
static_cast
<
KIO
::
TransferJob
*>
(
job
);
if
(
mData
.
contains
(
"BEGIN:VCALENDAR"
))
{
qCDebug
(
AKONADICALENDAR_LOG
)
<<
"found freebusy"
;
mValidUrl
=
transferJob
->
url
();
...
...
@@ -201,7 +201,7 @@ void FreeBusyManagerPrivate::fetchFreeBusyUrl(const QString &email)
return
;
}
// Try with the url configured by preferred email in kcontactmanager
auto
*
job
=
new
Akonadi
::
ContactSearchJob
();
auto
job
=
new
Akonadi
::
ContactSearchJob
();
job
->
setQuery
(
Akonadi
::
ContactSearchJob
::
Email
,
email
);
job
->
setProperty
(
"contactEmail"
,
QVariant
::
fromValue
(
email
));
connect
(
job
,
&
Akonadi
::
ContactSearchJob
::
result
,
this
,
&
FreeBusyManagerPrivate
::
contactSearchJobFinished
);
...
...
@@ -219,7 +219,7 @@ void FreeBusyManagerPrivate::contactSearchJobFinished(KJob *_job)
return
;
}
auto
*
job
=
qobject_cast
<
Akonadi
::
ContactSearchJob
*>
(
_job
);
auto
job
=
qobject_cast
<
Akonadi
::
ContactSearchJob
*>
(
_job
);
KConfig
cfg
(
configFile
());
KConfigGroup
group
=
cfg
.
group
(
email
);
QString
url
=
group
.
readEntry
(
QStringLiteral
(
"url"
));
...
...
@@ -327,7 +327,7 @@ void FreeBusyManagerPrivate::fbCheckerJobFinished(KJob *job)
{
const
QString
email
=
job
->
property
(
"email"
).
toString
();
if
(
!
job
->
error
())
{
auto
*
checkerJob
=
static_cast
<
FbCheckerJob
*>
(
job
);
auto
checkerJob
=
static_cast
<
FbCheckerJob
*>
(
job
);
QUrl
dirURL
=
checkerJob
->
validUrl
();
// write the URL to the cache
KConfig
cfg
(
configFile
());
...
...
@@ -379,7 +379,7 @@ void FreeBusyManagerPrivate::processFreeBusyDownloadResult(KJob *_job)
{
Q_Q
(
FreeBusyManager
);
auto
*
job
=
qobject_cast
<
FreeBusyDownloadJob
*>
(
_job
);
auto
job
=
qobject_cast
<
FreeBusyDownloadJob
*>
(
_job
);
Q_ASSERT
(
job
);
if
(
job
->
error
())
{
qCritical
()
<<
"Error downloading freebusy"
<<
_job
->
errorString
();
...
...
@@ -423,7 +423,7 @@ void FreeBusyManagerPrivate::processFreeBusyDownloadResult(KJob *_job)
void
FreeBusyManagerPrivate
::
processFreeBusyUploadResult
(
KJob
*
_job
)
{
auto
*
job
=
static_cast
<
KIO
::
FileCopyJob
*>
(
_job
);
auto
job
=
static_cast
<
KIO
::
FileCopyJob
*>
(
_job
);
if
(
job
->
error
())
{
KMessageBox
::
sorry
(
nullptr
,
...
...
@@ -481,7 +481,7 @@ void FreeBusyManagerPrivate::finishProcessRetrieveQueue(const QString &email, co
mFreeBusyUrlEmailMap
.
insert
(
freeBusyUrlForEmail
,
email
);
auto
*
job
=
new
FreeBusyDownloadJob
(
freeBusyUrlForEmail
,
mParentWidgetForRetrieval
);
auto
job
=
new
FreeBusyDownloadJob
(
freeBusyUrlForEmail
,
mParentWidgetForRetrieval
);
q
->
connect
(
job
,
&
FreeBusyDownloadJob
::
result
,
this
,
[
this
](
KJob
*
job
)
{
processFreeBusyDownloadResult
(
job
);
});
...
...
@@ -885,7 +885,7 @@ void FreeBusyManager::mailFreeBusy(int daysToPublish, QWidget *parentWidget)
QPointer
<
PublishDialog
>
publishdlg
=
new
PublishDialog
();
if
(
publishdlg
->
exec
()
==
QDialog
::
Accepted
)
{
// Send the mail
auto
*
scheduler
=
new
MailScheduler
(
/*factory=*/
nullptr
,
this
);
auto
scheduler
=
new
MailScheduler
(
/*factory=*/
nullptr
,
this
);
connect
(
scheduler
,
&
Scheduler
::
transactionFinished
,
d
,
&
FreeBusyManagerPrivate
::
processMailSchedulerResult
);
d
->
mParentWidgetForMailling
=
parentWidget
;
...
...
src/history_p.h
View file @
6f934c2a
...
...
@@ -32,8 +32,8 @@ class Entry : public QObject
{
Q_OBJECT
public:
typedef
QSharedPointer
<
Entry
>
Ptr
;