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 33c46213 authored by Laurent Montel's avatar Laurent Montel 😁

Move function to pimcomm directly

parent bc5575c9
......@@ -62,7 +62,7 @@
#include "followupreminder/followupreminderselectdatedialog.h"
#include "followupreminder/followupremindercreatejob.h"
#include "agents/followupreminderagent/followupreminderutil.h"
#include "pimcommon/util/vcardutil.h"
#include "libkdepim/progresswidget/statusbarprogresswidget.h"
#include "libkdepim/progresswidget/progressstatusbarwidget.h"
......@@ -2333,7 +2333,8 @@ void KMComposeWin::slotFetchJob(KJob*job)
attachmentName = contact.realName() + QLatin1String( ".vcf" );
//Workaround about broken kaddressbook fields.
QByteArray data = item.payloadData();
MessageComposer::Util::adaptVcard(data);
PimCommon::VCardUtil vcardUtil;
vcardUtil.adaptVcard(data);
addAttachment( attachmentName, KMime::Headers::CEbase64, QString(), data, "text/x-vcard" );
} else if ( item.hasPayload<KABC::ContactGroup>() ) {
const KABC::ContactGroup group = item.payload<KABC::ContactGroup>();
......
......@@ -17,7 +17,7 @@
#include "attachmentvcardfromaddressbookjob.h"
#include "messagecomposer/utils/util.h"
#include "pimcommon/util/vcardutil.h"
#include <KLocalizedString>
#include <KABC/Addressee>
#include <KABC/ContactGroup>
......@@ -65,7 +65,8 @@ void AttachmentVcardFromAddressBookJob::doStart()
QByteArray data = mItem.payloadData();
//Workaround about broken kaddressbook fields.
MessageComposer::Util::adaptVcard(data);
PimCommon::VCardUtil vcardUtil;
vcardUtil.adaptVcard(data);
addAttachment( data, attachmentName );
}
} else if ( mItem.hasPayload<KABC::ContactGroup>() ) {
......
......@@ -362,19 +362,3 @@ void MessageComposer::Util::removeNotNecessaryHeaders(const KMime::Message::Ptr
msg->removeHeader( "X-KMail-EncryptActionEnabled" );
msg->removeHeader( "X-KMail-CryptoMessageFormat" );
}
void MessageComposer::Util::adaptVcard(QByteArray &data)
{
data.replace("X-messaging/aim-All",("X-AIM"));
data.replace("X-messaging/icq-All",("X-ICQ"));
data.replace("X-messaging/xmpp-All",("X-JABBER"));
data.replace("X-messaging/msn-All",("X-MSN"));
data.replace("X-messaging/yahoo-All",("X-YAHOO"));
data.replace("X-messaging/gadu-All",("X-GADUGADU"));
data.replace("X-messaging/skype-All",("X-SKYPE"));
data.replace("X-messaging/groupwise-All",("X-GROUPWISE"));
data.replace(("X-messaging/sms-All"),("X-SMS"));
data.replace(("X-messaging/meanwhile-All"),("X-MEANWHILE"));
data.replace(("X-messaging/irc-All"),("X-IRC"));
data.replace(("X-messaging/googletalk-All"),("X-GTALK"));
}
......@@ -84,7 +84,6 @@ MESSAGECOMPOSER_EXPORT bool sendMailDispatcherIsOnline( QWidget *parent = 0);
MESSAGECOMPOSER_EXPORT QString rot13(const QString &s);
MESSAGECOMPOSER_EXPORT void addTextBox(QTextEdit *edit);
MESSAGECOMPOSER_EXPORT void removeNotNecessaryHeaders(const KMime::Message::Ptr &msg);
MESSAGECOMPOSER_EXPORT void adaptVcard(QByteArray &data);
}
}
......
......@@ -185,6 +185,7 @@ set(libpimcommon_util_SRCS
util/pimutil.cpp
util/editorutil.cpp
util/imapresourcecapabilitiesmanager.cpp
util/vcardutil.cpp
)
......
/*
Copyright (c) 2015 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "vcardutil.h"
#include <QByteArray>
using namespace PimCommon;
VCardUtil::VCardUtil()
{
}
void VCardUtil::adaptVcard(QByteArray &data)
{
data.replace("X-messaging/aim-All",("X-AIM"));
data.replace("X-messaging/icq-All",("X-ICQ"));
data.replace("X-messaging/xmpp-All",("X-JABBER"));
data.replace("X-messaging/msn-All",("X-MSN"));
data.replace("X-messaging/yahoo-All",("X-YAHOO"));
data.replace("X-messaging/gadu-All",("X-GADUGADU"));
data.replace("X-messaging/skype-All",("X-SKYPE"));
data.replace("X-messaging/groupwise-All",("X-GROUPWISE"));
data.replace(("X-messaging/sms-All"),("X-SMS"));
data.replace(("X-messaging/meanwhile-All"),("X-MEANWHILE"));
data.replace(("X-messaging/irc-All"),("X-IRC"));
data.replace(("X-messaging/googletalk-All"),("X-GTALK"));
}
/*
Copyright (c) 2015 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef VCARDUTIL_H
#define VCARDUTIL_H
#include "pimcommon_export.h"
namespace PimCommon {
class PIMCOMMON_EXPORT VCardUtil
{
public:
VCardUtil();
void adaptVcard(QByteArray &data);
};
}
#endif // VCARDUTIL_H
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