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
Commits
ddd7758e
Commit
ddd7758e
authored
Feb 04, 2021
by
Laurent Montel
😁
Browse files
Use auto vs auto * where it's possible
parent
f1691089
Pipeline
#49703
skipped
Changes
143
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
autotests/libs/attributefactorytest.cpp
View file @
ddd7758e
...
...
@@ -36,7 +36,7 @@ void AttributeFactoryTest::testUnknownAttribute()
Item
item
;
item
.
setMimeType
(
QStringLiteral
(
"text/directory"
));
item
.
setPayload
<
QByteArray
>
(
"payload"
);
auto
*
ta
=
new
TestAttribute
;
auto
ta
=
new
TestAttribute
;
{
auto
*
created
=
AttributeFactory
::
createAttribute
(
ta
->
type
());
// DefaultAttribute
QVERIFY
(
created
!=
nullptr
);
...
...
@@ -44,11 +44,11 @@ void AttributeFactoryTest::testUnknownAttribute()
}
ta
->
data
=
"lalala"
;
item
.
addAttribute
(
ta
);
auto
*
cjob
=
new
ItemCreateJob
(
item
,
res1
);
auto
cjob
=
new
ItemCreateJob
(
item
,
res1
);
AKVERIFYEXEC
(
cjob
);
int
id
=
cjob
->
item
().
id
();
item
=
Item
(
id
);
auto
*
fjob
=
new
ItemFetchJob
(
item
);
auto
fjob
=
new
ItemFetchJob
(
item
);
fjob
->
fetchScope
().
fetchFullPayload
();
fjob
->
fetchScope
().
fetchAllAttributes
();
AKVERIFYEXEC
(
fjob
);
...
...
@@ -66,7 +66,7 @@ void AttributeFactoryTest::testRegisteredAttribute()
Item
item
;
item
.
setMimeType
(
QStringLiteral
(
"text/directory"
));
item
.
setPayload
<
QByteArray
>
(
"payload"
);
auto
*
ta
=
new
TestAttribute
;
auto
ta
=
new
TestAttribute
;
{
auto
*
created
=
AttributeFactory
::
createAttribute
(
ta
->
type
());
QVERIFY
(
created
!=
nullptr
);
...
...
@@ -74,11 +74,11 @@ void AttributeFactoryTest::testRegisteredAttribute()
}
ta
->
data
=
"lalala"
;
item
.
addAttribute
(
ta
);
auto
*
cjob
=
new
ItemCreateJob
(
item
,
res1
);
auto
cjob
=
new
ItemCreateJob
(
item
,
res1
);
AKVERIFYEXEC
(
cjob
);
int
id
=
cjob
->
item
().
id
();
item
=
Item
(
id
);
auto
*
fjob
=
new
ItemFetchJob
(
item
);
auto
fjob
=
new
ItemFetchJob
(
item
);
fjob
->
fetchScope
().
fetchFullPayload
();
fjob
->
fetchScope
().
fetchAllAttributes
();
AKVERIFYEXEC
(
fjob
);
...
...
autotests/libs/autoincrementtest.cpp
View file @
ddd7758e
...
...
@@ -67,7 +67,7 @@ void AutoIncrementTest::testItemAutoIncrement()
// Delete the 20 items
for
(
const
Item
&
item
:
qAsConst
(
itemsToDelete
))
{
auto
*
job
=
new
ItemDeleteJob
(
item
);
auto
job
=
new
ItemDeleteJob
(
item
);
AKVERIFYEXEC
(
job
);
}
...
...
@@ -98,7 +98,7 @@ void AutoIncrementTest::testCollectionAutoIncrement()
// Delete the 20 collections
for
(
const
Collection
&
collection
:
qAsConst
(
collectionsToDelete
))
{
auto
*
job
=
new
CollectionDeleteJob
(
collection
);
auto
job
=
new
CollectionDeleteJob
(
collection
);
AKVERIFYEXEC
(
job
);
}
...
...
autotests/libs/cachetest.cpp
View file @
ddd7758e
...
...
@@ -44,7 +44,7 @@ private Q_SLOTS:
enableAgent
(
QStringLiteral
(
"akonadi_knut_resource_0"
),
false
);
auto
*
fetch
=
new
ItemFetchJob
(
col
,
this
);
auto
fetch
=
new
ItemFetchJob
(
col
,
this
);
fetch
->
fetchScope
().
fetchFullPayload
(
true
);
QVERIFY
(
!
fetch
->
exec
());
}
...
...
@@ -63,7 +63,7 @@ private Q_SLOTS:
QFETCH
(
Item
,
item
);
QFETCH
(
bool
,
resourceEnabled
);
auto
*
fetch
=
new
ItemFetchJob
(
item
,
this
);
auto
fetch
=
new
ItemFetchJob
(
item
,
this
);
fetch
->
fetchScope
().
fetchFullPayload
();
fetch
->
fetchScope
().
setCacheOnly
(
true
);
AKVERIFYEXEC
(
fetch
);
...
...
@@ -109,7 +109,7 @@ private Q_SLOTS:
QFETCH
(
Item
,
item
);
QFETCH
(
bool
,
resourceEnabled
);
auto
*
fetch
=
new
ItemFetchJob
(
item
,
this
);
auto
fetch
=
new
ItemFetchJob
(
item
,
this
);
fetch
->
fetchScope
().
fetchFullPayload
();
fetch
->
fetchScope
().
setCacheOnly
(
true
);
AKVERIFYEXEC
(
fetch
);
...
...
@@ -123,7 +123,7 @@ private Q_SLOTS:
Collection
dest
(
AkonadiTest
::
collectionIdFromPath
(
QStringLiteral
(
"res3"
)));
QVERIFY
(
dest
.
isValid
());
auto
*
copy
=
new
ItemCopyJob
(
item
,
dest
,
this
);
auto
copy
=
new
ItemCopyJob
(
item
,
dest
,
this
);
QCOMPARE
(
copy
->
exec
(),
resourceEnabled
);
fetch
=
new
ItemFetchJob
(
item
,
this
);
...
...
autotests/libs/changerecordertest.cpp
View file @
ddd7758e
...
...
@@ -110,7 +110,7 @@ private:
Item
item
(
uid
);
auto
*
attr
=
item
.
attribute
<
TestAttribute
>
(
Item
::
AddIfMissing
);
attr
->
data
=
QByteArray
::
number
(
++
s_num
);
auto
*
job
=
new
ItemModifyJob
(
item
);
auto
job
=
new
ItemModifyJob
(
item
);
job
->
disableRevisionCheck
();
AKVERIFYEXEC
(
job
);
}
...
...
@@ -118,7 +118,7 @@ private:
void
triggerDelete
(
Akonadi
::
Item
::
Id
uid
)
{
Item
item
(
uid
);
auto
*
job
=
new
ItemDeleteJob
(
item
);
auto
job
=
new
ItemDeleteJob
(
item
);
AKVERIFYEXEC
(
job
);
}
...
...
@@ -164,7 +164,7 @@ private:
rec
->
itemFetchScope
().
setCacheOnly
(
true
);
// Ensure we listen to a signal, otherwise MonitorPrivate::isLazilyIgnored will ignore notifications
auto
*
spy
=
new
QSignalSpy
(
rec
.
get
(),
&
Monitor
::
itemChanged
);
auto
spy
=
new
QSignalSpy
(
rec
.
get
(),
&
Monitor
::
itemChanged
);
spy
->
setParent
(
rec
.
get
());
QSignalSpy
readySpy
(
rec
.
get
(),
&
Monitor
::
monitorReady
);
...
...
autotests/libs/collectionattributetest.cpp
View file @
ddd7758e
...
...
@@ -100,20 +100,20 @@ void CollectionAttributeTest::testAttributes()
~
Cleanup
()
{
// cleanup
auto
*
del
=
new
CollectionDeleteJob
(
m_col
);
auto
del
=
new
CollectionDeleteJob
(
m_col
);
AKVERIFYEXEC
(
del
);
}
Collection
m_col
;
};
// add a custom attribute
auto
*
attr
=
new
TestAttribute
();
auto
attr
=
new
TestAttribute
();
attr
->
deserialize
(
attr1
);
Collection
col
;
col
.
setName
(
QStringLiteral
(
"attribute test"
));
col
.
setParentCollection
(
Collection
(
parentColId
));
col
.
addAttribute
(
attr
);
auto
*
create
=
new
CollectionCreateJob
(
col
,
this
);
auto
create
=
new
CollectionCreateJob
(
col
,
this
);
AKVERIFYEXEC
(
create
);
col
=
create
->
collection
();
QVERIFY
(
col
.
isValid
());
...
...
@@ -123,7 +123,7 @@ void CollectionAttributeTest::testAttributes()
QVERIFY
(
attr
!=
nullptr
);
QCOMPARE
(
attr
->
serialized
(),
QByteArray
(
attr1
));
auto
*
list
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
,
this
);
auto
list
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
,
this
);
AKVERIFYEXEC
(
list
);
QCOMPARE
(
list
->
collections
().
count
(),
1
);
col
=
list
->
collections
().
at
(
0
);
...
...
@@ -133,7 +133,7 @@ void CollectionAttributeTest::testAttributes()
QVERIFY
(
attr
!=
nullptr
);
QCOMPARE
(
attr
->
serialized
(),
QByteArray
(
attr1
));
auto
*
attrB
=
new
TestAttribute
();
auto
attrB
=
new
TestAttribute
();
attrB
->
deserialize
(
attr2
);
col
.
addAttribute
(
attrB
);
attrB
=
col
.
attribute
<
TestAttribute
>
();
...
...
@@ -151,7 +151,7 @@ void CollectionAttributeTest::testAttributes()
// modify a custom attribute
col
.
attribute
<
TestAttribute
>
(
Collection
::
AddIfMissing
)
->
deserialize
(
attr2
);
auto
*
modify
=
new
CollectionModifyJob
(
col
,
this
);
auto
modify
=
new
CollectionModifyJob
(
col
,
this
);
AKVERIFYEXEC
(
modify
);
list
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
,
this
);
...
...
autotests/libs/collectioncolorattributetest.cpp
View file @
ddd7758e
...
...
@@ -37,7 +37,7 @@ private Q_SLOTS:
QFETCH
(
QColor
,
color
);
QFETCH
(
QByteArray
,
output
);
auto
*
attr
=
new
CollectionColorAttribute
();
auto
attr
=
new
CollectionColorAttribute
();
attr
->
deserialize
(
input
);
QCOMPARE
(
attr
->
color
(),
color
);
...
...
autotests/libs/collectioncopytest.cpp
View file @
ddd7758e
...
...
@@ -43,7 +43,7 @@ private Q_SLOTS:
QVERIFY
(
source
.
isValid
());
// obtain reference listing
auto
*
fetch
=
new
CollectionFetchJob
(
source
,
CollectionFetchJob
::
Base
);
auto
fetch
=
new
CollectionFetchJob
(
source
,
CollectionFetchJob
::
Base
);
AKVERIFYEXEC
(
fetch
);
QCOMPARE
(
fetch
->
collections
().
count
(),
1
);
source
=
fetch
->
collections
().
first
();
...
...
@@ -55,17 +55,17 @@ private Q_SLOTS:
Collection
::
List
cols
=
fetch
->
collections
();
cols
<<
source
;
for
(
const
Collection
&
c
:
qAsConst
(
cols
))
{
auto
*
job
=
new
ItemFetchJob
(
c
,
this
);
auto
job
=
new
ItemFetchJob
(
c
,
this
);
AKVERIFYEXEC
(
job
);
referenceData
.
insert
(
c
,
job
->
items
());
}
// actually copy the collection
auto
*
copy
=
new
CollectionCopyJob
(
source
,
target
);
auto
copy
=
new
CollectionCopyJob
(
source
,
target
);
AKVERIFYEXEC
(
copy
);
// list destination and check if everything has arrived
auto
*
list
=
new
CollectionFetchJob
(
target
,
CollectionFetchJob
::
Recursive
);
auto
list
=
new
CollectionFetchJob
(
target
,
CollectionFetchJob
::
Recursive
);
AKVERIFYEXEC
(
list
);
cols
=
list
->
collections
();
QCOMPARE
(
cols
.
count
(),
referenceData
.
count
());
...
...
@@ -81,7 +81,7 @@ private Q_SLOTS:
QVERIFY
(
col
.
isValid
());
QCOMPARE
(
col
.
resource
(),
QStringLiteral
(
"akonadi_knut_resource_2"
));
QVERIFY
(
col
.
remoteId
().
isEmpty
());
auto
*
job
=
new
ItemFetchJob
(
col
,
this
);
auto
job
=
new
ItemFetchJob
(
col
,
this
);
job
->
fetchScope
().
fetchFullPayload
();
job
->
fetchScope
().
setCacheOnly
(
true
);
AKVERIFYEXEC
(
job
);
...
...
autotests/libs/collectioncreatetest.cpp
View file @
ddd7758e
...
...
@@ -34,7 +34,7 @@ private Q_SLOTS:
col
.
setParentCollection
(
Collection
(
AkonadiTest
::
collectionIdFromPath
(
QLatin1String
(
"res1"
))));
col
.
setRights
(
Collection
::
AllRights
);
auto
*
cj
=
new
CollectionCreateJob
(
col
,
this
);
auto
cj
=
new
CollectionCreateJob
(
col
,
this
);
AKVERIFYEXEC
(
cj
);
col
=
cj
->
collection
();
QVERIFY
(
col
.
isValid
());
...
...
@@ -43,7 +43,7 @@ private Q_SLOTS:
auto
ntfCol
=
spy
.
at
(
0
).
at
(
0
).
value
<
Collection
>
();
QCOMPARE
(
col
,
ntfCol
);
auto
*
dj
=
new
CollectionDeleteJob
(
col
,
this
);
auto
dj
=
new
CollectionDeleteJob
(
col
,
this
);
AKVERIFYEXEC
(
dj
);
}
};
...
...
autotests/libs/collectionjobtest.cpp
View file @
ddd7758e
...
...
@@ -176,7 +176,7 @@ void CollectionJobTest::testSignalOrder()
Akonadi
::
Collection
::
List
toFetch
;
toFetch
<<
Collection
(
res1ColId
);
toFetch
<<
Collection
(
res2ColId
);
auto
*
job
=
new
CollectionFetchJob
(
toFetch
,
CollectionFetchJob
::
Recursive
);
auto
job
=
new
CollectionFetchJob
(
toFetch
,
CollectionFetchJob
::
Recursive
);
ResultSignalTester
spy
;
connect
(
job
,
&
CollectionFetchJob
::
collectionsReceived
,
&
spy
,
&
ResultSignalTester
::
onCollectionsReceived
);
connect
(
job
,
&
KJob
::
result
,
&
spy
,
&
ResultSignalTester
::
onCollectionRetrievalDone
);
...
...
@@ -339,7 +339,7 @@ void CollectionJobTest::testCreateDeleteFolder()
QFETCH
(
Collection
,
collection
);
QFETCH
(
bool
,
creatable
);
auto
*
createJob
=
new
CollectionCreateJob
(
collection
,
this
);
auto
createJob
=
new
CollectionCreateJob
(
collection
,
this
);
QCOMPARE
(
createJob
->
exec
(),
creatable
);
if
(
!
creatable
)
{
return
;
...
...
@@ -352,7 +352,7 @@ void CollectionJobTest::testCreateDeleteFolder()
QCOMPARE
(
createdCol
.
remoteId
(),
collection
.
remoteId
());
QCOMPARE
(
createdCol
.
cachePolicy
(),
collection
.
cachePolicy
());
auto
*
listJob
=
new
CollectionFetchJob
(
collection
.
parentCollection
(),
CollectionFetchJob
::
FirstLevel
,
this
);
auto
listJob
=
new
CollectionFetchJob
(
collection
.
parentCollection
(),
CollectionFetchJob
::
FirstLevel
,
this
);
AKVERIFYEXEC
(
listJob
);
Collection
listedCol
=
findCol
(
listJob
->
collections
(),
collection
.
name
());
QCOMPARE
(
listedCol
,
createdCol
);
...
...
@@ -362,7 +362,7 @@ void CollectionJobTest::testCreateDeleteFolder()
// fetch parent to compare inherited collection properties
Collection
parentCol
=
Collection
::
root
();
if
(
collection
.
parentCollection
().
isValid
())
{
auto
*
listJob
=
new
CollectionFetchJob
(
collection
.
parentCollection
(),
CollectionFetchJob
::
Base
,
this
);
auto
listJob
=
new
CollectionFetchJob
(
collection
.
parentCollection
(),
CollectionFetchJob
::
Base
,
this
);
AKVERIFYEXEC
(
listJob
);
QCOMPARE
(
listJob
->
collections
().
count
(),
1
);
parentCol
=
listJob
->
collections
().
first
();
...
...
@@ -380,7 +380,7 @@ void CollectionJobTest::testCreateDeleteFolder()
QCOMPARE
(
listedCol
.
resource
(),
collection
.
resource
());
}
auto
*
delJob
=
new
CollectionDeleteJob
(
createdCol
,
this
);
auto
delJob
=
new
CollectionDeleteJob
(
createdCol
,
this
);
AKVERIFYEXEC
(
delJob
);
listJob
=
new
CollectionFetchJob
(
collection
.
parentCollection
(),
CollectionFetchJob
::
FirstLevel
,
this
);
...
...
@@ -454,10 +454,10 @@ void CollectionJobTest::testModify()
RESET_COLLECTION_ID
;
// test noop modify
auto
*
mod
=
new
CollectionModifyJob
(
col
,
this
);
auto
mod
=
new
CollectionModifyJob
(
col
,
this
);
AKVERIFYEXEC
(
mod
);
auto
*
ljob
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
,
this
);
auto
ljob
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
,
this
);
AKVERIFYEXEC
(
ljob
);
QCOMPARE
(
ljob
->
collections
().
count
(),
1
);
col
=
ljob
->
collections
().
first
();
...
...
@@ -534,7 +534,7 @@ void CollectionJobTest::testIllegalModify()
// non-existing collection
Collection
col
(
INT_MAX
);
col
.
parentCollection
().
setId
(
res1ColId
);
auto
*
mod
=
new
CollectionModifyJob
(
col
,
this
);
auto
mod
=
new
CollectionModifyJob
(
col
,
this
);
QVERIFY
(
!
mod
->
exec
());
// rename to already existing name
...
...
@@ -561,7 +561,7 @@ void CollectionJobTest::testUtf8CollectionName()
Collection
col
;
col
.
parentCollection
().
setId
(
res3ColId
);
col
.
setName
(
folderName
);
auto
*
create
=
new
CollectionCreateJob
(
col
,
this
);
auto
create
=
new
CollectionCreateJob
(
col
,
this
);
AKVERIFYEXEC
(
create
);
col
=
create
->
collection
();
QVERIFY
(
col
.
isValid
());
...
...
@@ -576,18 +576,18 @@ void CollectionJobTest::testUtf8CollectionName()
// modify collection
col
.
setContentMimeTypes
({
QStringLiteral
(
"message/rfc822"
)});
auto
*
modify
=
new
CollectionModifyJob
(
col
,
this
);
auto
modify
=
new
CollectionModifyJob
(
col
,
this
);
AKVERIFYEXEC
(
modify
);
// collection statistics
auto
*
statistics
=
new
CollectionStatisticsJob
(
col
,
this
);
auto
statistics
=
new
CollectionStatisticsJob
(
col
,
this
);
AKVERIFYEXEC
(
statistics
);
CollectionStatistics
s
=
statistics
->
statistics
();
QCOMPARE
(
s
.
count
(),
0LL
);
QCOMPARE
(
s
.
unreadCount
(),
0LL
);
// delete collection
auto
*
del
=
new
CollectionDeleteJob
(
col
,
this
);
auto
del
=
new
CollectionDeleteJob
(
col
,
this
);
AKVERIFYEXEC
(
del
);
}
...
...
@@ -595,7 +595,7 @@ void CollectionJobTest::testMultiList()
{
Collection
::
List
req
;
req
<<
Collection
(
res1ColId
)
<<
Collection
(
res2ColId
);
auto
*
job
=
new
CollectionFetchJob
(
req
,
this
);
auto
job
=
new
CollectionFetchJob
(
req
,
this
);
AKVERIFYEXEC
(
job
);
Collection
::
List
res
;
...
...
@@ -607,7 +607,7 @@ void CollectionJobTest::testMultiListInvalid()
{
Collection
::
List
req
;
req
<<
Collection
(
res1ColId
)
<<
Collection
(
1234567
)
<<
Collection
(
res2ColId
);
auto
*
job
=
new
CollectionFetchJob
(
req
,
this
);
auto
job
=
new
CollectionFetchJob
(
req
,
this
);
QVERIFY
(
!
job
->
exec
());
// not all available collections are fetched
QVERIFY
(
job
->
collections
().
count
()
!=
2
);
...
...
@@ -626,7 +626,7 @@ void CollectionJobTest::testRecursiveMultiList()
Akonadi
::
Collection
::
List
toFetch
;
toFetch
<<
Collection
(
res1ColId
);
toFetch
<<
Collection
(
res2ColId
);
auto
*
job
=
new
CollectionFetchJob
(
toFetch
,
CollectionFetchJob
::
Recursive
);
auto
job
=
new
CollectionFetchJob
(
toFetch
,
CollectionFetchJob
::
Recursive
);
QSignalSpy
spy
(
job
,
&
CollectionFetchJob
::
collectionsReceived
);
QVERIFY
(
spy
.
isValid
());
AKVERIFYEXEC
(
job
);
...
...
@@ -658,7 +658,7 @@ void CollectionJobTest::testNonOverlappingRootList()
Akonadi
::
Collection
::
List
toFetch
;
toFetch
<<
Collection
(
res1ColId
);
toFetch
<<
Collection
(
res2ColId
);
auto
*
job
=
new
CollectionFetchJob
(
toFetch
,
CollectionFetchJob
::
NonOverlappingRoots
);
auto
job
=
new
CollectionFetchJob
(
toFetch
,
CollectionFetchJob
::
NonOverlappingRoots
);
QSignalSpy
spy
(
job
,
&
CollectionFetchJob
::
collectionsReceived
);
QVERIFY
(
spy
.
isValid
());
AKVERIFYEXEC
(
job
);
...
...
@@ -687,7 +687,7 @@ void CollectionJobTest::testRidFetch()
Collection
col
;
col
.
setRemoteId
(
QStringLiteral
(
"10"
));
auto
*
job
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
,
this
);
auto
job
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
,
this
);
job
->
fetchScope
().
setResource
(
QStringLiteral
(
"akonadi_knut_resource_0"
));
AKVERIFYEXEC
(
job
);
QCOMPARE
(
job
->
collections
().
count
(),
1
);
...
...
@@ -715,7 +715,7 @@ void CollectionJobTest::testRidCreateDelete()
ResourceSelectJob
*
resSel
=
new
ResourceSelectJob
(
QStringLiteral
(
"akonadi_knut_resource_2"
));
AKVERIFYEXEC
(
resSel
);
auto
*
createJob
=
new
CollectionCreateJob
(
collection
,
this
);
auto
createJob
=
new
CollectionCreateJob
(
collection
,
this
);
AKVERIFYEXEC
(
createJob
);
Collection
createdCol
=
createJob
->
collection
();
...
...
@@ -729,7 +729,7 @@ void CollectionJobTest::testRidCreateDelete()
QCOMPARE
(
listedCol
.
name
(),
collection
.
name
());
QVERIFY
(
!
collection
.
isValid
());
auto
*
delJob
=
new
CollectionDeleteJob
(
collection
,
this
);
auto
delJob
=
new
CollectionDeleteJob
(
collection
,
this
);
AKVERIFYEXEC
(
delJob
);
listJob
=
new
CollectionFetchJob
(
Collection
(
res3ColId
),
CollectionFetchJob
::
FirstLevel
,
this
);
...
...
@@ -742,7 +742,7 @@ void CollectionJobTest::testAncestorRetrieval()
Collection
col
;
col
.
setRemoteId
(
QStringLiteral
(
"10"
));
auto
*
job
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
,
this
);
auto
job
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
,
this
);
job
->
fetchScope
().
setResource
(
QStringLiteral
(
"akonadi_knut_resource_0"
));
job
->
fetchScope
().
setAncestorRetrieval
(
CollectionFetchScope
::
All
);
AKVERIFYEXEC
(
job
);
...
...
@@ -772,7 +772,7 @@ void CollectionJobTest::testAncestorAttributeRetrieval()
baseCol
.
setParentCollection
(
Akonadi
::
Collection
(
res1ColId
));
baseCol
.
setName
(
QStringLiteral
(
"base"
));
baseCol
.
attribute
<
TestAttribute
>
(
Collection
::
AddIfMissing
)
->
data
=
"new"
;
auto
*
create
=
new
Akonadi
::
CollectionCreateJob
(
baseCol
);
auto
create
=
new
Akonadi
::
CollectionCreateJob
(
baseCol
);
AKVERIFYEXEC
(
create
);
baseCol
=
create
->
collection
();
}
...
...
@@ -780,7 +780,7 @@ void CollectionJobTest::testAncestorAttributeRetrieval()
Akonadi
::
Collection
col
;
col
.
setParentCollection
(
baseCol
);
col
.
setName
(
QStringLiteral
(
"enabled"
));
auto
*
create
=
new
Akonadi
::
CollectionCreateJob
(
col
);
auto
create
=
new
Akonadi
::
CollectionCreateJob
(
col
);
AKVERIFYEXEC
(
create
);
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
create
->
collection
(),
CollectionFetchJob
::
Base
);
...
...
@@ -793,7 +793,7 @@ void CollectionJobTest::testAncestorAttributeRetrieval()
}
// Cleanup
auto
*
deleteJob
=
new
CollectionDeleteJob
(
baseCol
);
auto
deleteJob
=
new
CollectionDeleteJob
(
baseCol
);
AKVERIFYEXEC
(
deleteJob
);
}
...
...
@@ -803,7 +803,7 @@ void CollectionJobTest::testListPreference()
{
baseCol
.
setParentCollection
(
Akonadi
::
Collection
(
res1ColId
));
baseCol
.
setName
(
QStringLiteral
(
"base"
));
auto
*
create
=
new
Akonadi
::
CollectionCreateJob
(
baseCol
);
auto
create
=
new
Akonadi
::
CollectionCreateJob
(
baseCol
);
AKVERIFYEXEC
(
create
);
baseCol
=
create
->
collection
();
}
...
...
@@ -812,7 +812,7 @@ void CollectionJobTest::testListPreference()
col
.
setParentCollection
(
baseCol
);
col
.
setEnabled
(
true
);
col
.
setName
(
QStringLiteral
(
"enabled"
));
auto
*
create
=
new
Akonadi
::
CollectionCreateJob
(
col
);
auto
create
=
new
Akonadi
::
CollectionCreateJob
(
col
);
AKVERIFYEXEC
(
create
);
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
create
->
collection
(),
CollectionFetchJob
::
Base
);
...
...
@@ -831,7 +831,7 @@ void CollectionJobTest::testListPreference()
col
.
setLocalListPreference
(
Collection
::
ListDisplay
,
Collection
::
ListDisabled
);
col
.
setLocalListPreference
(
Collection
::
ListSync
,
Collection
::
ListDisabled
);
col
.
setLocalListPreference
(
Collection
::
ListIndex
,
Collection
::
ListDisabled
);
auto
*
create
=
new
Akonadi
::
CollectionCreateJob
(
col
);
auto
create
=
new
Akonadi
::
CollectionCreateJob
(
col
);
AKVERIFYEXEC
(
create
);
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
create
->
collection
(),
CollectionFetchJob
::
Base
);
AKVERIFYEXEC
(
job
);
...
...
@@ -849,7 +849,7 @@ void CollectionJobTest::testListPreference()
col
.
setLocalListPreference
(
Collection
::
ListDisplay
,
Collection
::
ListEnabled
);
col
.
setLocalListPreference
(
Collection
::
ListSync
,
Collection
::
ListEnabled
);
col
.
setLocalListPreference
(
Collection
::
ListIndex
,
Collection
::
ListEnabled
);
auto
*
create
=
new
Akonadi
::
CollectionCreateJob
(
col
);
auto
create
=
new
Akonadi
::
CollectionCreateJob
(
col
);
AKVERIFYEXEC
(
create
);
CollectionFetchJob
*
job
=
new
CollectionFetchJob
(
create
->
collection
(),
CollectionFetchJob
::
Base
);
AKVERIFYEXEC
(
job
);
...
...
@@ -862,32 +862,32 @@ void CollectionJobTest::testListPreference()
// Check list filter
{
auto
*
job
=
new
CollectionFetchJob
(
baseCol
,
CollectionFetchJob
::
FirstLevel
);
auto
job
=
new
CollectionFetchJob
(
baseCol
,
CollectionFetchJob
::
FirstLevel
);
job
->
fetchScope
().
setListFilter
(
CollectionFetchScope
::
Display
);
AKVERIFYEXEC
(
job
);
QCOMPARE
(
job
->
collections
().
size
(),
2
);
}
{
auto
*
job
=
new
CollectionFetchJob
(
baseCol
,
CollectionFetchJob
::
FirstLevel
);
auto
job
=
new
CollectionFetchJob
(
baseCol
,
CollectionFetchJob
::
FirstLevel
);
job
->
fetchScope
().
setListFilter
(
CollectionFetchScope
::
Sync
);
AKVERIFYEXEC
(
job
);
QCOMPARE
(
job
->
collections
().
size
(),
2
);
}
{
auto
*
job
=
new
CollectionFetchJob
(
baseCol
,
CollectionFetchJob
::
FirstLevel
);
auto
job
=
new
CollectionFetchJob
(
baseCol
,
CollectionFetchJob
::
FirstLevel
);
job
->
fetchScope
().
setListFilter
(
CollectionFetchScope
::
Index
);
AKVERIFYEXEC
(
job
);
QCOMPARE
(
job
->
collections
().
size
(),
2
);
}
{
auto
*
job
=
new
CollectionFetchJob
(
baseCol
,
CollectionFetchJob
::
FirstLevel
);
auto
job
=
new
CollectionFetchJob
(
baseCol
,
CollectionFetchJob
::
FirstLevel
);
job
->
fetchScope
().
setListFilter
(
CollectionFetchScope
::
Enabled
);
AKVERIFYEXEC
(
job
);
QCOMPARE
(
job
->
collections
().
size
(),
2
);
}
// Cleanup
auto
*
deleteJob
=
new
CollectionDeleteJob
(
baseCol
);
auto
deleteJob
=
new
CollectionDeleteJob
(
baseCol
);
AKVERIFYEXEC
(
deleteJob
);
}
...
...
autotests/libs/collectionmodifytest.cpp
View file @
ddd7758e
...
...
@@ -32,7 +32,7 @@ private Q_SLOTS:
col
.
setParentCollection
(
Collection
(
AkonadiTest
::
collectionIdFromPath
(
QLatin1String
(
"res1"
))));
col
.
setRights
(
Collection
::
AllRights
);
auto
*
cj
=
new
CollectionCreateJob
(
col
,
this
);
auto
cj
=
new
CollectionCreateJob
(
col
,
this
);
AKVERIFYEXEC
(
cj
);
col
=
cj
->
collection
();
QVERIFY
(
col
.
isValid
());
...
...
@@ -41,10 +41,10 @@ private Q_SLOTS:
attr
->
setDisplayName
(
QStringLiteral
(
"Test Collection"
));
col
.
setContentMimeTypes
({
Collection
::
mimeType
(),
QLatin1String
(
"application/octet-stream"
)});
auto
*
mj
=
new
CollectionModifyJob
(
col
,
this
);
auto
mj
=
new
CollectionModifyJob
(
col
,
this
);
AKVERIFYEXEC
(
mj
);
auto
*
fj
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
);
auto
fj
=
new
CollectionFetchJob
(
col
,
CollectionFetchJob
::
Base
);
AKVERIFYEXEC
(
fj
);
QCOMPARE
(
fj
->
collections
().
count
(),
1
);
const
Collection
actual
=
fj
->
collections
().
at
(
0
);
...
...
@@ -56,7 +56,7 @@ private Q_SLOTS:
QCOMPARE
(
actual
.
parentCollection
(),
col
.
parentCollection
());
QCOMPARE
(
actual
.
rights
(),
col
.
rights
());
auto
*
dj
=
new
CollectionDeleteJob
(
col
,
this
);
auto
dj
=
new
CollectionDeleteJob
(
col
,
this
);
AKVERIFYEXEC
(
dj
);
}
};
...
...
autotests/libs/collectionmovetest.cpp
View file @
ddd7758e
...
...
@@ -47,7 +47,7 @@ private Q_SLOTS:
QVERIFY
(
source
.
isValid
());
QVERIFY
(
destination
.
isValid
());
auto
*
mod
=
new
CollectionMoveJob
(
source
,
destination
,
this
);
auto
mod
=
new
CollectionMoveJob
(
source
,
destination
,
this
);
QVERIFY
(
!
mod
->
exec
());
}
...
...
@@ -72,7 +72,7 @@ private Q_SLOTS:
QVERIFY
(
source
.
isValid
());
QVERIFY
(
destination
.
isValid
());
auto
*
fetch
=
new
CollectionFetchJob
(
source
,
CollectionFetchJob
::
Base
,
this
);
auto
fetch
=
new
CollectionFetchJob
(
source
,
CollectionFetchJob
::
Base
,
this
);
AKVERIFYEXEC
(
fetch
);
QCOMPARE
(
fetch
->
collections
().
count
(),
1
);
source
=
fetch
->
collections
().
first
();
...
...
@@ -82,17 +82,17 @@ private Q_SLOTS:
AKVERIFYEXEC
(
fetch
);
QHash
<
Collection
,
Item
::
List
>
referenceData
;
foreach
(
const
Collection
&
c
,
fetch
->
collections
())
{
auto
*
job
=
new
ItemFetchJob
(
c
,
this
);
auto
job
=
new
ItemFetchJob
(
c
,
this
);
AKVERIFYEXEC
(
job
);
referenceData
.
insert
(
c
,
job
->
items
());
}
// move collection
auto
*
mod
=
new
CollectionMoveJob
(
source
,
destination
,
this
);
auto
mod
=
new
CollectionMoveJob
(
source
,
destination
,
this
);
AKVERIFYEXEC
(
mod
);
// check if source was modified correctly
auto
*
ljob
=
new
CollectionFetchJob
(
source
,
CollectionFetchJob
::
Base
);
auto
ljob
=
new
CollectionFetchJob
(
source
,
CollectionFetchJob
::
Base
);
AKVERIFYEXEC
(
ljob
);
Collection
::
List
list
=
ljob
->
collections
();
...
...
@@ -114,7 +114,7 @@ private Q_SLOTS:
}
else
{
QCOMPARE
(
list
[
list
.
indexOf
(
it
.
key
())].
resource
(),
it
.
key
().
resource
());
}
auto
*
job
=
new
ItemFetchJob
(
it
.
key
(),
this
);
auto
job
=
new
ItemFetchJob
(
it
.
key
(),
this
);
job
->
fetchScope
().
fetchFullPayload
();
AKVERIFYEXEC
(
job
);
QCOMPARE
(
job
->
items
().
count
(),
it
.
value
().
count
());
...
...
autotests/libs/collectionsynctest.cpp
View file @
ddd7758e
...
...
@@ -120,7 +120,7 @@ private:
}
}
for
(
const
Collection
&
col
:
qAsConst
(
baseCols
))
{
auto
*
del
=
new
CollectionDeleteJob
(
col
);
auto
del
=
new
CollectionDeleteJob
(
col
);
AKVERIFYEXEC
(
del
);
}
}
...
...
@@ -154,7 +154,7 @@ private Q_SLOTS:
Collection
::
List
origCols
=
fetchCollections
(
resource
);
QVERIFY
(
!
origCols
.
isEmpty
());
auto
*
syncer
=
new
CollectionSync
(
resource
,
this
);
auto
syncer
=
new
CollectionSync
(
resource
,
this
);
syncer
->
setHierarchicalRemoteIds
(
hierarchicalRIDs
);