~ubuntu-branches/ubuntu/jaunty/psi/jaunty

« back to all changes in this revision

Viewing changes to src/privacylistitem.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
 
 * privacylistitem.h
3
 
 * Copyright (C) 2006  Remko Troncon
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 PRIVACYLISTITEM_H
22
 
#define PRIVACYLISTITEM_H
23
 
 
24
 
#include <QString>
25
 
 
26
 
class QDomElement;
27
 
class QDomDocument;
28
 
 
29
 
class PrivacyListItem
30
 
{
31
 
public:
32
 
        typedef enum { FallthroughType, JidType, GroupType, SubscriptionType } Type;
33
 
        typedef enum { Allow, Deny } Action;
34
 
 
35
 
        PrivacyListItem();
36
 
        PrivacyListItem(const QDomElement& e);
37
 
 
38
 
        Type type() const { return type_; }
39
 
        Action action() const { return action_; }
40
 
        bool message() const { return message_; }
41
 
        bool presenceIn() const { return presenceIn_; }
42
 
        bool presenceOut() const { return presenceOut_; }
43
 
        bool iq() const { return iq_; }
44
 
        bool all() const { return iq_ && presenceIn_ && presenceOut_ && message_; }
45
 
        const QString& value() const { return value_; }
46
 
        unsigned int order() const { return order_; }
47
 
 
48
 
        void setType(Type type) { type_ = type; }
49
 
        void setAction(Action action) { action_ = action; }
50
 
        void setMessage(bool b) { message_ = b; }
51
 
        void setPresenceIn(bool b) { presenceIn_ = b; }
52
 
        void setPresenceOut(bool b) { presenceOut_ = b; }
53
 
        void setIQ(bool b) { iq_ = b; }
54
 
        void setAll() { iq_ = presenceIn_ = presenceOut_ = message_ = true; }
55
 
        void setValue(const QString& value) { value_ = value; }
56
 
        void setOrder(unsigned int order) { order_ = order; }
57
 
        
58
 
        bool isBlock() const;
59
 
        QString toString() const;
60
 
        QDomElement toXml(QDomDocument&) const;
61
 
        void fromXml(const QDomElement& e);
62
 
 
63
 
        bool operator<(const PrivacyListItem& it) const { return order() < it.order(); }
64
 
 
65
 
        static PrivacyListItem blockItem(const QString& jid);
66
 
        
67
 
private:
68
 
        Type type_;
69
 
        Action action_;
70
 
        bool message_, presenceIn_, presenceOut_, iq_;
71
 
        unsigned int order_;
72
 
        QString value_;
73
 
};
74
 
 
75
 
#endif