File indexing completed on 2025-01-05 04:54:58

0001 /*
0002  *  Copyright (C) 2017 Michael Bohlender, <michael.bohlender@kdemail.net>
0003  *
0004  *  This program is free software; you can redistribute it and/or modify
0005  *  it under the terms of the GNU General Public License as published by
0006  *  the Free Software Foundation; either version 2 of the License, or
0007  *  (at your option) any later version.
0008  *
0009  *  This program is distributed in the hope that it will be useful,
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0012  *  GNU General Public License for more details.
0013  *
0014  *  You should have received a copy of the GNU General Public License along
0015  *  with this program; if not, write to the Free Software Foundation, Inc.,
0016  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0017  */
0018 
0019 
0020 #pragma once
0021 #include "kube_export.h"
0022 #include <QObject>
0023 #include <QString>
0024 #include <QStringList>
0025 #include <QStandardItemModel>
0026 #include <sink/applicationdomaintype.h>
0027 
0028 #include "controller.h"
0029 
0030 class KUBE_EXPORT ContactController : public Kube::Controller
0031 {
0032     Q_OBJECT
0033 
0034     // Input properties
0035     Q_PROPERTY(QVariant contact READ contact WRITE loadContact)
0036 
0037     //Interface properties
0038     KUBE_CONTROLLER_PROPERTY(QByteArray, AccountId, accountId)
0039     KUBE_CONTROLLER_PROPERTY(QString, FirstName, firstName)
0040     KUBE_CONTROLLER_PROPERTY(QString, LastName, lastName)
0041     KUBE_CONTROLLER_PROPERTY(QString, Name, name)
0042     KUBE_CONTROLLER_PROPERTY(QString, Street, street)
0043     KUBE_CONTROLLER_PROPERTY(QString, City, city)
0044     KUBE_CONTROLLER_PROPERTY(QString, Country, country)
0045     KUBE_CONTROLLER_PROPERTY(QString, Company, company)
0046     KUBE_CONTROLLER_PROPERTY(QString, JobTitle, jobTitle)
0047     KUBE_CONTROLLER_PROPERTY(QByteArray, ImageData, imageData)
0048     KUBE_CONTROLLER_PROPERTY(Sink::ApplicationDomain::ApplicationDomainType::Ptr, Addressbook, addressbook)
0049 
0050     KUBE_CONTROLLER_LISTCONTROLLER(mails)
0051     KUBE_CONTROLLER_LISTCONTROLLER(phones)
0052 
0053     KUBE_CONTROLLER_ACTION(save)
0054 
0055 public:
0056     explicit ContactController();
0057 
0058     Q_INVOKABLE void loadContact(const QVariant &contact);
0059     Q_INVOKABLE void remove();
0060 
0061     QVariant contact() const;
0062 
0063 private slots:
0064     void updateSaveAction();
0065 
0066 private:
0067     QVariant mContact;
0068 };