2
Copyright (C) 2010 Marco Mentasti <marcomentasti@gmail.com>
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License version 2 as published by the Free Software Foundation.
8
This library is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
Library General Public License for more details.
13
You should have received a copy of the GNU Library General Public License
14
along with this library; see the file COPYING.LIB. If not, write to
15
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16
Boston, MA 02110-1301, USA.
19
#ifndef CONNECTIONMODEL_H
20
#define CONNECTIONMODEL_H
22
#include "connection.h"
26
#include <QAbstractListModel>
30
class ConnectionModel : public QAbstractListModel
35
ConnectionModel(QObject *parent = 0);
36
virtual ~ConnectionModel();
38
virtual int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
39
virtual QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
41
virtual int addConnection(Connection conn);
42
virtual void removeConnection(const QString &name);
44
Connection::Status status(const QString &name) const;
45
void setStatus(const QString &name, const Connection::Status status);
47
void setPassword(const QString &name, const QString &password);
49
int indexOf(const QString &name);
51
// virtual bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex());
52
// virtual bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex());
55
QHash<QString, Connection> m_connections;
56
QHash<Connection::Status, KIcon> m_icons;
59
#endif // CONNECTIONMODEL_H