Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit cce44af4 authored by Laurent Montel's avatar Laurent Montel 😁

not necessary to use static function

parent 96e0bcd4
......@@ -81,9 +81,10 @@ void ContactConfigureDialog::slotDefaultClicked()
{
mConfigureWidget->setDefault();
if (!contacteditorutil::defaultContact().isEmpty()) {
ContactEditorUtil contactUtil;
if (!contactUtil.defaultContact().isEmpty()) {
KABC::VCardConverter converter;
KABC::Addressee addr = converter.parseVCard( contacteditorutil::defaultContact().toUtf8() );
KABC::Addressee addr = converter.parseVCard( contactUtil.defaultContact().toUtf8() );
mDefaultContact->setContactTemplate(addr);
} else {
mDefaultContact->setContactTemplate(KABC::Addressee());
......@@ -100,9 +101,10 @@ void ContactConfigureDialog::readConfig()
{
KSharedConfig::Ptr config = KGlobal::config();
ContactEditorUtil contactUtil;
if (config->hasGroup(QLatin1String("Global"))) {
KConfigGroup group = config->group(QLatin1String("Global"));
const QString defaultContact = group.readEntry("defaultContact",contacteditorutil::defaultContact());
const QString defaultContact = group.readEntry("defaultContact", contactUtil.defaultContact());
if (!defaultContact.isEmpty()) {
KABC::VCardConverter converter;
KABC::Addressee addr = converter.parseVCard( defaultContact.toUtf8() );
......@@ -112,9 +114,9 @@ void ContactConfigureDialog::readConfig()
}
mDefaultTemplate->setPlainText(group.readEntry("defaultTemplate",QString()));
} else {
if (!contacteditorutil::defaultContact().isEmpty()) {
if (!contactUtil.defaultContact().isEmpty()) {
KABC::VCardConverter converter;
KABC::Addressee addr = converter.parseVCard( contacteditorutil::defaultContact().toUtf8() );
KABC::Addressee addr = converter.parseVCard( contactUtil.defaultContact().toUtf8() );
mDefaultContact->setContactTemplate(addr);
} else {
mDefaultContact->setContactTemplate(KABC::Addressee());
......
......@@ -17,7 +17,13 @@
#include "contacteditorutil.h"
QString contacteditorutil::defaultContact()
ContactEditorUtil::ContactEditorUtil()
{
}
QString ContactEditorUtil::defaultContact() const
{
const QString contact = QString::fromLatin1("BEGIN:VCARD\n"
......@@ -33,3 +39,4 @@ QString contacteditorutil::defaultContact()
"END:VCARD");
return contact;
}
......@@ -21,9 +21,11 @@
#include <QString>
namespace contacteditorutil
class ContactEditorUtil
{
QString defaultContact();
}
public:
ContactEditorUtil();
QString defaultContact() const;
};
#endif
......@@ -110,9 +110,10 @@ void ContactPreviewWidget::loadConfig()
{
KSharedConfig::Ptr config = KGlobal::config();
ContactEditorUtil contactUtil;
if (config->hasGroup(QLatin1String("Global"))) {
KConfigGroup group = config->group(QLatin1String("Global"));
const QString defaultContact = group.readEntry("defaultContact",contacteditorutil::defaultContact());
const QString defaultContact = group.readEntry("defaultContact", contactUtil.defaultContact());
if (!defaultContact.isEmpty()) {
KABC::VCardConverter converter;
mContact = converter.parseVCard( defaultContact.toUtf8() );
......@@ -120,9 +121,9 @@ void ContactPreviewWidget::loadConfig()
mContact = KABC::Addressee();
}
} else {
if (!contacteditorutil::defaultContact().isEmpty()) {
if (!contactUtil.defaultContact().isEmpty()) {
KABC::VCardConverter converter;
mContact = converter.parseVCard( contacteditorutil::defaultContact().toUtf8() );
mContact = converter.parseVCard( contactUtil.defaultContact().toUtf8() );
} else {
mContact = KABC::Addressee();
}
......
Markdown is supported
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