All pastes #2065043 Raw Edit

Untitled

public text v1 · immutable
#2065043 ·published 2011-05-19 21:35 UTC
rendered paste body

import Qt 4.7
import MeeGo.Components 0.1
import MeeGo.App.socialdemo 0.1

Rectangle {
    id: feedColumn
    color: theme_fontColorHighlight
    radius: 5
    border.color: "black"
    border.width: 1
    anchors.top: parent.top
    anchors.bottom: parent.bottom
    anchors.margins: 10
    width: window.width / 2
    
    Row {
        id: serviceRow
        anchors.top: parent.top
        width: childrenRect.width
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.margins: 10
        spacing: 10

        Image {
            id: serviceIcon;
            source: iconUrl
            onStatusChanged: {
                if (status == Image.Error || status == Image.Null) {
                    // Use fallback image
                    serviceIcon.source = "image://meegotheme/widgets/common/avatar/avatar-default";
                }
            }                                    
        }
        Text {
            text: displayName
        }
    }

    Component {
        id: feedDelegate
        Rectangle {
            color: theme_fontBackgroundColor
            radius: 5
            width: parent.width
            height: 100
            clip: true
            
            Column {
                anchors.fill: parent
                anchors.margins: 5
                spacing: 5
                Text {
                    font.pixelSize: theme_fontPixelSizeSmall
                    font.bold: true
                    color: theme_fontColorNormal
                    text: author + " " + authorId
                    wrapMode: Text.WordWrap
                }
                Text {
                    font.pixelSize: theme_fontPixelSizeTiny
                    color: theme_fontColorNormal
                    text: content
                    wrapMode: Text.WordWrap
                    width: parent.width
                }
            }
        }
    }

    ListView {
        id: feedView
        model: {
            if (name == "twitter") {
                twitterProxyModel;
            }
            else if (name == "flickr") {
                flickrProxyModel;
            }
            else if (name == "facebook") {
                facebookProxyModel;
            }
        }
        anchors.top: serviceRow.bottom
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.bottom: parent.bottom
        anchors.margins: 10
        delegate: feedDelegate
        spacing: 3
        clip: true
        
        onCountChanged: {
            var showFeed = (count > 0);
            console.log("setting feedcolumn visible to " + showFeed + " " + count);
            //feedColumn.visible = showFeed;
        }
    }
}