Commit 9161494a authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

fix import/export colors

parent 6e73de4e
Pipeline #169607 passed with stage
in 2 minutes and 56 seconds
......@@ -11,100 +11,58 @@ Selection=foo/bla bla/bli2,foo/bla bla/bli150,foo/bla bla/bli647,foo/bla bla/bli
detailViewIconSize=16
[Resources Colors]
-13=invalid
-14=invalid
-15=invalid
-16=invalid
-17=invalid
-18=invalid
-19=invalid
-20=invalid
-21=invalid
-22=invalid
-23=invalid
-24=invalid
-25=invalid
-26=invalid
-27=invalid
-28=invalid
-29=invalid
-30=invalid
-31=invalid
-32=invalid
-33=invalid
-34=invalid
-35=invalid
-47=invalid
-48=invalid
-54=invalid
-55=invalid
-56=invalid
-57=invalid
-58=invalid
-59=invalid
-60=invalid
-61=invalid
-62=invalid
-77=invalid
-80=invalid
133=invalid
1336=61,185,225
1337=193,212,231
134=invalid
135=invalid
1394=199,188,156
1400=243,81,156
1444=invalid
1451=invalid
1458=22,167,101
1459=154,156,255
1460=146,225,192
1461=251,233,131
1462=146,225,192
1463=218,33,186
1464=122,99,140
147=32,70,254
150=231,193,230
1505=255,0,0
1506=255,0,0
1507=255,0,0
1508=218,112,214
1509=255,0,0
1510=255,0,0
1511=255,0,0
1512=255,0,0
1513=255,0,0
1514=218,112,214
1515=255,0,0
1516=255,0,0
1557=255,0,0
1558=255,0,0
1559=255,0,0
1560=218,112,214
1561=255,0,0
1562=255,0,0
1580=255,0,0
1581=255,0,0
1582=255,0,0
1583=218,112,214
1584=255,0,0
1585=255,0,0
1586=116,21,178
1588=255,0,0
1589=255,0,0
1590=255,0,0
1591=218,112,214
1592=255,0,0
1593=255,0,0
1595=231,122,210
160=161,177,193
174=15,86,115
2=19,138,247
219=167,14,209
278=invalid
647=208,231,193
655=218,112,214
8=227,231,193
foo/bla bla/bli1336=61,185,225
foo/bla bla/bli1337=193,212,231
foo/bla bla/bli1394=199,188,156
foo/bla bla/bli1400=243,81,156
foo/bla bla/bli1458=22,167,101
foo/bla bla/bli1459=154,156,255
foo/bla bla/bli1460=146,225,192
foo/bla bla/bli1461=251,233,131
foo/bla bla/bli1462=146,225,192
foo/bla bla/bli1463=218,33,186
foo/bla bla/bli1464=122,99,140
foo/bla bla/bli147=32,70,254
foo/bla bla/bli150=231,193,230
foo/bla bla/bli1505=255,0,0
foo/bla bla/bli1506=255,0,0
foo/bla bla/bli1507=255,0,0
foo/bla bla/bli1508=218,112,214
foo/bla bla/bli1509=255,0,0
foo/bla bla/bli1510=255,0,0
foo/bla bla/bli1511=255,0,0
foo/bla bla/bli1512=255,0,0
foo/bla bla/bli1513=255,0,0
foo/bla bla/bli1514=218,112,214
foo/bla bla/bli1515=255,0,0
foo/bla bla/bli1516=255,0,0
foo/bla bla/bli1557=255,0,0
foo/bla bla/bli1558=255,0,0
foo/bla bla/bli1559=255,0,0
foo/bla bla/bli1560=218,112,214
foo/bla bla/bli1561=255,0,0
foo/bla bla/bli1562=255,0,0
foo/bla bla/bli1580=255,0,0
foo/bla bla/bli1581=255,0,0
foo/bla bla/bli1582=255,0,0
foo/bla bla/bli1583=218,112,214
foo/bla bla/bli1584=255,0,0
foo/bla bla/bli1585=255,0,0
foo/bla bla/bli1586=116,21,178
foo/bla bla/bli1588=255,0,0
foo/bla bla/bli1589=255,0,0
foo/bla bla/bli1590=255,0,0
foo/bla bla/bli1591=218,112,214
foo/bla bla/bli1592=255,0,0
foo/bla bla/bli1593=255,0,0
foo/bla bla/bli1595=231,122,210
foo/bla bla/bli160=161,177,193
foo/bla bla/bli174=15,86,115
foo/bla bla/bli2=19,138,247
foo/bla bla/bli219=167,14,209
foo/bla bla/bli647=208,231,193
foo/bla bla/bli655=218,112,214
foo/bla bla/bli8=227,231,193
[Sidebar]
tagsSectionExpanded=false
......
......@@ -11,100 +11,58 @@ Selection=c12,c160,c657,c665
detailViewIconSize=16
[Resources Colors]
-13=invalid
-14=invalid
-15=invalid
-16=invalid
-17=invalid
-18=invalid
-19=invalid
-20=invalid
-21=invalid
-22=invalid
-23=invalid
-24=invalid
-25=invalid
-26=invalid
-27=invalid
-28=invalid
-29=invalid
-30=invalid
-31=invalid
-32=invalid
-33=invalid
-34=invalid
-35=invalid
-47=invalid
-48=invalid
-54=invalid
-55=invalid
-56=invalid
-57=invalid
-58=invalid
-59=invalid
-60=invalid
-61=invalid
-62=invalid
-77=invalid
-80=invalid
133=invalid
1336=61,185,225
1337=193,212,231
134=invalid
135=invalid
1394=199,188,156
1400=243,81,156
1444=invalid
1451=invalid
1458=22,167,101
1459=154,156,255
1460=146,225,192
1461=251,233,131
1462=146,225,192
1463=218,33,186
1464=122,99,140
147=32,70,254
150=231,193,230
1505=255,0,0
1506=255,0,0
1507=255,0,0
1508=218,112,214
1509=255,0,0
1510=255,0,0
1511=255,0,0
1512=255,0,0
1513=255,0,0
1514=218,112,214
12=19,138,247
1346=61,185,225
1347=193,212,231
1404=199,188,156
1410=243,81,156
1468=22,167,101
1469=154,156,255
1470=146,225,192
1471=251,233,131
1472=146,225,192
1473=218,33,186
1474=122,99,140
1515=255,0,0
1516=255,0,0
1557=255,0,0
1558=255,0,0
1559=255,0,0
1560=218,112,214
1561=255,0,0
1562=255,0,0
1580=255,0,0
1581=255,0,0
1582=255,0,0
1583=218,112,214
1584=255,0,0
1585=255,0,0
1586=116,21,178
1588=255,0,0
1589=255,0,0
1517=255,0,0
1518=218,112,214
1519=255,0,0
1520=255,0,0
1521=255,0,0
1522=255,0,0
1523=255,0,0
1524=218,112,214
1525=255,0,0
1526=255,0,0
1567=255,0,0
1568=255,0,0
1569=255,0,0
157=32,70,254
1570=218,112,214
1571=255,0,0
1572=255,0,0
1590=255,0,0
1591=218,112,214
1591=255,0,0
1592=255,0,0
1593=255,0,0
1595=231,122,210
160=161,177,193
174=15,86,115
2=19,138,247
219=167,14,209
278=invalid
647=208,231,193
655=218,112,214
8=227,231,193
1593=218,112,214
1594=255,0,0
1595=255,0,0
1596=116,21,178
1598=255,0,0
1599=255,0,0
160=231,193,230
1600=255,0,0
1601=218,112,214
1602=255,0,0
1603=255,0,0
1605=231,122,210
170=161,177,193
18=227,231,193
184=15,86,115
229=167,14,209
657=208,231,193
665=218,112,214
[Sidebar]
tagsSectionExpanded=false
......
......@@ -124,27 +124,33 @@ void ExportCalendarJobInterface::exportEventViewConfig()
tmp.open();
KConfig *eventviewConfig = eventviews->copyTo(tmp.fileName());
exportResourceColors(eventviewConfig);
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());
eventviewConfig->sync();
backupFile(tmp.fileName(), Utils::configsPath(), eventviewsrcStr);
delete eventviewConfig;
}
}
void ExportCalendarJobInterface::exportResourceColors(KConfig *config)
{
const QString resourceColorStr(QStringLiteral("Resources Colors"));
if (config->hasGroup(resourceColorStr)) {
KConfigGroup group = config->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());
if (color.isValid()) {
group.writeEntry(realPath, color);
group.deleteEntry(key);
}
group.deleteEntry(key);
}
}
eventviewConfig->sync();
backupFile(tmp.fileName(), Utils::configsPath(), eventviewsrcStr);
delete eventviewConfig;
}
}
......@@ -193,7 +199,7 @@ void ExportCalendarJobInterface::exportKalendarConfig()
// Add Current
}
// Add Resources Colors
exportResourceColors(kalendarConfig);
kalendarConfig->sync();
backupFile(tmp.fileName(), Utils::configsPath(), kalendarStr);
delete kalendarConfig;
......
......@@ -36,6 +36,7 @@ private:
void exportKorganizerConfig();
void exportReminderAgentConfig();
void exportKalendarConfig();
void exportResourceColors(KConfig *config);
void backupConfig();
int mIndexIdentifier = 0;
......
......@@ -249,7 +249,7 @@ void ImportCalendarJobInterface::importKalendarConfig(const KArchiveFile *file,
KSharedConfig::Ptr kalendarConfig = KSharedConfig::openConfig(config);
convertCollectionListStrToAkonadiId(kalendarConfig, QStringLiteral("GlobalCollectionSelection"), QStringLiteral("Selection"), true);
// TODO Resources Colors
convertResourceColors(kalendarConfig);
kalendarConfig->sync();
}
......@@ -265,10 +265,15 @@ void ImportCalendarJobInterface::importeventViewConfig(const KArchiveFile *file,
{
copyToFile(file, config, filename, prefix);
KSharedConfig::Ptr eventviewConfig = KSharedConfig::openConfig(config);
convertResourceColors(eventviewConfig);
eventviewConfig->sync();
}
void ImportCalendarJobInterface::convertResourceColors(const KSharedConfig::Ptr &config)
{
const QString resourceColorStr(QStringLiteral("Resources Colors"));
if (eventviewConfig->hasGroup(resourceColorStr)) {
KConfigGroup group = eventviewConfig->group(resourceColorStr);
if (config->hasGroup(resourceColorStr)) {
KConfigGroup group = config->group(resourceColorStr);
const QStringList keyList = group.keyList();
for (const QString &key : keyList) {
const Akonadi::Collection::Id id = convertPathToId(key);
......@@ -279,8 +284,6 @@ void ImportCalendarJobInterface::importeventViewConfig(const KArchiveFile *file,
group.deleteEntry(key);
}
}
eventviewConfig->sync();
}
void ImportCalendarJobInterface::restoreResources()
......
......@@ -37,4 +37,5 @@ private:
void restoreConfig();
void addSpecificResourceSettings(const KSharedConfig::Ptr &resourceConfig, const QString &resourceName, QMap<QString, QVariant> &settings) override;
Q_REQUIRED_RESULT QString installConfigLocation() const;
void convertResourceColors(const KSharedConfig::Ptr &config);
};
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