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
PIM Data Exporter
Commits
9dd40fc3
Commit
9dd40fc3
authored
Oct 01, 2021
by
Laurent Montel
😁
Browse files
Fix cppcheck warnings
parent
447794d6
Pipeline
#84040
passed with stage
in 12 minutes and 3 seconds
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
core/addressbook/importaddressbookjobinterface.cpp
View file @
9dd40fc3
...
...
@@ -209,11 +209,11 @@ void ImportAddressbookJobInterface::restoreResources()
const
KArchiveEntry
*
dataResouceEntry
=
mArchiveDirectory
->
entry
(
dataFile
);
if
(
dataResouceEntry
->
isFile
())
{
const
auto
file
=
const
auto
file
Entry
=
static_cast
<
const
KArchiveFile
*>
(
dataResouceEntry
);
// TODO adapt directory name too
extractZipFile
(
file
,
copyToDirName
,
newUrlInfo
.
path
(),
file
Entry
,
copyToDirName
,
newUrlInfo
.
path
(),
value
.
akonadiConfigFile
.
contains
(
QLatin1String
(
"akonadi_contacts_resource_"
)));
}
...
...
core/alarm/importalarmjobinterface.cpp
View file @
9dd40fc3
...
...
@@ -152,10 +152,10 @@ void ImportAlarmJobInterface::restoreResources()
bool
isDirResource
=
value
.
akonadiConfigFile
.
contains
(
QLatin1String
(
"akonadi_kalarm_dir_resource_"
));
if
(
dataResouceEntry
->
isFile
())
{
const
auto
file
=
const
auto
file
Entry
=
static_cast
<
const
KArchiveFile
*>
(
dataResouceEntry
);
// TODO adapt directory name too
extractZipFile
(
file
,
copyToDirName
,
newUrlInfo
.
path
(),
extractZipFile
(
file
Entry
,
copyToDirName
,
newUrlInfo
.
path
(),
isDirResource
);
}
settings
.
insert
(
QStringLiteral
(
"Path"
),
newUrl
);
...
...
core/autotests/generatelistfilefromarchive.cpp
View file @
9dd40fc3
...
...
@@ -66,17 +66,17 @@ void GenerateListFileFromArchive::addSubItems(const QString &topLevelPath, const
const
QString
space
=
QString
(
indent
*
2
,
QLatin1Char
(
' '
));
const
QStringList
lst
=
dir
->
entries
();
for
(
const
QString
&
entryName
:
lst
)
{
const
KArchiveEntry
*
e
ntry
=
dir
->
entry
(
entryName
);
if
(
e
ntry
)
{
if
(
e
ntry
->
isDirectory
())
{
const
auto
dirEntry
=
static_cast
<
const
KArchiveDirectory
*>
(
e
ntry
);
const
KArchiveEntry
*
archiveE
ntry
=
dir
->
entry
(
entryName
);
if
(
archiveE
ntry
)
{
if
(
archiveE
ntry
->
isDirectory
())
{
const
auto
dirEntry
=
static_cast
<
const
KArchiveDirectory
*>
(
archiveE
ntry
);
// mListFile += space + dirEntry->name();
addSubItems
(
topLevelPath
,
e
ntry
,
indent
,
topLevelPath
,
archiveE
ntry
,
indent
,
(
fullpath
.
isEmpty
()
?
QString
()
:
fullpath
+
QLatin1Char
(
'/'
))
+
dirEntry
->
name
());
}
else
if
(
e
ntry
->
isFile
())
{
const
auto
file
=
static_cast
<
const
KArchiveFile
*>
(
e
ntry
);
}
else
if
(
archiveE
ntry
->
isFile
())
{
const
auto
file
=
static_cast
<
const
KArchiveFile
*>
(
archiveE
ntry
);
const
QString
fileFullPath
=
topLevelPath
+
(
fullpath
.
isEmpty
()
?
QString
()
:
fullpath
+
QLatin1Char
(
'/'
))
+
...
...
core/autotests/testexportfile.cpp
View file @
9dd40fc3
...
...
@@ -18,8 +18,8 @@
TestExportFile
::
TestExportFile
(
QObject
*
parent
)
:
QObject
(
parent
)
,
mTemporaryFile
(
QDir
::
tempPath
()
+
QStringLiteral
(
"/archive.zip"
))
{
mTemporaryFile
=
QDir
::
tempPath
()
+
QStringLiteral
(
"/archive.zip"
);
mArchiveStorage
=
new
ArchiveStorage
(
mTemporaryFile
,
this
);
Q_ASSERT
(
mArchiveStorage
->
openArchive
(
true
));
}
...
...
core/calendar/importcalendarjobinterface.cpp
View file @
9dd40fc3
...
...
@@ -306,11 +306,11 @@ void ImportCalendarJobInterface::restoreResources()
bool
isDirResource
=
value
.
akonadiConfigFile
.
contains
(
QLatin1String
(
"akonadi_icaldir_resource_"
));
if
(
dataResouceEntry
->
isFile
())
{
const
auto
file
=
const
auto
file
Entry
=
static_cast
<
const
KArchiveFile
*>
(
dataResouceEntry
);
// TODO adapt directory name too
extractZipFile
(
file
,
copyToDirName
,
newUrlInfo
.
path
(),
file
Entry
,
copyToDirName
,
newUrlInfo
.
path
(),
value
.
akonadiConfigFile
.
contains
(
QLatin1String
(
"akonadi_icaldir_resource_"
)));
}
...
...
@@ -320,10 +320,10 @@ void ImportCalendarJobInterface::restoreResources()
if
(
!
agentConfigFile
.
isEmpty
())
{
const
KArchiveEntry
*
akonadiAgentConfigEntry
=
mArchiveDirectory
->
entry
(
agentConfigFile
);
if
(
akonadiAgentConfigEntry
->
isFile
())
{
const
auto
file
=
static_cast
<
const
KArchiveFile
*>
(
const
auto
file
Entry
=
static_cast
<
const
KArchiveFile
*>
(
akonadiAgentConfigEntry
);
copyArchiveFileTo
(
file
,
copyToDirName
);
resourceName
=
file
->
name
();
copyArchiveFileTo
(
file
Entry
,
copyToDirName
);
resourceName
=
file
Entry
->
name
();
filename
=
Utils
::
akonadiAgentName
(
copyToDirName
+
QLatin1Char
(
'/'
)
+
resourceName
);
}
...
...
core/mail/importmailjobinterface.cpp
View file @
9dd40fc3
...
...
@@ -106,12 +106,12 @@ void ImportMailJobInterface::storeMailArchiveResource(const KArchiveDirectory *d
if
(
entry
&&
entry
->
isDirectory
())
{
const
auto
resourceDir
=
static_cast
<
const
KArchiveDirectory
*>
(
entry
);
const
QStringList
lst
=
resourceDir
->
entries
();
if
(
lst
.
count
()
>=
2
)
{
const
QStringList
lst
ResourceDirEntries
=
resourceDir
->
entries
();
if
(
lst
ResourceDirEntries
.
count
()
>=
2
)
{
const
QString
archPath
(
prefix
+
QLatin1Char
(
'/'
)
+
entryName
+
QLatin1Char
(
'/'
));
ResourceFiles
files
;
for
(
const
QString
&
name
:
lst
)
{
for
(
const
QString
&
name
:
lst
ResourceDirEntries
)
{
if
(
name
.
endsWith
(
QLatin1String
(
"rc"
))
&&
(
name
.
contains
(
QLatin1String
(
"akonadi_mbox_resource_"
))
||
name
.
contains
(
...
...
@@ -129,7 +129,7 @@ void ImportMailJobInterface::storeMailArchiveResource(const KArchiveDirectory *d
mListResourceFile
.
append
(
files
);
}
else
{
qCDebug
(
PIMDATAEXPORTERCORE_LOG
)
<<
" Problem in archive. number of file "
<<
lst
.
count
();
<<
" Problem in archive. number of file "
<<
lst
ResourceDirEntries
.
count
();
}
}
}
...
...
@@ -533,10 +533,10 @@ void ImportMailJobInterface::restoreMails()
const
KArchiveEntry
*
akonadiAgentConfigEntry
=
mArchiveDirectory
->
entry
(
agentConfigFile
);
if
(
akonadiAgentConfigEntry
->
isFile
())
{
const
auto
file
=
const
auto
file
Entry
=
static_cast
<
const
KArchiveFile
*>
(
akonadiAgentConfigEntry
);
copyArchiveFileTo
(
file
,
copyToDirName
);
resourceName
=
file
->
name
();
copyArchiveFileTo
(
file
Entry
,
copyToDirName
);
resourceName
=
file
Entry
->
name
();
filename
=
Utils
::
akonadiAgentName
(
copyToDirName
+
QLatin1Char
(
'/'
)
+
resourceName
);
}
...
...
@@ -613,10 +613,10 @@ void ImportMailJobInterface::restoreMails()
const
QString
mailFile
=
value
.
akonadiResources
;
const
KArchiveEntry
*
dataResouceEntry
=
mArchiveDirectory
->
entry
(
mailFile
);
if
(
dataResouceEntry
&&
dataResouceEntry
->
isFile
())
{
const
auto
file
=
const
auto
file
Entry
=
static_cast
<
const
KArchiveFile
*>
(
dataResouceEntry
);
// TODO Fix me not correct zip filename.
extractZipFile
(
file
,
copyToDirName
,
newUrl
);
extractZipFile
(
file
Entry
,
copyToDirName
,
newUrl
);
}
listResourceToSync
<<
newResource
;
}
else
{
...
...
@@ -1149,8 +1149,8 @@ void ImportMailJobInterface::copyArchiveMailAgentConfigGroup(const KSharedConfig
KConfigGroup
newGroup
(
archiveConfigDestination
,
archiveGroupPattern
+
QString
::
number
(
id
));
oldGroup
.
copyTo
(
&
newGroup
);
newGroup
.
writeEntry
(
QStringLiteral
(
"saveCollectionId"
),
id
);
QUrl
p
ath
=
newGroup
.
readEntry
(
"storePath"
,
QUrl
());
if
(
!
QDir
(
p
ath
.
path
()).
exists
())
{
QUrl
storeP
ath
=
newGroup
.
readEntry
(
"storePath"
,
QUrl
());
if
(
!
QDir
(
storeP
ath
.
path
()).
exists
())
{
newGroup
.
writeEntry
(
QStringLiteral
(
"storePath"
),
QUrl
::
fromLocalFile
(
QDir
::
homePath
()));
}
}
...
...
core/notes/importnotesjobinterface.cpp
View file @
9dd40fc3
...
...
@@ -195,10 +195,10 @@ void ImportNotesJobInterface::restoreResources()
if
(
!
agentConfigFile
.
isEmpty
())
{
const
KArchiveEntry
*
akonadiAgentConfigEntry
=
mArchiveDirectory
->
entry
(
agentConfigFile
);
if
(
akonadiAgentConfigEntry
->
isFile
())
{
const
auto
file
=
static_cast
<
const
KArchiveFile
*>
(
const
auto
file
Entry
=
static_cast
<
const
KArchiveFile
*>
(
akonadiAgentConfigEntry
);
copyArchiveFileTo
(
file
,
copyToDirName
);
resourceName
=
file
->
name
();
copyArchiveFileTo
(
file
Entry
,
copyToDirName
);
resourceName
=
file
Entry
->
name
();
filename
=
Utils
::
akonadiAgentName
(
copyToDirName
+
QLatin1Char
(
'/'
)
+
resourceName
);
}
...
...
gui/dialog/showarchivestructuredialog.cpp
View file @
9dd40fc3
...
...
@@ -222,10 +222,10 @@ void ShowArchiveStructureDialog::addSubItems(const QString &topLevelPath, QTreeW
const
QString
space
=
QString
(
indent
*
2
,
QLatin1Char
(
' '
));
const
QStringList
lst
=
dir
->
entries
();
for
(
const
QString
&
entryName
:
lst
)
{
const
KArchiveEntry
*
e
ntry
=
dir
->
entry
(
entryName
);
if
(
e
ntry
)
{
if
(
e
ntry
->
isDirectory
())
{
const
auto
dirEntry
=
static_cast
<
const
KArchiveDirectory
*>
(
e
ntry
);
const
KArchiveEntry
*
archiveE
ntry
=
dir
->
entry
(
entryName
);
if
(
archiveE
ntry
)
{
if
(
archiveE
ntry
->
isDirectory
())
{
const
auto
dirEntry
=
static_cast
<
const
KArchiveDirectory
*>
(
archiveE
ntry
);
QTreeWidgetItem
*
newTopItem
=
addItem
(
parent
,
dirEntry
->
name
(),
QString
());
QFont
font
(
newTopItem
->
font
(
0
));
...
...
@@ -233,11 +233,11 @@ void ShowArchiveStructureDialog::addSubItems(const QString &topLevelPath, QTreeW
mLogFile
+=
space
+
dirEntry
->
name
()
+
QLatin1Char
(
'\n'
);
newTopItem
->
setFont
(
0
,
font
);
addSubItems
(
topLevelPath
,
newTopItem
,
e
ntry
,
indent
,
topLevelPath
,
newTopItem
,
archiveE
ntry
,
indent
,
(
fullpath
.
isEmpty
()
?
QString
()
:
fullpath
+
QLatin1Char
(
'/'
))
+
dirEntry
->
name
());
}
else
if
(
e
ntry
->
isFile
())
{
const
auto
file
=
static_cast
<
const
KArchiveFile
*>
(
e
ntry
);
}
else
if
(
archiveE
ntry
->
isFile
())
{
const
auto
file
=
static_cast
<
const
KArchiveFile
*>
(
archiveE
ntry
);
const
QString
fileFullPath
=
topLevelPath
+
(
fullpath
.
isEmpty
()
?
QString
()
:
fullpath
+
QLatin1Char
(
'/'
))
+
...
...
gui/widgets/logwidget.cpp
View file @
9dd40fc3
...
...
@@ -12,9 +12,9 @@
LogWidget
::
LogWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
,
mCustomLogWidget
(
new
PimCommon
::
CustomLogWidget
(
this
))
{
auto
layout
=
new
QHBoxLayout
(
this
);
mCustomLogWidget
=
new
PimCommon
::
CustomLogWidget
(
this
);
layout
->
addWidget
(
mCustomLogWidget
);
}
...
...
gui/widgets/logwidget.h
View file @
9dd40fc3
...
...
@@ -28,6 +28,6 @@ public:
Q_REQUIRED_RESULT
bool
isEmpty
()
const
;
private:
PimCommon
::
CustomLogWidget
*
mCustomLogWidget
=
nullptr
;
PimCommon
::
CustomLogWidget
*
const
mCustomLogWidget
;
};
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