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

Start to create email object

parent cc27e9e9
......@@ -21,6 +21,7 @@ set(kaddressbook_grantlee_printing_LIB_SRCS
printing/contactgrantleeprintobject.cpp
printing/contactgrantleeprintphoneobject.cpp
printing/contactgrantleeprintwebsite.cpp
printing/contactgrantleeprintemail.cpp
printing/grantleeprint.cpp
)
......
/*
Copyright (c) 2016 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 "contactgrantleeprintemail.h"
using namespace KAddressBookGrantlee;
ContactGrantleePrintEmail::ContactGrantleePrintEmail(const KContacts::Addressee &addressee, const KContacts::Email &email, QObject *parent)
: QObject(parent),
mEmail(email),
mAddressee(addressee)
{
}
ContactGrantleePrintEmail::~ContactGrantleePrintEmail()
{
}
QString ContactGrantleePrintEmail::email() const
{
//TODO
return {};
}
QString ContactGrantleePrintEmail::emailFormatted() const
{
const QString email = mEmail.mail();
const QString fullEmail = QString::fromLatin1(QUrl::toPercentEncoding(mAddressee.fullEmail(email)));
const QString url = QStringLiteral("<a href=\"mailto:%1\">%2</a>")
.arg(fullEmail, email);
return url;
}
/*
Copyright (c) 2016 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 CONTACTGRANTLEEPRINTEMAIL_H
#define CONTACTGRANTLEEPRINTEMAIL_H
#include <QObject>
#include <KContacts/Addressee>
#include <KContacts/Email>
namespace KAddressBookGrantlee
{
class ContactGrantleePrintEmail : public QObject
{
Q_OBJECT
Q_PROPERTY(QString emailFormatted READ emailFormatted)
Q_PROPERTY(QString email READ email)
public:
explicit ContactGrantleePrintEmail(const KContacts::Addressee &addressee, const KContacts::Email &email, QObject *parent = Q_NULLPTR);
~ContactGrantleePrintEmail();
QString emailFormatted() const;
QString email() const;
private:
KContacts::Email mEmail;
KContacts::Addressee mAddressee;
};
}
#endif // CONTACTGRANTLEEPRINTEMAIL_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