Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PIM
Mail-related libraries
Commits
2287af31
Commit
2287af31
authored
Mar 22, 2016
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for multi website
parent
7733f446
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
101 additions
and
0 deletions
+101
-0
kaddressbookgrantlee/src/CMakeLists.txt
kaddressbookgrantlee/src/CMakeLists.txt
+1
-0
kaddressbookgrantlee/src/printing/contactgrantleeprintobject.cpp
...sbookgrantlee/src/printing/contactgrantleeprintobject.cpp
+15
-0
kaddressbookgrantlee/src/printing/contactgrantleeprintobject.h
...essbookgrantlee/src/printing/contactgrantleeprintobject.h
+4
-0
kaddressbookgrantlee/src/printing/contactgrantleeprintwebsite.cpp
...bookgrantlee/src/printing/contactgrantleeprintwebsite.cpp
+43
-0
kaddressbookgrantlee/src/printing/contactgrantleeprintwebsite.h
...ssbookgrantlee/src/printing/contactgrantleeprintwebsite.h
+38
-0
No files found.
kaddressbookgrantlee/src/CMakeLists.txt
View file @
2287af31
...
...
@@ -20,6 +20,7 @@ set(kaddressbook_grantlee_printing_LIB_SRCS
printing/contactgrantleeprintimobject.cpp
printing/contactgrantleeprintobject.cpp
printing/contactgrantleeprintphoneobject.cpp
printing/contactgrantleeprintwebsite.cpp
printing/grantleeprint.cpp
)
...
...
kaddressbookgrantlee/src/printing/contactgrantleeprintobject.cpp
View file @
2287af31
...
...
@@ -21,6 +21,7 @@
#include "contactgrantleeprintimobject.h"
#include "contactgrantleeprintgeoobject.h"
#include "contactgrantleeprintcryptoobject.h"
#include "contactgrantleeprintwebsite.h"
#include <KContacts/PhoneNumber>
...
...
@@ -41,11 +42,19 @@ ContactGrantleePrintObject::ContactGrantleePrintObject(const KContacts::Addresse
mListAddress
<<
new
ContactGrantleePrintAddressObject
(
addr
);
}
const
auto
webSites
=
address
.
extraUrlList
();
mListWebSite
.
reserve
(
webSites
.
size
());
Q_FOREACH
(
const
KContacts
::
ResourceLocatorUrl
&
webSite
,
webSites
)
{
mListWebSite
<<
new
ContactGrantleePrintWebSite
(
webSite
);
}
const
auto
phoneNumbers
=
address
.
phoneNumbers
();
mListPhones
.
reserve
(
phoneNumbers
.
size
());
Q_FOREACH
(
const
KContacts
::
PhoneNumber
&
phone
,
phoneNumbers
)
{
mListPhones
<<
new
ContactGrantleePrintPhoneObject
(
phone
);
}
const
QStringList
customs
=
mAddress
.
customs
();
if
(
!
customs
.
empty
())
{
Q_FOREACH
(
const
QString
&
custom
,
customs
)
{
...
...
@@ -68,6 +77,7 @@ ContactGrantleePrintObject::~ContactGrantleePrintObject()
qDeleteAll
(
mListAddress
);
qDeleteAll
(
mListPhones
);
qDeleteAll
(
mListIm
);
qDeleteAll
(
mListWebSite
);
delete
mCryptoObject
;
}
...
...
@@ -192,6 +202,11 @@ QVariant ContactGrantleePrintObject::addresses() const
return
QVariant
::
fromValue
(
mListAddress
);
}
QVariant
ContactGrantleePrintObject
::
webSites
()
const
{
return
QVariant
::
fromValue
(
mListWebSite
);
}
QVariant
ContactGrantleePrintObject
::
phones
()
const
{
return
QVariant
::
fromValue
(
mListPhones
);
...
...
kaddressbookgrantlee/src/printing/contactgrantleeprintobject.h
View file @
2287af31
...
...
@@ -27,6 +27,7 @@ class ContactGrantleePrintPhoneObject;
class
ContactGrantleePrintImObject
;
class
ContactGrantleePrintGeoObject
;
class
ContactGrantleePrintCryptoObject
;
class
ContactGrantleePrintWebSite
;
class
ContactGrantleePrintObject
:
public
QObject
{
Q_OBJECT
...
...
@@ -63,6 +64,7 @@ class ContactGrantleePrintObject : public QObject
Q_PROPERTY
(
QString
assistant
READ
assistant
)
Q_PROPERTY
(
QString
spouse
READ
spouse
)
Q_PROPERTY
(
QString
languages
READ
languages
)
Q_PROPERTY
(
QVariant
webSites
READ
webSites
)
//Add more functions
public:
...
...
@@ -104,11 +106,13 @@ public:
QString
assistant
()
const
;
QString
spouse
()
const
;
QString
languages
()
const
;
QVariant
webSites
()
const
;
private:
QString
imgToDataUrl
(
const
QImage
&
image
)
const
;
QList
<
QObject
*>
mListAddress
;
QList
<
QObject
*>
mListPhones
;
QList
<
QObject
*>
mListIm
;
QList
<
QObject
*>
mListWebSite
;
ContactGrantleePrintGeoObject
*
mGeoObject
;
ContactGrantleePrintCryptoObject
*
mCryptoObject
;
KContacts
::
Addressee
mAddress
;
...
...
kaddressbookgrantlee/src/printing/contactgrantleeprintwebsite.cpp
0 → 100644
View file @
2287af31
/*
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 "contactgrantleeprintwebsite.h"
#include <QUrl>
using
namespace
KAddressBookGrantlee
;
ContactGrantleePrintWebSite
::
ContactGrantleePrintWebSite
(
const
KContacts
::
ResourceLocatorUrl
&
resourceLocator
,
QObject
*
parent
)
:
QObject
(
parent
)
{
}
ContactGrantleePrintWebSite
::~
ContactGrantleePrintWebSite
()
{
}
QString
ContactGrantleePrintWebSite
::
url
()
const
{
return
mResourceLocator
.
url
().
toDisplayString
();
}
bool
ContactGrantleePrintWebSite
::
preferred
()
const
{
//TODO
return
false
;
}
kaddressbookgrantlee/src/printing/contactgrantleeprintwebsite.h
0 → 100644
View file @
2287af31
/*
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 CONTACTGRANTLEEPRINTWEBSITE_H
#define CONTACTGRANTLEEPRINTWEBSITE_H
#include <QObject>
#include <KContacts/ResourceLocatorUrl>
namespace
KAddressBookGrantlee
{
class
ContactGrantleePrintWebSite
:
public
QObject
{
Q_OBJECT
Q_PROPERTY
(
QString
url
READ
url
)
public:
explicit
ContactGrantleePrintWebSite
(
const
KContacts
::
ResourceLocatorUrl
&
resourceLocator
,
QObject
*
parent
=
Q_NULLPTR
);
~
ContactGrantleePrintWebSite
();
QString
url
()
const
;
bool
preferred
()
const
;
private:
KContacts
::
ResourceLocatorUrl
mResourceLocator
;
};
}
#endif // CONTACTGRANTLEEPRINTWEBSITE_H
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