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
94cf64af
Commit
94cf64af
authored
Oct 04, 2021
by
Laurent Montel
😁
Browse files
Fix some cppcheck warnings
parent
2c790067
Pipeline
#84821
failed with stage
in 1 minute and 5 seconds
Changes
11
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
autotests/libs/actionstatemanagertest.cpp
View file @
94cf64af
...
...
@@ -39,8 +39,8 @@ class ActionStateManagerTest : public QObject
public:
ActionStateManagerTest
()
:
rootCollection
(
Collection
::
root
())
{
rootCollection
=
Collection
::
root
();
const
QString
dummyMimeType
(
QStringLiteral
(
"text/dummy"
));
resourceCollectionOne
.
setId
(
1
);
...
...
autotests/libs/collectionjobtest.cpp
View file @
94cf64af
...
...
@@ -364,10 +364,10 @@ void CollectionJobTest::testCreateDeleteFolder()
// fetch parent to compare inherited collection properties
Collection
parentCol
=
Collection
::
root
();
if
(
collection
.
parentCollection
().
isValid
())
{
auto
l
istJob
=
new
CollectionFetchJob
(
collection
.
parentCollection
(),
CollectionFetchJob
::
Base
,
this
);
AKVERIFYEXEC
(
l
istJob
);
QCOMPARE
(
l
istJob
->
collections
().
count
(),
1
);
parentCol
=
l
istJob
->
collections
().
first
();
auto
newL
istJob
=
new
CollectionFetchJob
(
collection
.
parentCollection
(),
CollectionFetchJob
::
Base
,
this
);
AKVERIFYEXEC
(
newL
istJob
);
QCOMPARE
(
newL
istJob
->
collections
().
count
(),
1
);
parentCol
=
newL
istJob
->
collections
().
first
();
}
if
(
collection
.
contentMimeTypes
().
isEmpty
())
{
...
...
autotests/libs/linktest.cpp
View file @
94cf64af
...
...
@@ -88,8 +88,8 @@ private Q_SLOTS:
AKVERIFYEXEC
(
fetch
);
QCOMPARE
(
fetch
->
items
().
count
(),
3
);
const
Item
::
List
fetchedItems
=
fetch
->
items
();
for
(
const
Item
&
i
tem
:
fetchedItems
)
{
QVERIFY
(
items
.
contains
(
i
tem
));
for
(
const
Item
&
fetchedI
tem
:
fetchedItems
)
{
QVERIFY
(
items
.
contains
(
fetchedI
tem
));
}
auto
unlink
=
new
UnlinkJob
(
col
,
items
,
this
);
...
...
autotests/server/fakeintervalcheck.h
View file @
94cf64af
...
...
@@ -20,7 +20,7 @@ class FakeIntervalCheck : public IntervalCheck
{
Q_OBJECT
public:
FakeIntervalCheck
(
ItemRetrievalManager
&
retrievalManager
);
explicit
FakeIntervalCheck
(
ItemRetrievalManager
&
retrievalManager
);
void
waitForInit
();
protected:
...
...
autotests/widgets/subscriptiondialogtest.cpp
View file @
94cf64af
...
...
@@ -144,17 +144,17 @@ class SubscriptionDialogTest : public QObject
QModelIndex
indexForCollection
(
const
Collection
&
col
)
const
{
auto
m
odel
=
collectionView
->
model
();
auto
collectionViewM
odel
=
collectionView
->
model
();
std
::
deque
<
QModelIndex
>
idxQueue
;
idxQueue
.
push_back
(
QModelIndex
{});
while
(
!
idxQueue
.
empty
())
{
const
auto
idx
=
idxQueue
.
front
();
idxQueue
.
pop_front
();
if
(
m
odel
->
data
(
idx
,
EntityTreeModel
::
CollectionIdRole
).
value
<
qint64
>
()
==
col
.
id
())
{
if
(
collectionViewM
odel
->
data
(
idx
,
EntityTreeModel
::
CollectionIdRole
).
value
<
qint64
>
()
==
col
.
id
())
{
return
idx
;
}
for
(
int
i
=
0
;
i
<
m
odel
->
rowCount
(
idx
);
++
i
)
{
idxQueue
.
push_back
(
m
odel
->
index
(
i
,
0
,
idx
));
for
(
int
i
=
0
;
i
<
collectionViewM
odel
->
rowCount
(
idx
);
++
i
)
{
idxQueue
.
push_back
(
collectionViewM
odel
->
index
(
i
,
0
,
idx
));
}
}
return
{};
...
...
autotests/widgets/tageditwidgettest.cpp
View file @
94cf64af
...
...
@@ -92,9 +92,9 @@ class TagEditWidgetTest : public QObject
bool
checkSelectionIsEmpty
()
const
{
auto
*
const
m
odel
=
tagsView
->
model
();
for
(
int
i
=
0
;
i
<
m
odel
->
rowCount
();
++
i
)
{
if
(
m
odel
->
data
(
m
odel
->
index
(
i
,
0
),
Qt
::
CheckStateRole
).
value
<
Qt
::
CheckState
>
()
!=
Qt
::
Unchecked
)
{
auto
*
const
tagViewM
odel
=
tagsView
->
model
();
for
(
int
i
=
0
;
i
<
tagViewM
odel
->
rowCount
();
++
i
)
{
if
(
tagViewM
odel
->
data
(
tagViewM
odel
->
index
(
i
,
0
),
Qt
::
CheckStateRole
).
value
<
Qt
::
CheckState
>
()
!=
Qt
::
Unchecked
)
{
return
false
;
}
}
...
...
src/core/changerecorderjournal.cpp
View file @
94cf64af
...
...
@@ -557,7 +557,7 @@ Protocol::ChangeNotificationPtr ChangeRecorderJournalReader::loadCollectionNotif
collection
.
setSearchCollections
(
vb
);
stream
>>
entityCnt
;
QVector
<
Protocol
::
Ancestor
>
ancestors
;
for
(
int
i
=
0
;
i
<
entityCnt
;
++
i
)
{
for
(
int
j
=
0
;
j
<
entityCnt
;
++
j
)
{
Protocol
::
Ancestor
ancestor
;
stream
>>
i64
;
ancestor
.
setId
(
i64
);
...
...
src/core/jobs/specialcollectionshelperjobs.cpp
View file @
94cf64af
...
...
@@ -267,15 +267,15 @@ void DefaultResourceJobPrivate::tryFetchResource()
// without updating the config file, in this case search for a resource
// of the same type and the default name
const
AgentInstance
::
List
resources
=
AgentManager
::
self
()
->
instances
();
for
(
const
AgentInstance
&
resource
:
resources
)
{
if
(
resource
.
type
().
identifier
()
==
mDefaultResourceType
)
{
if
(
resource
.
name
()
==
mDefaultResourceOptions
.
value
(
QStringLiteral
(
"Name"
)).
toString
())
{
for
(
const
AgentInstance
&
resource
Instance
:
resources
)
{
if
(
resource
Instance
.
type
().
identifier
()
==
mDefaultResourceType
)
{
if
(
resource
Instance
.
name
()
==
mDefaultResourceOptions
.
value
(
QStringLiteral
(
"Name"
)).
toString
())
{
// found a matching one...
setDefaultResourceId
(
mSettings
,
resource
.
identifier
());
setDefaultResourceId
(
mSettings
,
resource
Instance
.
identifier
());
mSettings
->
save
();
mResourceWasPreexisting
=
true
;
qCDebug
(
AKONADICORE_LOG
)
<<
"Found resource"
<<
resource
.
identifier
();
q
->
setResourceId
(
resource
.
identifier
());
qCDebug
(
AKONADICORE_LOG
)
<<
"Found resource"
<<
resource
Instance
.
identifier
();
q
->
setResourceId
(
resource
Instance
.
identifier
());
q
->
ResourceScanJob
::
doStart
();
return
;
}
...
...
src/core/models/agentfilterproxymodel.cpp
View file @
94cf64af
...
...
@@ -127,9 +127,9 @@ bool AgentFilterProxyModel::filterAcceptsRow(int row, const QModelIndex & /*sour
return
false
;
}
if
(
found
&&
!
d
->
excludeCapabilities
.
isEmpty
())
{
const
QStringList
lst
=
index
.
data
(
AgentTypeModel
::
CapabilitiesRole
).
toStringList
();
for
(
const
QString
&
capability
:
lst
)
{
if
(
!
d
->
excludeCapabilities
.
isEmpty
())
{
const
QStringList
lst
Capabilities
=
index
.
data
(
AgentTypeModel
::
CapabilitiesRole
).
toStringList
();
for
(
const
QString
&
capability
:
lst
Capabilities
)
{
if
(
d
->
excludeCapabilities
.
contains
(
capability
))
{
found
=
false
;
break
;
...
...
src/private/externalpartstorage.cpp
View file @
94cf64af
...
...
@@ -99,8 +99,8 @@ QString ExternalPartStorage::resolveAbsolutePath(const QString &filename, bool *
}
return
legacyPath
;
}
else
{
QFileInfo
f
info
(
path
);
QDir
().
mkpath
(
f
info
.
path
());
QFileInfo
legacyF
info
(
path
);
QDir
().
mkpath
(
legacyF
info
.
path
());
// If neither legacy or new path exists, return the new path, so that
// new items are created in the correct location
return
path
;
...
...
src/server/handler/collectionmodifyhandler.cpp
View file @
94cf64af
...
...
@@ -232,8 +232,8 @@ bool CollectionModifyHandler::parseStream()
return
failureResponse
(
"Unable to retrieve collection attribute"
);
}
const
CollectionAttribute
::
List
attrs
=
qb
.
result
();
if
(
attrs
.
isEmpty
())
{
const
CollectionAttribute
::
List
attrs
List
=
qb
.
result
();
if
(
attrs
List
.
isEmpty
())
{
CollectionAttribute
newAttr
;
newAttr
.
setCollectionId
(
collection
.
id
());
newAttr
.
setType
(
iter
.
key
());
...
...
@@ -242,8 +242,8 @@ bool CollectionModifyHandler::parseStream()
return
failureResponse
(
"Unable to add collection attribute"
);
}
changes
.
append
(
iter
.
key
());
}
else
if
(
attrs
.
size
()
==
1
)
{
CollectionAttribute
currAttr
=
attrs
.
first
();
}
else
if
(
attrs
List
.
size
()
==
1
)
{
CollectionAttribute
currAttr
=
attrs
List
.
first
();
if
(
currAttr
.
value
()
==
iter
.
value
())
{
continue
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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