Hi,
I use qtmobility.organizer to get the events out of the calendar on
harmattan (N9/N950) for my application. 
This works quite nice so far, I get all the events.

Here is working example:
#!/usr/bin/env python
#-*- coding: utf-8 -*-

# just for testing with qtmobiliy-organizer

import sys
from QtMobility.Organizer import *
from PySide import QtCore
from PySide.QtCore import QDateTime, QDate, QTime


class QtMobilityTest(QtCore.QObject):
    def __init__(self):
        QtCore.QObject.__init__(self)
        self.defaultManager = QOrganizerManager()
        self.collections = self.defaultManager.collections()
        print len(self.collections)
        self.selected_collections = []
        for collection in self.collections:
            print collection.metaData()['Color'],
collection.metaData()['Name'], collection.id()
            self.selected_collections.append(collection.id())
          
        now = QDateTime.currentDateTime()
        days_ahead = 50
        self.items =
self.defaultManager.items(now,now.addDays(days_ahead))
        for item in self.items:
            if item.type() == 'Todo':
                todo = QOrganizerTodo(item)
                print (todo.dueDateTime().toString("dd.MM.yyyy
hh:mm:ss"),
                       todo.displayLabel()) 
            if item.type() == 'EventOccurrence':
                occurrence = QOrganizerEventOccurrence(item)
                print (occurrence.startDateTime().toString("dd.MM.yyyy
hh:mm:ss"),
                       occurrence.endDateTime().toString("dd.MM.yyyy
hh:mm:ss"), 
                       occurrence.displayLabel(), 
                       occurrence.location()) 
            if item.type() == 'Event':
                event = QOrganizerEvent(item)
                print event.collectionId()
                print (event.startDateTime().toString("dd.MM.yyyy
hh:mm:ss"), 
                       event.endDateTime().toString("dd.MM.yyyy
hh:mm:ss"),
                       event.displayLabel(),
                       event.location(),
                       event.id())
        sys.exit(0)

if __name__ == "__main__":
    app = QtCore.QCoreApplication([])
    test = QtMobilityTest()
    app.exec_()
[/CODE]

But in my application the user should be able to choose which calendar
are be displayed, so I need to know to which calendar the event belong.

My first try was to compare the collectionIds of the collections given
by the manager with the collectionIds of the events I got, but the
program stops with a segmentation fault.

Any ideas what went wrong or any other suggestions how to do it?



_______________________________________________
PySide mailing list
PySide@lists.pyside.org
http://lists.pyside.org/listinfo/pyside

Reply via email to