~ubuntu-branches/ubuntu/saucy/kopete/saucy-proposed

« back to all changes in this revision

Viewing changes to protocols/testbed/testbedcontact.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-06-21 02:22:39 UTC
  • Revision ID: package-import@ubuntu.com-20130621022239-63l3zc8p0nf26pt6
Tags: upstream-4.10.80
ImportĀ upstreamĀ versionĀ 4.10.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    testbedcontact.h - Kopete Testbed Protocol
 
3
 
 
4
    Copyright (c) 2003      by Will Stephenson           <will@stevello.free-online.co.uk>
 
5
    Kopete    (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org>
 
6
 
 
7
    *************************************************************************
 
8
    *                                                                       *
 
9
    * This library is free software; you can redistribute it and/or         *
 
10
    * modify it under the terms of the GNU General Public                   *
 
11
    * License as published by the Free Software Foundation; either          *
 
12
    * version 2 of the License, or (at your option) any later version.      *
 
13
    *                                                                       *
 
14
    *************************************************************************
 
15
*/
 
16
 
 
17
#ifndef TESTBEDCONTACT_H
 
18
#define TESTBEDCONTACT_H
 
19
 
 
20
#include <qmap.h>
 
21
//Added by qt3to4:
 
22
#include <QList>
 
23
#include "kopetecontact.h"
 
24
#include "kopetemessage.h"
 
25
 
 
26
class KAction;
 
27
class KActionCollection;
 
28
namespace Kopete { class Account; }
 
29
namespace Kopete { class ChatSession; }
 
30
namespace Kopete { class MetaContact; }
 
31
 
 
32
/**
 
33
@author Will Stephenson
 
34
*/
 
35
class TestbedContact : public Kopete::Contact
 
36
{
 
37
        Q_OBJECT
 
38
public:
 
39
        /**
 
40
         * The range of possible contact types
 
41
         */
 
42
        enum Type { Null, Echo, Group };
 
43
 
 
44
        TestbedContact( Kopete::Account* _account, const QString &uniqueName, 
 
45
                        const QString &displayName, 
 
46
                        Kopete::MetaContact *parent );
 
47
 
 
48
    ~TestbedContact();
 
49
 
 
50
    virtual bool isReachable();
 
51
        /**
 
52
         * Serialize the contact's data into a key-value map
 
53
         * suitable for writing to a file
 
54
         */
 
55
    virtual void serialize(QMap< QString, QString >& serializedData,
 
56
                        QMap< QString, QString >& addressBookData);
 
57
        /**
 
58
         * Return the actions for this contact
 
59
         */
 
60
        virtual QList<KAction *> *customContextMenuActions();
 
61
        /**
 
62
         * Returns a Kopete::ChatSession associated with this contact
 
63
         */
 
64
        virtual Kopete::ChatSession *manager( CanCreateFlags canCreate = CannotCreate );
 
65
 
 
66
        /**
 
67
         * Set the Type of this contact
 
68
         */
 
69
        void setType( Type type );
 
70
public slots:
 
71
        /**
 
72
         * Transmits an outgoing message to the server 
 
73
         * Called when the chat window send button has been pressed
 
74
         * (in response to the relevant Kopete::ChatSession signal)
 
75
         */
 
76
        void sendMessage( Kopete::Message &message );
 
77
        /**
 
78
         * Called when an incoming message arrived
 
79
         * This displays it in the chatwindow
 
80
         */
 
81
        void receivedMessage( const QString &message );
 
82
 
 
83
protected slots:
 
84
        /**
 
85
         * Show the settings dialog
 
86
         */
 
87
        void showContactSettings();
 
88
        /**
 
89
         * Notify the contact that its current Kopete::ChatSession was
 
90
         * destroyed - probably by the chatwindow being closed
 
91
         */
 
92
        void slotChatSessionDestroyed();
 
93
        
 
94
protected:
 
95
        Kopete::ChatSession* m_msgManager;
 
96
        KActionCollection* m_actionCollection;
 
97
        Type m_type;
 
98
        KAction* m_actionPrefs;
 
99
};
 
100
 
 
101
#endif