~ubuntu-branches/ubuntu/breezy/psi/breezy

« back to all changes in this revision

Viewing changes to src/eventdlg.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2004-06-15 00:10:41 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040615001041-enywb6pcpe4sjsw6
Tags: 0.9.2-1
* New upstream release
* Set KDEDIR for ./configure so kde specific files get installed
* Don't install libpsiwidgets.so. It got installed in /usr/share
  where it doesn't belong. May be included (at a better location)
  later.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/****************************************************************************
2
 
** eventdlg.h - multi-window chat dialog for sending/receiving 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 program; if not, write to the Free Software
17
 
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 
**
19
 
****************************************************************************/
 
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
20
 
21
21
#ifndef EVENTDLG_H
22
22
#define EVENTDLG_H
23
23
 
24
24
#include<qwidget.h>
25
 
#include<qlayout.h>
26
 
#include<qlabel.h>
27
 
#include<qpushbutton.h>
28
 
#include<qtoolbutton.h>
 
25
#define private protected
29
26
#include<qlineedit.h>
30
 
#include<qpixmap.h>
31
 
#include<qgroupbox.h>
32
 
#include<qdropsite.h>
33
 
#include<qcombobox.h>
 
27
#undef private
 
28
#include<qlistview.h>
34
29
 
35
 
#include"message.h"
36
 
#include"msgmle.h"
 
30
#include"im.h"
37
31
#include"userlist.h"
38
 
#include"anim.h"
39
 
#include"uniquewindow.h"
40
 
 
41
 
class AnimatedButton : public QPushButton
42
 
{
43
 
        Q_OBJECT
44
 
public:
45
 
        AnimatedButton(QWidget *parent=0, const char *name=0);
46
 
 
47
 
        void setAnim(Anim *);
48
 
        bool isActive() { return v_isActive; }
49
 
 
50
 
private:
51
 
        Anim *anim;
52
 
        bool v_isActive;
53
 
        QTimer *t;
54
 
        int animStep;
55
 
 
56
 
        void changeIcon(const QPixmap &);
57
 
 
58
 
private slots:
59
 
        void animate();
60
 
};
61
 
 
62
 
 
 
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;
63
44
class ELineEdit : public QLineEdit
64
45
{
65
46
        Q_OBJECT
66
47
public:
67
 
        ELineEdit(QWidget *parent=0, const char *name=0);
 
48
        ELineEdit(EventDlg *parent, const char *name=0);
 
49
 
 
50
signals:
 
51
        void changeResource(const QString &);
 
52
        void tryComplete();
68
53
 
69
54
protected:
 
55
        // reimplemented
70
56
        void dragEnterEvent(QDragEnterEvent *);
71
57
        void dropEvent(QDropEvent *);
72
 
};
73
 
 
74
 
class EventDlg : public QWidget, public UniqueWindow
75
 
