~lightdm-team/lightdm/1.4

« back to all changes in this revision

Viewing changes to liblightdm-qt/QLightDM/sessionsmodel.cpp

  • Committer: David Edmundson
  • Date: 2011-05-21 19:47:27 UTC
  • mfrom: (458.1.7 fix_namespace)
  • Revision ID: david@davidedmundson.co.uk-20110521194727-c3wmqlx2n4wjdiqb
Merge branch that puts Qt LightDM into a namespace, removes possibility of file clash. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "ldmsessionsmodel.h"
 
1
#include "sessionsmodel.h"
2
2
 
3
3
#include <QtCore/QList>
4
4
#include <QtCore/QDir>
5
5
#include <QtCore/QVariant>
6
6
#include <QtCore/QSettings>
7
7
 
 
8
using namespace QLightDM;
 
9
 
8
10
class SessionItem;
9
11
 
10
 
class LdmSessionsModelPrivate
 
12
class SessionsModelPrivate
11
13
{
12
14
public:
13
15
    QList<SessionItem> items;
22
24
    QString comment;
23
25
};
24
26
 
25
 
LdmSessionsModel::LdmSessionsModel(QObject *parent) :
 
27
SessionsModel::SessionsModel(QObject *parent) :
26
28
    QAbstractListModel(parent),
27
 
    d(new LdmSessionsModelPrivate())
 
29
    d(new SessionsModelPrivate())
28
30
{
29
31
    buildList();
30
32
}
31
33
 
32
 
LdmSessionsModel::~LdmSessionsModel()
 
34
SessionsModel::~SessionsModel()
33
35
{
34
36
}
35
37
 
36
 
int LdmSessionsModel::rowCount(const QModelIndex &parent) const
 
38
int SessionsModel::rowCount(const QModelIndex &parent) const
37
39
{
38
40
    if (parent == QModelIndex()) { //if top level
39
41
        return d->items.size();
42
44
    }
43
45
}
44
46
 
45
 
QVariant LdmSessionsModel::data(const QModelIndex &index, int role) const
 
47
QVariant SessionsModel::data(const QModelIndex &index, int role) const
46
48
{
47
49
    if (! index.isValid()) {
48
50
        return QVariant();
60
62
    return QVariant();
61
63
}
62
64
 
63
 
void LdmSessionsModel::buildList()
 
65
void SessionsModel::buildList()
64
66
{
65
67
    //maybe clear first?
66
68