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

Import/export kaddressbook/printing/

parent 85d479bb
......@@ -278,27 +278,31 @@ void ImportAddressbookJob::importkaddressBookConfig(const KArchiveFile *file, co
}
importSubdirectory(QStringLiteral("/kaddressbook/viewertemplates/"));
importSubdirectory(QStringLiteral("/kaddressbook/printing/"));
kaddressBookConfig->sync();
}
const QString viewerTemplateName = QStringLiteral("/kaddressbook/viewertemplates/");
const KArchiveEntry *themeEntry = mArchiveDirectory->entry(Utils::dataPath() + viewerTemplateName);
void ImportAddressbookJob::importSubdirectory(const QString &subdirectoryRelativePath)
{
const KArchiveEntry *themeEntry = mArchiveDirectory->entry(Utils::dataPath() + subdirectoryRelativePath);
if (themeEntry && themeEntry->isDirectory()) {
const KArchiveDirectory *themeDir = static_cast<const KArchiveDirectory *>(themeEntry);
Q_FOREACH (const QString &entryName, themeDir->entries()) {
const KArchiveEntry *entry = themeDir->entry(entryName);
if (entry && entry->isDirectory()) {
QString subFolderName = entryName;
QDir themeDirectory(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + viewerTemplateName + QStringLiteral("/%1").arg(entryName));
QDir themeDirectory(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + subdirectoryRelativePath + QStringLiteral("/%1").arg(entryName));
int i = 1;
while (themeDirectory.exists()) {
subFolderName = entryName + QStringLiteral("_%1").arg(i);
themeDirectory = QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + viewerTemplateName + QStringLiteral("/%1").arg(subFolderName));
themeDirectory = QDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + subdirectoryRelativePath + QStringLiteral("/%1").arg(subFolderName));
++i;
}
copyToDirectory(entry, QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + viewerTemplateName + QStringLiteral("/%1").arg(subFolderName));
copyToDirectory(entry, QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + subdirectoryRelativePath + QStringLiteral("/%1").arg(subFolderName));
}
}
}
kaddressBookConfig->sync();
}
......@@ -36,6 +36,7 @@ protected Q_SLOTS:
void slotNextStep() Q_DECL_OVERRIDE;
private:
void importSubdirectory(const QString &subdirectoryRelativePath);
void searchAllFiles(const KArchiveDirectory *dir, const QString &prefix);
void storeAddressBookArchiveResource(const KArchiveDirectory *dir, const QString &prefix);
void importkaddressBookConfig(const KArchiveFile *file, const QString &config, const QString &filename, const QString &prefix);
......
......@@ -111,5 +111,6 @@ Root
| |---------blogilo/blogilo.db
| |---------kaddressbook/viewertemplates/
| |---------kaddressbook/csv-templates/
| |---------kaddressbook/printing/
| |---------korganizer/designer/
| |---------gravatar/*.png
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