×
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 - - Summary)
hamishwillee (Talk | contribs)
m (Text replace - "<code cpp>" to "<code cpp-qt>")
 
(13 intermediate revisions by 6 users not shown)
Line 1: Line 1:
[[Category:MeeGo 1.2 Harmattan]][[Category:Qt Mobility]][[Category:Code Snippet]]
+
[[Category:Qt Mobility]][[Category:Code Snippet]][[Category:MeeGo Harmattan]][[Category:PIM]]
{{Abstract|The code snippet shows how we can add an event to the native calender application on meego harmattan device using the QOranizer API.}}
+
{{Abstract|The code snippet shows how we can add an event to the native calender application on MeeGo Harmattan device using the QOrganizer API.}}
 
+
  
 
{{ArticleMetaData
 
{{ArticleMetaData
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
+
|sourcecode= [[Media:AddToCalender.zip]]  
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 
|devices= N9,N950
 
|devices= N9,N950
Line 20: Line 19:
 
|update-timestamp=<!-- After significant update: YYYYMMDD -->
 
|update-timestamp=<!-- After significant update: YYYYMMDD -->
 
|creationdate=20111207
 
|creationdate=20111207
|author= <!-- Display as link [[User:vineet.jain]] -->
+
|author= [[User:vineet.jain]]  
 
}}
 
}}
  
  
 
+
== Headers  ==  
== Summary ==
+
<code cpp-qt>
 
+
'''Headers required:'''
+
<code cpp>
+
 
#include <qorganizerevent.h>
 
#include <qorganizerevent.h>
 
#include <qorganizermanager.h>
 
#include <qorganizermanager.h>
Line 36: Line 32:
 
In the .pro file, add the following lines:
 
In the .pro file, add the following lines:
  
<code cpp>
+
<code cpp-qt>
 
CONFIG += mobility
 
CONFIG += mobility
 
MOBILITY += organizer
 
MOBILITY += organizer
 
</code>
 
</code>
  
'''Source:'''
+
== Source ==
<code cpp>
+
<code cpp-qt>
 
bool Cyourclass::addEventToCalender(const QString& alabeltext,const QString& aStartDateTime,const QString aEndDateTime)
 
bool Cyourclass::addEventToCalender(const QString& alabeltext,const QString& aStartDateTime,const QString aEndDateTime)
 
{
 
{
Line 56: Line 52:
 
    
 
    
 
     m_organizerEvent.setDisplayLabel(alabeltext);
 
     m_organizerEvent.setDisplayLabel(alabeltext);
     m_organizerEvent.setStartDateTime(start);
+
     m_organizerEvent.setStartDateTime(startdatetime );
     m_organizerEvent.setEndDateTime(end);
+
     m_organizerEvent.setEndDateTime(enddatetime );
  
 
// similarly more fields can be added to the event
 
// similarly more fields can be added to the event

Latest revision as of 04:23, 11 October 2012

The code snippet shows how we can add an event to the native calender application on MeeGo Harmattan device using the QOrganizer API.

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


[edit] Headers

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

In the .pro file, add the following lines:

CONFIG += mobility
MOBILITY += organizer

[edit] 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(startdatetime );
m_organizerEvent.setEndDateTime(enddatetime );
 
// similarly more fields can be added to the event
 
m_manager.saveItem(&m_organizerEvent);
return true;
}
This page was last modified on 11 October 2012, at 04:23.
112 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.

×