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
KDE PIM Runtime
Commits
92adff99
Commit
92adff99
authored
Nov 16, 2021
by
Laurent Montel
😁
Browse files
Remove deprecated I18N_NOOP macro
parent
55b6ceef
Pipeline
#98180
failed with stage
in 24 minutes and 46 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
resources/kolab/pimkolab/kolabformat/formathelpers.cpp
View file @
92adff99
...
...
@@ -5,23 +5,37 @@
*/
#include "formathelpers.h"
#include "ki18n_version.h"
#include "kolabdefinitions.h"
#include <KLocalizedString>
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0)
#include <klazylocalizedstring.h>
#undef I18N_NOOP
#define I18N_NOOP kli18n
#endif
namespace
Kolab
{
static
const
struct
{
const
char
*
name
;
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
const
char
*
label
;
}
folderTypeData
[]
=
{{
KOLAB_FOLDER_TYPE_MAIL
,
""
},
{
KOLAB_FOLDER_TYPE_CONTACT
,
I18N_NOOP
(
"Contacts"
)},
{
KOLAB_FOLDER_TYPE_EVENT
,
I18N_NOOP
(
"Calendar"
)},
{
KOLAB_FOLDER_TYPE_TASK
,
I18N_NOOP
(
"Tasks"
)},
{
KOLAB_FOLDER_TYPE_JOURNAL
,
I18N_NOOP
(
"Journal"
)},
{
KOLAB_FOLDER_TYPE_NOTE
,
I18N_NOOP
(
"Notes"
)},
{
KOLAB_FOLDER_TYPE_CONFIGURATION
,
I18N_NOOP
(
"Configuration"
)},
{
KOLAB_FOLDER_TYPE_FREEBUSY
,
I18N_NOOP
(
"Freebusy"
)},
{
KOLAB_FOLDER_TYPE_FILE
,
I18N_NOOP
(
"Files"
)}};
#else
const
KLazyLocalizedString
label
;
#endif
}
folderTypeData
[]
=
{
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
{
KOLAB_FOLDER_TYPE_MAIL
,
""
},
#else
{
KOLAB_FOLDER_TYPE_MAIL
,
KLazyLocalizedString
()},
#endif
{
KOLAB_FOLDER_TYPE_CONTACT
,
I18N_NOOP
(
"Contacts"
)},
{
KOLAB_FOLDER_TYPE_EVENT
,
I18N_NOOP
(
"Calendar"
)},
{
KOLAB_FOLDER_TYPE_TASK
,
I18N_NOOP
(
"Tasks"
)},
{
KOLAB_FOLDER_TYPE_JOURNAL
,
I18N_NOOP
(
"Journal"
)},
{
KOLAB_FOLDER_TYPE_NOTE
,
I18N_NOOP
(
"Notes"
)},
{
KOLAB_FOLDER_TYPE_CONFIGURATION
,
I18N_NOOP
(
"Configuration"
)},
{
KOLAB_FOLDER_TYPE_FREEBUSY
,
I18N_NOOP
(
"Freebusy"
)},
{
KOLAB_FOLDER_TYPE_FILE
,
I18N_NOOP
(
"Files"
)}};
static
const
int
numFolderTypeData
=
sizeof
folderTypeData
/
sizeof
*
folderTypeData
;
std
::
string
folderAnnotation
(
FolderType
type
,
bool
isDefault
)
...
...
@@ -74,9 +88,15 @@ FolderType folderTypeFromString(const std::string &folderTypeName)
FolderType
guessFolderTypeFromName
(
const
std
::
string
&
name
)
{
for
(
int
i
=
0
;
i
<
numFolderTypeData
;
++
i
)
{
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
if
(
name
==
i18n
(
folderTypeData
[
i
].
label
).
toStdString
()
||
name
==
folderTypeData
[
i
].
label
)
{
return
static_cast
<
FolderType
>
(
i
);
}
#else
if
(
name
==
KLocalizedString
(
folderTypeData
[
i
].
label
).
toString
().
toStdString
()
||
name
==
folderTypeData
[
i
].
label
.
untranslatedText
())
{
return
static_cast
<
FolderType
>
(
i
);
}
#endif
}
return
MailType
;
}
...
...
@@ -84,6 +104,10 @@ FolderType guessFolderTypeFromName(const std::string &name)
std
::
string
nameForFolderType
(
FolderType
type
)
{
Q_ASSERT
(
type
>=
0
&&
type
<
LastType
);
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
return
i18n
(
folderTypeData
[
type
].
label
).
toStdString
();
#else
return
KLocalizedString
(
folderTypeData
[
type
].
label
).
toString
().
toStdString
();
#endif
}
}
Write
Preview
Markdown
is supported
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