Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
PIM Data Exporter
Commits
6e73de4e
Commit
6e73de4e
authored
Apr 29, 2022
by
Laurent Montel
😁
Browse files
Fix import kalendar config
parent
c3ef8d26
Pipeline
#169604
passed with stage
in 2 minutes and 28 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
core/autotests/calendar/data/import/calendarconfigandresourceskalendar/references/config/kalendaracrc
View file @
6e73de4e
[Alarms]
CalendarsLastChecked=
foo/bla bla/bli
20
2
2,
foo/bla bla/bli4,foo/bla bla/bli27,foo/bla bla/bli12,foo/bla bla/bli3
9
CalendarsLastChecked=20
3
2,
14,37,22,4
9
[General]
Autostart=true
...
...
core/autotests/calendar/data/import/calendarconfigandresourceskalendar/references/config/kalendarrc
View file @
6e73de4e
...
...
@@ -5,7 +5,7 @@ showMenubar=true
[GlobalCollectionSelection]
Current=x-1
Selection=c2,c1
5
0,c6
4
7,c6
5
5
Selection=c
1
2,c1
6
0,c6
5
7,c6
6
5
[KFileDialog Settings]
detailViewIconSize=16
...
...
core/calendar/importcalendarjobinterface.cpp
View file @
6e73de4e
...
...
@@ -118,96 +118,108 @@ void ImportCalendarJobInterface::restoreConfig()
}
}
const
QString
korganizerStr
(
QStringLiteral
(
"korganizerrc"
));
const
KArchiveEntry
*
korganizerrcentry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
korganizerStr
);
if
(
korganizerrcentry
&&
korganizerrcentry
->
isFile
())
{
const
auto
korganizerrcFile
=
static_cast
<
const
KArchiveFile
*>
(
korganizerrcentry
);
const
QString
korganizerrc
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
ConfigLocation
)
+
QLatin1Char
(
'/'
)
+
korganizerStr
;
if
(
QFileInfo
::
exists
(
korganizerrc
))
{
if
(
overwriteConfigMessageBox
(
korganizerStr
))
{
{
const
QString
korganizerStr
(
QStringLiteral
(
"korganizerrc"
));
const
KArchiveEntry
*
korganizerrcentry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
korganizerStr
);
if
(
korganizerrcentry
&&
korganizerrcentry
->
isFile
())
{
const
auto
korganizerrcFile
=
static_cast
<
const
KArchiveFile
*>
(
korganizerrcentry
);
const
QString
korganizerrc
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
ConfigLocation
)
+
QLatin1Char
(
'/'
)
+
korganizerStr
;
if
(
QFileInfo
::
exists
(
korganizerrc
))
{
if
(
overwriteConfigMessageBox
(
korganizerStr
))
{
importkorganizerConfig
(
korganizerrcFile
,
korganizerrc
,
korganizerStr
,
Utils
::
configsPath
());
}
}
else
{
importkorganizerConfig
(
korganizerrcFile
,
korganizerrc
,
korganizerStr
,
Utils
::
configsPath
());
}
}
else
{
importkorganizerConfig
(
korganizerrcFile
,
korganizerrc
,
korganizerStr
,
Utils
::
configsPath
());
}
}
const
QString
eventviewStr
(
QStringLiteral
(
"eventviewsrc"
));
const
KArchiveEntry
*
eventviewentry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
eventviewStr
);
if
(
eventviewentry
&&
eventviewentry
->
isFile
())
{
const
auto
eventviewrcFile
=
static_cast
<
const
KArchiveFile
*>
(
eventviewentry
);
const
QString
eventviewrc
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
ConfigLocation
)
+
QLatin1Char
(
'/'
)
+
eventviewStr
;
if
(
QFileInfo
::
exists
(
eventviewrc
))
{
if
(
overwriteConfigMessageBox
(
eventviewStr
))
{
{
const
QString
eventviewStr
(
QStringLiteral
(
"eventviewsrc"
));
const
KArchiveEntry
*
eventviewentry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
eventviewStr
);
if
(
eventviewentry
&&
eventviewentry
->
isFile
())
{
const
auto
eventviewrcFile
=
static_cast
<
const
KArchiveFile
*>
(
eventviewentry
);
const
QString
eventviewrc
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
ConfigLocation
)
+
QLatin1Char
(
'/'
)
+
eventviewStr
;
if
(
QFileInfo
::
exists
(
eventviewrc
))
{
if
(
overwriteConfigMessageBox
(
eventviewStr
))
{
importeventViewConfig
(
eventviewrcFile
,
eventviewrc
,
eventviewStr
,
Utils
::
configsPath
());
}
}
else
{
importeventViewConfig
(
eventviewrcFile
,
eventviewrc
,
eventviewStr
,
Utils
::
configsPath
());
}
}
else
{
importeventViewConfig
(
eventviewrcFile
,
eventviewrc
,
eventviewStr
,
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
))
{
{
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
{
importReminderAgentConfig
(
kalendaracFile
,
kalendaracrc
,
kalendaracStr
,
Utils
::
configsPath
());
}
}
else
{
importReminderAgentConfig
(
kalendaracFile
,
kalendaracrc
,
kalendaracStr
,
Utils
::
configsPath
());
}
}
const
QString
kalendarStr
(
QStringLiteral
(
"kalendarrc"
));
const
KArchiveEntry
*
kalendarentry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
kalendarStr
);
if
(
kalendarentry
&&
kalendarentry
->
isFile
())
{
const
auto
kalendarentryFile
=
static_cast
<
const
KArchiveFile
*>
(
kalendarentry
);
const
QString
kalendarentrycrc
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
ConfigLocation
)
+
QLatin1Char
(
'/'
)
+
kalendaracStr
;
if
(
QFileInfo
::
exists
(
kalendarentrycrc
))
{
if
(
overwriteConfigMessageBox
(
kalendaracStr
))
{
importKalendarConfig
(
kalendarentryFile
,
kalendarentrycrc
,
kalendaracStr
,
Utils
::
configsPath
());
{
const
QString
kalendarStr
(
QStringLiteral
(
"kalendarrc"
));
const
KArchiveEntry
*
kalendarentry
=
mArchiveDirectory
->
entry
(
Utils
::
configsPath
()
+
kalendarStr
);
if
(
kalendarentry
&&
kalendarentry
->
isFile
())
{
const
auto
kalendarentryFile
=
static_cast
<
const
KArchiveFile
*>
(
kalendarentry
);
const
QString
kalendarentrycrc
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
ConfigLocation
)
+
QLatin1Char
(
'/'
)
+
kalendarStr
;
if
(
QFileInfo
::
exists
(
kalendarentrycrc
))
{
if
(
overwriteConfigMessageBox
(
kalendarStr
))
{
importKalendarConfig
(
kalendarentryFile
,
kalendarentrycrc
,
kalendarStr
,
Utils
::
configsPath
());
}
}
else
{
importKalendarConfig
(
kalendarentryFile
,
kalendarentrycrc
,
kalendarStr
,
Utils
::
configsPath
());
}
}
else
{
importKalendarConfig
(
kalendarentryFile
,
kalendarentrycrc
,
kalendaracStr
,
Utils
::
configsPath
());
}
}
const
QString
freebusyStr
(
QStringLiteral
(
"freebusyurls"
));
const
KArchiveEntry
*
freebusyentry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
QLatin1String
(
"korganizer/"
)
+
freebusyStr
);
if
(
freebusyentry
&&
freebusyentry
->
isFile
())
{
const
auto
freebusyrcFile
=
static_cast
<
const
KArchiveFile
*>
(
freebusyentry
);
const
QString
freebusypath
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
)
+
QLatin1String
(
"/korganizer/"
)
+
freebusyStr
;
if
(
QFileInfo
::
exists
(
freebusypath
))
{
// TODO 4.12 merge it.
if
(
overwriteConfigMessageBox
(
freebusyStr
))
{
{
const
QString
freebusyStr
(
QStringLiteral
(
"freebusyurls"
));
const
KArchiveEntry
*
freebusyentry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
QLatin1String
(
"korganizer/"
)
+
freebusyStr
);
if
(
freebusyentry
&&
freebusyentry
->
isFile
())
{
const
auto
freebusyrcFile
=
static_cast
<
const
KArchiveFile
*>
(
freebusyentry
);
const
QString
freebusypath
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
)
+
QLatin1String
(
"/korganizer/"
)
+
freebusyStr
;
if
(
QFileInfo
::
exists
(
freebusypath
))
{
// TODO 4.12 merge it.
if
(
overwriteConfigMessageBox
(
freebusyStr
))
{
copyToFile
(
freebusyrcFile
,
freebusypath
,
freebusyStr
,
Utils
::
dataPath
());
}
}
else
{
copyToFile
(
freebusyrcFile
,
freebusypath
,
freebusyStr
,
Utils
::
dataPath
());
}
}
else
{
copyToFile
(
freebusyrcFile
,
freebusypath
,
freebusyStr
,
Utils
::
dataPath
());
}
}
const
KArchiveEntry
*
templateEntry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
QStringLiteral
(
"korganizer/templates/"
));
if
(
templateEntry
&&
templateEntry
->
isDirectory
())
{
// TODO 4.12 verify if template already exists.
const
QString
templatePath
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
)
+
QLatin1Char
(
'/'
)
+
QStringLiteral
(
"korganizer/templates/"
);
const
auto
templateDir
=
static_cast
<
const
KArchiveDirectory
*>
(
templateEntry
);
if
(
!
templateDir
->
copyTo
(
templatePath
))
{
qCDebug
(
PIMDATAEXPORTERCORE_LOG
)
<<
"template cannot copy to "
<<
templatePath
;
{
const
KArchiveEntry
*
templateEntry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
QStringLiteral
(
"korganizer/templates/"
));
if
(
templateEntry
&&
templateEntry
->
isDirectory
())
{
// TODO 4.12 verify if template already exists.
const
QString
templatePath
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
)
+
QLatin1Char
(
'/'
)
+
QStringLiteral
(
"korganizer/templates/"
);
const
auto
templateDir
=
static_cast
<
const
KArchiveDirectory
*>
(
templateEntry
);
if
(
!
templateDir
->
copyTo
(
templatePath
))
{
qCDebug
(
PIMDATAEXPORTERCORE_LOG
)
<<
"template cannot copy to "
<<
templatePath
;
}
}
}
const
KArchiveEntry
*
designerEntry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
QStringLiteral
(
"korganizer/designer/"
));
if
(
designerEntry
&&
designerEntry
->
isDirectory
())
{
const
QString
templatePath
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
)
+
QLatin1Char
(
'/'
)
+
QStringLiteral
(
"korganizer/designer/"
);
const
auto
templateDir
=
static_cast
<
const
KArchiveDirectory
*>
(
designerEntry
);
if
(
!
templateDir
->
copyTo
(
templatePath
))
{
qCDebug
(
PIMDATAEXPORTERCORE_LOG
)
<<
"template cannot copy to "
<<
templatePath
;
{
const
KArchiveEntry
*
designerEntry
=
mArchiveDirectory
->
entry
(
Utils
::
dataPath
()
+
QStringLiteral
(
"korganizer/designer/"
));
if
(
designerEntry
&&
designerEntry
->
isDirectory
())
{
const
QString
templatePath
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
)
+
QLatin1Char
(
'/'
)
+
QStringLiteral
(
"korganizer/designer/"
);
const
auto
templateDir
=
static_cast
<
const
KArchiveDirectory
*>
(
designerEntry
);
if
(
!
templateDir
->
copyTo
(
templatePath
))
{
qCDebug
(
PIMDATAEXPORTERCORE_LOG
)
<<
"template cannot copy to "
<<
templatePath
;
}
}
}
...
...
@@ -238,7 +250,6 @@ void ImportCalendarJobInterface::importKalendarConfig(const KArchiveFile *file,
convertCollectionListStrToAkonadiId
(
kalendarConfig
,
QStringLiteral
(
"GlobalCollectionSelection"
),
QStringLiteral
(
"Selection"
),
true
);
// TODO Resources Colors
kalendarConfig
->
sync
();
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment