Commit 966e0241 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Now korgac is remplaced by kalendaracrc

parent 926d000d
Pipeline #169019 passed with stage
in 2 minutes and 41 seconds
[Alarms]
CalendarsLastChecked=2022,4,27,12,39,0.161
[General]
Autostart=true
Enabled=true
[Suspended][45bfaf0e-5335-479d-a56a-7db0f0509794]
Occurrence=0,0,0,-1,-1,-1.001
RemindAt=2022,1,7,10,45,0.128
Text=REMINDER
UID=45bfaf0e-5335-479d-a56a-7db0f0509794
......@@ -5,7 +5,7 @@ calendar/akonadi_ical_resource_2/akonadi_ical_resource_2rc
calendar/akonadi_ical_resource_2/std.ics
configs/calendar_printing.rc
configs/eventviewsrc
configs/korgacrc
configs/kalendaracrc
configs/korganizerrc
information/VERSION_2
information/exportdatatype.xml
[Alarms]
CalendarsLastChecked=foo/bla bla/bli2022,foo/bla bla/bli4,foo/bla bla/bli27,foo/bla bla/bli12,foo/bla bla/bli39
[General]
Autostart=true
Enabled=true
[Suspended][45bfaf0e-5335-479d-a56a-7db0f0509794]
Occurrence=0,0,0,-1,-1,-1.001
RemindAt=2022,1,7,10,45,0.128
Text=REMINDER
UID=45bfaf0e-5335-479d-a56a-7db0f0509794
[Alarms]
CalendarsLastChecked=2022,4,27,12,41,0.167
[General]
Autostart=true
Enabled=true
[Suspended][45bfaf0e-5335-479d-a56a-7db0f0509794]
Occurrence=0,0,0,-1,-1,-1.001
RemindAt=2022,1,7,10,45,0.128
Text=REMINDER
UID=45bfaf0e-5335-479d-a56a-7db0f0509794
configs/korganizerrc
configs/eventviewsrc
configs/korgacrc
configs/kalendaracrc
configs/calendar_printing.rc
information/VERSION_2
information/exportdatatype.xml
[Alarms]
CalendarsLastChecked=foo/bla bla/bli2022,foo/bla bla/bli4,foo/bla bla/bli27,foo/bla bla/bli12,foo/bla bla/bli41
[General]
Autostart=true
Enabled=true
[Suspended][45bfaf0e-5335-479d-a56a-7db0f0509794]
Occurrence=0,0,0,-1,-1,-1.001
RemindAt=2022,1,7,10,45,0.128
Text=REMINDER
UID=45bfaf0e-5335-479d-a56a-7db0f0509794
......@@ -5,7 +5,7 @@ calendar/akonadi_ical_resource_2/akonadi_ical_resource_2rc
calendar/akonadi_ical_resource_2/std.ics
configs/calendar_printing.rc
configs/eventviewsrc
configs/korgacrc
configs/kalendaracrc
configs/korganizerrc
information/VERSION_2
information/exportdatatype.xml
configs/korganizerrc
configs/eventviewsrc
configs/korgacrc
configs/kalendaracrc
configs/calendar_printing.rc
information/VERSION_2
information/exportdatatype.xml
......@@ -113,10 +113,68 @@ void ExportCalendarJobInterface::slotCheckBackupConfig()
Q_EMIT jobFinished();
}
void ExportCalendarJobInterface::backupConfig()
void ExportCalendarJobInterface::exportEventViewConfig()
{
setProgressDialogLabel(i18n("Backing up config..."));
const QString eventviewsrcStr(QStringLiteral("eventviewsrc"));
const QString eventviewsrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + eventviewsrcStr;
if (QFileInfo::exists(eventviewsrc)) {
KSharedConfigPtr eventviews = KSharedConfig::openConfig(eventviewsrc);
QTemporaryFile tmp;
tmp.open();
KConfig *eventviewConfig = eventviews->copyTo(tmp.fileName());
const QString resourceColorStr(QStringLiteral("Resources Colors"));
if (eventviewConfig->hasGroup(resourceColorStr)) {
KConfigGroup group = eventviewConfig->group(resourceColorStr);
const QStringList keyList = group.keyList();
bool found = false;
for (const QString &key : keyList) {
const int collectionValue = key.toInt(&found);
if (found && collectionValue != -1) {
const QString realPath = convertToFullCollectionPath(collectionValue);
const QColor color = group.readEntry(key, QColor());
group.writeEntry(realPath, color);
group.deleteEntry(key);
}
}
}
eventviewConfig->sync();
backupFile(tmp.fileName(), Utils::configsPath(), eventviewsrcStr);
delete eventviewConfig;
}
}
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::exportKorganizerConfig()
{
const QString korganizerStr(QStringLiteral("korganizerrc"));
const QString korganizerrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + korganizerStr;
if (QFileInfo::exists(korganizerrc)) {
......@@ -152,40 +210,17 @@ void ExportCalendarJobInterface::backupConfig()
backupFile(tmp.fileName(), Utils::configsPath(), korganizerStr);
delete korganizerConfig;
}
const QString eventviewsrcStr(QStringLiteral("eventviewsrc"));
const QString eventviewsrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + eventviewsrcStr;
if (QFileInfo::exists(eventviewsrc)) {
KSharedConfigPtr eventviews = KSharedConfig::openConfig(eventviewsrc);
QTemporaryFile tmp;
tmp.open();
KConfig *eventviewConfig = eventviews->copyTo(tmp.fileName());
const QString resourceColorStr(QStringLiteral("Resources Colors"));
if (eventviewConfig->hasGroup(resourceColorStr)) {
KConfigGroup group = eventviewConfig->group(resourceColorStr);
}
const QStringList keyList = group.keyList();
bool found = false;
for (const QString &key : keyList) {
const int collectionValue = key.toInt(&found);
if (found && collectionValue != -1) {
const QString realPath = convertToFullCollectionPath(collectionValue);
const QColor color = group.readEntry(key, QColor());
group.writeEntry(realPath, color);
group.deleteEntry(key);
}
}
}
void ExportCalendarJobInterface::backupConfig()
{
setProgressDialogLabel(i18n("Backing up config..."));
eventviewConfig->sync();
backupFile(tmp.fileName(), Utils::configsPath(), eventviewsrcStr);
delete eventviewConfig;
}
exportKorganizerConfig();
exportEventViewConfig();
exportReminderAgentConfig();
backupConfigFile(QStringLiteral("calendar_printing.rc"));
backupConfigFile(QStringLiteral("korgacrc"));
const QString freebusyurlsStr(QStringLiteral("korganizer/freebusyurls"));
const QString freebusyurls = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + freebusyurlsStr;
......
......@@ -32,6 +32,9 @@ protected:
private:
void slotCheckBackupResource();
void exportEventViewConfig();
void exportKorganizerConfig();
void exportReminderAgentConfig();
void backupConfig();
int mIndexIdentifier = 0;
......
......@@ -146,17 +146,17 @@ void ImportCalendarJobInterface::restoreConfig()
}
}
const QString korgacStr(QStringLiteral("korgacrc"));
const KArchiveEntry *korgacrcentry = mArchiveDirectory->entry(Utils::configsPath() + korgacStr);
if (korgacrcentry && korgacrcentry->isFile()) {
const auto korgacrcFile = static_cast<const KArchiveFile *>(korgacrcentry);
const QString korgacrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + korgacStr;
if (QFileInfo::exists(korgacrc)) {
if (overwriteConfigMessageBox(korgacStr)) {
copyToFile(korgacrcFile, korgacrc, korgacStr, Utils::configsPath());
const QString kalendaracStr(QStringLiteral("kalendaracrc"));
const KArchiveEntry *kalendaracentry = mArchiveDirectory->entry(Utils::configsPath() + kalendaracStr);
if (kalendaracentry && kalendaracentry->isFile()) {
const auto kalendaracFile = static_cast<const KArchiveFile *>(kalendaracentry);
const QString kalendaracrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + kalendaracStr;
if (QFileInfo::exists(kalendaracrc)) {
if (overwriteConfigMessageBox(kalendaracStr)) {
importReminderAgentConfig(kalendaracFile, kalendaracrc, kalendaracStr, Utils::configsPath());
}
} else {
copyToFile(korgacrcFile, korgacrc, korgacStr, Utils::configsPath());
importReminderAgentConfig(kalendaracFile, kalendaracrc, kalendaracStr, Utils::configsPath());
}
}
......@@ -217,6 +217,14 @@ void ImportCalendarJobInterface::importkorganizerConfig(const KArchiveFile *file
korganizerConfig->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,6 +31,7 @@ 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 restoreResources();
void restoreConfig();
void addSpecificResourceSettings(const KSharedConfig::Ptr &resourceConfig, const QString &resourceName, QMap<QString, QVariant> &settings) override;
......
2019-11-04:
2022-04-22:
-----------
2015-1-29: New VERSION for archive => VERSION_2 => knote-akonadi
......@@ -59,7 +59,7 @@ Root
| |---------kalarmrc
| |---------korganizerrc
| |---------calendar_printing.rc
| |---------korgacrc
| |---------kalendaracrc
| |---------kaddressbookrc
| |---------akonadi_mailfilter_agent.notifyrc
| |---------akonadi_sendlater_agent.notifyrc
......
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