~pkunal-parmar/ubuntu-calendar-app/ICalImport

« back to all changes in this revision

Viewing changes to PathViewBase.qml

  • Committer: Launchpad Translations on behalf of ubuntu-calendar-dev
  • Date: 2013-08-30 05:25:11 UTC
  • Revision ID: launchpad_translations_on_behalf_of_ubuntu-calendar-dev-20130830052511-yvisk7eao427cp9w
Launchpad automatic translations update.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2013-2014 Canonical Ltd
3
 
 *
4
 
 * This file is part of Ubuntu Calendar App
5
 
 *
6
 
 * Ubuntu Calendar App is free software: you can redistribute it and/or modify
7
 
 * it under the terms of the GNU General Public License version 3 as
8
 
 * published by the Free Software Foundation.
9
 
 *
10
 
 * Ubuntu Calendar App is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 * GNU General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU General Public License
16
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 
 */
18
 
import QtQuick 2.3
 
1
import QtQuick 2.0
19
2
 
20
3
PathView {
21
4
    id: root
26
9
    signal nextItemHighlighted();
27
10
    signal previousItemHighlighted();
28
11
 
29
 
    signal scrollUp();
30
 
    signal scrollDown();
31
 
 
32
 
    preferredHighlightBegin: 0.5
33
 
    preferredHighlightEnd: 0.5
34
 
 
35
12
    path: Path {
36
 
        startX: -(root.width); startY: root.height/2
37
 
        PathLine { x: (root.width)*2  ; relativeY: 0;  }
38
 
    }
39
 
 
40
 
    // 0= current index, -1= previous index, 1 next index
41
 
    function indexType(index) {
42
 
        if (index === root.currentIndex) {
43
 
            return 0;
44
 
        }
45
 
 
46
 
        var previousIndex = root.currentIndex > 0 ? root.currentIndex - 1 : 2
47
 
        if ( index === previousIndex ) {
48
 
            return -1;
49
 
        }
50
 
 
51
 
        return 1;
52
 
    }
53
 
 
54
 
    Keys.onLeftPressed:{
55
 
        root.decrementCurrentIndex();
56
 
    }
57
 
 
58
 
    Keys.onRightPressed:{
59
 
        root.incrementCurrentIndex();
60
 
    }
61
 
 
62
 
    Keys.onSpacePressed: {
63
 
        root.scrollDown();
64
 
    }
65
 
 
66
 
    Keys.onDownPressed: {
67
 
        root.scrollDown();
68
 
    }
69
 
 
70
 
    Keys.onUpPressed: {
71
 
        root.scrollUp();
 
13
        startX: -(root.width/2); startY: root.height/2
 
14
        PathLine { relativeX: root.width; relativeY: 0 }
 
15
        PathLine { relativeX: root.width; relativeY: 0 }
 
16
        PathLine { relativeX: root.width; relativeY: 0 }
72
17
    }
73
18
 
74
19
    onCurrentIndexChanged: {
75
20
        var diff = currentIndex - intern.previousIndex
76
 
        if(diff == 0) return;
77
21
 
78
22
        if (intern.previousIndex === count - 1 && currentIndex === 0) diff = 1
79
23
        if (intern.previousIndex === 0 && currentIndex === count - 1) diff = -1