/usr/include/KTp/Models/rooms-model.h is in libktp-dev 15.08.3-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | /*
* Rooms Model - A model of chatrooms.
* Copyright (C) 2012 Dominik Cermak <d.cermak@arcor.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef ROOMS_MODEL_H
#define ROOMS_MODEL_H
#include <QtCore/QAbstractListModel>
#include <TelepathyQt/Types>
#include <KTp/Models/ktpmodels_export.h>
namespace KTp {
class KTPMODELS_EXPORT RoomsModel : public QAbstractListModel
{
Q_OBJECT
public:
// TODO: find a suitable icon and add an invitation column
enum Column {
NameColumn=0,
DescriptionColumn,
MembersColumn,
PasswordColumn,
};
enum Roles {
HandleNameRole = Qt::UserRole
};
explicit RoomsModel(QObject *parent = 0);
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
/**
* \brief Add new rooms to the list.
*
* \param newRoomList The list with the new rooms to add.
*/
void addRooms(const Tp::RoomInfoList newRoomList);
/**
* \brief Clear the room list.
*/
void clearRoomInfoList();
private:
Tp::RoomInfoList m_roomInfoList;
};
class KTPMODELS_EXPORT FavoriteRoomsModel : public QAbstractListModel
{
Q_OBJECT
public:
enum Column {
BookmarkColumn = 0,
HandleNameColumn,
AccountIdentifierColumn
};
enum Roles {
HandleNameRole = Qt::UserRole,
BookmarkRole,
AccountRole,
FavoriteRoomRole
};
explicit FavoriteRoomsModel(QObject *parent = 0);
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
virtual bool setData(const QModelIndex &index, const QVariant &value, int role);
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
/**
* \brief Add new rooms to the list.
*
* \param newRoomList The list with the new rooms to add.
*/
void addRooms(const QList<QVariantMap> newRoomList);
/**
* \brief Add a new room to the list.
*
* \param room The room to add.
*/
void addRoom(const QVariantMap &room);
/**
* \brief Remove a room from the list.
*
* \param room The room to remove.
*/
void removeRoom(const QVariantMap &room);
/**
* \brief Remove all rooms from the list.
*/
void clearRooms();
/**
* \brief Checks if it contains a room (identified by his handle-name).
*
* \param handle The handle to look for.
*
* \return True if it contains the room else false.
*/
bool containsRoom(const QString &handle, const QString &account) const;
/**
* \brief Returns the count of rooms for the specified account.
*
* \param account The account to return the count for.
*
* \return The count of rooms.
*/
int countForAccount(const QString &account) const;
private:
QList<QVariantMap> m_favoriteRoomsList;
};
} // namespace KTp
#endif // ROOMS_MODEL_H
|