File indexing completed on 2024-05-12 16:42:34

0001 /*
0002     SPDX-FileCopyrightText: 2014-2015 Cristian OneČ› <onet.cristian@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef MYMONEYCONTACT_H
0007 #define MYMONEYCONTACT_H
0008 
0009 #include <QObject>
0010 #include <QString>
0011 #include <QMetaType>
0012 
0013 #include "kmm_mymoney_export.h"
0014 
0015 /**
0016   * POD containing contact data, these fields are retrieved based on an email address.
0017   */
0018 struct ContactData {
0019     QString email;
0020     QString phoneNumber;
0021     QString street;
0022     QString city;
0023     QString state;
0024     QString locality;
0025     QString country;
0026     QString region;
0027     QString postalCode;
0028 };
0029 
0030 Q_DECLARE_METATYPE(ContactData);
0031 
0032 class KJob;
0033 /**
0034   * This class can be used to retrieve contact fields from the address book based on an email
0035   * address. It's hides the KDE PIM libraries dependency so it can be made optional.
0036   */
0037 class KMM_MYMONEY_EXPORT MyMoneyContact : public QObject
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042     explicit MyMoneyContact(QObject *parent);
0043     /**
0044       * Properties of the default identity (the current user).
0045       */
0046     bool ownerExists() const;
0047     QString ownerEmail() const;
0048     QString ownerFullName() const;
0049 
0050 public Q_SLOTS:
0051     /**
0052       * Use this slot to start retrieving contact data for an email.
0053       */
0054     void fetchContact(const QString &email);
0055 
0056 Q_SIGNALS:
0057     /**
0058       * This signal is emitted when the contact data was retrieved.
0059       */
0060     void contactFetched(const ContactData &identity);
0061 
0062 private Q_SLOTS:
0063     void searchContactResult(KJob *job);
0064 };
0065 
0066 #endif // MYMONEYCONTACT_H