Commit 95a11b03 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix export reminder agent config

parent f600b003
Pipeline #169620 passed with stage
in 1 minute and 27 seconds
[Alarms]
CalendarsLastChecked=foo/bla bla/bli2022,foo/bla bla/bli4,foo/bla bla/bli27,foo/bla bla/bli12,foo/bla bla/bli39
CalendarsLastChecked=2022,4,27,12,39,0.161
[General]
Autostart=true
......
[Alarms]
CalendarsLastChecked=foo/bla bla/bli2022,foo/bla bla/bli4,foo/bla bla/bli27,foo/bla bla/bli12,foo/bla bla/bli39
CalendarsLastChecked=2022,4,27,12,39,0.161
[General]
Autostart=true
......
[Alarms]
CalendarsLastChecked=foo/bla bla/bli2022,foo/bla bla/bli4,foo/bla bla/bli27,foo/bla bla/bli12,foo/bla bla/bli41
CalendarsLastChecked=2022,4,27,12,41,0.167
[General]
Autostart=true
......
[Alarms]
CalendarsLastChecked=2032,14,37,22,49
CalendarsLastChecked=2022,4,27,12,39,0.161
[General]
Autostart=true
......
[Alarms]
CalendarsLastChecked=2032,14,37,22,49
CalendarsLastChecked=2022,4,27,12,39,0.161
[General]
Autostart=true
......
[Alarms]
CalendarsLastChecked=2032,14,37,22,51
CalendarsLastChecked=2022,4,27,12,41,0.167
[General]
Autostart=true
......
......@@ -154,31 +154,6 @@ void ExportCalendarJobInterface::exportResourceColors(KConfig *config)
}
}
void ExportCalendarJobInterface::exportReminderAgentConfig()
{
const QString kalendarcStr(QStringLiteral("kalendaracrc"));
const QString kalendarcrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + kalendarcStr;
if (QFileInfo::exists(kalendarcrc)) {
KSharedConfigPtr kalendarc = KSharedConfig::openConfig(kalendarcrc);
QTemporaryFile tmp;
tmp.open();
tmp.setAutoRemove(false);
KConfig *kalendarcConfig = kalendarc->copyTo(tmp.fileName());
const QString globalCollectionsStr(QStringLiteral("Alarms"));
if (kalendarcConfig->hasGroup(globalCollectionsStr)) {
KConfigGroup group = kalendarcConfig->group(globalCollectionsStr);
const QString selectionKey(QStringLiteral("CalendarsLastChecked"));
convertCollectionListToRealPath(group, selectionKey);
}
kalendarcConfig->sync();
backupFile(tmp.fileName(), Utils::configsPath(), kalendarcStr);
delete kalendarcConfig;
}
}
void ExportCalendarJobInterface::exportKalendarConfig()
{
const QString kalendarStr(QStringLiteral("kalendarrc"));
......@@ -251,7 +226,7 @@ void ExportCalendarJobInterface::backupConfig()
exportKorganizerConfig();
exportEventViewConfig();
exportReminderAgentConfig();
backupConfigFile(QStringLiteral("kalendaracrc"));
exportKalendarConfig();
backupConfigFile(QStringLiteral("calendar_printing.rc"));
......
......@@ -34,7 +34,6 @@ private:
void slotCheckBackupResource();
void exportEventViewConfig();
void exportKorganizerConfig();
void exportReminderAgentConfig();
void exportKalendarConfig();
void exportResourceColors(KConfig *config);
......
......@@ -157,10 +157,10 @@ void ImportCalendarJobInterface::restoreConfig()
const QString kalendaracrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + kalendaracStr;
if (QFileInfo::exists(kalendaracrc)) {
if (overwriteConfigMessageBox(kalendaracStr)) {
importReminderAgentConfig(kalendaracFile, kalendaracrc, kalendaracStr, Utils::configsPath());
copyToFile(kalendaracFile, kalendaracrc, kalendaracStr, Utils::configsPath());
}
} else {
importReminderAgentConfig(kalendaracFile, kalendaracrc, kalendaracStr, Utils::configsPath());
copyToFile(kalendaracFile, kalendaracrc, kalendaracStr, Utils::configsPath());
}
}
}
......@@ -253,14 +253,6 @@ void ImportCalendarJobInterface::importKalendarConfig(const KArchiveFile *file,
kalendarConfig->sync();
}
void ImportCalendarJobInterface::importReminderAgentConfig(const KArchiveFile *file, const QString &config, const QString &filename, const QString &prefix)
{
copyToFile(file, config, filename, prefix);
KSharedConfig::Ptr reminderAgentConfig = KSharedConfig::openConfig(config);
convertCollectionListStrToAkonadiId(reminderAgentConfig, QStringLiteral("Alarms"), QStringLiteral("CalendarsLastChecked"), false);
reminderAgentConfig->sync();
}
void ImportCalendarJobInterface::importeventViewConfig(const KArchiveFile *file, const QString &config, const QString &filename, const QString &prefix)
{
copyToFile(file, config, filename, prefix);
......
......@@ -31,7 +31,6 @@ private:
Q_REQUIRED_RESULT bool isAConfigFile(const QString &name) const override;
void importkorganizerConfig(const KArchiveFile *file, const QString &config, const QString &filename, const QString &prefix);
void importeventViewConfig(const KArchiveFile *file, const QString &config, const QString &filename, const QString &prefix);
void importReminderAgentConfig(const KArchiveFile *file, const QString &config, const QString &filename, const QString &prefix);
void importKalendarConfig(const KArchiveFile *file, const QString &config, const QString &filename, const QString &prefix);
void restoreResources();
void restoreConfig();
......
Supports Markdown
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