{
76
 
        Q_OBJECT
77
 
public:
78
 
        EventDlg(UserListItem *item, int localStatus, bool isUnique, bool compose=FALSE, bool urlMode=FALSE);
79
 
        EventDlg(const QStringList &to, int x_localStatus);
 
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 QWidget
 
105
{
 
106
        Q_OBJECT
 
107
public:
 
108
        // compose
 
109
        EventDlg(const QString &, PsiCon *, PsiAccount *);
 
110
        // read
 
111
        EventDlg(const Jid &, PsiAccount *, bool unique);
80
112
        ~EventDlg();
81
113
 
82
 
        void init();
83
 
 
84
 
        QString & jid() { return v_jid; }
85
 
        static EventDlg *find(const QString &);
 
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
 
86
122
        static QSize defaultSize();
87
123
 
 
124
signals:
 
125
        void aReply(const Jid &jid, const QString &body, const QString &subject, const QString &thread);
 
126
        void aReadNext(const Jid &);
 
127
        void aDeny(const Jid &);
 
128
        void aAuth(const Jid &);
 
129
 
 
130
protected:
88
131
        // reimplemented
89
 
protected:
 
132
        void showEvent(QShowEvent *);
90
133
        void resizeEvent(QResizeEvent *);
91
 
 
92
 
signals:
93
 
        void aSend(const Message &);
94
 
        void aHistory(const QString &jid);
95
 
        void aReply(const QString &jid);
96
 
        void aReadNext(const QString &jid);
97
 
        void aAuth(const QString &jid);
98
 
        void aInfo(const QString &jid);
99
 
        void aOpenURL(const QString &url);
 
134
        void keyPressEvent(QKeyEvent *);
 
135
        void closeEvent(QCloseEvent *);
100
136
 
101
137
public slots:
102
 
        void localUpdate(const JabRosterEntry &);
103
 
        void updateContact(UserListItem *);
104
 
        void updateReadNext(int nextType, int amount);
105
 
        void updateEvent(const Message &);
 
138
        void optionsUpdate();
106
139
        void closeAfterReply();
107
 
        void optionsUpdate();
 
140
        void updateContact(const Jid &);
 
141
        void updateEvent(PsiEvent *);
 
142
        void updateReadNext(Icon *, int);
 
143
        void actionGCJoin(const QString &);
108
144
 
109
145
private slots:
 
146
        void to_textChanged(const QString &);
 
147
        void to_changeResource(const QString &);
 
148
        void to_tryComplete();
 
149
        void updateIdentity(PsiAccount *);
 
150
        void accountUpdatedActivity();
 
151
        void doWhois(bool force=false);
 
152
        void doSend();
 
153
        void doReadNext();
 
154
        void doReply();
 
155
        void doQuote();
 
156
        void doDeny();
 
157
        void doAuth();
 
158
        void doInfo();
110
159
        void doHistory();
111
 
        void doInfo();
112
 
        void doReadNext();
113
 
        void doButton1();
114
 
        void setCurrentTime();
115
 
        void showSubject(bool);
116
 
        void showUrl(bool);
117
 
        void showMulti();
118
 
        void showSingle();
119
 
        void goToURL();
120
 
 
 
160
        void showHideAttachView();
 
161
        void addUrl();
 
162
 
 
163
        void updatePGP();
 
164
        void encryptedMessageSent(int, bool);
 
165
        void trySendEncryptedNext();
 
166
 
 
167
public:
 
168
        class Private;
121
169
private:
122
 
        bool isCompose, isMulti;
123
 
        QString v_jid, v_nick;
124
 
        int v_status;
125
 
        int localStatus;
126
 
        Anim *eventAnim;
127
 
        int eventType;
128
 
        Message *msg;
129
 
        int numReadNext;
130
 
        int nextType;
131
 
 
132
 
        QBoxLayout *layout1;
133
 
        QWidget *lo_single, *lo_multi;
134
 
 
135
 
        QLabel *lb_statusIcon, *lb_statusStr, *lb_eventType, *lb_time;
136
 
        QLineEdit *le_nick, *le_jid;
137
 
        ELineEdit *le_to;
138
 
        QPushButton *pb_toMulti, *pb_toSingle;
139
 
        QToolButton *tb_subj, *tb_url, *tb_history, *tb_info;
140
 
        QComboBox *cb_eventType;
141
 
 
142
 
        // optional subject
143
 
        QGroupBox *gb_subj;
144
 
        QLabel *lb_subj;
145
 
        QLineEdit *le_subj;
146
 
 
147
 
        // optional URL
148
 
        QGroupBox *gb_url;
149
 
        QLabel *lb_url, *lb_desc;
150
 
        QLineEdit *le_url, *le_desc;
151
 
 
152
 
        QPushButton *pb_button1;
153
 
        bool flag_button1;
154
 
 
155
 
        AnimatedButton *pb_next;
156
 
        MsgMle *mle;
157
 
 
158
 
        void setButton1();
159
 
        void setTime(const QDateTime &);
160
 
 
161
 
        void keyPressEvent(QKeyEvent *e);
 
170
        Private *d;
 
171
 
 
172
        void doneSend();
 
173
 
 
174
        void init();
 
175
        QStringList stringToList(const QString &, bool enc=true) const;
 
176
        QString findJidInString(const QString &) const;
 
177
        QString expandAddresses(const QString &, bool enc=true) const;
 
178
        void buildCompletionList();
 
179
        void setAccount(PsiAccount *);
 
180
        void setTime(const QDateTime &, bool late=false);
 
181
 
 
182
        friend class ELineEdit;
 
183
        UserResourceList getResources(const QString &) const;
 
184
        QString jidToString(const Jid &, const QString &r="") const;
162
185
};
163
186
 
164
187
#endif