2 Copyright (c) 2015 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 "kalarmmigrateapplication.h"
21 #include <Kdelibs4ConfigMigrator>
23 KAlarmMigrateApplication::KAlarmMigrateApplication()
28 void KAlarmMigrateApplication::migrate()
31 Kdelibs4ConfigMigrator
migrate(QStringLiteral("kalarm"));
32 migrate
.setConfigFiles(QStringList() << QStringLiteral("kalarmrc"));
33 migrate
.setUiFiles(QStringList() << QStringLiteral("kalarmui.rc"));
36 // Migrate folders and files.
37 if (mMigrator
.checkIfNecessary())
41 void KAlarmMigrateApplication::initializeMigrator()
43 const int currentVersion
= 2;
44 mMigrator
.setApplicationName(QStringLiteral("kalarm"));
45 mMigrator
.setConfigFileName(QStringLiteral("kalarmrc"));
47 // To migrate we need a version > currentVersion
48 const int initialVersion
= currentVersion
+ 1;
51 PimCommon::MigrateFileInfo migrateInfoIcs
;
52 migrateInfoIcs
.setFolder(false);
53 migrateInfoIcs
.setType(QStringLiteral("data"));
54 migrateInfoIcs
.setPath(QStringLiteral("kalarm/"));
55 migrateInfoIcs
.setVersion(initialVersion
);
56 migrateInfoIcs
.setFilePatterns(QStringList() << QStringLiteral("*.ics"));
57 mMigrator
.insertMigrateInfo(migrateInfoIcs
);