Commit 20f14c79 authored by Laurent Montel's avatar Laurent Montel 😁

Allow to migrate ics file

parent 233c966a
......@@ -101,6 +101,7 @@ set(kalarm_bin_SRCS ${libkalarm_SRCS}
wakedlg.cpp
)
set(kalarm_bin_SRCS ${kalarm_bin_SRCS}
kalarmmigrateapplication.cpp
akonadimodel.cpp
akonadiresourcecreator.cpp
collectionmodel.cpp
......@@ -155,6 +156,7 @@ KF5::KCMUtils
Phonon::phonon4qt5
KF5::Auth
KF5::DBusAddons
pimcommon
)
if (Qt5X11Extras_FOUND)
......
/*
Copyright (c) 2015 Montel Laurent <montel@kde.org>
based on code from Sune Vuorela <sune@vuorela.dk> (Rawatar source code)
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "kalarmmigrateapplication.h"
#include <Kdelibs4ConfigMigrator>
KAlarmMigrateApplication::KAlarmMigrateApplication()
{
initializeMigrator();
}
void KAlarmMigrateApplication::migrate()
{
// Migrate to xdg.
Kdelibs4ConfigMigrator migrate(QStringLiteral("kalarm"));
migrate.setConfigFiles(QStringList() << QStringLiteral("kalarmrc"));
migrate.setUiFiles(QStringList() << QStringLiteral("kalarmui.rc"));
migrate.migrate();
// Migrate folders and files.
if (mMigrator.checkIfNecessary()) {
mMigrator.start();
}
}
void KAlarmMigrateApplication::initializeMigrator()
{
const int currentVersion = 2;
mMigrator.setApplicationName(QStringLiteral("kalarm"));
mMigrator.setConfigFileName(QStringLiteral("kalarmrc"));
// To migrate we need a version > currentVersion
const int initialVersion = currentVersion + 1;
// ics file
PimCommon::MigrateFileInfo migrateInfoIcs;
migrateInfoIcs.setFolder(false);
migrateInfoIcs.setType(QStringLiteral("data"));
migrateInfoIcs.setPath(QStringLiteral("kalarm/"));
migrateInfoIcs.setVersion(initialVersion);
migrateInfoIcs.setFilePatterns(QStringList() << QStringLiteral("*.ics"));
mMigrator.insertMigrateInfo(migrateInfoIcs);
}
/*
Copyright (c) 2015 Montel Laurent <montel@kde.org>
based on code from Sune Vuorela <sune@vuorela.dk> (Rawatar source code)
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef KALARMMIGRATEAPPLICATION_H
#define KALARMMIGRATEAPPLICATION_H
#include <migration/migrateapplicationfiles.h>
class KAlarmMigrateApplication
{
public:
KAlarmMigrateApplication();
void migrate();
private:
void initializeMigrator();
PimCommon::MigrateApplicationFiles mMigrator;
};
#endif // KALARMMIGRATEAPPLICATION_H
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