~ubuntu-branches/ubuntu/quantal/psi/quantal

« back to all changes in this revision

Viewing changes to src/psicon.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2005-01-10 17:41:43 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050110174143-ltocv5zapl6blf5d
Tags: 0.9.3-1
* New upstream release
* Cleaned up debian/rules (some things are done by upstream Makefiles now)
* Fixed some lintian warnings:
  - removed executable bit from some .png files
  - moved psi.desktop to /usr/share/applications
* Updated menu files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * psicon.h - core of Psi
 
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 PSICON_H
 
22
#define PSICON_H
 
23
 
 
24
#include<qcombobox.h>
 
25
#include"profiles.h"
 
26
#include"psievent.h"
 
27
#include"im.h"
 
28
 
 
29
using namespace XMPP;
 
30
 
 
31
class PsiCon;
 
32
class PsiAccount;
 
33
class ContactView;
 
34
class EventDlg;
 
35
class UserListItem;
 
36
class EDB;
 
37
class EDBItem;
 
38
class ProxyManager;
 
39
class MainWin;
 
40
class FileTransDlg;
 
41
class IconSelectPopup;
 
42
class QThread;
 
43
class PsiActionList;
 
44
class PsiToolBar;
 
45
 
 
46
namespace OpenPGP
 
47
{
 
48
        class Engine;
 
49
}
 
50
 
 
51
typedef QPtrList<PsiAccount> PsiAccountList;
 
52
typedef QPtrListIterator<PsiAccount> PsiAccountListIt;
 
53
 
 
54
class AccountsComboBox : public QComboBox
 
55
{
 
56
        Q_OBJECT
 
57
public:
 
58
        AccountsComboBox(PsiCon *, QWidget *parent=0, bool online_only = false);
 
59
        ~AccountsComboBox();
 
60
 
 
61
        void setAccount(PsiAccount *);
 
62
 
 
63
signals:
 
64
        void activated(PsiAccount *);
 
65
 
 
66
private slots:
 
67
        void changeAccount();
 
68
        void updateAccounts();
 
69
        void deleteMe();
 
70
 
 
71
private:
 
72
        PsiCon *psi;
 
73
        PsiAccount *pa;
 
74
        bool onlineOnly;
 
75
};
 
76
 
 
77
class PsiCon : public QObject
 
78
{
 
79
        Q_OBJECT
 
80
public:
 
81
        enum { QuitProgram, QuitProfile };
 
82
        PsiCon();
 
83
        ~PsiCon();
 
84
 
 
85
        bool init();
 
86
        void deinit();
 
87
 
 
88
        ContactView *contactView() const;
 
89
        const PsiAccountList & accountList(bool enabledOnly=FALSE) const;
 
90
        EDB *edb() const;
 
91
        OpenPGP::Engine *pgp() const;
 
92
        ProxyManager *proxy() const;
 
93
        FileTransDlg *ftdlg() const;
 
94
 
 
95
        QWidget *dialogFind(const char *className);
 
96
        void dialogRegister(QWidget *w);
 
97
        void dialogUnregister(QWidget *w);
 
98
 
 
99
        bool isValid(PsiAccount *);
 
100
        void createAccount(const QString &name, const Jid &j="", const QString &pass="", bool opt_host=false, const QString &host="", int port=5222, bool ssl=false, int proxy=0);
 
101
        //void createAccount(const QString &, const QString &host="", int port=5222, bool ssl=false, const QString &user="", const QString &pass="");
 
102
        void modifyAccount(PsiAccount *);
 
103
        void removeAccount(PsiAccount *);
 
104
        void enableAccount(PsiAccount *, bool e=TRUE);
 
105
 
 
106
        void playSound(const QString &);
 
107
        void raiseMainwin();
 
108
 
 
109
        // global event handling
 
110
        int queueCount();
 
111
        PsiAccount *queueLowestEventId();
 
112
 
 
113
        AccountsComboBox *accountsComboBox(QWidget *parent=0, bool online_only = false);
 
114
 
 
115
        const QStringList & recentGCList() const;
 
116
        void recentGCAdd(const QString &);
 
117
        const QStringList & recentBrowseList() const;
 
118
        void recentBrowseAdd(const QString &);
 
119
        const QStringList & recentNodeList() const;
 
120
        void recentNodeAdd(const QString &);
 
121
 
 
122
        EventDlg *createEventDlg(const QString &, PsiAccount *);
 
123
        void updateContactGlobal(PsiAccount *, const Jid &);
 
124
 
 
125
        QPtrList<PsiToolBar> *toolbarList() const;
 
126
        PsiToolBar *findToolBar(QString group, int index);
 
127
        PsiActionList *actionList() const;
 
128
 
 
129
        MainWin *mainWin() const;
 
130
        IconSelectPopup *iconSelectPopup() const;
 
131
        void processEvent(PsiEvent *);
 
132
 
 
133
signals:
 
134
        void quit(int);
 
135
        void accountAdded(PsiAccount *);
 
136
        void accountUpdated(PsiAccount *);
 
137
        void accountRemoved(PsiAccount *);
 
138
        void accountCountChanged();
 
139
        void accountActivityChanged();
 
140
        void emitOptionsUpdate();
 
141
        void pgpToggled(bool);
 
142
        void pgpKeysUpdated();
 
143
 
 
144
public slots:
 
145
        void setGlobalStatus(const Status &);
 
146
        QWidget *doToolbars();
 
147
 
 
148
private slots:
 
149
        void closeProgram();
 
150
        void changeProfile();
 
151
        void doManageAccounts();
 
152
        void doGroupChat();
 
153
        void doNewBlankMessage();
 
154
        void doOptions();
 
155
        void doFileTransDlg();
 
156
        void statusMenuChanged(int);
 
157
        void pa_updatedActivity();
 
158
        void pa_updatedAccount();
 
159
        void slotApplyOptions(const Options &);
 
160
        void queueChanged();
 
161
        void recvNextEvent();
 
162
        void setStatusFromDialog(const Status &);
 
163
        void pgp_initFinished(bool, const QString &);
 
164
        void pgp_keysUpdated();
 
165
        void proxy_settingsChanged();
 
166
        void updateMainwinStatus();
 
167
 
 
168
        void mainWinGeomChanged(int x, int y, int w, int h);
 
169
 
 
170
private:
 
171
        class Private;
 
172
        Private *d;
 
173
 
 
174
        PsiAccount *loadAccount(const UserAccount &);
 
175
        void loadAccounts(const UserAccountList &);
 
176
        UserAccountList unloadAccounts();
 
177
        void deleteAllDialogs();
 
178
        void saveAccounts();
 
179
        void pgp_init(const QString &);
 
180
        void s5b_init();
 
181
        void updateS5BServerAddresses();
 
182
 
 
183
        friend class PsiAccount;
 
184
        void link(PsiAccount *);
 
185
        void unlink(PsiAccount *);
 
186
        void setToggles(bool tog_offline, bool tog_away, bool tog_agents, bool tog_hidden, bool tog_self);
 
187
        void getToggles(bool *tog_offline, bool *tog_away, bool *tog_agents, bool *tog_hidden, bool *tog_self);
 
188
 
 
189
        friend class EventQueue;
 
190
        int getId();
 
191
};
 
192
 
 
193
#endif