SVN_SILENT made messages (.desktop file) - always resolve ours
[kdepim.git] / kalarm / kalarmmigrateapplication.cpp
blob55951a32b59ccf59cc6b05096b4f1da85a66f6c3
1 /*
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()
25 initializeMigrator();
28 void KAlarmMigrateApplication::migrate()
30 // Migrate to xdg.
31 Kdelibs4ConfigMigrator migrate(QStringLiteral("kalarm"));
32 migrate.setConfigFiles(QStringList() << QStringLiteral("kalarmrc"));
33 migrate.setUiFiles(QStringList() << QStringLiteral("kalarmui.rc"));
34 migrate.migrate();
36 // Migrate folders and files.
37 if (mMigrator.checkIfNecessary())
38 mMigrator.start();
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;
50 // ics file
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);