~ubuntu-branches/ubuntu/utopic/telephony-service/utopic-proposed

« back to all changes in this revision

Viewing changes to Ubuntu/Telephony/PhoneNumber/PhoneNumberField.qml

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Tiago Salem Herrmann, Renato Araujo Oliveira Filho
  • Date: 2014-07-09 00:58:42 UTC
  • mfrom: (1.1.40)
  • Revision ID: package-import@ubuntu.com-20140709005842-h3vf9e2dooixtk6i
Tags: 0.1+14.10.20140709-0ubuntu1
[ Tiago Salem Herrmann ]
* Fix message token to properly remove read messages from the
  messaging menu. (LP: #1236895)

[ Renato Araujo Oliveira Filho ]
* Added uninstall rule in CMake. Implemented formattedText in
  AsYouTypeFormatter class that return the cursor position after the
  number format. Fixed PhoneNumberField cursor position after editing.
  .

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
import QtQuick 2.0
23
23
import Ubuntu.Components 0.1
24
24
import Ubuntu.Telephony.PhoneNumber 0.1
25
 
 
 
25
import "PhoneNumber.js" as PhoneNumberJS
26
26
 
27
27
/*!
28
28
    \qmltype PhoneNumberField
29
29
    \inqmlmodule Ubuntu.Telephony.PhoneNumber 0.1
30
30
    \brief The PhoneNumberField element allows to format a phone-number as you type
 
31
    The PhoneNumberInput uses TextField as base class
31
32
 
32
33
    \b{This component is under heavy development.}
33
34
 
59
60
    */
60
61
    property alias defaultRegion: formatter.defaultRegionCode
61
62
 
 
63
    /*!
 
64
      Specifies if the autoformat should format the text even if the field does not have focus
 
65
      Default value is true
 
66
 
 
67
      \qmlproperty bool autoFormat
 
68
    */
 
69
    property bool updateOnlyWhenFocused: true
 
70
 
62
71
    AsYouTypeFormatter {
63
72
        id: formatter
64
 
 
65
 
        text: phoneNumberField.text
66
 
    }
67
 
 
68
 
    Binding {
69
 
        target: phoneNumberField
70
 
        when: phoneNumberField.autoFormat && phoneNumberField.activeFocus
71
 
        property: "text"
72
 
        value: formatter.formattedText
73
 
    }
 
73
    }
 
74
 
 
75
    onTextChanged: PhoneNumberJS.onTextChange(phoneNumberField, formatter)
74
76
}