1 | /*
|
---|
2 | * eventdlg.h - dialog for sending / receiving messages and events
|
---|
3 | * Copyright (C) 2001, 2002 Justin Karneges
|
---|
4 | *
|
---|
5 | * This program is free software; you can redistribute it and/or
|
---|
6 | * modify it under the terms of the GNU General Public License
|
---|
7 | * as published by the Free Software Foundation; either version 2
|
---|
8 | * of the License, or (at your option) any later version.
|
---|
9 | *
|
---|
10 | * This program 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 this library; if not, write to the Free Software
|
---|
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
18 | *
|
---|
19 | */
|
---|
20 |
|
---|
21 | #ifndef EVENTDLG_H
|
---|
22 | #define EVENTDLG_H
|
---|
23 |
|
---|
24 | #include"advwidget.h"
|
---|
25 | #define private protected
|
---|
26 | #include<qlineedit.h>
|
---|
27 | #undef private
|
---|
28 | #include<qlistview.h>
|
---|
29 |
|
---|
30 | #include"im.h"
|
---|
31 | #include"userlist.h"
|
---|
32 | #include"ui_addurl.h"
|
---|
33 |
|
---|
34 | using namespace XMPP;
|
---|
35 |
|
---|
36 | class QDateTime;
|
---|
37 | class QStringList;
|
---|
38 | class PsiEvent;
|
---|
39 | class PsiCon;
|
---|
40 | class PsiAccount;
|
---|
41 | class Icon;
|
---|
42 |
|
---|
43 | class EventDlg;
|
---|
44 | class ELineEdit : public QLineEdit
|
---|
45 | {
|
---|
46 | Q_OBJECT
|
---|
47 | public:
|
---|
48 | ELineEdit(EventDlg *parent, const char *name=0);
|
---|
49 |
|
---|
50 | signals:
|
---|
51 | void changeResource(const QString &);
|
---|
52 | void tryComplete();
|
---|
53 |
|
---|
54 | protected:
|
---|
55 | // reimplemented
|
---|
56 | void dragEnterEvent(QDragEnterEvent *);
|
---|
57 | void dropEvent(QDropEvent *);
|
---|
58 | void keyPressEvent(QKeyEvent *);
|
---|
59 | QPopupMenu *createPopupMenu();
|
---|
60 |
|
---|
61 | private slots:
|
---|
62 | void resourceMenuActivated(int);
|
---|
63 |
|
---|
64 | private:
|
---|
65 | UserResourceList url;
|
---|
66 | };
|
---|
67 |
|
---|
68 | class AttachView : public QListView
|
---|
69 | {
|
---|
70 | Q_OBJECT
|
---|
71 | public:
|
---|
72 | AttachView(QWidget *parent=0, const char *name=0);
|
---|
73 | ~AttachView();
|
---|
74 |
|
---|
75 | void setReadOnly(bool);
|
---|
76 | void urlAdd(const QString &, const QString &);
|
---|
77 | void gcAdd(const QString &);
|
---|
78 |
|
---|
79 | UrlList urlList() const;
|
---|
80 | void addUrlList(const UrlList &);
|
---|
81 |
|
---|
82 | signals:
|
---|
83 | void childCountChanged();
|
---|
84 | void actionGCJoin(const QString &);
|
---|
85 |
|
---|
86 | private slots:
|
---|
87 | void qlv_context(QListViewItem *, const QPoint &, int);
|
---|
88 | void qlv_doubleClicked(QListViewItem *);
|
---|
89 |
|
---|
90 | private:
|
---|
91 | bool v_readOnly;
|
---|
92 |
|
---|
93 | void goURL(const QString &);
|
---|
94 | };
|
---|
95 |
|
---|
96 | class AddUrlDlg : public AddUrlUI
|
---|
97 | {
|
---|
98 | Q_OBJECT
|
---|
99 | public:
|
---|
100 | AddUrlDlg(QWidget *parent=0, const char *name=0);
|
---|
101 | ~AddUrlDlg();
|
---|
102 | };
|
---|
103 |
|
---|
104 | class EventDlg : public AdvancedWidget<QWidget>
|
---|
105 | {
|
---|
106 | Q_OBJECT
|
---|
107 | public:
|
---|
108 | // compose
|
---|
109 | EventDlg(const QString &, PsiCon *, PsiAccount *);
|
---|
110 | // read
|
---|
111 | EventDlg(const Jid &, PsiAccount *, bool unique);
|
---|
112 | ~EventDlg();
|
---|
113 |
|
---|
114 | QString text() const;
|
---|
115 | void setText(const QString &);
|
---|
116 | void setSubject(const QString &);
|
---|
117 | void setThread(const QString &);
|
---|
118 | void setUrlOnShow();
|
---|
119 |
|
---|
120 | PsiAccount *psiAccount();
|
---|
121 |
|
---|
122 | static QSize defaultSize();
|
---|
123 |
|
---|
124 | signals:
|
---|
125 | void aChat(const Jid& jid);
|
---|
126 | void aReply(const Jid &jid, const QString &body, const QString &subject, const QString &thread);
|
---|
127 | void aReadNext(const Jid &);
|
---|
128 | void aDeny(const Jid &);
|
---|
129 | void aAuth(const Jid &);
|
---|
130 |
|
---|
131 | protected:
|
---|
132 | // reimplemented
|
---|
133 | void showEvent(QShowEvent *);
|
---|
134 | void resizeEvent(QResizeEvent *);
|
---|
135 | void keyPressEvent(QKeyEvent *);
|
---|
136 | void closeEvent(QCloseEvent *);
|
---|
137 |
|
---|
138 | public slots:
|
---|
139 | void optionsUpdate();
|
---|
140 | void closeAfterReply();
|
---|
141 | void updateContact(const Jid &);
|
---|
142 | void updateEvent(PsiEvent *);
|
---|
143 | void updateReadNext(Icon *, int);
|
---|
144 | void actionGCJoin(const QString &);
|
---|
145 |
|
---|
146 | private slots:
|
---|
147 | void to_textChanged(const QString &);
|
---|
148 | void to_changeResource(const QString &);
|
---|
149 | void to_tryComplete();
|
---|
150 | void updateIdentity(PsiAccount *);
|
---|
151 | void accountUpdatedActivity();
|
---|
152 | void doWhois(bool force=false);
|
---|
153 | void doSend();
|
---|
154 | void doReadNext();
|
---|
155 | void doChat();
|
---|
156 | void doReply();
|
---|
157 | void doQuote();
|
---|
158 | void doDeny();
|
---|
159 | void doAuth();
|
---|
160 | void doInfo();
|
---|
161 | void doHistory();
|
---|
162 | void showHideAttachView();
|
---|
163 | void addUrl();
|
---|
164 |
|
---|
165 | void updatePGP();
|
---|
166 | void encryptedMessageSent(int, bool);
|
---|
167 | void trySendEncryptedNext();
|
---|
168 |
|
---|
169 | public:
|
---|
170 | class Private;
|
---|
171 | private:
|
---|
172 | Private *d;
|
---|
173 |
|
---|
174 | void doneSend();
|
---|
175 |
|
---|
176 | void init();
|
---|
177 | QStringList stringToList(const QString &, bool enc=true) const;
|
---|
178 | QString findJidInString(const QString &) const;
|
---|
179 | QString expandAddresses(const QString &, bool enc=true) const;
|
---|
180 | void buildCompletionList();
|
---|
181 | void setAccount(PsiAccount *);
|
---|
182 | void setTime(const QDateTime &, bool late=false);
|
---|
183 |
|
---|
184 | friend class ELineEdit;
|
---|
185 | UserResourceList getResources(const QString &) const;
|
---|
186 | QString jidToString(const Jid &, const QString &r="") const;
|
---|
187 | };
|
---|
188 |
|
---|
189 | #endif
|
---|