~qqworini/ubuntu-rssreader-app/fix-toolbar-bug

« back to all changes in this revision

Viewing changes to article_items/ArticleTextB.qml

  • Committer: Tarmac
  • Author(s): Roman Shchekin
  • Date: 2013-09-22 16:18:51 UTC
  • mfrom: (70.1.2 main-bug-removed)
  • Revision ID: tarmac-20130922161851-ctimfzxaj4vw3oan
Little bugs related to article read/unread status are fixed.

Approved by Ubuntu Phone Apps Jenkins Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
UbuntuShape
8
8
{
 
9
    property var imageArray: []
 
10
    property bool invalid: false
 
11
    property var modelItem
 
12
    property var rssModel
 
13
    property int modelIndex
 
14
 
9
15
    width: units.gu(18)
10
16
    height: units.gu(15) /*content.height + units.gu(4)*/
11
 
    color: rss_item.status == "1" ? Qt.rgba(0, 0, 0, 0.7) : Qt.rgba(0, 0, 0, 0.4)
 
17
    color: invalid ? "black" : modelItem.status == "1" ? Qt.rgba(0, 0, 0, 0.7) : Qt.rgba(0, 0, 0, 0.4)
12
18
    radius: "medium"
13
19
 
14
 
    property var rss_item
15
 
    property var imageArray: []
16
 
    property var rss_model
17
 
    property int model_index
 
20
    onModelItemChanged: {
 
21
        if (modelItem == null) {
 
22
            invalid = true
 
23
        }
 
24
    }
18
25
 
19
 
    Column
20
 
    {
 
26
    Column {
21
27
        id: content
22
 
//        anchors{ left: parent.left; right: parent.right; margins: units.gu(2); verticalCenter: parent.verticalCenter }
 
28
 
23
29
        anchors {
24
30
            fill: parent; topMargin: units.gu(2); bottomMargin: units.gu(1.5);
25
31
            leftMargin: units.gu(1); rightMargin: units.gu(1.5)
26
32
        }
27
33
        spacing: units.gu(1)
28
34
 
29
 
        Label
30
 
        {
 
35
        Label {
31
36
            id: label_time
32
 
            text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate)
 
37
            text: { invalid ? "" : DateUtils.formatRelativeTime(i18n, modelItem.pubdate) }
33
38
            fontSize: "x-small"
34
39
            width: parent.width
35
40
            wrapMode: Text.WrapAtWordBoundaryOrAnywhere
36
41
            opacity: 0.6
37
42
        }
38
43
 
39
 
        Label
40
 
        {
41
 
            id: label_title
42
 
            text: rss_item.title
 
44
        Label {
 
45
            id: labelTitle
 
46
 
 
47
            text: invalid ? "" : modelItem.title
43
48
            width: parent.width
44
 
            height: parent.height - parent.spacing * 2 - label_time.paintedHeight - label_feedname.paintedHeight
 
49
            height: parent.height - parent.spacing * 2 - label_time.paintedHeight - labelFeedname.paintedHeight
45
50
            wrapMode: Text.WrapAtWordBoundaryOrAnywhere
46
51
            fontSize: "small"
47
52
            textFormat: Text.PlainText
48
53
            font.weight: Font.DemiBold
49
54
            elide: Text.ElideRight
50
 
            opacity: rss_item.status == "1" ? 0.4 : 0.8
 
55
            opacity: invalid ? 0.4 : modelItem.status == "1" ? 0.4 : 0.8
51
56
        }
52
57
 
53
 
        Label
54
 
        {
55
 
            id: label_feedname
56
 
            text: rss_item.feed_name
 
58
        Label {
 
59
            id: labelFeedname
 
60
 
 
61
            text: invalid ? "" : modelItem.feed_name
57
62
            fontSize: "x-small"
58
63
            width: parent.width
59
64
            wrapMode: Text.WrapAtWordBoundaryOrAnywhere
61
66
        }
62
67
    }
63
68
 
64
 
    MouseArea
65
 
    {
 
69
    MouseArea {
66
70
        anchors.fill: parent
67
 
 
68
 
        onClicked:
69
 
        {
70
 
//            var dbResult = DB.updateArticleStatus(rss_item.id, "1")
71
 
//            if (dbResult.rowsAffected == 1) {
72
 
//                rss_item.status = "1"
73
 
//            }
74
 
            mainView.toRssPage(rss_model, model_index) ;
 
71
        onClicked: {
 
72
            mainView.toRssPage(rssModel, modelIndex)
75
73
        }
76
74
    }
77
75
}