Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KMail
Commits
cc010b34
Commit
cc010b34
authored
Dec 26, 2021
by
Laurent Montel
Browse files
Remove duplicate code
parent
19a5a777
Pipeline
#114303
passed with stage
in 4 minutes and 24 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/userfeedback/accountinfosource.cpp
View file @
cc010b34
...
...
@@ -27,6 +27,14 @@ QString AccountInfoSource::description() const
return
i18n
(
"Number and type of accounts configured in KMail (receiver and sender)."
);
}
void
AccountInfoSource
::
updateAccountInfo
(
const
QString
&
resourceName
,
int
numberOfResource
,
QVariantList
&
l
)
{
QVariantMap
m
;
m
.
insert
(
QStringLiteral
(
"name"
),
resourceName
);
m
.
insert
(
QStringLiteral
(
"number"
),
numberOfResource
);
l
.
push_back
(
m
);
}
QVariant
AccountInfoSource
::
data
()
{
const
Akonadi
::
AgentInstance
::
List
lst
=
MailCommon
::
Util
::
agentInstances
();
...
...
@@ -55,40 +63,22 @@ QVariant AccountInfoSource::data()
}
QVariantList
l
;
if
(
numberOfImap
>
0
)
{
QVariantMap
m
;
m
.
insert
(
QStringLiteral
(
"name"
),
QStringLiteral
(
"imap"
));
m
.
insert
(
QStringLiteral
(
"number"
),
numberOfImap
);
l
.
push_back
(
m
);
updateAccountInfo
(
QStringLiteral
(
"imap"
),
numberOfImap
,
l
);
}
if
(
numberOfPop3
>
0
)
{
QVariantMap
m
;
m
.
insert
(
QStringLiteral
(
"name"
),
QStringLiteral
(
"pop3"
));
m
.
insert
(
QStringLiteral
(
"number"
),
numberOfPop3
);
l
.
push_back
(
m
);
updateAccountInfo
(
QStringLiteral
(
"pop3"
),
numberOfPop3
,
l
);
}
if
(
numberOfKolab
>
0
)
{
QVariantMap
m
;
m
.
insert
(
QStringLiteral
(
"name"
),
QStringLiteral
(
"kolab"
));
m
.
insert
(
QStringLiteral
(
"number"
),
numberOfKolab
);
l
.
push_back
(
m
);
updateAccountInfo
(
QStringLiteral
(
"kolab"
),
numberOfKolab
,
l
);
}
if
(
numberOfEws
>
0
)
{
QVariantMap
m
;
m
.
insert
(
QStringLiteral
(
"name"
),
QStringLiteral
(
"ews"
));
m
.
insert
(
QStringLiteral
(
"number"
),
numberOfEws
);
l
.
push_back
(
m
);
updateAccountInfo
(
QStringLiteral
(
"ews"
),
numberOfEws
,
l
);
}
if
(
numberOfMaildir
>
0
)
{
QVariantMap
m
;
m
.
insert
(
QStringLiteral
(
"name"
),
QStringLiteral
(
"maildir"
));
m
.
insert
(
QStringLiteral
(
"number"
),
numberOfMaildir
);
l
.
push_back
(
m
);
updateAccountInfo
(
QStringLiteral
(
"maildir"
),
numberOfMaildir
,
l
);
}
if
(
numberOfMbox
>
0
)
{
QVariantMap
m
;
m
.
insert
(
QStringLiteral
(
"name"
),
QStringLiteral
(
"mbox"
));
m
.
insert
(
QStringLiteral
(
"number"
),
numberOfMbox
);
l
.
push_back
(
m
);
updateAccountInfo
(
QStringLiteral
(
"mbox"
),
numberOfMbox
,
l
);
}
// Mail Transport
...
...
src/userfeedback/accountinfosource.h
View file @
cc010b34
...
...
@@ -17,5 +17,8 @@ public:
Q_REQUIRED_RESULT
QString
description
()
const
override
;
Q_REQUIRED_RESULT
QVariant
data
()
override
;
private:
void
updateAccountInfo
(
const
QString
&
resourceName
,
int
numberOfResource
,
QVariantList
&
l
);
};
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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