×
Namespaces

Variants
Actions
(Difference between revisions)

Adding event to native calender application on Meego Harmattan using QOrganizer API

From Nokia Developer Wiki
Jump to: navigation, search
vineet.jain (Talk | contribs)
(Vineet.jain -)
 
vineet.jain (Talk | contribs)
(Vineet.jain - - Summary)
Line 30: Line 30:
 
<code cpp>
 
<code cpp>
 
#include <qorganizerevent.h>
 
#include <qorganizerevent.h>
#include<qorganizermanager.h>
+
#include <qorganizermanager.h>
 
#include <qorganizeritem>  
 
#include <qorganizeritem>  
 
</code>
 
</code>
Line 65: Line 65:
 
}
 
}
 
</code>
 
</code>
''Add categories below. Remove Category:Draft when the page is complete or near complete''
 

Revision as of 12:49, 7 December 2011

The code snippet shows how we can add an event to the native calender application on meego harmattan device using the QOranizer API.


Article Metadata
Tested with
SDK: Nokia Qt SDK 1.1.3
Devices(s): N9,N950
Article
Keywords: QOrganizerManager, QOrganizerEvent,QOrganizerItem
Created: (07 Dec 2011)
Last edited: vineet.jain (07 Dec 2011)


Summary

Headers required:

#include <qorganizerevent.h>
#include <qorganizermanager.h>
#include <qorganizeritem>

In the .pro file, add the following lines:

CONFIG += mobility
MOBILITY += organizer

Source:

bool Cyourclass::addEventToCalender(const QString& alabeltext,const QString& aStartDateTime,const QString aEndDateTime)
{
QOrganizerManager m_manager;
QOrganizerEvent m_organizerEvent;
 
QDateTime startdatetime = QDateTime::fromString(aStartDateTime, "yyyy-MM-ddTHH:mm");
QDateTime enddatetime = QDateTime::fromString(aEndDateTime, "yyyy-MM-ddTHH:mm");
 
if (startdatetime > enddatetime ) {
return false;
}
 
m_organizerEvent.setDisplayLabel(alabeltext);
m_organizerEvent.setStartDateTime(start);
m_organizerEvent.setEndDateTime(end);
 
// similarly more fields can be added to the event
 
m_manager.saveItem(&m_organizerEvent);
return true;
}
113 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×