code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0
import "../core/core.js" as Core

/**
 * Timer to call update after 5 seconds.
 * The timer is active right after creation, should different behavior be
 * desired the interval property needs to be modified *at* object creation.
 *
 * @code
 * Qt.createComponent("../core/UpdateTimer.qml").createObject(parent)
 * @endcode
 */
Timer {
    interval: 5000
    running: true
    repeat: false
    onTriggered: { Core.update(); destroy() }
}


code:
.pragma library

var gplUrl = 'http://www.gnu.org/licenses/gpl-3.0.html'

repo_name: snapshot/uds

license: mit


code:
.pragma library

var summit = "http://summit.ubuntu.com/api/summit/"


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/**
 * @returns cpp Settings wrapper object without parent (i.e. lifetime depends on scope)
 */
function settings() {
    return Qt.createComponent("../core/Settings.qml").createObject(null)
}

function hasCache() {
    return mainCalendar.hasCache(__ical())
}

function clearCache() {
    mainCalendar.clearCache(__ical())

    var username = settings().value("lpuser")
    if (username)
        userCalendar.clearCache(__icalParticipant())
}

function updateFromCache() {
    __updateInternal(true)
}

function update() {
    __updateInternal(false)
}

// -------------------------------- PRIVATE --------------------------------- //

var __id = 'uds-p'
var __name = 'UDS-P'
var __location = 'Orlando, Florida, USA'
var __time = '31 October - 4 November, 2011'
var __location_latitude = 28.3586255
var __location_longitude = -81.4874438

function __ical() {
    return 'http://summit.ubuntu.com/' + settings().value("name") + '.ical'
}

function __icalParticipant() {
    return 'http://summit.ubuntu.com/' + settings().value("name") + '/participant/' + settings().value("lpuser") + '.ical'
}

