~renatofilho/ubuntu-filemanager-app/import-contact

91.2.25 by Michael Spencer
Refactored files into sub-directories
1
/*
2
 * Copyright (C) 2013 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 version 3 as
6
 * published by the Free Software Foundation.
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
 * Authored by: Arto Jalkanen <ajalkane@gmail.com>
17
 */
519.1.1 by Florian Boucault
Migrated to version 1.3 of the Ubuntu UI Toolkit
18
import QtQuick 2.4
19
import Ubuntu.Components 1.3
20
import Ubuntu.Components.Popups 1.3
91.2.25 by Michael Spencer
Refactored files into sub-directories
21
22
Dialog {
23
    id: root
24
25
    property alias inputText: input.text
26
    property alias placeholderText: input.placeholderText
27
    signal accepted
28
    signal rejected
29
262.1.2 by Arto Jalkanen
Fixed focus issue with rename dialog (or any other dialog using ConfirmDialogWithInput.qml)
30
    Component.onCompleted: {
31
        // Need to force active focus to input, otherwise the parent object that created this
32
        // dialog will continue to have active focus.
33
        input.forceActiveFocus()
34
    }
35
91.2.25 by Michael Spencer
Refactored files into sub-directories
36
    TextField {
37
        id: input
38
        objectName: "inputField"
39
        focus: true
564 by Renato Araujo Oliveira Filho
Add comments
40
        // Avoid need to press enter to make "Ok" button enabled.
571 by Renato Araujo Oliveira Filho
Does not upercase inital letter on input dialog.
41
        inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
91.2.25 by Michael Spencer
Refactored files into sub-directories
42
        validator: RegExpValidator {
43
            regExp: /.+/
44
        }
45
    }
46
47
    Button {
48
        objectName: "okButton"
459.1.1 by Michael Terry
Ok -> OK
49
        text: i18n.tr("OK")
91.2.25 by Michael Spencer
Refactored files into sub-directories
50
        enabled: input.acceptableInput
51
        onClicked: {
52
            accepted()
53
            PopupUtils.close(root)
54
        }
55
    }
56
57
    Button {
58
        objectName: "cancelButton"
59
        text: i18n.tr("Cancel")
60
61
        gradient: Gradient {
62
            GradientStop {
63
                position: 0
64
                color: "gray"
65
            }
66
67
            GradientStop {
68
                position: 1
69
                color: "lightgray"
70
            }
71
        }
72
73
        onClicked: {
74
            rejected()
75
            PopupUtils.close(root)
76
        }
77
    }
78
}