~dandrader/unity-api/lifecycle

« back to all changes in this revision

Viewing changes to test/qmltest/mocks/plugins/Unity/Scopes/Mocks/MockDepartment.cpp

  • Committer: CI bot
  • Author(s): Michal Hruby, Albert Astals
  • Date: 2014-06-16 14:45:00 UTC
  • mfrom: (134.3.11 departments)
  • Revision ID: ps-jenkins@lists.canonical.com-20140616144500-xcnt2u2onjgu26si
Add Departments interfaces
 Fixes: 1320847

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2014 Canonical, Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program 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
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
// self
 
18
#include "MockDepartment.h"
 
19
 
 
20
MockDepartment::MockDepartment(QObject* parent)
 
21
 : unity::shell::scopes::DepartmentInterface(parent)
 
22
{
 
23
}
 
24
 
 
25
QString MockDepartment::departmentId() const
 
26
{
 
27
    return "root";
 
28
}
 
29
 
 
30
QString MockDepartment::label() const
 
31
{
 
32
    return "All Departments";
 
33
}
 
34
 
 
35
QString MockDepartment::allLabel() const
 
36
{
 
37
    return "All Departments";
 
38
}
 
39
 
 
40
QString MockDepartment::parentDepartmentId() const
 
41
{
 
42
    return QString();
 
43
}
 
44
 
 
45
QString MockDepartment::parentLabel() const
 
46
{
 
47
    return QString();
 
48
}
 
49
 
 
50
bool MockDepartment::loaded() const
 
51
{
 
52
    return true;
 
53
}
 
54
 
 
55
bool MockDepartment::isRoot() const
 
56
{
 
57
    return true;
 
58
}
 
59
 
 
60
int MockDepartment::count() const
 
61
{
 
62
    return rowCount();
 
63
}
 
64
 
 
65
int MockDepartment::rowCount(const QModelIndex&) const
 
66
{
 
67
    return 1;
 
68
}
 
69
 
 
70
QVariant MockDepartment::data(const QModelIndex& /*index*/, int role) const
 
71
{
 
72
    switch (role) {
 
73
        case RoleDepartmentId:
 
74
            return "child";
 
75
        case RoleLabel:
 
76
            return "Child Clothes";
 
77
        case RoleHasChildren:
 
78
            return true;
 
79
        case RoleIsActive:
 
80
            return false;
 
81
        default:
 
82
            return QVariant();
 
83
    }
 
84
}