~pieq/checkbox/fix-1484872-env-variables-forced-to-non-international

« back to all changes in this revision

Viewing changes to checkbox-touch/components/PasswordDialog.qml

  • Committer: Zygmunt Krynicki
  • Date: 2014-12-19 12:11:52 UTC
  • mto: This revision was merged to the branch mainline in revision 3516.
  • Revision ID: zygmunt.krynicki@canonical.com-20141219121152-y9vtxajhrd6e1c3l
cep: merge CEPs in to trunk

This patch merges CEPs (aka Checkbox Enhancement Proposals) into trunk.
Those lived on separately for a while as lp:checkbox/cep but in
retrospective nobody knows about them and this should give them some
more exposure. In addition, the move allows new features to land a CEP
document along, making review of complex new features easier to make as
their specification can be seen alongside the patches that implement it.

Due to bazaar limitations in merging separate repositories together I've
discarded history entries (not that there were many) and just added
those files in directly.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * This file is part of Checkbox
3
 
 *
4
 
 * Copyright 2015 Canonical Ltd.
5
 
 *
6
 
 * Authors:
7
 
 * - Maciej Kisielewski <maciej.kisielewski@canonical.com>
8
 
 *
9
 
 * This program is free software; you can redistribute it and/or modify
10
 
 * it under the terms of the GNU General Public License as published by
11
 
 * the Free Software Foundation; version 3.
12
 
 *
13
 
 * This program is distributed in the hope that it will be useful,
14
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 
 * GNU General Public License for more details.
17
 
 *
18
 
 * You should have received a copy of the GNU General Public License
19
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
 
 */
21
 
import QtQuick 2.0
22
 
import Ubuntu.Components 1.1
23
 
import Ubuntu.Components.Popups 0.1
24
 
 
25
 
/*! \brief Password prompt dialog.
26
 
    \inherits Item
27
 
 
28
 
    This component is a prompt for user's password.
29
 
*/
30
 
Item {
31
 
    id: passwordDialog
32
 
 
33
 
    /*!
34
 
      This alias aids the process of popping up the dialog.
35
 
      Usage: PopupUtils.open(passwordDialog.dialogComponent);
36
 
     */
37
 
    property alias dialogComponent: component
38
 
 
39
 
    signal passwordEntered(string password)
40
 
    signal dialogCancelled
41
 
 
42
 
    Component {
43
 
        id: component
44
 
 
45
 
        Dialog {
46
 
            id: dialog
47
 
            title: i18n.tr("Enter password")
48
 
 
49
 
            modal: true
50
 
 
51
 
            TextField {
52
 
                id: passwordBox
53
 
                placeholderText: i18n.tr("password")
54
 
                echoMode: TextInput.Password
55
 
                onAccepted: okButton.clicked(text)
56
 
            }
57
 
 
58
 
            Button {
59
 
                id: okButton
60
 
                text: i18n.tr("OK")
61
 
                color: UbuntuColors.green
62
 
                onClicked: {
63
 
                    PopupUtils.close(dialog);
64
 
                    // once qml pam authentication goes live, we might want to
65
 
                    // check if the password is correct in some QML-ish manner
66
 
                    passwordEntered(passwordBox.text);
67
 
                    passwordBox.text = "";
68
 
                }
69
 
            }
70
 
 
71
 
            Button {
72
 
                text: i18n.tr("Cancel")
73
 
                color: UbuntuColors.red
74
 
                onClicked: {
75
 
                    passwordBox.text = "";
76
 
                    PopupUtils.close(dialog);
77
 
                    dialogCancelled();
78
 
                }
79
 
            }
80
 
 
81
 
            Component.onCompleted: {
82
 
                // let user type in password without tapping on
83
 
                // the text field
84
 
                passwordBox.forceActiveFocus();
85
 
            }
86
 
        }
87
 
    }
88
 
}