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
PIM Data Exporter
Commits
0aea5265
Commit
0aea5265
authored
May 02, 2020
by
Laurent Montel
Browse files
Fix adding description to archive
parent
33987346
Changes
9
Hide whitespace changes
Inline
Side-by-side
core/autotests/addressbook/exportaddressbookjobinterfacetest.cpp
View file @
0aea5265
...
...
@@ -71,7 +71,7 @@ void ExportAddressbookJobInterfaceTest::exportAddressBookConfigTest1()
ArchiveStorage
*
archiveStorage
=
new
ArchiveStorage
(
storeArchivePath
,
this
);
Q_ASSERT
(
archiveStorage
->
openArchive
(
true
));
Utils
::
addVersion
(
archiveStorage
->
archive
());
Utils
::
storeDataExportInfo
(
storeArchivePath
,
archiveStorage
->
archive
());
Utils
::
storeDataExportInfo
(
archiveStorage
->
archive
());
ExportAddressbookJobInterfaceTestImpl
*
exportNote
=
new
ExportAddressbookJobInterfaceTestImpl
(
this
,
{
Utils
::
StoredType
::
Config
},
archiveStorage
,
1
);
QSignalSpy
finish
(
exportNote
,
&
ExportAddressbookJobInterfaceTestImpl
::
jobFinished
);
...
...
core/autotests/akregator/exportakregatorjobinterfacetest.cpp
View file @
0aea5265
...
...
@@ -54,7 +54,7 @@ void ExportAkregatorJobInterfaceTest::exportAkregatorConfigTest1()
ArchiveStorage
*
archiveStorage
=
new
ArchiveStorage
(
storeArchivePath
,
this
);
Q_ASSERT
(
archiveStorage
->
openArchive
(
true
));
Utils
::
addVersion
(
archiveStorage
->
archive
());
Utils
::
storeDataExportInfo
(
storeArchivePath
,
archiveStorage
->
archive
());
Utils
::
storeDataExportInfo
(
archiveStorage
->
archive
());
ExportAkregatorJobInterfaceTestImpl
*
exportNote
=
new
ExportAkregatorJobInterfaceTestImpl
(
this
,
{
Utils
::
StoredType
::
Config
},
archiveStorage
,
1
);
QSignalSpy
finish
(
exportNote
,
&
ExportAkregatorJobInterfaceTestImpl
::
jobFinished
);
...
...
core/autotests/alarm/exportalarmjobinterfacetest.cpp
View file @
0aea5265
...
...
@@ -59,7 +59,7 @@ void ExportAlarmJobInterfaceTest::exportAlarmConfigTest1()
ArchiveStorage
*
archiveStorage
=
new
ArchiveStorage
(
storeArchivePath
,
this
);
Q_ASSERT
(
archiveStorage
->
openArchive
(
true
));
Utils
::
addVersion
(
archiveStorage
->
archive
());
Utils
::
storeDataExportInfo
(
storeArchivePath
,
archiveStorage
->
archive
());
Utils
::
storeDataExportInfo
(
archiveStorage
->
archive
());
ExportAlarmJobInterfaceTestImpl
*
exportNote
=
new
ExportAlarmJobInterfaceTestImpl
(
this
,
{
Utils
::
StoredType
::
Config
},
archiveStorage
,
1
);
QSignalSpy
finish
(
exportNote
,
&
ExportAlarmJobInterfaceTestImpl
::
jobFinished
);
...
...
core/autotests/calendar/exportcalendarsjobinterfacetest.cpp
View file @
0aea5265
...
...
@@ -59,7 +59,7 @@ void ExportCalendarsJobInterfaceTest::exportCalendarConfigTest1()
ArchiveStorage
*
archiveStorage
=
new
ArchiveStorage
(
storeArchivePath
,
this
);
Q_ASSERT
(
archiveStorage
->
openArchive
(
true
));
Utils
::
addVersion
(
archiveStorage
->
archive
());
Utils
::
storeDataExportInfo
(
storeArchivePath
,
archiveStorage
->
archive
());
Utils
::
storeDataExportInfo
(
archiveStorage
->
archive
());
ExportCalendarsJobInterfaceTestImpl
*
exportNote
=
new
ExportCalendarsJobInterfaceTestImpl
(
this
,
{
Utils
::
StoredType
::
Config
},
archiveStorage
,
1
);
QSignalSpy
finish
(
exportNote
,
&
ExportCalendarsJobInterfaceTestImpl
::
jobFinished
);
...
...
core/autotests/mail/exportmailjobinterfacetest.cpp
View file @
0aea5265
...
...
@@ -82,7 +82,7 @@ void ExportMailJobInterfaceTest::exportMailConfigTest1()
ArchiveStorage
*
archiveStorage
=
new
ArchiveStorage
(
storeArchivePath
,
this
);
Q_ASSERT
(
archiveStorage
->
openArchive
(
true
));
Utils
::
addVersion
(
archiveStorage
->
archive
());
Utils
::
storeDataExportInfo
(
storeArchivePath
,
archiveStorage
->
archive
());
Utils
::
storeDataExportInfo
(
archiveStorage
->
archive
());
ExportMailJobInterfaceTestImpl
*
exportNote
=
new
ExportMailJobInterfaceTestImpl
(
this
,
{
Utils
::
StoredType
::
Config
},
archiveStorage
,
1
);
QSignalSpy
finish
(
exportNote
,
&
ExportMailJobInterfaceTestImpl
::
jobFinished
);
...
...
core/autotests/notes/exportnotesjobinterfacetest.cpp
View file @
0aea5265
...
...
@@ -67,12 +67,12 @@ void ExportNotesJobInterfaceTest::exportNoteConfigTest1()
qputenv
(
"XDG_CONFIG_HOME"
,
PIMDATAEXPORTER_DIR
"/export/test1/config"
);
//TODO fix file name.
const
QString
temporaryFile
=
QStringLiteral
(
"/tmp/foo.zip"
);
const
QString
storeArchivePath
(
temporaryFile
);
ArchiveStorage
*
archiveStorage
=
new
ArchiveStorage
(
storeArchivePath
,
this
);
const
QString
temporaryFile
=
QDir
::
tempPath
()
+
QStringLiteral
(
"/archive.zip"
);
ArchiveStorage
*
archiveStorage
=
new
ArchiveStorage
(
temporaryFile
,
this
);
Q_ASSERT
(
archiveStorage
->
openArchive
(
true
));
Utils
::
addVersion
(
archiveStorage
->
archive
());
Utils
::
storeDataExportInfo
(
storeArchivePath
,
archiveStorage
->
archive
());
//qDebug() << " temporaryFile " << temporaryFile;
Utils
::
storeDataExportInfo
(
archiveStorage
->
archive
());
ExportNotesJobInterfaceTestImpl
*
exportNote
=
new
ExportNotesJobInterfaceTestImpl
(
this
,
{
Utils
::
StoredType
::
Config
},
archiveStorage
,
1
);
QSignalSpy
finish
(
exportNote
,
&
ExportNotesJobInterfaceTestImpl
::
jobFinished
);
...
...
@@ -87,4 +87,5 @@ void ExportNotesJobInterfaceTest::exportNoteConfigTest1()
compareExportFile
.
setTempFilePath
(
temporaryFile
);
compareExportFile
.
setListFilePath
(
QStringLiteral
(
PIMDATAEXPORTER_DIR
"/export/test1"
));
compareExportFile
.
compareFiles
();
QVERIFY
(
QFile
(
temporaryFile
).
remove
());
}
core/pimdatabackuprestore.cpp
View file @
0aea5265
...
...
@@ -110,7 +110,7 @@ bool PimDataBackupRestore::backupStart(const QString &filename)
Utils
::
addVersion
(
mArchiveStorage
->
archive
());
//Add exported file info.
//qDebug() << "mExportedInfoFileName" << mExportedInfoFileName;
Utils
::
storeDataExportInfo
(
mExportedInfoFileName
,
mArchiveStorage
->
archive
());
Utils
::
storeDataExportInfo
(
mArchiveStorage
->
archive
());
backupNextStep
();
return
true
;
}
...
...
core/utils.cpp
View file @
0aea5265
...
...
@@ -172,15 +172,14 @@ KZip *Utils::openZip(const QString &filename, QString &errorMsg)
return
zip
;
}
void
Utils
::
storeDataExportInfo
(
const
QString
&
filename
,
KZip
*
archive
)
void
Utils
::
storeDataExportInfo
(
KZip
*
archive
)
{
if
(
QFileInfo
::
exists
(
filename
))
{
const
bool
fileAdded
=
archive
->
addLocalFile
(
filename
,
Utils
::
infoPath
()
+
Utils
::
exportDataTypeFileName
());
if
(
fileAdded
)
{
qCDebug
(
PIMDATAEXPORTERCORE_LOG
)
<<
"exporteddata file can not add to archive"
<<
filename
<<
" to "
<<
Utils
::
infoPath
()
+
Utils
::
exportDataTypeFileName
();
}
}
else
{
qCDebug
(
PIMDATAEXPORTERCORE_LOG
)
<<
"exported file was not created"
<<
filename
;
QTemporaryFile
tmp
;
tmp
.
open
();
const
bool
fileAdded
=
archive
->
addLocalFile
(
tmp
.
fileName
(),
Utils
::
infoPath
()
+
Utils
::
exportDataTypeFileName
());
qDebug
()
<<
" fileAdded "
<<
fileAdded
;
if
(
fileAdded
)
{
qCDebug
(
PIMDATAEXPORTERCORE_LOG
)
<<
"storeDataExportInfo can't add to archive"
;
}
}
...
...
core/utils.h
View file @
0aea5265
...
...
@@ -95,7 +95,7 @@ Q_REQUIRED_RESULT QString akonadiAgentName(const QString &configPath);
Q_REQUIRED_RESULT
QString
storeResources
(
KZip
*
archive
,
const
QString
&
identifier
,
const
QString
&
path
);
KZip
*
openZip
(
const
QString
&
filename
,
QString
&
errorMsg
);
PIMDATAEXPORTER_EXPORT
void
storeDataExportInfo
(
const
QString
&
filename
,
KZip
*
archive
);
PIMDATAEXPORTER_EXPORT
void
storeDataExportInfo
(
KZip
*
archive
);
PIMDATAEXPORTER_EXPORT
void
addVersion
(
KZip
*
archive
);
Q_REQUIRED_RESULT
int
archiveVersion
(
KZip
*
archive
);
...
...
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