~ci-train-bot/ubuntu-system-settings/ubuntu-system-settings-ubuntu-zesty-2679

« back to all changes in this revision

Viewing changes to tests/mocks/Ubuntu/SystemSettings/Wifi/MockCertHandler.h

  • Committer: Ken VanDine
  • Date: 2017-03-15 19:17:14 UTC
  • mto: This revision was merged to the branch mainline in revision 1766.
  • Revision ID: ken.vandine@canonical.com-20170315191714-1appjzosayvmf246
removed more click/updates stuff

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * This file is part of system-settings
3
 
 *
4
 
 * Copyright (C) 2016 Canonical Ltd.
5
 
 *
6
 
 * This program is free software: you can redistribute it and/or modify it
7
 
 * under the terms of the GNU General Public License version 3, as published
8
 
 * by the Free Software Foundation.
9
 
 *
10
 
 * This program is distributed in the hope that it will be useful, but
11
 
 * WITHOUT ANY WARRANTY; without even the implied warranties of
12
 
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
13
 
 * PURPOSE.  See the GNU General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU General Public License along
16
 
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 
 */
18
 
 
19
 
#ifndef MOCK_CERTHANDLER_H
20
 
#define MOCK_CERTHANDLER_H
21
 
 
22
 
#include <QAbstractListModel>
23
 
#include <QObject>
24
 
#include <QList>
25
 
 
26
 
struct MockFile {
27
 
    QString fileName;
28
 
    QString commonName;
29
 
    QString organization;
30
 
    QString expiryDate; // dd.mm.yyyy
31
 
 
32
 
    QString keyName;
33
 
    QString keyType;
34
 
    QString keyAlgorithm;
35
 
    uint keyLength;
36
 
 
37
 
    QString pacFileName;
38
 
};
39
 
 
40
 
class MockAbstractListModel : public QAbstractListModel
41
 
{
42
 
    Q_OBJECT
43
 
public:
44
 
    enum Roles {
45
 
        CNRole = Qt::UserRole + 1,
46
 
        ORole,
47
 
        expDateRole,
48
 
 
49
 
        keyName,
50
 
        keyType,
51
 
        keyAlgorithm,
52
 
        keyLength,
53
 
 
54
 
        pacFileName
55
 
    };
56
 
    explicit MockAbstractListModel(QObject *parent = 0);
57
 
    ~MockAbstractListModel() {};
58
 
    QHash<int, QByteArray> roleNames() const;
59
 
    Q_INVOKABLE int rowCount(const QModelIndex &parent = QModelIndex()) const;
60
 
    Q_INVOKABLE QString  getfileName(const int selectedIndex) const;
61
 
    Q_INVOKABLE void dataupdate();
62
 
    QVariant data(const QModelIndex &index, int role) const;
63
 
    QList<MockFile> m_files = QList<MockFile>();
64
 
};
65
 
 
66
 
class MockFileHandler : public QObject
67
 
{
68
 
    Q_OBJECT
69
 
public:
70
 
    Q_INVOKABLE QByteArray getCertContent(QString filename);
71
 
    Q_INVOKABLE QString moveCertFile(QString filename);
72
 
    Q_INVOKABLE QString moveKeyFile(QString filename);
73
 
    Q_INVOKABLE QString movePacFile(QString filename);
74
 
    Q_INVOKABLE bool removeFile(QString filename);
75
 
};
76
 
 
77
 
class MockCertificateListModel : public MockAbstractListModel
78
 
{
79
 
    Q_OBJECT
80
 
};
81
 
 
82
 
class MockPrivatekeyListModel : public MockAbstractListModel
83
 
{
84
 
    Q_OBJECT
85
 
};
86
 
 
87
 
class MockPacFileListModel : public MockAbstractListModel
88
 
{
89
 
    Q_OBJECT
90
 
};
91
 
 
92
 
#endif // MOCK_CERTHANDLER_H