function __updateInternal(fromCache)
{
    var url = __ical()
    if (fromCache)
        mainCalendar.updateFromCache(url)
    else
        mainCalendar.update(url)

    var username = Qt.createComponent("../core/Settings.qml").createObject(null).value("lpuser")
    if (username) {
        url = __icalParticipant()
        if (fromCache)
            userCalendar.updateFromCache(url)
        else
            userCalendar.update(url)
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

.pragma library

/**
 * Provides a fakelist implemenation.
 * A fake list is a plain JavaScript Array. This is necessary because in QML one
 * can only have QML lists, and those are rather limited when it comes to
 * adding or removing QObject pointers.
 *
 * Whenever a QML list does not work a fakelist can be used by simply importing
 * this file and using its identifier as if it were a static object in C++.
 */

/** The actual internal Array */
var __array = new Array()

/** @returns the current internal array */
function getList() {
    return __array
}

/** @param item adds a new item to the internal array */
function addItem(item) {
    __array.push(item)
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

.pragma library

/** prints all attributes (functions, properties etc.) of an object on the terminal */
var getKeys = function(obj){
   for(var key in obj){
        console.debug(key)
   }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

.pragma library

var weekday = new Array(qsTr("Sunday"),
                        qsTr("Monday"),
                        qsTr("Tuesday"),
                        qsTr("Wednesday"),
                        qsTr("Thursday"),
                        qsTr("Friday"),
                        qsTr("Saturday"))

function stringToNumber(string) {r
    for (var i = 0; i < weekday.length; ++i) {
        if (string === weekday[i])
            return i
    }
    return null
}

function numberToString(number) {
    var name = weekday[number]
    if (name === undefined)
        return ""
    return name
}


code:
import QtQuick 1.0

Rectangle {
    function onItemsChanged(manager) {
        console.debug("SDFSDF")
        parser.parse(manager);
        listview.model = parser.ical.events
    }

    width: 640
    height: 480

    ListView {
        id: listview
        anchors.fill: parent
        anchors.margins: 10

        delegate:
            Row {
            spacing: 10
        }

        onModelChanged: {
            console.debug("nu model")
            console.debug(model.length)
        }
    }

    Component.onCompleted: {
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0
import com.nokia.meego 1.0
import "../core"
import "../core/about.js" as About

Page {
    id: page

    objectName: "aboutPage"
    anchors.fill: parent
    anchors.margins: 32
    tools: commonTools

    Row {
        id: headerContainer
        spacing: 10
        Image { id: icon; source: "../images/icon80.png" }
        Label {
            anchors.verticalCenter: icon.verticalCenter
            text: "12.04";
            font.pixelSize: 32; font.bold: true; font.family: "Nokia Pure Text Bold"
        }
        Image {
            anchors.verticalCenter: icon.verticalCenter
            source: "../images/gplv3.png"
            MouseArea { anchors.fill: parent; onClicked: Qt.openUrlExternally(About.gplUrl) }
        }
    }

    Item {
        anchors {
            top: headerContainer.bottom; topMargin: 40;
            bottom: parent.bottom;
            left: parent.left; right: parent.right
        }

        ListView {
            anchors.fill: parent
            boundsBehavior: Flickable.StopAtBounds
            clip: true
            model: AboutModel {}
            delegate: ListDelegate {
                title: "© " + year + " " + name
                subtitle: "" + mail + ""
                onClicked: Qt.openUrlExternally("mailto:" + mail)
            }
        }
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.1
import com.nokia.meego 1.0
import "../core/"
import "../core/weekday.js" as WeekDay

Page {
    id: page

    property alias busy: busyIndicator.running
    property alias model: listview.model

    anchors.fill: parent
    tools: commonTools

    Item {
        anchors.top: title.bottom
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.bottom: parent.bottom

        BusyIndicator {
            id: busyIndicator
            anchors.centerIn: parent
            platformStyle: BusyIndicatorStyle { size: "large" }
            running: true
            visible: running
        }

        ListView {
            id: listview

            /** @returns name of day with first character having bigger font size */
            function formattedTitle(dayOfWeek, baseSize) {
                var name = WeekDay.numberToString(dayOfWeek)
                var firstChar = name.charAt(0)
                var rest = name.substr(1)
                return '' + firstChar + '' + rest
            }

            visible: !busyIndicator.running
            model: DayListModel {}
            anchors.fill: parent
            anchors.margins: 10
            clip: true

            delegate: ListDelegate {
                title: listview.formattedTitle(number, titleSize)
                onClicked: pageStack.push(Qt.resolvedUrl("ListPage.qml"),
                                          { dayOfWeek: number, model: mainCalendar.sessionModel })

                ToolIcon {
                    platformIconId: "common-drilldown-arrow".concat(theme.inverted ? "-inverse" : "")
                    anchors.right: parent.right;
                    anchors.verticalCenter: parent.verticalCenter
                }
            }
        }
    }

    PageHeader { id: title; title: qsTr("Ubuntu Developer Summit") }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.1
import com.nokia.meego 1.0
import com.nokia.extras 1.0
import "constants.js" as UI

Page {
    id: page

    property alias summary: header.title
    property alias dtstart: dtstart.value
    property alias dtend: dtend.value
    property alias location: location.value
    property alias description: description.value
    property alias track: track.value
    property alias room: room.value

    anchors.fill: parent
    tools: commonTools

    Flickable {
        id: flickable

        anchors.topMargin: header.height + 10
        anchors.fill: parent
        anchors.margins: 10
        clip: true
        contentWidth: container.width; contentHeight: container.height

        Item {
            id: container

            height: column.height + map.height
            width: Math.max(column.width, map.width)

            Column {
                id: column

                PropertyLabel { id: dtstart; label: "Start:"; }
                PropertyLabel { id: dtend; label: "End:"; }
                PropertyLabel { id: location; label: "Location:"; }
                PropertyLabel { id: description; label: "Description:"; }
                PropertyLabel { id: track; label: "Track:"; }
                PropertyLabel { id: room; label: "Room:"; }
            }

            Image {
                id: map

                anchors.top: column.bottom
                anchors.topMargin: 10
                source: "../images/maps/uds-p.jpeg"
                width: page.width/2
                fillMode: Image.PreserveAspectFit

                MouseArea {
                    anchors.fill: parent
                    onClicked: {
                        pageStack.push(Qt.resolvedUrl("RoomMapPage.qml"))
                    }
                }
            }
        }
    }

    ScrollDecorator { flickableItem: flickable }

    PageHeader {
        id: header
//        Item {
//            id: ratingContainer
//            anchors.right: parent.right
//            anchors.verticalCenter: parent.verticalCenter
//            width: rater.width + 32*2 // 32 is margin on each side
//            height: parent.height
//            RatingIndicator {
//                id: rater
//                anchors.centerIn: parent
//                maximumValue: 1
//                ratingValue: 0
//            }
//            MouseArea {
//                anchors.fill: parent
//                onClicked: rater.ratingValue = rater.ratingValue == 1 ? 0 : 1
//            }
//        }
    }
}


code:
import QtQuick 1.1
import com.nokia.extras 1.0

InfoBanner {
    property bool __wasVisible: false

    anchors.top: parent.top
    anchors.topMargin: 64

    onVisibleChanged: {
        if (__wasVisible && !visible)
            destroy()
        else if (!__wasVisible && visible)
            __wasVisible = true
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.1

Row {
    spacing: 5
    property alias lbl: label.text
    property alias txt: txt.text
    Text { id: label; text: qsTr("Summary") }
    Text { id: txt; text: model.modelData.summary }
}


code:
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Components project.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
**   * Redistributions of source code must retain the above copyright
**     notice, this list of conditions and the following disclaimer.
**   * Redistributions in binary form must reproduce the above copyright
**     notice, this list of conditions and the following disclaimer in
**     the documentation and/or other materials provided with the
**     distribution.
**   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
**     the names of its contributors may be used to endorse or promote
**     products derived from this software without specific prior written
**     permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** $QT_END_LICENSE$
**
****************************************************************************/

import QtQuick 1.1
import com.nokia.meego 1.0
import com.nokia.extras 1.0
import "constants.js" as UI

Item {
    id: listItem

    signal clicked
    property alias title: mainText.text
    property alias subtitle: subText.text
    property alias pressed: mouseArea.pressed

    property alias mainText: mainText
    property alias subText: subText

    property int titleSize: UI.LIST_TILE_SIZE
    property int titleWeight: Font.Bold
    property string titleFont: UI.FONT_FAMILY
    property color titleColor: theme.inverted ? UI.LIST_TITLE_COLOR_INVERTED : UI.LIST_TITLE_COLOR
    property color titleColorPressed: theme.inverted ? UI.LIST_TITLE_COLOR_PRESSED_INVERTED : UI.LIST_TITLE_COLOR_PRESSED

    property int subtitleSize: UI.LIST_SUBTILE_SIZE
    property int subtitleWeight: Font.Normal
    property string subtitleFont: UI.FONT_FAMILY_LIGHT
    property color subtitleColor: theme.inverted ? UI.LIST_SUBTITLE_COLOR_INVERTED : UI.LIST_SUBTITLE_COLOR
    property color subtitleColorPressed: theme.inverted ? UI.LIST_SUBTITLE_COLOR_PRESSED_INVERTED : UI.LIST_SUBTITLE_COLOR_PRESSED

    height: UI.LIST_ITEM_HEIGHT
    width: parent.width

    BorderImage {
        id: background
        anchors.fill: parent
        // Fill page porders
        anchors.leftMargin: -UI.MARGIN_XLARGE
        anchors.rightMargin: -UI.MARGIN_XLARGE
        visible: mouseArea.pressed
        source: theme.inverted ? "image://theme/meegotouch-panel-inverted-background-pressed" : "image://theme/meegotouch-panel-background-pressed"
    }

    Row {
        anchors.fill: parent
        spacing: UI.LIST_ITEM_SPACING

        Image {
            anchors.verticalCenter: parent.verticalCenter
            visible: model.iconSource ? true : false
            width: UI.LIST_ICON_SIZE
            height: UI.LIST_ICON_SIZE
            source: model.iconSource ? model.iconSource : ""
        }

        Column {
            anchors.verticalCenter: parent.verticalCenter

            Label {
                id: mainText
                font.family: listItem.titleFont
                font.weight: listItem.titleWeight
                font.pixelSize: listItem.titleSize
                color: mouseArea.pressed ? listItem.titleColorPressed : listItem.titleColor
            }

            Label {
                id: subText
                font.family: listItem.subtitleFont
                font.weight: listItem.subtitleWeight
                font.pixelSize: listItem.subtitleSize
                color: mouseArea.pressed ? listItem.subtitleColorPressed : listItem.subtitleColor

                visible: text != ""
            }
        }
    }
    MouseArea {
        id: mouseArea;
        anchors.fill: parent
        onClicked: {
            listItem.clicked();
        }
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.1
import com.nokia.meego 1.0
import com.nokia.extras 1.0
import com.ubuntu.summit 1.0
import "constants.js" as UI
import "../core/weekday.js" as WeekDay
import "."

Page {
    property int dayOfWeek: -1
    property alias model: filtermodel.sourceModel
    property alias title: header.title

    anchors.fill: parent
    tools: commonTools

    Item {
        anchors.top: header.bottom
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.bottom: parent.bottom

        Label {
            visible: !listview.gotOneItem
            anchors.centerIn: parent
            opacity: 0.2
            font.bold: true
            font.pixelSize: platformStyle.fontPixelSize * 1.5
            text: qsTr("Empty :(")
        }

        ListView {
            id: listview

            property bool gotOneItem: false

            anchors.fill: parent
            anchors.margins: 10
            clip: true

            model: FilterProxyModel { id: filtermodel; dateFilter: dayOfWeek }

            delegate: ListDelegate {
                title: display
                subtitle: room

                mainText.width: listview.width - drillIcon.width
                mainText.elide: Text.ElideRight
                subText.width: mainText.width
                subText.elide: Text.ElideRight

                onClicked: {
                    appWindow.pageStack.push(Qt.resolvedUrl("EventPage.qml"),
                                             {
                                                 summary: model.summary,
                                                 dtstart: Qt.formatTime(model.startDateTime),
                                                 dtend: Qt.formatTime(model.endDateTime),
                                                 location: model.location,
                                                 description: model.description,
                                                 track: model.track,
                                                 room: model.room
                                             })
                }

                ToolIcon {
                    id: drillIcon
                    iconId: "common-drilldown-arrow".concat(theme.inverted ? "-inverse" : "")
                    anchors.right: parent.right;
                    anchors.verticalCenter: parent.verticalCenter
                }

                Component.onCompleted: listview.gotOneItem = true
            }
        }
        ScrollDecorator { flickableItem: listview }
    }

    PageHeader { id: header; title: WeekDay.numberToString(dayOfWeek) }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.1
import com.nokia.meego 1.0
import QtMobility.location 1.2
import "../core/core.js" as Core

Page {
    id: page
    tools: commonTools

    property real defaultLatitude: Core.__location_latitude
    property real defaultLongitude: Core.__location_longitude
    property int  defaultZoomLevel: 13
    property alias mapType: map.mapType

    anchors.fill: parent

    Map {
        id: map

        anchors.fill: parent
        zoomLevel: page.defaultZoomLevel
        plugin: Plugin { name: "nokia" }
        mapType: Map.StreetMap

        center: Coordinate {
            latitude: page.defaultLatitude
            longitude: page.defaultLongitude
        }
    }

    PinchArea {
        id: pincharea

        property real __oldZoom

        anchors.fill: parent

        function calcZoomDelta(zoom, percent) {
            return zoom + Math.log(percent)/Math.log(2)
        }

        onPinchStarted: {
            __oldZoom = map.zoomLevel
        }

        onPinchUpdated: {
            map.zoomLevel = calcZoomDelta(__oldZoom, pinch.scale)
        }

        onPinchFinished: {
            map.zoomLevel = calcZoomDelta(__oldZoom, pinch.scale)
        }
    }

    MouseArea {
        id: mousearea

        property bool __isPanning: false
        property int __lastX: -1
        property int __lastY: -1

        anchors.fill : parent

        onPressed: {
            __isPanning = true
            __lastX = mouse.x
            __lastY = mouse.y
        }

        onReleased: {
            __isPanning = false
        }

        onPositionChanged: {
            if (__isPanning) {
                var dx = mouse.x - __lastX
                var dy = mouse.y - __lastY
                map.pan(-dx, -dy)
                __lastX = mouse.x
                __lastY = mouse.y
            }
        }

        onCanceled: {
            __isPanning = false;
        }
    }

}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0
import "constants.js" as UI

Rectangle {
    id: title

    property alias title: titleText.text
    property alias backgroundColor: title.color

    height: 72
    anchors.top: parent.top
    anchors.left: parent.left
    anchors.right: parent.right
//        color: "#0886CE"
    color: "#E3683D"

    Text {
        id: titleText
        anchors.verticalCenter: parent.verticalCenter
        anchors.left: parent.left
        anchors.leftMargin: 20
        font.pixelSize: 28
        font.family: UI.FONT_FAMILY_BOLD
        color: "white"
        elide: Text.ElideRight
        width: parent.width - 20
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.1
import com.nokia.meego 1.0

Row {
    id: row

    property alias label: label.text
    property alias value: value.text

    width: page.width - 25
    spacing: 10

    Label { id: label; font.bold: true }
    Label {
        id: value;
        anchors.bottom: parent.bottom
        wrapMode: Text.Wrap
        width: parent.width - label.width
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.1
import com.nokia.meego 1.0

Page {
    id: page

    property double currentWidth;
    property double currentHeight;

    property double originalWidth;
    property double originalHeight;

    property bool imageHandled: false;
    property bool imageFlicked: false;

    property bool resizeToFit;

    //property list<string> images;

    property int listID;
    property int currentID;

    property int totalImages;

    ///////////

    property alias currentImage: map

    ///////////////////////////////

    anchors.fill: parent
    tools: commonTools

    Flickable {
        id: flickable

        anchors.fill: parent

        contentWidth: map.width * map.scale
        contentHeight: map.height * map.scale

        onFlickStarted: flicked()

        onHeightChanged: adjustImage()
        onWidthChanged: adjustImage()

        Image {
            id: map

            fillMode: Image.PreserveAspectFit
            scale: 1
            smooth: true
            source: "../images/maps/uds-p.jpeg"
            transformOrigin: Item.TopLeft
        }

        MouseArea {
            id: areaZoomDown
            x: 0 + flickable.contentX
            y: page.height - 80 + flickable.contentY
            width: 80
            height: 80
            onClicked: zoomDown();
            Image {
                id: zoomDownIcon
                source: "image://theme/icon-m-common-remove"
                anchors.centerIn: parent
            }
        }

        MouseArea {
            id: areaZoomUp
            x: page.width - 80 + flickable.contentX
            y: page.height - 80 + flickable.contentY
            width: 80
            height: 80
            onClicked: zoomUp();
            Image {
                id: zoomUpIcon
                source: "image://theme/icon-m-common-add"
                anchors.centerIn: parent
            }
        }
    }

    function flicked() {
        imageHandled = true;
        imageFlicked = true;
    }

    function adjustImage() {
        if (imageHandled == false && resizeToFit == true) fitToScreen();
    }

    function zoomUp() {
        imageHandled = true;
        var flickX = flickable.contentX;
        var flickY = flickable.contentY;
        currentImage.scale += 0.1;
        if (currentImage.scale >= 1.5) currentImage.scale = 1.5;
        if (currentImage.scale != 1.5 && imageFlicked === true) {
            flickable.contentX = 1.1 * flickX;
            flickable.contentY = 1.1 * flickY;
        }
        else if (imageFlicked == false) {
            if (currentImage.width > page.width || currentImage.height > page.height) {
                if (currentImage.width > page.width) flickable.contentX = (originalWidth * currentImage.scale) / 2 - page.width / 2;
                if (currentImage.height > page.height) flickable.contentY = (originalHeight * currentImage.scale) / 2 - page.height / 2;
            }
        }
        if (currentImage.width <= page.width) flickable.contentX = 0;
        if (currentImage.height <= page.height) flickable.contentY = 0;

        resize();
    }

    function zoomDown() {
        imageHandled = true;
        var flickX = flickable.contentX;
        var flickY = flickable.contentY;
        currentImage.scale -= 0.1;
        if (currentImage.scale <= 0.1) currentImage.scale = 0.1;
        if (currentImage.scale != 0.1 && imageFlicked == true) {
            flickable.contentX = 0.9 * flickX;
            flickable.contentY = 0.9 * flickY;
        }
        else if (imageFlicked == false) {
            if ((originalWidth * currentImage.scale) > page.width || (originalHeight * currentImage.scale) > page.height) {
                if ((originalWidth * currentImage.scale) > page.width) flickable.contentX = (originalWidth * currentImage.scale) / 2 - page.width / 2;
                if ((originalHeight * currentImage.scale) > page.height) flickable.contentY = (originalHeight * currentImage.scale) / 2 - page.height / 2;
            }
        }
        if (originalWidth * currentImage.scale <= page.width) flickable.contentX = 0;
        if (originalHeight * currentImage.scale <= page.height) flickable.contentY = 0;

        resize();
    }

    function centerOnZoom() {
        var contentX = flickable.contentX;
        var contentY = flickable.contentY;
        if (currentImage.scale > 1.0) {
            if (currentImage.width > flickable.width) flickable.contentX = contentX + (originalWidth - originalWidth * currentImage.scale) / 2;
            if (currentImage.height > flickable.height) flickable.contentY = contentY + (originalHeight - originalHeight * currentImage.scale) / 2;
        }
        else if (currentImage.scale < 1.0) {
            if (currentImage.width > flickable.width) flickable.contentX = contentX - (originalWidth - originalWidth * currentImage.scale) / 2;
            if (currentImage.height > flickable.height) flickable.contentY = contentY - (originalHeight - originalHeight * currentImage.scale) / 2;
        }
    }

    function showImage(string, id) {
        imageHandled = false;
        imageFlicked = false;
        currentID = id;
        base.getImageID(string);
        setTotalText();
        currentImage.scale = 1;
        currentImage.source = string;
        resize();
    }

    function fitToScreen() {
        var resizeScale;

        currentImage.scale = Math.min( page.width/currentImage.width, page.height/currentImage.height);
        resize();
        centerInResized();
    }

    function centerInResized() {
        flickable.contentX = 0;
        flickable.contentY = 0;
    }

    function centerIn() {
        if (currentImage.width >= flickable.width) {
            flickable.contentX = currentImage.width / 2 - flickable.width / 2;
        }
        if (currentImage.height >= flickable.height) {
            flickable.contentY = currentImage.height / 2 - flickable.height / 2;
        }
    }

    function resize() {
//        flickable.resizeContent()
        flickable.returnToBounds()
        if (currentImage.status == Image.Ready) {
            currentImage.x = 0;
            currentImage.y = 0;

            currentWidth = currentImage.width * currentImage.scale;
            currentHeight = currentImage.height * currentImage.scale;

            if (scale != 1) return;

            if (currentWidth < page.width) {
                currentImage.x = page.x + page.width - (page.width / 2) - currentWidth / 2;
            }
            if (currentHeight < page.height) {
                currentImage.y = page.y + page.height - (page.height / 2) - currentHeight / 2;
            }
        }
        else {
            return;
        }
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.1
import com.nokia.meego 1.0
import "../core/core.js" as Core

Sheet {
    acceptButtonText: qsTr("Save")
    rejectButtonText: qsTr("Cancel")

    content: Flickable {
        id: container
        anchors.fill: parent
        anchors.leftMargin: 10
        anchors.topMargin: 10
        flickableDirection: Flickable.VerticalFlick

        Column {
            id: col
            width: parent.width
            spacing: 10

            Label { text: qsTr("Settings"); font.bold: true; }
            Label { text: qsTr("Launchpad Username:") }
            TextField {
                id: lpusername
                anchors { left: parent.left; right: parent.right; }
                height: implicitHeight
                inputMethodHints: Qt.ImhNoAutoUppercase

                Component.onCompleted: text = Core.settings().value("lpuser")
            }
        }
    }

    onAccepted: { Core.settings().setValue("lpuser", lpusername.text); destroy() }
    onRejected: destroy();
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.1
import com.nokia.meego 1.0
import "../core"
import "../core/api.js" as API
import "../core/core.js" as Core

Page {
    id: page

    property date startDate
    property date endDate

    anchors.fill: parent

    JsonHandler {
        id: handler

        onListModelChanged: {
            var info = listModel.get(listModel.count - 1)
            title.text = info.title
            location.text = info.location
            page.startDate = info.date_start
            page.endDate = info.date_end
            time.text = Qt.formatDate(page.startDate) + ' - ' + Qt.formatDate(page.endDate)
            Core.settings().setValue("name", info.name)
            Core.update()
        }
    }

    Column {
        id: column
        anchors.centerIn: parent
        spacing: 10

        Image { anchors.horizontalCenter: parent.horizontalCenter; source: '../images/icon164.png' }
        Label {
            id: title
            width: page.width
            horizontalAlignment: Text.AlignHCenter
            anchors.horizontalCenter: parent.horizontalCenter;
            font.pixelSize: platformStyle.fontPixelSize*1.5;
        }
        Label {
            id: location
            width: page.width
            horizontalAlignment: Text.AlignHCenter
            anchors.horizontalCenter: parent.horizontalCenter
        }
        Label {
            id: time
            width: page.width
            horizontalAlignment: Text.AlignHCenter
            anchors.horizontalCenter: parent.horizontalCenter
        }
        BusyIndicator { anchors.horizontalCenter: parent.horizontalCenter; running: true }
    }

    Component.onCompleted: handler.load(API.summit)
}


code:
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Components project.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
**   * Redistributions of source code must retain the above copyright
**     notice, this list of conditions and the following disclaimer.
**   * Redistributions in binary form must reproduce the above copyright
**     notice, this list of conditions and the following disclaimer in
**     the documentation and/or other materials provided with the
**     distribution.
**   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
**     the names of its contributors may be used to endorse or promote
**     products derived from this software without specific prior written
**     permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** $QT_END_LICENSE$
**
****************************************************************************/

.pragma library

/* Margins */
var INDENT_DEFAULT = 16;
var CORNER_MARGINS = 22;
var MARGIN_DEFAULT = 0;
var MARGIN_XLARGE = 16;

// ListDelegate
var LIST_ITEM_MARGIN = 16
var LIST_ITEM_SPACING = 16
var LIST_ITEM_HEIGHT = 80
var LIST_ICON_SIZE = 64
var LIST_TILE_SIZE = 26
var LIST_TITLE_COLOR = "#282828"
var LIST_TITLE_COLOR_PRESSED = "#797979"
var LIST_TITLE_COLOR_INVERTED = "#ffffff"
var LIST_TITLE_COLOR_PRESSED_INVERTED = "#797979"
var LIST_SUBTILE_SIZE = 22
var LIST_SUBTITLE_COLOR = "#505050"
var LIST_SUBTITLE_COLOR_PRESSED = "#797979"
var LIST_SUBTITLE_COLOR_INVERTED = "#C8C8C8"
var LIST_SUBTITLE_COLOR_PRESSED_INVERTED = "#797979"

/* Font properties */
var FONT_FAMILY = "Nokia Pure Text";
var FONT_FAMILY_BOLD = "Nokia Pure Text Bold";
var FONT_FAMILY_LIGHT = "Nokia Pure Text Light";
var FONT_DEFAULT_SIZE = 24;
var FONT_LIGHT_SIZE = 22;

/* TUMBLER properties */
var TUMBLER_COLOR_TEXT = "#FFFFFF";
var TUMBLER_COLOR_LABEL = "#8C8C8C";
var TUMBLER_COLOR = "#000000";
var TUMBLER_OPACITY_FULL = 1.0;
var TUMBLER_OPACITY = 0.4;
var TUMBLER_OPACITY_LOW = 0.1;
var TUMBLER_FLICK_VELOCITY = 700;
var TUMBLER_ROW_HEIGHT = 64;
var TUMBLER_LABEL_HEIGHT = 54;
var TUMBLER_MARGIN = 16;
var TUMBLER_BORDER_MARGIN = 1;
var TUMBLER_WIDTH = 344;
var TUMBLER_HEIGHT_PORTRAIT = 256;
var TUMBLER_HEIGHT_LANDSCAPE = 192;

/* Button styles */
// Normal
var COLOR_BUTTON_FOREGROUND = "#191919"; // Text color
var COLOR_BUTTON_SECONDARY_FOREGROUND = "#8c8c8c"; // Pressed
var COLOR_BUTTON_DISABLED_FOREGROUND = "#b2b2b4"; // Disabled
// Inverted
var COLOR_BUTTON_INVERTED_FOREGROUND = "#FFFFFF";
var COLOR_BUTTON_INVERTED_SECONDARY_FOREGROUND = "#8c8c8c"; // Pressed
var COLOR_BUTTON_INVERTED_DISABLED_FOREGROUND = "#f5f5f5"; // Disabled

var SIZE_BUTTON = 51;
var SIZE_SMALL_BUTTON = 43;
var WIDTH_SMALL_BUTTON = 122;
var WIDTH_TUMBLER_BUTTON = 222;

var FONT_BOLD_BUTTON = true;

var INFO_BANNER_OPACITY = 0.9
var INFO_BANNER_LETTER_SPACING = -1.2


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.1
import com.nokia.meego 1.0
import com.nokia.extras 1.0
import com.ubuntu.summit 1.0
import "../core/core.js" as Core
import "../core/fakelist.js" as FakeList
import "../core/weekday.js" as WeekDay

PageStackWindow {
    id: appWindow

    function onMainEventsChanged() {
        if (pageStack.currentPage.objectName === 'splash')
            pageStack.replace(mainPage)

        mainPage.busy = false
    }

    function onUserEventsChanged() {
        userPage.title = Core.settings().value("lpuser")
    }

    showToolBar: true
    showStatusBar: true
//    initialPage: mainPage

    DayListPage { id: mainPage }
    ListPage { id: userPage; model: userCalendar.sessionModel }

    ToolBarLayout {
        id: commonTools
        visible: false

        ToolIcon {
            enabled: appWindow.pageStack.depth > 1
            platformIconId: "icon-m-toolbar-back".concat(enabled ? "" : "-dimmed")
            onClicked: pageStack.pop()
        }

        ToolIcon {
            enabled: pageStack.currentPage != mainPage
            platformIconId: "icon-m-toolbar-home".concat(enabled ? "" : "-dimmed")
            onClicked: { pageStack.clear(); pageStack.push(mainPage) }
        }
        ToolIcon {
            enabled: pageStack.currentPage != userPage /* || userPage.itemCount <= 0*/
            platformIconId: "icon-m-toolbar-contact".concat(enabled ? "" : "-dimmed")
            onClicked: { pageStack.clear(); pageStack.push(userPage) }
        }
//        ToolIcon {
//            property bool canCreate: Qt.createComponent("MapPage.qml").createObject(null) !== null
//            visible: canCreate
//            enabled: pageStack.currentPage.objectName !== "mapPage"
//            platformIconId: "icon-m-toolbar-search".concat(enabled ? "" : "-dimmed")
//            onClicked: { pageStack.clear(); pageStack.push(Qt.resolvedUrl("MapPage.qml"), {objectName: "mapPage"}) }
//        }

        ToolIcon {
            platformIconId: "icon-m-toolbar-refresh"
            onClicked: Core.update()
        }
        ToolIcon {
            platformIconId: "toolbar-view-menu"
            anchors.right: (parent === undefined) ? undefined : parent.right
            onClicked: (myMenu.status == DialogStatus.Closed) ? myMenu.open() : myMenu.close()
        }
    }

    Menu {
        id: myMenu
        visualParent: pageStack
        MenuLayout {
//            MenuItem { text: qsTr("Landscape"); onClicked: screen.allowedOrientations = Screen.Landscape }
//            MenuItem { text: qsTr("Portrait"); onClicked: screen.allowedOrientations = Screen.Portrait }
            MenuItem { text: qsTr("Clear Cache"); onClicked: Core.clearCache() }
            MenuItem { text: qsTr("Settings"); onClicked: Qt.createComponent("SettingsSheet.qml").createObject(pageStack.currentPage).open() }
            MenuItem {
                text: qsTr("About")
                enabled: pageStack.currentPage !== null && pageStack.currentPage.objectName !== "aboutPage"
                onClicked: pageStack.push(Qt.resolvedUrl("AboutPage.qml"))
                onEnabledChanged: style.textColor = enabled ? "black" : "grey"
            }
        }
    }

    function onMainError(error) {
        var c = Qt.createComponent(Qt.resolvedUrl("InfoBanner.qml"));
        c.createObject(appWindow, { text: qsTr("Main Calendar:") + " " + error }).show()
    }

    function onUserError(error) {
        var c = Qt.createComponent(Qt.resolvedUrl("InfoBanner.qml"));
        c.createObject(appWindow, { text: qsTr("User Calendar:") + " " + error }).show()
    }

    Component.onCompleted: {
        mainCalendar.eventsChanged.connect(onMainEventsChanged)
        userCalendar.eventsChanged.connect(onUserEventsChanged)

        mainCalendar.error.connect(onMainError)
        userCalendar.error.connect(onUserError)

        if (Core.hasCache()) {
            pageStack.push(mainPage)
            Core.updateFromCache();
            Qt.createComponent("../core/UpdateTimer.qml").createObject(appWindow)
            commonTools.visible = true
        } else {
            pageStack.push(Qt.resolvedUrl('SplashPage.qml'), { objectName: 'splash' })
        }
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0

Text {
    color: systemPalette.text
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0

Item {
    id: listDelegate

    signal clicked

    property alias title: title

    height: 70
    anchors { left: parent.left; right: parent.right }

    Label {
        id: title
        anchors.verticalCenter: parent.verticalCenter
        height: font.pixelSize + 8
    }

    Rectangle {
        id: divider
        anchors.bottom: parent.bottom
        height: 1
        width: parent.width - 10
        anchors.horizontalCenter: parent.horizontalCenter
        color: "#002439"
    }

    MouseArea {
        anchors.fill: parent
        onClicked: listDelegate.clicked()
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0
import com.ubuntu.summit.maemo 5.0

Window {
    id: window

    property alias delegate: view.delegate
    property alias model: view.model

    anchors.fill: parent
    title: "All Sessions"

    SystemPalette { id: systemPalette; colorGroup: SystemPalette.Active }

    Item {
        anchors.fill: parent

        ListView {
            id: view
            anchors.fill: parent
            anchors.margins: 20
            clip: true
        }
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0

Row {
    id: row

    property alias label: label.text
    property alias value: value.text

    width: window.width - 25
    spacing: 10

    Label { id: label; font.bold: true }
    Label {
        id: value;
        anchors.bottom: parent.bottom
        wrapMode: Text.Wrap
        width: parent.width - label.width
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0
import com.ubuntu.summit.maemo 5.0

Window {
    id: window

//    property alias summary: title
    property alias dtstart: dtstart.value
    property alias dtend: dtend.value
    property alias location: location.value
    property alias description: description.value
    property alias track: track.value
    property alias room: room.value

    anchors.fill: parent

    Flickable {
        id: flickable

//        anchors.topMargin: header.height + 10
        anchors.fill: parent
        anchors.margins: 10
        clip: true
        contentWidth: container.width; contentHeight: container.height

        Item {
            id: container

            height: column.height + map.height
            width: Math.max(column.width, map.width)

            Column {
                id: column

                PropertyLabel { id: dtstart; label: "Start:"; }
                PropertyLabel { id: dtend; label: "End:"; }
                PropertyLabel { id: location; label: "Location:"; }
                PropertyLabel { id: description; label: "Description:"; }
                PropertyLabel { id: track; label: "Track:"; }
                PropertyLabel { id: room; label: "Room:"; }
            }

            Image {
                id: map

                anchors.top: column.bottom
                anchors.topMargin: 10
                source: "../images/room-map.jpg"
                width: window.width/2
                fillMode: Image.PreserveAspectFit

//                MouseArea {
//                    anchors.fill: parent
//                    onClicked: {
//                        pageStack.push(Qt.resolvedUrl("RoomMapPage.qml"))
//                    }
//                }
            }
        }
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0
import com.ubuntu.summit 1.0
import "../core/weekday.js" as WeekDay

ListWindow {
    id: window
    anchors.fill: parent

    property alias model: filtermodel.sourceModel
    property int dayOfWeek: -1

    title: dayOfWeek > -1 ? WeekDay.numberToString(dayOfWeek) : ""
    model: FilterProxyModel { id: filtermodel; dateFilter: dayOfWeek }
    delegate: ListDelegate {
        title.text: display

        onClicked: {
            windowStack.push(createWindow(Qt.resolvedUrl("SessionInfoWindow.qml"),
                                          {
                                              title: model.summary,
                                              dtstart: model.startDateTime,
                                              dtend: model.endDateTime,
                                              location: model.location,
                                              description: model.description,
                                              track: model.track,
                                              room: model.room
                                          }))
        }
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0
import com.ubuntu.summit.maemo 5.0
import "../core/introspect.js" as Introspect

WindowBase {
    function createWindow(window, properties) {
        var windowInstance

        var comp
        if (window.createObject) {
            comp = window
        } else if (typeof window === "string") {
            comp = Qt.createComponent(window)
        }

        if (comp) {
            if (comp.status == Component.Error) {
                throw new Error("Error while loading page: " + comp.errorString());
            } else {
                windowInstance = comp.createObject(null);
            }
        }

        windowInstance["title"] = properties["title"]
        console.debug(properties["title"])
        console.debug(windowInstance["title"])

        for (var attr in properties || {}) {
            windowInstance[attr] = properties[attr]
        }

        return windowInstance
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0
//import QtDesktop 0.1
import com.ubuntu.summit.maemo 5.0
import "../core/core.js" as Core
import "../core/weekday.js" as WeekDay
import "../core/introspect.js" as Introspect

StackedWindow {
    id: appWindow

    property bool initialized: false

    function init() {
        for (var i = 0; i < 7; ++i) {
            mainWindow.model.append({"dayOfWeek": i})
        }
        initialized = true
    }

    function onMainEventsChanged() {
        if (!initialized)
            init()
    }

    MenuGroup {
        id: menuGroup
        MenuItem {
            text: qsTr("Schedule");
            checkable: true;
            checked: true
        }
        MenuItem { text: qsTr("You Schedule"); checkable: true; }
    }
    MenuItem { id: setting; text: qsTr("Settings") }

    ListWindow {
        id: mainWindow

        model: ListModel {}
        delegate: ListDelegate {
            title.text: WeekDay.numberToString(dayOfWeek)
            onClicked: {
                var c = Qt.createComponent("SessionListWindow.qml")
                var o = c.createObject(null)
                o.dayOfWeek = dayOfWeek
                o.model = mainCalendar.sessionModel
                windowStack.push(o)
//                windowStack.push(mainWindow.createWindow(
//                                     "SessionListWindow.qml",
//                                     {
//                                         dayOfWeek: dayOfWeek,
//                                         model: mainCalendar.sessionModel
//                                     }))
            }
        }

        Component.onCompleted: {
            mainWindow.addActions(menuGroup)
            mainWindow.addAction(setting)
        }
    }

    Component.onCompleted: {
        mainCalendar.eventsChanged.connect(onMainEventsChanged)
//        userCalendar.eventsChanged.connect(onUserEventsChanged)

        windowStack.push(mainWindow)

        Core.settings().setValue("name", "uds-p")
        Core.updateFromCache();
//        Core.update();
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0
import com.nokia.symbian 1.0
import "../core"
import "../core/about.js" as About

Page {
    id: page

    objectName: "aboutPage"
    anchors.fill: parent
    anchors.margins: 32

    Row {
        id: headerContainer
        spacing: 10
        Image { id: icon; source: "../images/icon80.png" }
        Label {
            anchors.verticalCenter: icon.verticalCenter
            text: "12.04";
            font.pixelSize: 32; font.bold: true; font.family: "Nokia Pure Text Bold"
        }
        Image {
            anchors.verticalCenter: icon.verticalCenter
            source: "../images/gplv3.png"
            MouseArea { anchors.fill: parent; onClicked: Qt.openUrlExternally(About.gplUrl) }
        }
    }

    Item {
        anchors {
            top: headerContainer.bottom; topMargin: 40;
            bottom: parent.bottom;
            left: parent.left; right: parent.right
        }

        ListView {
            anchors.fill: parent
            boundsBehavior: Flickable.StopAtBounds
            clip: true
            model: AboutModel {}
            delegate: ListDelegate {
                title: "© " + year + " " + name
                subtitle: "" + mail + ""
                onClicked: Qt.openUrlExternally("mailto:" + mail)
            }
        }
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.1
import com.nokia.symbian 1.0
import com.nokia.extras 1.0

Page {
    id: page

    property string summary
    property alias dtstart: dtstart.value
    property alias dtend: dtend.value
    property alias location: location.value
    property alias description: description.value
    property alias track: track.value
    property alias room: room.value

    anchors.fill: parent

    Flickable {
        id: flickable

        anchors.fill: parent
        anchors.margins: 20
        clip: true
        flickableDirection: Flickable.VerticalFlick
        contentWidth: container.width; contentHeight: container.height

        Item {
            id: container

            height: column.height /*+ map.height*/
            width: column.width /*+ map.width*/

            Column {
                id: column

                width: page.width - flickable.anchors.margins

                PropertyLabel { id: dtstart; label: "Start:"; }
                PropertyLabel { id: dtend; label: "End:"; }
                PropertyLabel { id: location; label: "Location:"; }
                PropertyLabel { id: description; label: "Description:"; }
                PropertyLabel { id: track; label: "Track:"; }
                PropertyLabel { id: room; label: "Room:"; }
            }

//            Image {
//                id: map

//                anchors.top: column.bottom
//                anchors.topMargin: 10
//                source: "../images/room-map.jpg"
//                width: page.width/2
//                fillMode: Image.PreserveAspectFit

//                MouseArea {
//                    anchors.fill: parent
//                    onClicked: {
//                        pageStack.push(Qt.createComponent("RoomMapPage.qml"))
//                    }
//                }
//            }
        }
    }

    ScrollDecorator { flickableItem: flickable }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.1

Text {
    color: platformStyle.colorNormalLight
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0
import com.nokia.symbian 1.0

ListItem {
    id: item

    property alias title: title.text
    property alias subtitle: subtitle.text

    Column {
        anchors { left: parent.left; right: parent.right;
                  verticalCenter: parent.verticalCenter;
                  rightMargin: privateStyle.scrollBarThickness }

        ListItemText {
            id: title
            mode: item.mode
            role: "Title"
            wrapMode: Text.Wrap
            width: parent.width
        }
        ListItemText {
            id: subtitle
            mode: item.mode
            role: "SubTitle"
            wrapMode: Text.Wrap
            width: parent.width
        }
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0
import com.nokia.symbian 1.0
import com.ubuntu.summit 1.0

Page {
    id: page

    property string title: ''
    property alias dayOfWeek: filtermodel.dateFilter
    property alias model: filtermodel.sourceModel
    property alias listview: listview
    property alias itemCount: listview.count

    anchors.fill: parent

    ListView {
        id: listview
        anchors.fill: parent
        anchors.margins: 10
        clip: true

        model: FilterProxyModel { id: filtermodel }

        header: Component {
            id: listHeader

            ListHeading {
                id: listHeading

                ListItemText {
                    id: headingText
                    anchors.fill: listHeading.paddingItem
                    role: "Heading"
                    text: page.title
                }
            }
        }

        delegate: ListDelegate {
            subItemIndicator: true
            title: display
            subtitle: room

            onClicked: {
                console.debug(listview.model)
                var eventPageComponent = Qt.createComponent("EventPage.qml")
                var eventPage = eventPageComponent.createObject(listview)
                eventPage.summary = model.summary
                eventPage.dtstart = Qt.formatTime(model.startDateTime)
                eventPage.dtend = Qt.formatTime(model.endDateTime)
                eventPage.location = model.location
                eventPage.description = model.description
                eventPage.track = model.track
                eventPage.room = model.room

                pageStack.push(eventPage)
            }
        }
    }

    ScrollDecorator { flickableItem: listview }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.1
import com.nokia.symbian 1.0
import "../core"

Page {
    property alias busy: busyIndicator.running

    Item {
        anchors.fill: parent

        ListView {
            clip: true
            anchors.fill: parent
            visible: !busyIndicator.visible
            model: DayListModel{}
            delegate: ListItem {
                subItemIndicator: true
                ListItemText { text: name; anchors.verticalCenter: parent.verticalCenter }
                onClicked: {
                    pageStack.push(Qt.resolvedUrl("ListPage.qml"),
                                   {
                                       title: name,
                                       dayOfWeek: number,
                                       model: mainCalendar.sessionModel
                                   })
                }
            }
        }

        BusyIndicator {
            id: busyIndicator
            anchors.centerIn: parent
            running: true
            visible: running
        }
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0
import com.nokia.symbian 1.0

Row {
    id: row

    property alias label: label.text
    property alias value: value.text

    anchors { left: parent.left; right: parent.right }
    spacing: 10

    ListItemText { id: label; font.bold: true }
    ListItemText {
        id: value;
        anchors.bottom: parent.bottom
        elide: Text.ElideNone
        wrapMode: Text.WordWrap
        width: parent.width - label.width - 5
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0
import com.nokia.symbian 1.0
import "../core"
import "../core/core.js" as Core

Page {
    function save() {
        Core.settings().setValue("lpuser", lpusername.text)
    }

    onStatusChanged: {
        if (status === PageStatus.Deactivating)
            save()
    }

    Flickable {
        id: container
        anchors.fill: parent
        height: 250
        anchors.leftMargin: 10
        anchors.topMargin: 10
        flickableDirection: Flickable.VerticalFlick
        Column {
            id: col
            width: parent.width
            spacing: 10

            ListItemText { text: qsTr("Launchpad Username:") }
            TextField {
                id: lpusername
                anchors { left: parent.left; right: parent.right; }
                height: implicitHeight
                inputMethodHints: Qt.ImhPreferLowercase

                Component.onCompleted: text = Core.settings().value("lpuser")
            }
        }
    }
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.1
import com.nokia.symbian 1.0
import "../core"
import "../core/api.js" as API
import "../core/core.js" as Core

Window {
    id: page

    property date startDate
    property date endDate

    anchors.fill: parent

    JsonHandler {
        id: handler

        onListModelChanged: {
            var info = listModel.get(listModel.count - 1)
            title.text = info.title
            location.text = info.location
            page.startDate = info.date_start
            page.endDate = info.date_end
            time.text = Qt.formatDate(page.startDate) + ' - ' + Qt.formatDate(page.endDate)
            Core.settings().setValue("name", info.name)
            Core.update()
        }
    }

    Column {
        id: column
        anchors.centerIn: parent
        spacing: 10

        Image { anchors.horizontalCenter: parent.horizontalCenter; source: '../images/icon164.png' }
        Label {
            id: title
            width: page.width
            horizontalAlignment: Text.AlignHCenter
            font.pixelSize: platformStyle.fontPixelSize*1.5;
        }
        Label {
            id: location
            width: page.width
            horizontalAlignment: Text.AlignHCenter
        }
        Label {
            id: time
            width: page.width
            horizontalAlignment: Text.AlignHCenter
        }
        BusyIndicator { anchors.horizontalCenter: parent.horizontalCenter; running: true }
    }

    Component.onCompleted: handler.load(API.summit)
}


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 1.0
import com.nokia.symbian 1.0
import "../core"
import "../core/core.js" as Core

Window {
    id: window

    function onMainEventsChanged() {
        if (pageStack.currentPage.objectName === 'splash')
            pageStack.replace(mainPage)
        allPage.busy = false

        statusBar.visible = true
        toolBar.visible = true
    }

    function onUserEventsChanged() {
        userPage.title = Qt.createComponent("../core/Settings.qml").createObject(null).value("lpuser")
    }

    StatusBar { id: statusBar; anchors.top: window.top }

    PageStack {
        id: pageStack
        anchors { left: parent.left; right: parent.right; top: statusBar.bottom; bottom: toolBar.top }
    }

    Page {
        id: mainPage

        TabBar {
            id: tabBar
            anchors { left: parent.left; right: parent.right; top: parent.top }
            TabButton { tab: allPage; text: "All" }
            TabButton { tab: userPage; text: "User" }
        }

        TabGroup {
            id: tabGroup
            anchors { left: parent.left; right: parent.right; top: tabBar.bottom; bottom: parent.bottom }
            MainPage { id: allPage; pageStack: mainPage.pageStack }
            ListPage { id: userPage; pageStack: mainPage.pageStack; model: userCalendar.sessionModel }
        }
    }

    Menu {
        id: menu
        content: MenuLayout {
            MenuItem { text: qsTr("Clear Cache"); onClicked: Core.clearCache() }
            MenuItem { text: qsTr("Settings"); onClicked: pageStack.push(Qt.resolvedUrl("SettingsDialog.qml")) }
            MenuItem { text: qsTr("About"); onClicked: pageStack.push(Qt.resolvedUrl("AboutPage.qml")) }
            MenuItem { text: qsTr("Exit"); onClicked: Qt.quit() }
        }
    }

    ToolBar {
        id: toolBar
        anchors.bottom: window.bottom
        tools: ToolBarLayout {
            id: toolBarLayout
            ToolButton {
                iconSource: "toolbar-back"
                onClicked: pageStack.depth <= 1 ? Qt.quit() : pageStack.pop()
            }
            ToolButton {
                enabled: !(pageStack.currentPage == mainPage)
                iconSource: "toolbar-home"
                onClicked: { pageStack.clear(); pageStack.push(mainPage) }
            }
            ToolButton {
                iconSource: "toolbar-refresh"
                onClicked: Core.update()
            }
            ToolButton {
                flat: true
                iconSource: "toolbar-list"
                onClicked: menu.open()
            }
        }
    }

    Component.onCompleted: {
        mainCalendar.eventsChanged.connect(onMainEventsChanged)
        userCalendar.eventsChanged.connect(onUserEventsChanged)

        if (Core.hasCache()) {
            pageStack.push(mainPage)
            Core.updateFromCache();
            Qt.createComponent("../core/UpdateTimer.qml").createObject(null)
        } else {
            statusBar.visible = false
            toolBar.visible = false
            pageStack.push(Qt.resolvedUrl('SplashPage.qml'), { objectName: 'splash' })
        }
    }
}


code:
The Debian Package uds
----------------------------

Comments regarding the Package

 -- Harald Sitter <me@unknown>  Mon, 19 Sep 2011 21:52:49 +0200


code:
uds (12.04.0) unstable; urgency=low

  * Initial Release.

 -- Harald Sitter <me@unknown>  Mon, 19 Sep 2011 21:52:59 +0200


code:
This package was debianized by Harald Sitter <me@unknown> on
Mon, 19 Sep 2011 21:52:49 +0200.

It was downloaded from <url://example.com>

Upstream Author(s):

    <put author's name and email here>
    <likewise for another author>

Copyright:

    <Copyright (C) YYYY Name OfAuthor>
    <likewise for another author>

License:

    This package is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This package is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this package; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

On Debian systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL'.

The Debian packaging is (C) 2011, Harald Sitter <me@unknown> and
is licensed under the GPL, see above.

# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.


code:
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

configure: configure-stamp
configure-stamp:
	dh_testdir
	# qmake PREFIX=/usr# Uncomment this line for use without Qt Creator

	touch configure-stamp

build: build-stamp

build-stamp: configure-stamp
	dh_testdir

	# Add here commands to compile the package.
	# $(MAKE) # Uncomment this line for use without Qt Creator
	#docbook-to-man debian/uds.sgml > uds.1

	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp

	# Add here commands to clean up after the build process.
	$(MAKE) clean

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install the package into debian/uds.
	$(MAKE) INSTALL_ROOT="$(CURDIR)"/debian/uds install

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
#	dh_install
#	dh_installmenu
#	dh_installdebconf
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installpam
#	dh_installmime
#	dh_python
#	dh_installinit
#	dh_installcron
#	dh_installinfo
	dh_installman
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
#	dh_perl
#	dh_makeshlibs
	dh_installdeb
	# dh_shlibdeps # Uncomment this line for use without Qt Creator
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure


code:
The Debian Package uds
----------------------------

Comments regarding the Package

 -- Harald Sitter <me@unknown>  Mon, 19 Sep 2011 21:52:59 +0200


code:
uds (12.04.1) unstable; urgency=low
  * Fix time zone issue by forcing UTC conversion in libqcalparser
  * Add UDS-P map

 -- Harald Sitter <apachelogger@ubuntu.com>  Mon, 31 Oct 2011 15:55:41 +0100

uds (12.04.0) unstable; urgency=low

  * Initial Release.

 -- Harald Sitter <apachelogger@ubuntu.com>  Mon, 19 Sep 2011 21:52:59 +0200


code:
This package was debianized by Harald Sitter <me@unknown> on
Mon, 19 Sep 2011 21:52:59 +0200.

It was downloaded from <url://example.com>

Upstream Author(s):

    <put author's name and email here>
    <likewise for another author>

Copyright:

    <Copyright (C) YYYY Name OfAuthor>
    <likewise for another author>

License:

    This package is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This package is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this package; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

On Debian systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL'.

The Debian packaging is (C) 2011, Harald Sitter <me@unknown> and
is licensed under the GPL, see above.

# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.


code:
#!/bin/sh

if [ -e libqcalparser ]; then
  git submodule init
  git submodule update
else
  echo "Erm, there is no libqcalparser dir? wth? go scrw yrslf"
fi

path: repo-update


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef DESKTOPSERVICES_H
#define DESKTOPSERVICES_H

#include <QtCore/QObject>
#include <QtGui/QDesktopServices>

#define U_PROPERTY_GETTER(__cName) \
    public: QString __cName() const { return QDesktopServices::storageLocation(__cName); } private:

class DesktopServices : public QObject
{
    Q_OBJECT
//    Q_PROPERTY(QString desktopLocation READ DesktopLocation)
//    Q_PROPERTY(QString documentsLocation READ DocumentsLocation)
//    Q_PROPERTY(QString fontsLocation READ FontsLocation)
//    Q_PROPERTY(QString applicationsLocation READ ApplicationsLocation)
//    Q_PROPERTY(QString musicLocation READ MusicLocation)
//    Q_PROPERTY(QString moviesLocation READ MoviesLocation)
//    Q_PROPERTY(QString picturesLocation READ PicturesLocation)
//    Q_PROPERTY(QString tempLocation READ TempLocation)
//    Q_PROPERTY(QString homeLocation READ HomeLocation)
//    Q_PROPERTY(QString dataLocation READ DataLocation)
//    Q_PROPERTY(QString cacheLocation READ CacheLocation)
//    U_PROPERTY_GETTER(TempLocation)
//    U_PROPERTY_GETTER(HomeLocation)
//    U_PROPERTY_GETTER(DataLocation)
//    U_PROPERTY_GETTER(CacheLocation)
public:
    DesktopServices(QObject *parent = 0) : QObject(parent) {}
    ~DesktopServices() {}

public slots:
    bool openUrl(const QUrl &url) { return QDesktopServices::openUrl(url); }
};

#endif // DESKTOPSERVICES_H


code:
/*
    Copyright (C) 2011 Harald Sitter <apachelogger@ubuntu.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "RemoteManager.h"

#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QEventLoop>
#include <QtCore/QFile>
#include <QtCore/QStringBuilder>
#include <QtCore/QStringList>
#include <QtCore/QThreadPool>
#include <QtGui/QDesktopServices>
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkReply>
#include <QtNetwork/QNetworkRequest>

#include "qcalevent.h"
#include "qcalparser.h"

#include "SessionModel.h"

// ---------------------------------- File ---------------------------------- //

void FileParserRunnable::run()
{
    QFile cacheFile(m_path);
    if (cacheFile.exists() ||
            !cacheFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
        cacheFile.open(QIODevice::ReadOnly | QIODevice::Text);

        QCalParser parser;
        parser.parse(&cacheFile);
        emit done(parser.eventList());
    } else {
        qWarning("File '%s' could not be opened for reading.", qPrintable(m_path));
        emit done(QList<QSharedPointer<QCalEvent> >());
    }
}

// --------------------------------- Network -------------------------------- //

NetworkParser::NetworkParser()
{
}

void NetworkParser::parseReply(QNetworkReply *reply)
{

    if (reply->error() != QNetworkReply::NoError) {
        qWarning("QNR error");
        emit error(reply->errorString());
    } else {
        reply->open(QIODevice::ReadOnly | QIODevice::Text);
        QByteArray data = reply->readAll();

        const QString cacheDirPath = QDesktopServices::storageLocation(QDesktopServices::CacheLocation);
        QDir cacheDir(cacheDirPath);
        if (!cacheDir.exists())
            cacheDir.mkpath(cacheDirPath);

        QFile f(RemoteManager::cacheFilePath(reply->url()));
        if (!f.open(QIODevice::WriteOnly | QIODevice::Text))
            qWarning() << "Failed to open cache file for" << reply->url() << "for writing!";
        f.write(data);
        f.close();

        QCalParser parser;
        parser.parse(data);
        emit done(parser.eventList());
    }

    reply->manager()->deleteLater();
    deleteLater();
    QThread::currentThread()->quit();
}

// --------------------------------- Manager -------------------------------- //

RemoteManager::RemoteManager(QObject *parent) :
    QObject(parent),
    m_sessionModel(new SessionModel(this))
{
    qRegisterMetaType<QList<QSharedPointer<QCalEvent> > >("QList<QSharedPointer<QCalEvent> >");
}

RemoteManager::~RemoteManager()
{
    foreach (EventList list, m_list)
        qDeleteAll(list);
}

void RemoteManager::update(const QUrl &url)
{
    NetworkParser *parser = new NetworkParser;
    QNetworkAccessManager *networkAccessManager = new QNetworkAccessManager;

    connect(networkAccessManager, SIGNAL(finished(QNetworkReply*)),
            parser, SLOT(parseReply(QNetworkReply*)),
            Qt::QueuedConnection);
    connect(parser, SIGNAL(done(QList<QSharedPointer<QCalEvent> >)),
            this, SLOT(parsingDone(QList<QSharedPointer<QCalEvent> >)),
            Qt::QueuedConnection);
    // Queue the error signal so we are in a well defined state when the error
    // hits a connected object.
    connect(parser, SIGNAL(error(QString)),
            this, SIGNAL(error(QString)), Qt::QueuedConnection);

    networkAccessManager->get(QNetworkRequest(url));

    QThread *t = new QThread(this);
    parser->moveToThread(t);
    t->start();
}

void RemoteManager::updateFromCache(const QUrl &url)
{
    FileParserRunnable *parser = new FileParserRunnable(cacheFilePath(url));
    connect(parser, SIGNAL(done(QList<QSharedPointer<QCalEvent> >)),
            this, SLOT(parsingDone(QList<QSharedPointer<QCalEvent> >)),
            Qt::QueuedConnection);
    QThreadPool::globalInstance()->start(parser);
}

void RemoteManager::parsingDone(QList<QSharedPointer<QCalEvent> > events)
{
    m_sessionModel->setEvents(events);
    emit sessionModelChanged();
    emit eventsChanged();
}

void RemoteManager::clearCache(const QUrl &url)
{
    QFile cacheFile(cacheFilePath(url));
    if (cacheFile.exists())
        cacheFile.remove();
}

bool RemoteManager::hasCache(const QUrl &url) const
{
    QFile cacheFile(cacheFilePath(url));
    if (cacheFile.exists()) {
        return true;
    }
    return false;
}

inline QString RemoteManager::cacheFilePath(const QUrl &url)
{
    const QString cacheDirPath = QDesktopServices::storageLocation(QDesktopServices::CacheLocation);
    return cacheDirPath % QLatin1Literal("/") %  url.path().split("/").last();
}