~ubuntu-branches/ubuntu/karmic/psi/karmic

« back to all changes in this revision

Viewing changes to src/psicontactlist.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2008-04-14 18:57:30 UTC
  • mfrom: (2.1.9 hardy)
  • Revision ID: james.westby@ubuntu.com-20080414185730-528re3zp0m2hdlhi
Tags: 0.11-8
* added CONFIG -= link_prl to .pro files and removed dependencies
  which are made unnecessary by this change
* Fix segfault when closing last chat tab with qt4.4
  (This is from upstream svn, rev. 1101) (Closes: Bug#476122)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * psicontactlist.h - general abstraction of the psi-specific contact list
 
3
 * Copyright (C) 2006  Michail Pishchagin
 
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 PSICONTACTLIST_H
 
22
#define PSICONTACTLIST_H
 
23
 
 
24
#include <QList>
 
25
 
 
26
#include "contactlist.h"
 
27
#include "profiles.h"
 
28
 
 
29
using namespace XMPP;
 
30
 
 
31
class PsiCon;
 
32
class PsiAccount;
 
33
class XMPP::Jid;
 
34
 
 
35
class PsiContactList : public ContactList
 
36
{
 
37
        Q_OBJECT
 
38
public:
 
39
        PsiContactList(PsiCon* psi);
 
40
        ~PsiContactList();
 
41
 
 
42
        PsiCon* psi() const;
 
43
 
 
44
        const QList<PsiAccount*>& accounts() const;
 
45
        const QList<PsiAccount*>& enabledAccounts() const;
 
46
        bool haveActiveAccounts() const;
 
47
        bool haveEnabledAccounts() const;
 
48
 
 
49
        PsiAccount *defaultAccount() const;
 
50
 
 
51
        UserAccountList getUserAccountList() const;
 
52
 
 
53
        void createAccount(const QString& name, const Jid& j = "", const QString& pass = "", bool opt_host = false, const QString& host = "", int port = 5222, bool legacy_ssl_probe = true, UserAccount::SSLFlag ssl = UserAccount::SSL_Auto, int proxy = 0, bool modify = true);
 
54
        void createAccount(const UserAccount&);
 
55
        void removeAccount(PsiAccount*);
 
56
        void setAccountEnabled(PsiAccount*, bool enabled = TRUE);
 
57
 
 
58
        int queueCount() const;
 
59
        PsiAccount *queueLowestEventId();
 
60
 
 
61
        void loadAccounts(const UserAccountList &);
 
62
        void link(PsiAccount*);
 
63
        void unlink(PsiAccount*);
 
64
 
 
65
signals:
 
66
        /**
 
67
         * This signal is emitted when account is loaded from disk or created
 
68
         * anew.
 
69
         */
 
70
        void accountAdded(PsiAccount*);
 
71
        /**
 
72
         * This signal is emitted when account is completely removed from the
 
73
         * program, i.e. deleted.
 
74
         */
 
75
        void accountRemoved(PsiAccount*);
 
76
        /**
 
77
         * This signal is emitted when number of accounts managed by
 
78
         * PsiContactList changes.
 
79
         */
 
80
        void accountCountChanged();
 
81
        /**
 
82
         * This signal is emitted when one of the accounts emits
 
83
         * activityChanged() signal.
 
84
         */
 
85
        void accountActivityChanged();
 
86
        /**
 
87
         * This signal is emitted when the features of one of the accounts change.
 
88
         */
 
89
        void accountFeaturesChanged();
 
90
        /**
 
91
         * This signal is emitted when either new account was added, or 
 
92
         * existing one was removed altogether.
 
93
         */
 
94
        void saveAccounts();
 
95
 
 
96
private slots:
 
97
        void accountEnabledChanged();
 
98
 
 
99
private:
 
100
        PsiAccount *loadAccount(const UserAccount &);
 
101
        PsiAccount *tryQueueLowestEventId(bool includeDND);
 
102
 
 
103
        PsiCon *psi_;
 
104
        PsiContactList *contactList_;
 
105
        QList<PsiAccount *> accounts_, enabledAccounts_;
 
106
};
 
107
 
 
108
#endif