Commit 5d0d7f3a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Return logging file path

parent 4ff814d8
......@@ -84,6 +84,7 @@ void ImportAddressbookJobInterfaceTest::importAddressbookConfig()
file->setExcludePath(Utils::addressbookPath());
ImportAddressbookJobInterfaceTestImpl *impl = new ImportAddressbookJobInterfaceTestImpl(this, {Utils::StoredType::Config}, file->archiveStorage(), 1);
file->setAbstractImportExportJob(impl);
file->setLoggingFilePath(impl->loggingFilePath());
file->start();
delete impl;
delete file;
......
......@@ -84,6 +84,8 @@ void ImportAlarmJobInterfaceTest::importAlarmConfig()
file->setExtractPath(QDir::tempPath() + testPath);
ImportAlarmJobInterfaceTestImpl *impl = new ImportAlarmJobInterfaceTestImpl(this, {Utils::StoredType::Config}, file->archiveStorage(), 1);
file->setAbstractImportExportJob(impl);
file->setLoggingFilePath(impl->loggingFilePath());
file->start();
delete impl;
delete file;
......
......@@ -84,6 +84,7 @@ void ImportCalendarJobInterfaceTest::importCalendarConfig()
file->setExcludePath(Utils::calendarPath());
ImportCalendarJobInterfaceTestImpl *impl = new ImportCalendarJobInterfaceTestImpl(this, {Utils::StoredType::Config}, file->archiveStorage(), 1);
file->setAbstractImportExportJob(impl);
file->setLoggingFilePath(impl->loggingFilePath());
file->start();
delete impl;
delete file;
......
......@@ -43,3 +43,8 @@ void ExportImportUtil::addLogCreateResource(const QString &str)
{
mLogCreateResource->appendText(str);
}
QString ExportImportUtil::loggingFilePath() const
{
return mLogCreateResource->logPath();
}
......@@ -31,6 +31,7 @@ public:
void setListOfResource(const QVector<Utils::AkonadiInstanceInfo> &instanceInfoList);
void setPathConfig(const QString &pathConfig);
void addLogCreateResource(const QString &str);
Q_REQUIRED_RESULT QString loggingFilePath() const;
QVector<Utils::AkonadiInstanceInfo> mListAkonadiInstanceInfo;
QString mPathConfig;
......
......@@ -36,7 +36,8 @@ LogCreatingResource::~LogCreatingResource()
void LogCreatingResource::appendText(const QString &str)
{
//TODO
QTextStream stream(mTmpLogFile);
stream << str << '\n';
}
void LogCreatingResource::logSynchronizeResource(const QStringList &lst)
......@@ -53,10 +54,14 @@ QString LogCreatingResource::logPath() const
void LogCreatingResource::logCreateResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree)
{
// QTextStream stream(&mTmpLogFile);
// //stream << content; // content is a QString
// stream << resources << '\n';
// stream << name << '\n';
// stream << settings << '\n';
QTextStream stream(mTmpLogFile);
stream << resources << '\n';
stream << name << '\n';
QMapIterator<QString, QVariant> i(settings);
while (i.hasNext()) {
i.next();
stream << i.key() << ' ' << i.value().toString() << '\n';
}
stream << synchronizeTree << '\n';
qDebug() << "settings "<< settings;
}
......@@ -94,6 +94,7 @@ void ImportMailJobInterfaceTest::importMailConfig()
file->setExcludePath(Utils::mailsPath()); // ???
ImportMailJobInterfaceTestImpl *impl = new ImportMailJobInterfaceTestImpl(this, {Utils::StoredType::Config}, file->archiveStorage(), 1);
file->setAbstractImportExportJob(impl);
file->setLoggingFilePath(impl->loggingFilePath());
file->start();
delete impl;
delete file;
......
......@@ -86,6 +86,7 @@ void ImportNotesJobInterfaceTest::importNoteConfig()
file->setExcludePath(Utils::notePath());
ImportNotesJobInterfaceTestImpl *impl = new ImportNotesJobInterfaceTestImpl(this, {Utils::StoredType::Config}, file->archiveStorage(), 1);
file->setAbstractImportExportJob(impl);
file->setLoggingFilePath(impl->loggingFilePath());
file->start();
delete impl;
delete file;
......
......@@ -125,3 +125,13 @@ void TestImportFile::setExcludePath(const QString &excludePath)
{
mExcludePath = excludePath;
}
QString TestImportFile::loggingFilePath() const
{
return mLoggingFilePath;
}
void TestImportFile::setLoggingFilePath(const QString &loggingFilePath)
{
mLoggingFilePath = loggingFilePath;
}
......@@ -45,6 +45,9 @@ public:
Q_REQUIRED_RESULT QString excludePath() const;
void setExcludePath(const QString &excludePath);
Q_REQUIRED_RESULT QString loggingFilePath() const;
void setLoggingFilePath(const QString &loggingFilePath);
private:
AbstractImportExportJob *mAbstractImportExportJob = nullptr;
ArchiveStorage *mArchiveStorage = nullptr;
......@@ -52,6 +55,7 @@ private:
QString mPathConfig;
QString mExtractPath;
QString mExcludePath;
QString mLoggingFilePath;
};
#endif // TESTIMPORTFILE_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment