~jonas-drange/ubuntu-system-settings/hotspots-binding

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
/*
 * Copyright (C) 2014 Canonical Ltd
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 3 as
 * published by the Free Software Foundation.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 * Jonas G. Drange <jonas.drange@canonical.com>
 *
*/
import QtQuick 2.0

Item {


    /*
        The mapping of code to string is taken from
        http://bazaar.launchpad.net/~vcs-imports/
            network-manager/trunk/view/head:/cli/src/common.c

        NetworkManager documentation: https://developer.gnome.org/
            NetworkManager/0.9/spec.html#type-NM_DEVICE_STATE_REASON
    */
    function reasonToString (reason) {
        switch (reason) {
            case 0:
                return i18n.tr("Unknown error");
            case 1:
                return i18n.tr("No reason given");
            case 2:
                return i18n.tr("Device is now managed");
            case 3:
                return i18n.tr("Device is now unmanaged");
            case 4:
                return i18n.tr("The device could not be readied for configuration");
            case 5:
                return i18n.tr("IP configuration could not be reserved (no available address, timeout, etc.)");
            case 6:
                return i18n.tr("The IP configuration is no longer valid");
            case 7:
                return i18n.tr("Your authentication details were incorrect");
            case 8:
                return i18n.tr("802.1X supplicant disconnected");
            case 9:
                return i18n.tr("802.1X supplicant configuration failed");
            case 10:
                return i18n.tr("802.1X supplicant failed");
            case 11:
                return i18n.tr("802.1X supplicant took too long to authenticate");
            case 15:
                return i18n.tr("DHCP client failed to start");
            case 16:
                return i18n.tr("DHCP client error");
            case 17:
                return i18n.tr("DHCP client failed");
            case 18:
                return i18n.tr("Shared connection service failed to start");
            case 19:
                return i18n.tr("Shared connection service failed");
            case 35:
                return i18n.tr("Necessary firmware for the device may be missing");
            case 36:
                return i18n.tr("The device was removed");
            case 37:
                return i18n.tr("NetworkManager went to sleep");
            case 38:
                return i18n.tr("The device's active connection disappeared");
            case 39:
                return i18n.tr("Device disconnected by user or client");
            case 41:
                return i18n.tr("The device's existing connection was assumed");
            case 42:
                return i18n.tr("The supplicant is now available");
            case 43:
                return i18n.tr("The modem could not be found");
            case 44:
                return i18n.tr("The Bluetooth connection failed or timed out");
            case 50:
                return i18n.tr("A dependency of the connection failed");
            case 52:
                return i18n.tr("ModemManager is unavailable");
            case 53:
                return i18n.tr("The Wi-Fi network could not be found");
            case 54:
                return i18n.tr("A secondary connection of the base connection failed");
            default:
                return i18n.tr("Unknown");
        }
    }
}