File indexing completed on 2024-11-24 04:53:24

0001 /* Copyright (C) 2012 Thomas Lübking <thomas.luebking@gmail.com>
0002    Copyright (C) 2013 Caspar Schutijser <caspar@schutijser.com>
0003    Copyright (C) 2006 - 2014 Jan Kundrát <jkt@flaska.net>
0004 
0005    This file is part of the Trojita Qt IMAP e-mail client,
0006    http://trojita.flaska.net/
0007 
0008    This program is free software; you can redistribute it and/or
0009    modify it under the terms of the GNU General Public License as
0010    published by the Free Software Foundation; either version 2 of
0011    the License or (at your option) version 3 or any later version
0012    accepted by the membership of KDE e.V. (or its successor approved
0013    by the membership of KDE e.V.), which shall act as a proxy
0014    defined in Section 14 of version 3 of the license.
0015 
0016    This program is distributed in the hope that it will be useful,
0017    but WITHOUT ANY WARRANTY; without even the implied warranty of
0018    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0019    GNU General Public License for more details.
0020 
0021    You should have received a copy of the GNU General Public License
0022    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0023 */
0024 
0025 #include <QDateTime>
0026 
0027 #ifndef BE_CONTACTED_H
0028 #define BE_CONTACTED_H
0029 
0030 class QFileSystemWatcher;
0031 class QModelIndex;
0032 class QStandardItem;
0033 class QStandardItemModel;
0034 class QSortFilterProxyModel;
0035 
0036 namespace Ui {
0037     class Contacts;
0038     class OneContact;
0039 }
0040 
0041 class AbookAddressbook;
0042 
0043 #include <QWidget>
0044 #include <QPixmap>
0045 
0046 namespace BE {
0047     class Field;
0048     class Contacts : public QWidget {
0049         Q_OBJECT
0050     public:
0051         explicit Contacts(AbookAddressbook *abook);
0052         virtual ~Contacts();
0053 
0054         void manageContact(const QString &mail, const QString &prettyName);
0055 
0056     protected:
0057         bool eventFilter(QObject *o, QEvent *e);
0058         virtual void closeEvent(QCloseEvent *);
0059     private slots:
0060         void addContact();
0061         void updateLabel();
0062         void updateFocusPolicy(QWidget *oldFocus, QWidget *newFocus);
0063         void removeCurrentContact();
0064         void saveContacts();
0065         void setContact(const QModelIndex &index);
0066     private:
0067         void importPhoto(const QString &path);
0068         bool setPhoto(const QString &path);
0069     private:
0070         QStandardItem *m_currentContact;
0071         QSortFilterProxyModel *m_sortFilterProxy;
0072         Ui::Contacts *m_ui;
0073         Ui::OneContact *m_ui2;
0074         QPixmap m_incognitoPic;
0075         AbookAddressbook *m_abook;
0076         QList<Field> fields;
0077         bool m_dirty;
0078     };
0079 } // namepsace
0080 
0081 #endif // BE_CONTACTED_H