| 1 | /* |
|---|
| 2 | * This file is part of Licq, an instant messaging client for UNIX. |
|---|
| 3 | * Copyright (C) 2005-2006 Licq developers |
|---|
| 4 | * |
|---|
| 5 | * Licq is free software; you can redistribute it and/or modify |
|---|
| 6 | * it under the terms of the GNU General Public License as published by |
|---|
| 7 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 8 | * (at your option) any later version. |
|---|
| 9 | * |
|---|
| 10 | * Licq is distributed in the hope that it will be useful, |
|---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | * GNU General Public License for more details. |
|---|
| 14 | * |
|---|
| 15 | * You should have received a copy of the GNU General Public License |
|---|
| 16 | * along with Licq; if not, write to the Free Software |
|---|
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 18 | */ |
|---|
| 19 | |
|---|
| 20 | #ifndef GPGKEYMANAGER_H |
|---|
| 21 | #define GPGKEYMANAGER_H |
|---|
| 22 | |
|---|
| 23 | #include <QDialog> |
|---|
| 24 | #include <QTreeWidget> |
|---|
| 25 | |
|---|
| 26 | class ICQUser; |
|---|
| 27 | |
|---|
| 28 | namespace LicqQtGui |
|---|
| 29 | { |
|---|
| 30 | class GPGKeySelect; |
|---|
| 31 | class KeyList; |
|---|
| 32 | |
|---|
| 33 | class GPGKeyManager : public QDialog |
|---|
| 34 | { |
|---|
| 35 | Q_OBJECT |
|---|
| 36 | |
|---|
| 37 | public: |
|---|
| 38 | GPGKeyManager(QWidget* parent = 0); |
|---|
| 39 | |
|---|
| 40 | private: |
|---|
| 41 | KeyList* lst_keyList; |
|---|
| 42 | void initKeyList(); |
|---|
| 43 | |
|---|
| 44 | private slots: |
|---|
| 45 | void slot_add(); |
|---|
| 46 | void slot_edit(); |
|---|
| 47 | void slot_remove(); |
|---|
| 48 | void slot_doubleClicked(QTreeWidgetItem* item); |
|---|
| 49 | }; |
|---|
| 50 | |
|---|
| 51 | class KeyList : public QTreeWidget |
|---|
| 52 | { |
|---|
| 53 | Q_OBJECT |
|---|
| 54 | |
|---|
| 55 | public: |
|---|
| 56 | KeyList(QWidget* parent = 0); |
|---|
| 57 | |
|---|
| 58 | void editUser(QString id, unsigned long ppid); |
|---|
| 59 | void resizeColumnsToContents(); |
|---|
| 60 | |
|---|
| 61 | private: |
|---|
| 62 | void dragEnterEvent(QDragEnterEvent* event); |
|---|
| 63 | void dragMoveEvent(QDragMoveEvent* /* event */) {}; |
|---|
| 64 | void dropEvent(QDropEvent* event); |
|---|
| 65 | virtual void resizeEvent(QResizeEvent* event); |
|---|
| 66 | }; |
|---|
| 67 | |
|---|
| 68 | class KeyListItem : public QObject, public QTreeWidgetItem |
|---|
| 69 | { |
|---|
| 70 | Q_OBJECT |
|---|
| 71 | |
|---|
| 72 | public: |
|---|
| 73 | KeyListItem(QTreeWidget* parent, const ICQUser* u); |
|---|
| 74 | |
|---|
| 75 | void edit(); |
|---|
| 76 | void unsetKey(); |
|---|
| 77 | |
|---|
| 78 | QString getszId() { return szId; }; |
|---|
| 79 | unsigned long getnPPID() { return nPPID; }; |
|---|
| 80 | |
|---|
| 81 | private: |
|---|
| 82 | QString szId; |
|---|
| 83 | unsigned long nPPID; |
|---|
| 84 | GPGKeySelect* keySelect; |
|---|
| 85 | void updateText(const ICQUser* u); |
|---|
| 86 | |
|---|
| 87 | private slots: |
|---|
| 88 | void slot_done(); |
|---|
| 89 | }; |
|---|
| 90 | |
|---|
| 91 | } // namespace LicqQtGui |
|---|
| 92 | |
|---|
| 93 | #endif |
|---|