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
5d1994f1
Commit
5d1994f1
authored
Jun 22, 2017
by
Laurent Montel
Browse files
Coding style
parent
77d4f7f8
Changes
56
Hide whitespace changes
Inline
Side-by-side
console/autotests/loginfiletest.cpp
View file @
5d1994f1
...
...
@@ -23,12 +23,10 @@
LogInFileTest
::
LogInFileTest
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
LogInFileTest
::~
LogInFileTest
()
{
}
void
LogInFileTest
::
shouldHaveDefaultValue
()
...
...
console/importexportprogressindicatorconsole.cpp
View file @
5d1994f1
...
...
@@ -23,7 +23,6 @@
ImportExportProgressIndicatorConsole
::
ImportExportProgressIndicatorConsole
(
QObject
*
parent
)
:
ImportExportProgressIndicatorBase
(
parent
)
{
}
ImportExportProgressIndicatorConsole
::~
ImportExportProgressIndicatorConsole
()
...
...
@@ -39,4 +38,3 @@ void ImportExportProgressIndicatorConsole::showErrorMessage(const QString &messa
{
qDebug
()
<<
" message "
<<
message
<<
" title "
<<
title
;
}
console/loginfile.cpp
View file @
5d1994f1
...
...
@@ -23,8 +23,8 @@
#include
<QFile>
LogInFile
::
LogInFile
(
QObject
*
parent
)
:
QObject
(
parent
)
,
mFile
(
nullptr
)
:
QObject
(
parent
)
,
mFile
(
nullptr
)
{
}
...
...
console/loginfo.cpp
View file @
5d1994f1
...
...
@@ -22,12 +22,10 @@
LogInfo
::
LogInfo
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
LogInfo
::~
LogInfo
()
{
}
void
LogInfo
::
addInfoLogEntry
(
const
QString
&
log
)
...
...
console/pimsettingexporterconsole.cpp
View file @
5d1994f1
...
...
@@ -30,12 +30,12 @@
#include
<MailCommon/FilterManager>
PimSettingExporterConsole
::
PimSettingExporterConsole
(
QObject
*
parent
)
:
QObject
(
parent
)
,
mPimSettingsBackupRestore
(
new
PimSettingsBackupRestore
(
this
))
,
mLogInFile
(
nullptr
)
,
mLogInfo
(
new
LogInfo
(
this
))
,
mMode
(
Import
)
,
mInProgress
(
false
)
:
QObject
(
parent
)
,
mPimSettingsBackupRestore
(
new
PimSettingsBackupRestore
(
this
))
,
mLogInFile
(
nullptr
)
,
mLogInfo
(
new
LogInfo
(
this
))
,
mMode
(
Import
)
,
mInProgress
(
false
)
{
//Initialize filtermanager
(
void
)
MailCommon
::
FilterManager
::
instance
();
...
...
@@ -49,7 +49,6 @@ PimSettingExporterConsole::PimSettingExporterConsole(QObject *parent)
PimSettingExporterConsole
::~
PimSettingExporterConsole
()
{
}
void
PimSettingExporterConsole
::
initializeLogInFile
()
...
...
core/abstractimportexportjob.cpp
View file @
5d1994f1
...
...
@@ -43,16 +43,16 @@
int
AbstractImportExportJob
::
sArchiveVersion
=
-
1
;
AbstractImportExportJob
::
AbstractImportExportJob
(
QObject
*
parent
,
ArchiveStorage
*
archiveStorage
,
Utils
::
StoredTypes
typeSelected
,
int
numberOfStep
)
:
QObject
(
parent
)
,
mTypeSelected
(
typeSelected
)
,
mArchiveStorage
(
archiveStorage
)
,
mIdentityManager
(
KIdentityManagement
::
IdentityManager
::
self
())
,
mTempDir
(
nullptr
)
,
mArchiveDirectory
(
nullptr
)
,
mNumberOfStep
(
numberOfStep
)
,
mCreateResource
(
nullptr
)
,
mIndex
(
-
1
)
,
mImportExportProgressIndicator
(
new
ImportExportProgressIndicatorBase
(
this
))
:
QObject
(
parent
)
,
mTypeSelected
(
typeSelected
)
,
mArchiveStorage
(
archiveStorage
)
,
mIdentityManager
(
KIdentityManagement
::
IdentityManager
::
self
())
,
mTempDir
(
nullptr
)
,
mArchiveDirectory
(
nullptr
)
,
mNumberOfStep
(
numberOfStep
)
,
mCreateResource
(
nullptr
)
,
mIndex
(
-
1
)
,
mImportExportProgressIndicator
(
new
ImportExportProgressIndicatorBase
(
this
))
{
mImportExportProgressIndicator
->
setNumberOfStep
(
numberOfStep
);
connect
(
mImportExportProgressIndicator
,
&
ImportExportProgressIndicatorBase
::
info
,
this
,
&
AbstractImportExportJob
::
info
);
...
...
@@ -84,7 +84,6 @@ bool AbstractImportExportJob::wasCanceled() const
void
AbstractImportExportJob
::
increaseProgressDialog
()
{
mImportExportProgressIndicator
->
increaseProgressDialog
();
}
void
AbstractImportExportJob
::
setProgressDialogLabel
(
const
QString
&
text
)
...
...
@@ -130,7 +129,7 @@ void AbstractImportExportJob::backupConfigFile(const QString &configFileName)
void
AbstractImportExportJob
::
backupFile
(
const
QString
&
filename
,
const
QString
&
path
,
const
QString
&
storedName
)
{
if
(
QFileInfo
::
exists
(
filename
))
{
const
bool
fileAdded
=
archive
()
->
addLocalFile
(
filename
,
path
+
storedName
);
const
bool
fileAdded
=
archive
()
->
addLocalFile
(
filename
,
path
+
storedName
);
if
(
fileAdded
)
{
Q_EMIT
info
(
i18n
(
"
\"
%1
\"
backup done."
,
path
+
storedName
));
}
else
{
...
...
@@ -345,7 +344,7 @@ void AbstractImportExportJob::backupResourceFile(const Akonadi::AgentInstance &a
if
(
!
url
.
isEmpty
())
{
QFileInfo
fi
(
url
);
QString
filename
=
fi
.
fileName
();
const
bool
fileAdded
=
archive
()
->
addLocalFile
(
url
,
archivePath
+
filename
);
const
bool
fileAdded
=
archive
()
->
addLocalFile
(
url
,
archivePath
+
filename
);
if
(
fileAdded
)
{
const
QString
errorStr
=
Utils
::
storeResources
(
archive
(),
identifier
,
archivePath
);
if
(
!
errorStr
.
isEmpty
())
{
...
...
@@ -357,14 +356,13 @@ void AbstractImportExportJob::backupResourceFile(const Akonadi::AgentInstance &a
if
(
!
url
.
isEmpty
())
{
fi
=
QFileInfo
(
url
);
filename
=
fi
.
fileName
();
const
bool
fileAdded
=
archive
()
->
addLocalFile
(
url
,
archivePath
+
filename
);
const
bool
fileAdded
=
archive
()
->
addLocalFile
(
url
,
archivePath
+
filename
);
if
(
fileAdded
)
{
Q_EMIT
info
(
i18n
(
"
\"
%1
\"
was backed up."
,
filename
));
}
else
{
Q_EMIT
error
(
i18n
(
"
\"
%1
\"
file cannot be added to backup file."
,
filename
));
}
}
}
else
{
Q_EMIT
error
(
i18n
(
"
\"
%1
\"
file cannot be added to backup file."
,
filename
));
}
...
...
@@ -438,7 +436,7 @@ QStringList AbstractImportExportJob::restoreResourceFile(const QString &resource
return
resourceToSync
;
}
void
AbstractImportExportJob
::
addSpecificResourceSettings
(
KSharedConfig
::
Ptr
/*resourceConfig*/
,
const
QString
&
/*resourceName*/
,
QMap
<
QString
,
QVariant
>
&
/*settings*/
)
void
AbstractImportExportJob
::
addSpecificResourceSettings
(
KSharedConfig
::
Ptr
/*resourceConfig*/
,
const
QString
&
/*resourceName*/
,
QMap
<
QString
,
QVariant
>
&
/*settings*/
)
{
//Redefine it in subclass
}
...
...
@@ -483,8 +481,8 @@ void AbstractImportExportJob::extractZipFile(const KArchiveFile *file, const QSt
void
AbstractImportExportJob
::
restoreUiRcFile
(
const
QString
&
configNameStr
,
const
QString
&
applicationName
)
{
const
KArchiveEntry
*
configNameentry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
configNameStr
);
if
(
configNameentry
&&
configNameentry
->
isFile
())
{
const
KArchiveEntry
*
configNameentry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
configNameStr
);
if
(
configNameentry
&&
configNameentry
->
isFile
())
{
const
KArchiveFile
*
configNameconfiguration
=
static_cast
<
const
KArchiveFile
*>
(
configNameentry
);
const
QString
configNamerc
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
)
+
QLatin1String
(
"/kxmlgui5/"
)
+
applicationName
+
QLatin1Char
(
'/'
)
+
configNameStr
;
if
(
QFileInfo
::
exists
(
configNamerc
))
{
...
...
@@ -499,8 +497,8 @@ void AbstractImportExportJob::restoreUiRcFile(const QString &configNameStr, cons
void
AbstractImportExportJob
::
restoreConfigFile
(
const
QString
&
configNameStr
)
{
const
KArchiveEntry
*
configNameentry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
configNameStr
);
if
(
configNameentry
&&
configNameentry
->
isFile
())
{
const
KArchiveEntry
*
configNameentry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
configNameStr
);
if
(
configNameentry
&&
configNameentry
->
isFile
())
{
const
KArchiveFile
*
configNameconfiguration
=
static_cast
<
const
KArchiveFile
*>
(
configNameentry
);
const
QString
configNamerc
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
ConfigLocation
)
+
QLatin1Char
(
'/'
)
+
configNameStr
;
if
(
QFileInfo
::
exists
(
configNamerc
))
{
...
...
@@ -599,7 +597,7 @@ void AbstractImportExportJob::storeDirectory(const QString &subDirectory)
void
AbstractImportExportJob
::
importDataSubdirectory
(
const
QString
&
subdirectoryRelativePath
)
{
const
KArchiveEntry
*
themeEntry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
subdirectoryRelativePath
);
const
KArchiveEntry
*
themeEntry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
subdirectoryRelativePath
);
if
(
themeEntry
&&
themeEntry
->
isDirectory
())
{
const
KArchiveDirectory
*
themeDir
=
static_cast
<
const
KArchiveDirectory
*>
(
themeEntry
);
const
QStringList
lst
=
themeDir
->
entries
();
...
...
@@ -619,6 +617,4 @@ void AbstractImportExportJob::importDataSubdirectory(const QString &subdirectory
}
}
}
}
core/abstractimportexportjob.h
View file @
5d1994f1
...
...
@@ -34,14 +34,12 @@ class KZip;
class
KArchiveFile
;
class
KArchiveEntry
;
namespace
KIdentityManagement
{
namespace
KIdentityManagement
{
class
Identity
;
class
IdentityManager
;
}
namespace
PimCommon
{
namespace
PimCommon
{
class
CreateResource
;
}
class
ImportExportProgressIndicatorBase
;
...
...
core/addressbook/exportaddressbookjob.cpp
View file @
5d1994f1
...
...
@@ -32,8 +32,8 @@
#include
<QTimer>
ExportAddressbookJob
::
ExportAddressbookJob
(
QObject
*
parent
,
Utils
::
StoredTypes
typeSelected
,
ArchiveStorage
*
archiveStorage
,
int
numberOfStep
)
:
AbstractImportExportJob
(
parent
,
archiveStorage
,
typeSelected
,
numberOfStep
)
,
mIndexIdentifier
(
0
)
:
AbstractImportExportJob
(
parent
,
archiveStorage
,
typeSelected
,
numberOfStep
)
,
mIndexIdentifier
(
0
)
{
}
...
...
@@ -172,4 +172,3 @@ void ExportAddressbookJob::backupConfig()
Q_EMIT
info
(
i18n
(
"Config backup done."
));
}
core/addressbook/importaddressbookjob.cpp
View file @
5d1994f1
...
...
@@ -32,8 +32,7 @@
#include
<QDir>
#include
<QStandardPaths>
namespace
{
namespace
{
inline
const
QString
storeAddressbook
()
{
return
QStringLiteral
(
"backupaddressbook/"
);
...
...
@@ -48,7 +47,6 @@ ImportAddressbookJob::ImportAddressbookJob(QObject *parent, Utils::StoredTypes t
ImportAddressbookJob
::~
ImportAddressbookJob
()
{
}
void
ImportAddressbookJob
::
start
()
...
...
@@ -82,7 +80,9 @@ void ImportAddressbookJob::restoreResources()
setProgressDialogLabel
(
i18n
(
"Restore resources..."
));
increaseProgressDialog
();
QStringList
listResource
;
listResource
<<
restoreResourceFile
(
QStringLiteral
(
"akonadi_vcard_resource"
),
Utils
::
addressbookPath
(),
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
)
+
QLatin1String
(
"/share/kaddressbook/"
));
listResource
<<
restoreResourceFile
(
QStringLiteral
(
"akonadi_vcard_resource"
),
Utils
::
addressbookPath
(),
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
)
+
QLatin1String
(
"/share/kaddressbook/"
));
if
(
!
mListResourceFile
.
isEmpty
())
{
QDir
dir
(
mTempDirName
);
...
...
@@ -93,8 +93,8 @@ void ImportAddressbookJob::restoreResources()
for
(
int
i
=
0
;
i
<
numberOfResourceFile
;
++
i
)
{
resourceFiles
value
=
mListResourceFile
.
at
(
i
);
QMap
<
QString
,
QVariant
>
settings
;
if
(
value
.
akonadiConfigFile
.
contains
(
QStringLiteral
(
"akonadi_vcarddir_resource_"
))
||
value
.
akonadiConfigFile
.
contains
(
QStringLiteral
(
"akonadi_contacts_resource_"
)))
{
if
(
value
.
akonadiConfigFile
.
contains
(
QStringLiteral
(
"akonadi_vcarddir_resource_"
))
||
value
.
akonadiConfigFile
.
contains
(
QStringLiteral
(
"akonadi_contacts_resource_"
)))
{
const
KArchiveEntry
*
fileResouceEntry
=
mArchiveDirectory
->
entry
(
value
.
akonadiConfigFile
);
if
(
fileResouceEntry
&&
fileResouceEntry
->
isFile
())
{
const
KArchiveFile
*
file
=
static_cast
<
const
KArchiveFile
*>
(
fileResouceEntry
);
...
...
@@ -168,9 +168,9 @@ void ImportAddressbookJob::addSpecificResourceSettings(KSharedConfig::Ptr resour
bool
ImportAddressbookJob
::
isAConfigFile
(
const
QString
&
name
)
const
{
return
name
.
endsWith
(
QLatin1String
(
"rc"
))
&&
(
name
.
contains
(
QStringLiteral
(
"akonadi_vcarddir_resource_"
))
||
name
.
contains
(
QStringLiteral
(
"akonadi_vcard_resource_"
))
||
name
.
contains
(
QStringLiteral
(
"akonadi_contacts_resource_"
)));
return
name
.
endsWith
(
QLatin1String
(
"rc"
))
&&
(
name
.
contains
(
QStringLiteral
(
"akonadi_vcarddir_resource_"
))
||
name
.
contains
(
QStringLiteral
(
"akonadi_vcard_resource_"
))
||
name
.
contains
(
QStringLiteral
(
"akonadi_contacts_resource_"
)));
}
void
ImportAddressbookJob
::
restoreConfig
()
...
...
@@ -178,7 +178,7 @@ void ImportAddressbookJob::restoreConfig()
increaseProgressDialog
();
setProgressDialogLabel
(
i18n
(
"Restore configs..."
));
const
QString
kaddressbookStr
(
QStringLiteral
(
"kaddressbookrc"
));
const
KArchiveEntry
*
kaddressbookrcentry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
kaddressbookStr
);
const
KArchiveEntry
*
kaddressbookrcentry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
kaddressbookStr
);
if
(
kaddressbookrcentry
&&
kaddressbookrcentry
->
isFile
())
{
const
KArchiveFile
*
kaddressbookrcFile
=
static_cast
<
const
KArchiveFile
*>
(
kaddressbookrcentry
);
const
QString
kaddressbookrc
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
ConfigLocation
)
+
QLatin1Char
(
'/'
)
+
kaddressbookStr
;
...
...
@@ -220,7 +220,7 @@ void ImportAddressbookJob::importkaddressBookConfig(const KArchiveFile *file, co
convertRealPathToCollection
(
group
,
currentKey
,
true
);
}
const
QString
cvsTemplateDirName
=
QStringLiteral
(
"/kaddressbook/csv-templates/"
);
const
KArchiveEntry
*
csvtemplateEntry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
cvsTemplateDirName
);
const
KArchiveEntry
*
csvtemplateEntry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
cvsTemplateDirName
);
if
(
csvtemplateEntry
&&
csvtemplateEntry
->
isDirectory
())
{
const
KArchiveDirectory
*
csvTemplateDir
=
static_cast
<
const
KArchiveDirectory
*>
(
csvtemplateEntry
);
const
QStringList
lst
=
csvTemplateDir
->
entries
();
...
...
core/akregator/exportakregatorjob.cpp
View file @
5d1994f1
...
...
@@ -34,7 +34,6 @@ ExportAkregatorJob::ExportAkregatorJob(QObject *parent, Utils::StoredTypes typeS
ExportAkregatorJob
::~
ExportAkregatorJob
()
{
}
void
ExportAkregatorJob
::
start
()
...
...
@@ -82,4 +81,3 @@ void ExportAkregatorJob::slotCheckBackupData()
}
Q_EMIT
jobFinished
();
}
core/akregator/importakregatorjob.cpp
View file @
5d1994f1
...
...
@@ -84,7 +84,7 @@ void ImportAkregatorJob::restoreData()
{
increaseProgressDialog
();
setProgressDialogLabel
(
i18n
(
"Restore data..."
));
const
KArchiveEntry
*
akregatorEntry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
QLatin1String
(
"akregator/"
));
const
KArchiveEntry
*
akregatorEntry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
QLatin1String
(
"akregator/"
));
if
(
akregatorEntry
&&
akregatorEntry
->
isDirectory
())
{
const
QString
akregatorPath
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
)
+
QLatin1Char
(
'/'
)
+
QLatin1String
(
"akregator/"
);
overwriteDirectory
(
akregatorPath
,
akregatorEntry
);
...
...
@@ -92,4 +92,3 @@ void ImportAkregatorJob::restoreData()
Q_EMIT
info
(
i18n
(
"Data restored."
));
QTimer
::
singleShot
(
0
,
this
,
&
ImportAkregatorJob
::
slotNextStep
);
}
core/alarm/exportalarmjob.cpp
View file @
5d1994f1
...
...
@@ -33,14 +33,13 @@
#include
<exportresourcearchivejob.h>
ExportAlarmJob
::
ExportAlarmJob
(
QObject
*
parent
,
Utils
::
StoredTypes
typeSelected
,
ArchiveStorage
*
archiveStorage
,
int
numberOfStep
)
:
AbstractImportExportJob
(
parent
,
archiveStorage
,
typeSelected
,
numberOfStep
)
,
mIndexIdentifier
(
0
)
:
AbstractImportExportJob
(
parent
,
archiveStorage
,
typeSelected
,
numberOfStep
)
,
mIndexIdentifier
(
0
)
{
}
ExportAlarmJob
::~
ExportAlarmJob
()
{
}
void
ExportAlarmJob
::
start
()
...
...
@@ -159,4 +158,3 @@ void ExportAlarmJob::backupConfig()
Q_EMIT
info
(
i18n
(
"Config backup done."
));
}
core/alarm/importalarmjob.cpp
View file @
5d1994f1
...
...
@@ -33,8 +33,7 @@
#include
<QStandardPaths>
#include
<QTimer>
namespace
{
namespace
{
inline
const
QString
storeAlarm
()
{
return
QStringLiteral
(
"backupalarm/"
);
...
...
@@ -49,7 +48,6 @@ ImportAlarmJob::ImportAlarmJob(QObject *parent, Utils::StoredTypes typeSelected,
ImportAlarmJob
::~
ImportAlarmJob
()
{
}
void
ImportAlarmJob
::
start
()
...
...
@@ -97,7 +95,7 @@ void ImportAlarmJob::restoreResources()
resourceFiles
value
=
mListResourceFile
.
at
(
i
);
QMap
<
QString
,
QVariant
>
settings
;
if
(
value
.
akonadiConfigFile
.
contains
(
QStringLiteral
(
"akonadi_kalarm_dir_resource_"
))
||
value
.
akonadiConfigFile
.
contains
(
QStringLiteral
(
"akonadi_kalarm_resource_"
)))
{
||
value
.
akonadiConfigFile
.
contains
(
QStringLiteral
(
"akonadi_kalarm_resource_"
)))
{
const
KArchiveEntry
*
fileResouceEntry
=
mArchiveDirectory
->
entry
(
value
.
akonadiConfigFile
);
if
(
fileResouceEntry
&&
fileResouceEntry
->
isFile
())
{
const
KArchiveFile
*
file
=
static_cast
<
const
KArchiveFile
*>
(
fileResouceEntry
);
...
...
@@ -148,7 +146,7 @@ void ImportAlarmJob::restoreResources()
bool
ImportAlarmJob
::
isAConfigFile
(
const
QString
&
name
)
const
{
return
name
.
endsWith
(
QLatin1String
(
"rc"
))
&&
(
name
.
contains
(
QStringLiteral
(
"akonadi_kalarm_resource_"
))
||
name
.
contains
(
QStringLiteral
(
"akonadi_kalarm_dir_resource_"
)));
||
name
.
contains
(
QStringLiteral
(
"akonadi_kalarm_dir_resource_"
)));
}
void
ImportAlarmJob
::
restoreConfig
()
...
...
@@ -156,7 +154,7 @@ void ImportAlarmJob::restoreConfig()
increaseProgressDialog
();
setProgressDialogLabel
(
i18n
(
"Restore configs..."
));
const
QString
kalarmStr
(
QStringLiteral
(
"kalarmrc"
));
const
KArchiveEntry
*
kalarmrcentry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
kalarmStr
);
const
KArchiveEntry
*
kalarmrcentry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
kalarmStr
);
if
(
kalarmrcentry
&&
kalarmrcentry
->
isFile
())
{
const
KArchiveFile
*
kalarmrcFile
=
static_cast
<
const
KArchiveFile
*>
(
kalarmrcentry
);
const
QString
kalarmrc
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
ConfigLocation
)
+
QLatin1Char
(
'/'
)
+
kalarmStr
;
...
...
@@ -187,4 +185,3 @@ void ImportAlarmJob::importkalarmConfig(const KArchiveFile *kalarmFile, const QS
kalarmConfig
->
sync
();
}
core/alarm/importalarmjob.h
View file @
5d1994f1
...
...
@@ -37,7 +37,7 @@ protected Q_SLOTS:
void
slotNextStep
()
override
;
private:
bool
isAConfigFile
(
const
QString
&
name
)
const
override
;
bool
isAConfigFile
(
const
QString
&
name
)
const
override
;
void
importkalarmConfig
(
const
KArchiveFile
*
kalarmFile
,
const
QString
&
kalarmrc
,
const
QString
&
filename
,
const
QString
&
prefix
);
void
restoreResources
();
void
restoreConfig
();
...
...
core/archivestorage.cpp
View file @
5d1994f1
...
...
@@ -22,8 +22,8 @@
#include
<KLocalizedString>
ArchiveStorage
::
ArchiveStorage
(
const
QString
&
filename
,
QObject
*
parent
)
:
QObject
(
parent
)
,
mArchive
(
new
KZip
(
filename
))
:
QObject
(
parent
)
,
mArchive
(
new
KZip
(
filename
))
{
}
...
...
@@ -66,4 +66,3 @@ KZip *ArchiveStorage::archive() const
{
return
mArchive
;
}
core/blogilo/exportblogilojob.cpp
View file @
5d1994f1
...
...
@@ -34,7 +34,6 @@ ExportBlogiloJob::ExportBlogiloJob(QObject *parent, Utils::StoredTypes typeSelec
ExportBlogiloJob
::~
ExportBlogiloJob
()
{
}
void
ExportBlogiloJob
::
start
()
...
...
@@ -78,4 +77,3 @@ void ExportBlogiloJob::slotCheckBackupData()
}
Q_EMIT
jobFinished
();
}
core/blogilo/importblogilojob.cpp
View file @
5d1994f1
...
...
@@ -81,7 +81,7 @@ void ImportBlogiloJob::restoreData()
{
increaseProgressDialog
();
setProgressDialogLabel
(
i18n
(
"Restore data..."
));
const
KArchiveEntry
*
blogiloEntry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
QLatin1String
(
"blogilo/"
));
const
KArchiveEntry
*
blogiloEntry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
QLatin1String
(
"blogilo/"
));
if
(
blogiloEntry
&&
blogiloEntry
->
isDirectory
())
{
const
QString
blogiloPath
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
)
+
QLatin1Char
(
'/'
)
+
QLatin1String
(
"blogilo/"
);
overwriteDirectory
(
blogiloPath
,
blogiloEntry
);
...
...
@@ -89,4 +89,3 @@ void ImportBlogiloJob::restoreData()
Q_EMIT
info
(
i18n
(
"Data restored."
));
QTimer
::
singleShot
(
0
,
this
,
&
ImportBlogiloJob
::
slotNextStep
);
}
core/calendar/exportcalendarjob.cpp
View file @
5d1994f1
...
...
@@ -34,14 +34,13 @@
#include
<exportresourcearchivejob.h>
ExportCalendarJob
::
ExportCalendarJob
(
QObject
*
parent
,
Utils
::
StoredTypes
typeSelected
,
ArchiveStorage
*
archiveStorage
,
int
numberOfStep
)
:
AbstractImportExportJob
(
parent
,
archiveStorage
,
typeSelected
,
numberOfStep
)
,
mIndexIdentifier
(
0
)
:
AbstractImportExportJob
(
parent
,
archiveStorage
,
typeSelected
,
numberOfStep
)
,
mIndexIdentifier
(
0
)
{
}
ExportCalendarJob
::~
ExportCalendarJob
()
{
}
void
ExportCalendarJob
::
start
()
...
...
@@ -172,4 +171,3 @@ void ExportCalendarJob::backupConfig()
backupUiRcFile
(
QStringLiteral
(
"korganizer_part.rc"
),
QStringLiteral
(
"korganizer"
));
Q_EMIT
info
(
i18n
(
"Config backup done."
));
}
core/calendar/importcalendarjob.cpp
View file @
5d1994f1
...
...
@@ -36,8 +36,7 @@
#include
<QStandardPaths>
#include
<QTimer>
namespace
{
namespace
{
inline
const
QString
storeCalendar
()
{
return
QStringLiteral
(
"backupcalendar/"
);
...
...
@@ -100,7 +99,7 @@ void ImportCalendarJob::restoreResources()
resourceFiles
value
=
mListResourceFile
.
at
(
i
);
QMap
<
QString
,
QVariant
>
settings
;
if
(
value
.
akonadiConfigFile
.
contains
(
QStringLiteral
(
"akonadi_icaldir_resource_"
))
||
value
.
akonadiConfigFile
.
contains
(
QStringLiteral
(
"akonadi_ical_resource_"
)))
{
||
value
.
akonadiConfigFile
.
contains
(
QStringLiteral
(
"akonadi_ical_resource_"
)))
{
const
KArchiveEntry
*
fileResouceEntry
=
mArchiveDirectory
->
entry
(
value
.
akonadiConfigFile
);
if
(
fileResouceEntry
&&
fileResouceEntry
->
isFile
())
{
const
KArchiveFile
*
file
=
static_cast
<
const
KArchiveFile
*>
(
fileResouceEntry
);
...
...
@@ -170,7 +169,7 @@ void ImportCalendarJob::addSpecificResourceSettings(KSharedConfig::Ptr resourceC
bool
ImportCalendarJob
::
isAConfigFile
(
const
QString
&
name
)
const
{
return
name
.
endsWith
(
QLatin1String
(
"rc"
))
&&
(
name
.
contains
(
QStringLiteral
(
"akonadi_ical_resource_"
))
||
name
.
contains
(
QStringLiteral
(
"akonadi_icaldir_resource_"
)));
||
name
.
contains
(
QStringLiteral
(
"akonadi_icaldir_resource_"
)));
}
void
ImportCalendarJob
::
restoreConfig
()
...
...
@@ -179,7 +178,7 @@ void ImportCalendarJob::restoreConfig()
setProgressDialogLabel
(
i18n
(
"Restore configs..."
));
const
QString
korganizerPrinterrcStr
(
QStringLiteral
(
"calendar_printing.rc"
));
const
QString
oldKorganizerPrintrrcStr
(
QStringLiteral
(
"korganizer_printing.rc"
));
const
KArchiveEntry
*
oldKorganizerPrinterEntry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
oldKorganizerPrintrrcStr
);
const
KArchiveEntry
*
oldKorganizerPrinterEntry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
oldKorganizerPrintrrcStr
);
if
(
oldKorganizerPrinterEntry
&&
oldKorganizerPrinterEntry
->
isFile
())
{
const
KArchiveFile
*
korganizerFile
=
static_cast
<
const
KArchiveFile
*>
(
oldKorganizerPrinterEntry
);
const
QString
oldKorganizerPrintrrc
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
ConfigLocation
)
+
QLatin1Char
(
'/'
)
+
korganizerPrinterrcStr
;
...
...
@@ -191,7 +190,7 @@ void ImportCalendarJob::restoreConfig()
copyToFile
(
korganizerFile
,
oldKorganizerPrintrrc
,
oldKorganizerPrintrrcStr
,
Utils
::
configsPath
());
}
}
else
{
const
KArchiveEntry
*
korganizerPrinterEntry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
korganizerPrinterrcStr
);
const
KArchiveEntry
*
korganizerPrinterEntry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
korganizerPrinterrcStr
);
if
(
korganizerPrinterEntry
&&
korganizerPrinterEntry
->
isFile
())
{
const
KArchiveFile
*
korganizerFile
=
static_cast
<
const
KArchiveFile
*>
(
korganizerPrinterEntry
);
const
QString
korganizerPrinterrc
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
ConfigLocation
)
+
QLatin1Char
(
'/'
)
+
korganizerPrinterrcStr
;
...
...
@@ -206,7 +205,7 @@ void ImportCalendarJob::restoreConfig()
}
const
QString
korganizerStr
(
QStringLiteral
(
"korganizerrc"
));
const
KArchiveEntry
*
korganizerrcentry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
korganizerStr
);
const
KArchiveEntry
*
korganizerrcentry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
korganizerStr
);
if
(
korganizerrcentry
&&
korganizerrcentry
->
isFile
())
{
const
KArchiveFile
*
korganizerrcFile
=
static_cast
<
const
KArchiveFile
*>
(
korganizerrcentry
);
const
QString
korganizerrc
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
ConfigLocation
)
+
QLatin1Char
(
'/'
)
+
korganizerStr
;
...
...
@@ -220,7 +219,7 @@ void ImportCalendarJob::restoreConfig()
}
const
QString
korgacStr
(
QStringLiteral
(
"korgacrc"
));
const
KArchiveEntry
*
korgacrcentry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
korgacStr
);
const
KArchiveEntry
*
korgacrcentry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
korgacStr
);
if
(
korgacrcentry
&&
korgacrcentry
->
isFile
())
{
const
KArchiveFile
*
korgacrcFile
=
static_cast
<
const
KArchiveFile
*>
(
korgacrcentry
);
const
QString
korgacrc
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
ConfigLocation
)
+
QLatin1Char
(
'/'
)
+
korgacStr
;
...
...
@@ -234,7 +233,7 @@ void ImportCalendarJob::restoreConfig()
}
const
QString
freebusyStr
(
QStringLiteral
(
"freebusyurls"
));
const
KArchiveEntry
*
freebusyentry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
QLatin1String
(
"korganizer/"
)
+
freebusyStr
);
const
KArchiveEntry
*
freebusyentry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
QLatin1String
(
"korganizer/"
)
+
freebusyStr
);
if
(
freebusyentry
&&
freebusyentry
->
isFile
())
{
const
KArchiveFile
*
freebusyrcFile
=
static_cast
<
const
KArchiveFile
*>
(
freebusyentry
);
...
...
@@ -249,7 +248,7 @@ void ImportCalendarJob::restoreConfig()
}
}
const
KArchiveEntry
*
templateEntry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
QLatin1String
(
"korganizer/templates/"
));
const
KArchiveEntry
*
templateEntry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
QLatin1String
(
"korganizer/templates/"
));
if
(
templateEntry
&&
templateEntry
->
isDirectory
())
{
//TODO 4.12 verify if template already exists.
const
QString
templatePath
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
)
+
QLatin1Char
(
'/'
)
+
QLatin1String
(
"korganizer/templates/"
);
...
...
@@ -259,7 +258,7 @@ void ImportCalendarJob::restoreConfig()
}
}
const
KArchiveEntry
*
designerEntry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
QLatin1String
(
"korganizer/designer/"
));
const
KArchiveEntry
*
designerEntry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
QLatin1String
(
"korganizer/designer/"
));
if
(
designerEntry
&&
designerEntry
->
isDirectory
())
{
const
QString
templatePath
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
)
+
QLatin1Char
(
'/'
)
+
QLatin1String
(
"korganizer/designer/"
);
const
KArchiveDirectory
*
templateDir
=
static_cast
<
const
KArchiveDirectory
*>
(
designerEntry
);
...
...
@@ -288,4 +287,3 @@ void ImportCalendarJob::importkorganizerConfig(const KArchiveFile *file, const Q
}
korganizerConfig
->
sync
();
}
core/exportresourcearchivejob.cpp
View file @
5d1994f1
...
...
@@ -28,16 +28,14 @@
#include
<AkonadiCore/ServerManager>
ExportResourceArchiveJob
::
ExportResourceArchiveJob
(
QObject
*
parent
)
:
QObject
(
parent
)
,
mZip
(
nullptr
)
,
mThread
(
nullptr
)
:
QObject
(
parent
)
,
mZip
(
nullptr
)
,
mThread
(
nullptr
)
{
}
ExportResourceArchiveJob
::~
ExportResourceArchiveJob
()
{
}
void
ExportResourceArchiveJob
::
setArchive
(
KZip
*
zip
)
...
...
@@ -91,7 +89,7 @@ void ExportResourceArchiveJob::slotTerminated(bool success)
if
(
!
url
.
isEmpty
())
{
const
QFileInfo
fi
(
url
);
const
QString
filename
=
fi
.
fileName
();
const
bool
fileAdded
=
mZip
->
addLocalFile
(
url
,
mArchivePath
+
filename
);
const
bool
fileAdded
=
mZip
->
addLocalFile
(
url
,
mArchivePath
+
filename
);
if
(
fileAdded
)
{
Q_EMIT
info
(
i18n
(
"
\"
%1
\"
was backed up."
,
filename
));
}
else
{
...
...
Prev
1
2
3
Next
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