Commit caf36588 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix sync tree folder

parent 12b906e6
Pipeline #168629 failed with stage
in 2 minutes and 23 seconds
......@@ -371,7 +371,7 @@ AbstractImportExportJob::restoreResourceFile(const QString &resourceBaseName, co
addSpecificResourceSettings(resourceConfig, resourceBaseName, settings);
const QString newResource = createResource(resourceBaseName, filename, settings);
const QString newResource = createResource(resourceBaseName, filename, settings, false);
infoAboutNewResource(newResource);
resourceToSync << newResource;
qCDebug(PIMDATAEXPORTERCORE_LOG) << " newResource" << newResource;
......
......@@ -57,7 +57,7 @@ protected:
virtual void slotNextStep();
protected:
Q_REQUIRED_RESULT bool copyArchiveFileTo(const KArchiveFile *file, const QString &destination);
bool copyArchiveFileTo(const KArchiveFile *file, const QString &destination);
void initializeListStep();
virtual void startSynchronizeResources(const QStringList &listResourceToSync);
void infoAboutNewResource(const QString &resourceName);
......@@ -104,7 +104,7 @@ protected:
Q_REQUIRED_RESULT virtual Akonadi::Collection::Id convertFolderPathToCollectionId(const QString &path) = 0;
virtual QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) = 0;
Q_REQUIRED_RESULT virtual QString
createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree = false) = 0;
createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings, bool synchronizeTree) = 0;
QHash<QString, Akonadi::Collection::Id> mHashConvertPathCollectionId;
QVector<ResourceFiles> mListResourceFile;
......
......@@ -23,7 +23,7 @@ protected:
Q_REQUIRED_RESULT QString createResource(const QString &resources,
const QString &name,
const QMap<QString, QVariant> &settings,
bool synchronizeTree = false) override;
bool synchronizeTree) override;
Q_REQUIRED_RESULT QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData) override;
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
};
......@@ -25,6 +25,6 @@ protected:
Q_REQUIRED_RESULT QString createResource(const QString &resources,
const QString &name,
const QMap<QString, QVariant> &settings,
bool synchronizeTree = false) override;
bool synchronizeTree) override;
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
};
akonadi_vcard_resource
Notes
Path /tmp/backupaddressbook//akonadi_vcard_resource_1.zip
0
synchronizeTree: false
--------------------------
akonadi_vcarddir_resource
Notes
Path /tmp/backupaddressbook//0/
1
synchronizeTree: true
--------------------------
akonadi_contacts_resource
Notes
Path /tmp/backupaddressbook//1/
1
synchronizeTree: true
--------------------------
akonadi_vcard_resource_new_resource_0
akonadi_vcarddir_resource_new_resource_1
......
......@@ -23,7 +23,7 @@ protected:
Q_REQUIRED_RESULT QString createResource(const QString &resources,
const QString &name,
const QMap<QString, QVariant> &settings,
bool synchronizeTree = false) override;
bool synchronizeTree) override;
void synchronizeResource(const QStringList &lst) override;
Q_REQUIRED_RESULT QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData) override;
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
......
akonadi_kalarm_dir_resource
Active Alarms2
Path /tmp/backupalarm//calendar.ics
1
synchronizeTree: true
--------------------------
akonadi_kalarm_dir_resource_new_resource_0
--------------------------
......@@ -24,7 +24,7 @@ protected:
Q_REQUIRED_RESULT QString createResource(const QString &resources,
const QString &name,
const QMap<QString, QVariant> &settings,
bool synchronizeTree = false) override;
bool synchronizeTree) override;
void synchronizeResource(const QStringList &lst) override;
Q_REQUIRED_RESULT QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData) override;
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
......
akonadi_ical_resource
schedule.ics
Path /tmp/backupcalendar//std.ics
0
synchronizeTree: false
--------------------------
akonadi_davgroupware_resource
caldav
Path /tmp/backupcalendar//0/
0
synchronizeTree: false
--------------------------
akonadi_ical_resource_new_resource_0
akonadi_davgroupware_resource_new_resource_1
......
......@@ -24,7 +24,7 @@ protected:
Q_REQUIRED_RESULT QString createResource(const QString &resources,
const QString &name,
const QMap<QString, QVariant> &settings,
bool synchronizeTree = false) override;
bool synchronizeTree) override;
void synchronizeResource(const QStringList &lst) override;
Q_REQUIRED_RESULT QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData) override;
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
......
......@@ -68,7 +68,7 @@ QString LogCreatingResource::logCreateResource(const QString &resources, const Q
stream << i.key() << ' ' << i.value().toString() << '\n';
}
}
stream << synchronizeTree << '\n';
stream << "synchronizeTree: " << (synchronizeTree ? "true" : "false") << '\n';
stream << "--------------------------\n";
const QString resourceName = resources + QStringLiteral("_new_resource_") + QString::number(mResourceIndex++);
// qDebug() << " RESOURCE NAME " << resourceName;
......
......@@ -2,32 +2,32 @@ akonadi_mixedmaildir_resource
Local Folders
Path /tmp/backupmail//0/
TopLevelIsContainer true
0
synchronizeTree: true
--------------------------
akonadi_mbox_resource
mbox1
Path /tmp/backupmail//akonadi_mbox_resource_1.mbox
0
synchronizeTree: true
--------------------------
akonadi_maildir_resource
maildir 1
Path /tmp/backupmail//1/
TopLevelIsContainer true
0
synchronizeTree: true
--------------------------
akonadi_mixedmaildir_resource_new_resource_0
akonadi_maildir_resource_new_resource_2
--------------------------
akonadi_imap_resource
akonadi_imap_resource_1rc
0
synchronizeTree: true
--------------------------
akonadi_kolab_resource
perso
ImapServer bli.bla.com
TrashCollection 245
UserName bla@bla.com
0
synchronizeTree: true
--------------------------
akonadi_pop3_resource
perso3
......@@ -41,7 +41,7 @@ Pipelining true
SeenUidList 1589466101.18581.mail175.ha.foo.net,S=6906,1589466102.10772.mail114.ha.foo.net
TargetCollection 3788
UseTLS true
0
synchronizeTree: false
--------------------------
Special Collection : 3 colId 3734
--------------------------
......
akonadi_imap_resource
akonadi_imap_resource_1rc
0
synchronizeTree: true
--------------------------
akonadi_kolab_resource
perso
ImapServer bli.bla.com
TrashCollection 245
UserName bla@bla.com
0
synchronizeTree: true
--------------------------
akonadi_pop3_resource
perso3
......@@ -21,5 +21,5 @@ Pipelining true
SeenUidList 1589466101.18581.mail175.ha.foo.net,S=6906,1589466102.10772.mail114.ha.foo.net
TargetCollection 3788
UseTLS true
0
synchronizeTree: false
--------------------------
akonadi_akonotes_resource
Notes2
Path /tmp/backupnote//0/
1
synchronizeTree: true
--------------------------
akonadi_akonotes_resource
Notes
Path /tmp/backupnote//1/
1
synchronizeTree: true
--------------------------
akonadi_akonotes_resource_new_resource_0
akonadi_akonotes_resource_new_resource_1
......
......@@ -24,7 +24,7 @@ protected:
Q_REQUIRED_RESULT QString createResource(const QString &resources,
const QString &name,
const QMap<QString, QVariant> &settings,
bool synchronizeTree = false) override;
bool synchronizeTree) override;
void synchronizeResource(const QStringList &lst) override;
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
};
......@@ -172,11 +172,16 @@ void ImportMailJobInterface::restoreTransports()
Q_EMIT info(i18n("Restore transports..."));
const KArchiveEntry *transport = mArchiveDirectory->entry(path);
bool importDone = false;
if (transport && transport->isFile()) {
const auto fileTransport = static_cast<const KArchiveFile *>(transport);
copyArchiveFileTo(fileTransport, mTempDirName);
importMailTransport(mTempDirName);
importDone = copyArchiveFileTo(fileTransport, mTempDirName);
if (importDone) {
importMailTransport(mTempDirName);
}
}
if (importDone) {
Q_EMIT info(i18n("Transports restored."));
} else {
Q_EMIT error(i18n("Failed to restore transports file."));
......@@ -295,7 +300,7 @@ void ImportMailJobInterface::restoreResources()
settings.insert(QStringLiteral("DownloadLater"), leaveOnserver.readEntry("downloadLater", QStringList()));
}
const QString newResourceName = resourceName.isEmpty() ? filename : resourceName;
const QString newResource = createResource(QStringLiteral("akonadi_pop3_resource"), newResourceName, settings);
const QString newResource = createResource(QStringLiteral("akonadi_pop3_resource"), newResourceName, settings, false);
if (!newResource.isEmpty()) {
mHashResources.insert(filename, newResource);
infoAboutNewResource(newResource);
......@@ -394,11 +399,11 @@ void ImportMailJobInterface::restoreResources()
QString newResource;
const QString newResourceName = resourceName.isEmpty() ? filename : resourceName;
if (filename.contains(QLatin1String("kolab_"))) {
newResource = createResource(QStringLiteral("akonadi_kolab_resource"), newResourceName, settings);
newResource = createResource(QStringLiteral("akonadi_kolab_resource"), newResourceName, settings, true);
} else if (filename.contains(QLatin1String("gmail_"))) {
newResource = createResource(QStringLiteral("akonadi_gmail_resource"), newResourceName, settings);
newResource = createResource(QStringLiteral("akonadi_gmail_resource"), newResourceName, settings, true);
} else {
newResource = createResource(QStringLiteral("akonadi_imap_resource"), newResourceName, settings);
newResource = createResource(QStringLiteral("akonadi_imap_resource"), newResourceName, settings, true);
}
if (!newResource.isEmpty()) {
mHashResources.insert(filename, newResource);
......@@ -494,7 +499,7 @@ void ImportMailJobInterface::restoreMails()
settings.insert(QStringLiteral("MessageCount"), compacting.readEntry(QStringLiteral("MessageCount"), 50));
}
}
const QString newResource = createResource(QStringLiteral("akonadi_mbox_resource"), filename, settings);
const QString newResource = createResource(QStringLiteral("akonadi_mbox_resource"), filename, settings, true);
if (!newResource.isEmpty()) {
mHashResources.insert(filename, newResource);
infoAboutNewResource(newResource);
......@@ -517,7 +522,8 @@ void ImportMailJobInterface::restoreMails()
createResource(resourceName.contains(QLatin1String("akonadi_mixedmaildir_resource_")) ? QStringLiteral("akonadi_mixedmaildir_resource")
: QStringLiteral("akonadi_maildir_resource"),
filename,
settings);
settings,
true);
if (!newResource.isEmpty()) {
mHashResources.insert(filename, newResource);
infoAboutNewResource(newResource);
......
......@@ -36,7 +36,7 @@ protected:
Q_REQUIRED_RESULT QString createResource(const QString &resources,
const QString &name,
const QMap<QString, QVariant> &settings,
bool synchronizeTree = false) override;
bool synchronizeTree) override;
Q_REQUIRED_RESULT QString adaptResourcePath(const KSharedConfigPtr &resourceConfig, const QString &storedData) override;
void synchronizeResource(const QStringList &lst) override;
void importFilters(const QString &filename) override;
......
......@@ -24,7 +24,7 @@ protected:
Q_REQUIRED_RESULT QString createResource(const QString &resources,
const QString &name,
const QMap<QString, QVariant> &settings,
bool synchronizeTree = false) override;
bool synchronizeTree) override;
void synchronizeResource(const QStringList &lst) override;
Q_REQUIRED_RESULT QString adaptNewResourceUrl(bool overwriteResources, const KSharedConfig::Ptr &resourceConfig, const QString &storePath) override;
};
Supports Markdown
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