1 /*
2  Kopete Oscar Protocol
3  icquserinfowidget.h - Display ICQ user info
4 
5  Copyright (c) 2005 Matt Rogers <mattr@kde.org>
6  Copyright (c) 2006 Roman Jarosz <kedgedev@centrum.cz>
7 
8  Kopete (c) 2002-2006 by the Kopete developers <kopete-devel@kde.org>
9 
10  *************************************************************************
11  *                                                                       *
12  * This library is free software; you can redistribute it and/or         *
13  * modify it under the terms of the GNU Lesser General Public            *
14  * License as published by the Free Software Foundation; either          *
15  * version 2 of the License, or (at your option) any later version.      *
16  *                                                                       *
17  *************************************************************************
18 */
19 
20 #ifndef _ICQUSERINFOWIDGET_H_
21 #define _ICQUSERINFOWIDGET_H_
22 
23 #include <kpagedialog.h>
24 #include <icquserinfo.h>
25 
26 class QStandardItemModel;
27 class QItemSelection;
28 
29 namespace Ui
30 {
31 	class ICQGeneralInfoWidget;
32 	class ICQHomeInfoWidget;
33 	class ICQWorkInfoWidget;
34 	class ICQOtherInfoWidget;
35 	class ICQInterestInfoWidget;
36 	class ICQOrgAffInfoWidget;
37 }
38 class ICQContact;
39 class ICQAccount;
40 
41 class ICQUserInfoWidget : public KPageDialog
42 {
43 Q_OBJECT
44 public:
45 	ICQUserInfoWidget( ICQAccount* account, const QString& contactId, QWidget* parent = nullptr, bool ownInfo = false );
46 	ICQUserInfoWidget( ICQContact* contact, QWidget* parent = nullptr, bool ownInfo = false );
47 	~ICQUserInfoWidget();
48 
49 	QList<ICQInfoBase*> getInfoData() const;
50 	QString getAlias() const;
51 
52 public Q_SLOTS:
53 	void fillBasicInfo( const ICQGeneralUserInfo& );
54 	void fillWorkInfo( const ICQWorkUserInfo& );
55 	void fillEmailInfo( const ICQEmailInfo& );
56 	void fillNotesInfo( const ICQNotesInfo& );
57 	void fillMoreInfo( const ICQMoreUserInfo& );
58 	void fillInterestInfo( const ICQInterestInfo& );
59 	void fillOrgAffInfo( const ICQOrgAffInfo& info);
60 
61 private Q_SLOTS:
62 	void receivedLongInfo( const QString& contact );
63 
64 	void slotUpdateDay();
65 	void slotUpdateAge();
66 
67 	void slotOrg1CategoryChanged( int index );
68 	void slotOrg2CategoryChanged( int index );
69 	void slotOrg3CategoryChanged( int index );
70 	void slotAff1CategoryChanged( int index );
71 	void slotAff2CategoryChanged( int index );
72 	void slotAff3CategoryChanged( int index );
73 
74 	void slotInterestTopic1Changed( int index );
75 	void slotInterestTopic2Changed( int index );
76 	void slotInterestTopic3Changed( int index );
77 	void slotInterestTopic4Changed( int index );
78 
79 	void slotAddEmail();
80 	void slotRemoveEmail();
81 	void slotUpEmail();
82 	void slotDownEmail();
83 	void slotEmailSelectionChanged( const QItemSelection& selected );
84 
85 private:
86 	void init();
87 	void swapEmails( int r1, int r2 );
88 
89 	ICQGeneralUserInfo* storeBasicInfo() const;
90 	ICQMoreUserInfo* storeMoreInfo() const;
91 	ICQWorkUserInfo* storeWorkInfo() const;
92 	ICQOrgAffInfo* storeOrgAffInfo() const;
93 	ICQInterestInfo* storeInterestInfo() const;
94 	ICQNotesInfo* storeNotesInfo() const;
95 	ICQEmailInfo* storeEmailInfo() const;
96 
97 	QMap<QString, int> reverseMap( const QMap<int, QString>& map ) const;
98 	QTextCodec* getTextCodec() const;
99 
100 	Ui::ICQGeneralInfoWidget* m_genInfoWidget;
101 	Ui::ICQWorkInfoWidget* m_workInfoWidget;
102 	Ui::ICQHomeInfoWidget* m_homeInfoWidget;
103 	Ui::ICQOtherInfoWidget* m_otherInfoWidget;
104 	Ui::ICQInterestInfoWidget * m_interestInfoWidget;
105 	Ui::ICQOrgAffInfoWidget* m_orgAffInfoWidget;
106 
107 	ICQContact* m_contact;
108 	ICQAccount* m_account;
109 	QString m_contactId;
110 	bool m_ownInfo;
111 
112 	QStandardItemModel* m_emailModel;
113 
114 	ICQGeneralUserInfo m_generalUserInfo;
115 	ICQMoreUserInfo m_moreUserInfo;
116 	ICQWorkUserInfo m_workUserInfo;
117 	ICQOrgAffInfo m_orgAffUserInfo;
118 	ICQInterestInfo m_interestInfo;
119 	ICQNotesInfo m_notesInfo;
120 	ICQEmailInfo m_emailInfo;
121 };
122 
123 #endif
124 
125