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

« back to all changes in this revision

Viewing changes to src/whiteboarding/wbmanager.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2008-08-28 18:46:52 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080828184652-iiik12dl91nq7cdi
Tags: 0.12-2
Uploading to unstable (Closes: Bug#494352)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * wbmanager.h - Whiteboard manager
 
3
 * Copyright (C) 2007  Joonas Govenius
 
4
 *
 
5
 * Influenced by:
 
6
 * pepmanager.h - Classes for PEP
 
7
 * Copyright (C) 2006  Remko Troncon
 
8
 *
 
9
 * This program is free software; you can redistribute it and/or
 
10
 * modify it under the terms of the GNU General Public License
 
11
 * as published by the Free Software Foundation; either version 2
 
12
 * of the License, or (at your option) any later version.
 
13
 *
 
14
 * This program is distributed in the hope that it will be useful,
 
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 * GNU General Public License for more details.
 
18
 *
 
19
 * You should have received a copy of the GNU General Public License
 
20
 * along with this library; if not, write to the Free Software
 
21
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
22
 *
 
23
 */
 
24
 
 
25
#ifndef WBMANAGER_H
 
26
#define WBMANAGER_H
 
27
 
 
28
#include "../sxe/sxemanager.h"
 
29
#include "wbdlg.h"
 
30
 
 
31
#include <QInputDialog>
 
32
 
 
33
namespace XMPP {
 
34
        class Client;
 
35
        class Jid;
 
36
        class Message;
 
37
}
 
38
 
 
39
using namespace XMPP;
 
40
 
 
41
/*! \brief The manager for whiteboard dialogs.
 
42
 *  The manager listen to SxeManager to pick up any new sessions negotiated by
 
43
 *  it and creates a dialog for each session.
 
44
 *
 
45
 *  The manager also provides a possibillity for the local client to start
 
46
 *  a new session negotiation with the desired contact.
 
47
 *
 
48
 *  \sa WbDlg
 
49
 */
 
50
class WbManager : public QObject
 
51
{
 
52
        Q_OBJECT
 
53
 
 
54
public:
 
55
        /*! \brief Constructor.
 
56
         *  Creates a new manager for the specified Client and PsiAccount
 
57
         */
 
58
        WbManager(PsiAccount* pa, SxeManager* sxemanager);
 
59
        /*! \brief Returns true if features contains WBNS and the user wishes to accept the invitation. */
 
60
    static bool checkInvitation(const Jid &peer, const QList<QString> &features);
 
61
 
 
62
public slots:
 
63
        /*! \brief Opens the existing dialog to the specified contact or starts a new session negotiation if necessary.*/
 
64
        void openWhiteboard(const Jid &target, const Jid &ownJid, bool groupChat, bool promptInitialDoc = true);
 
65
 
 
66
private:
 
67
        /*! \brief Return a pointer to a dialog to the specified contact.
 
68
         *  If such dialog doesn't exits, returns 0.
 
69
         */
 
70
        WbDlg* findWbDlg(const Jid &target);
 
71
 
 
72
        /*! \brief A pointer to the PsiAccount to pass to new dialogs.*/
 
73
        PsiAccount* pa_;
 
74
        /*! \brief A list of dialogs of established sessions.*/
 
75
        QList<WbDlg*> dialogs_;
 
76
        /*! \brief A pointer to the SxeManager used for negotiating sessions.*/
 
77
    SxeManager* sxemanager_;
 
78
 
 
79
private slots:
 
80
        /*! \brief Removes and deletes the dialog for the given session.*/
 
81
        void removeDialog(WbDlg* dialog);
 
82
        /*! \brief Returns a pointer to a new dialog to with given contact and session set.*/
 
83
        void createWbDlg(SxeSession* session);
 
84
};
 
85
 
 
86
#endif