~ubuntu-branches/ubuntu/edgy/psi/edgy

« back to all changes in this revision

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