~ci-train-bot/libertine/libertine-ubuntu-zesty-2086

« back to all changes in this revision

Viewing changes to libertine/qml/ContainerOptionsDialog.qml

  • Committer: Chris Townsend
  • Date: 2016-07-15 18:39:58 UTC
  • mto: This revision was merged to the branch mainline in revision 272.
  • Revision ID: christopher.townsend@canonical.com-20160715183958-l95grj44p272lfz4
Rework the whole way we handle updating the necessary system files for unprivileged LXC's:
- Add new script that does the updates.
- Add sudoers file for this script.
- Remove the password dialog in the UI.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    id: containerOptionsDialog
27
27
    title: i18n.tr("Container Options")
28
28
    text: i18n.tr("Configure options for container creation.")
29
 
    property var showPasswordDialog: false
30
 
    signal passwordDialogSignal(var enableMultiarch, var containerName)
31
29
 
32
30
    Row {
 
31
        visible: containerConfigList.getHostArchitecture() == 'x86_64' ? true : false
33
32
        spacing: units.gu(1)
34
33
        CheckBox {
35
34
            id: enableMultiarchCheckbox
47
46
 
48
47
    Label {
49
48
        id: containerNameText
50
 
        text: i18n.tr("Enter or name for the container or leave blank for default name")
 
49
        text: i18n.tr("Enter a name for the container or leave blank for default name:")
51
50
        wrapMode: Text.Wrap
52
51
    }
53
52
 
57
56
        onAccepted: okButton.clicked()
58
57
    }
59
58
 
 
59
    Label {
 
60
        id: containerPasswordText
 
61
        visible: true
 
62
        text: i18n.tr("Enter password for your user in the Libertine container or leave blank for no password:")
 
63
        wrapMode: Text.Wrap
 
64
    }
 
65
 
 
66
    TextField {
 
67
        id: containerPasswordInput
 
68
        visible: containerPasswordText.visible
 
69
        placeholderText: i18n.tr("password")
 
70
        echoMode: TextInput.Password
 
71
    }
 
72
 
60
73
    Row {
61
74
        spacing: units.gu(1)
62
75
        Button {
65
78
            color: UbuntuColors.green
66
79
            width: (parent.width - parent.spacing) / 2
67
80
            onClicked: {
68
 
                showPasswordDialog = true
 
81
                createContainer()
69
82
                PopupUtils.close(containerOptionsDialog)
70
83
            }
71
84
        }
79
92
        }
80
93
    }
81
94
 
82
 
    Component.onDestruction: {
83
 
        if (showPasswordDialog) {
84
 
            passwordDialogSignal(enableMultiarchCheckbox.checked, containerNameInput.text)
85
 
        }
 
95
    function createContainer() {
 
96
        var container_id = containerConfigList.addNewContainer("lxc", containerNameInput.text)
 
97
        var worker = Qt.createComponent("ContainerManager.qml").createObject(mainView)
 
98
 
 
99
        worker.updateOperationDetails.connect(mainView.updateOperationDetails)
 
100
        worker.operationFinished.connect(mainView.resetOperationDetails)
 
101
        worker.error.connect(mainView.error)
 
102
 
 
103
        worker.createContainer(container_id,
 
104
                               containerConfigList.getContainerName(container_id),
 
105
                               containerConfigList.getContainerDistro(container_id),
 
106
                               enableMultiarchCheckbox.checked,
 
107
                               containerPasswordInput.text)
86
108
    }
87
109
}