2 Copyright (c) 2015-2016 Montel Laurent <montel@kde.org>
4 based on code from Sune Vuorela <sune@vuorela.dk> (Rawatar source code)
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License, version 2, as
8 published by the Free Software Foundation.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #include "kaddressbookmigrateapplication.h"
22 #include <Kdelibs4ConfigMigrator>
25 KAddressBookMigrateApplication::KAddressBookMigrateApplication()
30 void KAddressBookMigrateApplication::migrate()
33 Kdelibs4ConfigMigrator
migrate(QStringLiteral("kaddressbook"));
34 migrate
.setConfigFiles(QStringList() << QStringLiteral("kaddressbookrc"));
35 migrate
.setUiFiles(QStringList() << QStringLiteral("kaddressbookui.rc"));
38 // Migrate folders and files.
39 if (mMigrator
.checkIfNecessary()) {
44 void KAddressBookMigrateApplication::initializeMigrator()
46 const int currentVersion
= 2;
47 mMigrator
.setApplicationName(QStringLiteral("kaddressbook"));
48 mMigrator
.setConfigFileName(QStringLiteral("kaddressbookrc"));
50 // To migrate we need a version > currentVersion
51 const int initialVersion
= currentVersion
+ 1;
54 PimCommon::MigrateFileInfo migrateInfoPrinting
;
55 migrateInfoPrinting
.setFolder(true);
56 migrateInfoPrinting
.setType(QStringLiteral("data"));
57 migrateInfoPrinting
.setPath(QStringLiteral("kaddressbook/printing"));
58 migrateInfoPrinting
.setVersion(initialVersion
);
59 mMigrator
.insertMigrateInfo(migrateInfoPrinting
);
62 PimCommon::MigrateFileInfo migrateInfoViewerTemplates
;
63 migrateInfoViewerTemplates
.setFolder(true);
64 migrateInfoViewerTemplates
.setType(QStringLiteral("data"));
65 migrateInfoViewerTemplates
.setPath(QStringLiteral("kaddressbook/viewertemplates"));
66 migrateInfoViewerTemplates
.setVersion(initialVersion
);
67 mMigrator
.insertMigrateInfo(migrateInfoViewerTemplates
);
70 PimCommon::MigrateFileInfo migrateInfoCsvTemplates
;
71 migrateInfoCsvTemplates
.setFolder(true);
72 migrateInfoCsvTemplates
.setType(QStringLiteral("data"));
73 migrateInfoCsvTemplates
.setPath(QStringLiteral("kaddressbook/csv-templates"));
74 migrateInfoCsvTemplates
.setVersion(initialVersion
);
75 mMigrator
.insertMigrateInfo(migrateInfoCsvTemplates
);
77 mMigrator
.setCurrentConfigVersion(currentVersion
);
79 //TODO add folder to migrate