ProfileView: clean-up
authorSami Rämö <sami.ramo@ixonos.com>
Mon, 22 Nov 2010 08:44:10 +0000 (10:44 +0200)
committerSami Rämö <sami.ramo@ixonos.com>
Mon, 22 Nov 2010 08:44:10 +0000 (10:44 +0200)
src/qmlui/ProfileView.qml

index 02c5f63..74f36ea 100644 (file)
@@ -3,8 +3,6 @@ import Qt 4.7
 Item {
     id: delegate
 
-    property int textSingleLineHeight: 0
-
     height: details.item.y + details.item.height + 5
 //    anchors { left: parent.left; right: parent.right; verticalCenter: parent.verticalCenter; margins: 10 }
     anchors.fill: parent
@@ -61,7 +59,7 @@ Item {
         anchors { left: parent.left; right: parent.right; top: borderImage.bottom; margins: 5 }
         horizontalAlignment: Text.AlignHCenter
         clip: true;
-        elide: Text.ElideRight
+        wrapMode: Text.Wrap
         Behavior on height {
             id: textHeightBehavior
             NumberAnimation { duration: 150 }
@@ -72,23 +70,12 @@ Item {
         id: details
         z: 1
         sourceComponent: detailsComponent
-        state: parent.state
         anchors { left: primaryText.left; right: primaryText.right; top: primaryText.bottom }
     }
 
-//    Loader {
-//        id: buttons
-//        height: 0
-//        anchors { horizontalCenter: parent.horizontalCenter; top: details.bottom }
-//        onLoaded: {
-//            item.visible = false
-//        }
-//    }
-
     Component {
         id: detailsComponent
         Item {
-            state: delegate.state
             height: messageRow.height + addressRow.height + timeRow.height
             width: parent.width
             DetailEditorRow { id: messageRow; image: "qrc:/res/images/envelope.png"; text: userProfile.message }
@@ -96,66 +83,4 @@ Item {
             DetailRow { id: timeRow; state: "expanded"; anchors.top: addressRow.bottom; image: "qrc:/res/images/clock.png"; text: userProfile.time }
         }
     }
-
-    MouseArea {
-        anchors.fill: parent
-        onClicked: delegate.state = !delegate.state
-    }
-
-    Component.onCompleted: {
-        textSingleLineHeight = primaryText.height
-    }
-
-    states: [
-        State {
-            name: "expanded"
-            when: delegate.ListView.isCurrentItem
-            PropertyChanges {
-                target: buttons
-                height: buttons.status == Loader.Ready ? buttons.item.childrenRect.height : 0
-                explicit: true
-            }
-            PropertyChanges {
-                target: primaryText
-                height: paintedHeight
-            }
-        },
-        State {
-            name: ""
-            when: !delegate.ListView.isCurrentItem
-            PropertyChanges {
-                target: primaryText
-                explicit: true
-                height: textSingleLineHeight
-            }
-        }
-    ]
-
-    onStateChanged: {
-        if (buttons.status == Loader.Ready) {
-            buttons.item.visible = (state == "expanded")
-        }
-    }
-
-    transitions: [
-        Transition {
-            from: ""
-            to: "expanded"
-            SequentialAnimation {
-                PropertyAction { target: textHeightBehavior; property: "enabled"; value: true }
-                PropertyAction { target: primaryText; property: "wrapMode"; value: Text.Wrap }
-                PropertyAction { target: primaryText; property: "elide"; value: Text.ElideNone }
-            }
-        },
-        Transition {
-            from: "expanded"
-            to: ""
-            SequentialAnimation {
-                PropertyAction { target: textHeightBehavior; property: "enabled"; value: false }
-                NumberAnimation { target: primaryText; properties: "height"; duration: 150 }
-                PropertyAction { target: primaryText; property: "wrapMode"; value: Text.NoWrap }
-                PropertyAction { target: primaryText; property: "elide"; value: Text.ElideRight }
-            }
-        }
-    ]
 }