~ubuntu-branches/ubuntu/oneiric/kdepim/oneiric-updates

« back to all changes in this revision

Viewing changes to examples/coisceim/coisceim-mobile/NotesListView.qml

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2011-06-28 19:33:24 UTC
  • mfrom: (0.2.13) (0.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20110628193324-8yvjs8sdv9rdoo6c
Tags: 4:4.7.0-0ubuntu1
* New upstream release
  - update install files
  - add missing kdepim-doc package to control file
  - Fix Vcs lines
  - kontact breaks/replaces korganizer << 4:4.6.80
  - tighten the dependency of kdepim-dev on libkdepim4 to fix lintian error

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (c) 2010 Volker Krause <vkrause@kde.org>
 
3
 
 
4
    This library is free software; you can redistribute it and/or modify it
 
5
    under the terms of the GNU Library General Public License as published by
 
6
    the Free Software Foundation; either version 2 of the License, or (at your
 
7
    option) any later version.
 
8
 
 
9
    This library is distributed in the hope that it will be useful, but WITHOUT
 
10
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
11
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
 
12
    License for more details.
 
13
 
 
14
    You should have received a copy of the GNU Library General Public License
 
15
    along with this library; see the file COPYING.LIB.  If not, write to the
 
16
    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
17
    02110-1301, USA.
 
18
*/
 
19
 
 
20
import Qt 4.7 as QML
 
21
import org.kde.pim.mobileui 4.5 as KPIM
 
22
 
 
23
/** Akonadi Note List View
 
24
 */
 
25
KPIM.ItemListView {
 
26
  id: _top
 
27
  property bool showDeleteButton : true
 
28
  property bool showCheckBox
 
29
  property variant checkModel
 
30
 
 
31
  delegate: [
 
32
    KPIM.ItemListViewDelegate {
 
33
      showCheckBox : _top.showCheckBox
 
34
      checkModel : _top.checkModel
 
35
      navigationModel : _top.navigationModel
 
36
      height : itemListView.height / 7
 
37
      summaryContent : [
 
38
        QML.Text {
 
39
          id: titleLabel
 
40
          anchors.top : parent.top
 
41
          anchors.topMargin : 1
 
42
          anchors.left : parent.left
 
43
          anchors.leftMargin : 10
 
44
          anchors.right: parent.right
 
45
          anchors.rightMargin: deleteAction.width
 
46
          text : model.display
 
47
          color : "#0C55BB"
 
48
          font.pixelSize: 16
 
49
          elide: "ElideRight"
 
50
        },
 
51
        QML.Text {
 
52
          id: subjectLabel
 
53
          anchors.top : titleLabel.bottom
 
54
          anchors.topMargin : 1
 
55
          anchors.left : parent.left
 
56
          anchors.leftMargin : 10
 
57
          anchors.right: parent.right
 
58
          anchors.rightMargin: deleteAction.width
 
59
          height : 30;
 
60
          text : "model.shortContent"
 
61
          font.pixelSize: 18
 
62
          elide: "ElideRight"
 
63
          clip: true
 
64
        }, /*
 
65
        QML.Image {
 
66
          id : importantFlagImage
 
67
          anchors.verticalCenter : parent.verticalCenter;
 
68
          anchors.left : parent.left
 
69
          anchors.leftMargin : 15
 
70
          source : "important-email.png"
 
71
          opacity : model.is_important ? 0.25 : 0
 
72
        },
 
73
        QML.Image {
 
74
          id : actionFlagImage
 
75
          anchors.verticalCenter : parent.verticalCenter;
 
76
          anchors.left : importantFlagImage.right
 
77
          source : "action-item-email.png"
 
78
          opacity : model.is_action_item ? 0.25 : 0
 
79
        }, */
 
80
        KPIM.Action{
 
81
          id : deleteAction
 
82
          anchors.verticalCenter: parent.verticalCenter;
 
83
          anchors.right : parent.right;
 
84
          width: imageWidth
 
85
          height : imageHeight
 
86
          action : application.getAction("akonadi_item_delete", "")
 
87
          hidable : false
 
88
          showText : false
 
89
          disableable : false
 
90
          opacity : 0.6
 
91
          visible : showDeleteButton
 
92
          onTriggered : {
 
93
            _itemActionModel.select(model.index, 3);
 
94
          }
 
95
          image : KDE.locate( "data", "mobileui/delete-button.png" );
 
96
        }
 
97
      ]
 
98
 
 
99
      states : [
 
100
        QML.State {
 
101
          name : "deleteFaded"
 
102
          when : itemListView.flicking
 
103
          QML.PropertyChanges {
 
104
            target : deleteAction;
 
105
            opacity : 0
 
106
          }
 
107
          QML.PropertyChanges {
 
108
            target : deleteAction.anchors;
 
109
            rightMargin : -deleteAction.width
 
110
          }
 
111
        }
 
112
      ]
 
113
      transitions : [
 
114
        QML.Transition {
 
115
          from : ""
 
116
          to   : "deleteFaded"
 
117
          QML.PropertyAnimation {
 
118
            target : deleteAction
 
119
            properties : "opacity"
 
120
            duration: 500
 
121
            easing.type: "OutQuad"
 
122
          }
 
123
        },
 
124
        QML.Transition {
 
125
          from : "deleteFaded"
 
126
          to   : ""
 
127
          QML.SequentialAnimation {
 
128
            QML.PauseAnimation {
 
129
              // delay a bit
 
130
              duration: {
 
131
                // TODO: figure out how to do this.
 
132
                0
 
133
              }
 
134
            }
 
135
            QML.PropertyAnimation {
 
136
              target : deleteAction.anchors
 
137
              properties : "rightMargin"
 
138
              duration: 500
 
139
              easing.type: "InQuad"
 
140
            }
 
141
          }
 
142
        }
 
143
      ]
 
144
    }
 
145
  ]
 
146
}