~ubuntu-branches/ubuntu/quantal/psi/quantal

« back to all changes in this revision

Viewing changes to src/mucaffiliationsmodel.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
 * mucaffiliationsmodel.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 MUCAFFILIATIONSMODEL_H
 
22
#define MUCAFFILIATIONSMODEL_H
 
23
 
 
24
#include <QStandardItemModel>
 
25
#include <QList>
 
26
#include <QMap>
 
27
 
 
28
#include "xmpp_muc.h"
 
29
 
 
30
class QMimeData;
 
31
 
 
32
class MUCAffiliationsModel : public QStandardItemModel
 
33
{
 
34
        Q_OBJECT
 
35
 
 
36
public:
 
37
        MUCAffiliationsModel();
 
38
        
 
39
        virtual Qt::ItemFlags flags(const QModelIndex &index) const;
 
40
        virtual Qt::DropActions supportedDropActions() const;
 
41
        bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
 
42
        QStringList mimeTypes () const;
 
43
        QMimeData* mimeData(const QModelIndexList &indexes) const;
 
44
 
 
45
        void resetAffiliationLists();
 
46
        void setAffiliationListEnabled(XMPP::MUCItem::Affiliation, bool = true);
 
47
        QModelIndex affiliationListIndex(XMPP::MUCItem::Affiliation);
 
48
        void addItems(const QList<XMPP::MUCItem>&);
 
49
        QList<XMPP::MUCItem> changes() const;
 
50
        
 
51
protected:
 
52
        enum AffiliationListIndex { 
 
53
                Owners = 0, Admins = 1, Members = 2, Outcast = 3 , Unknown = 4 };
 
54
        
 
55
        void resetAffiliationList(XMPP::MUCItem::Affiliation);
 
56
        static QString affiliationlistindexToString(AffiliationListIndex);
 
57
        AffiliationListIndex affiliationToIndex(XMPP::MUCItem::Affiliation);
 
58
        static XMPP::MUCItem::Affiliation indexToAffiliation(int);
 
59
 
 
60
private:
 
61
        QList<XMPP::MUCItem> items_;
 
62
        QMap<AffiliationListIndex,bool> enabled_;
 
63
};
 
64
 
 
65
 
 
66
#endif