×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    45

    Qt + Calendar Interim API

    Hi!

    I need to use CalInterim API in my Qt project, because the Mobility API doesn't contains yet the Calendar API. I just need to add Notifys for some days, and remove them. Is there anybody who did this before? Could someone give an example code, how can I use this Symbian API from Qt?

    Thank you very much!
    Last edited by chriske86; 2010-07-05 at 13:22.

  2. #2
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: Qt + Calendar Interim API

    Hi, chriske

    Quote Originally Posted by chriske86 View Post
    Hi!

    I need to use CalInterim API in my Qt project, because the Mobility API doesn't contains yet the Calendar API. I just need to add Notifys for some days, and remove them. Is there anybody who did this before? Could someone give an example code, how can I use this Symbian API from Qt?

    Thank you very much!
    Qt is library plateform , not the OS of the mobile thats why we are telling Qt for Symbian , or Qt for Meamo.

    You can not run the symbian API or symbian code in Qt library.
    You have to wait for the calendar API in the next Qt mobility version, because you can not use symbian native API.

    Best regards,
    RaHuL

  3. #3
    Registered User
    Join Date
    Feb 2010
    Posts
    45

    Re: Qt + Calendar Interim API

    Thanks for the answer, but I'm using a native Symbian API in Qt, to lock the device orientation... and it's working fine...

  4. #4
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: Qt + Calendar Interim API

    Quote Originally Posted by chriske86 View Post
    Thanks for the answer, but I'm using a native Symbian API in Qt, to lock the device orientation... and it's working fine...
    Some API will work But I dont think calendar API work. Because in Qt mobility API also does not have calendar API,

    The camera API and calendar API are going to be included in the next release.

    Best regards,
    RaHuL

  5. #5
    Registered User
    Join Date
    Feb 2009
    Location
    Poznań, Poland
    Posts
    3

    Re: Qt + Calendar Interim API

    I think you should use CalInterim API to get events' ids or description, convert them to Qt string for displaying. There is calendar example and example for using s60 native API with Qt signals and slots. I'll look for them. Creating events shouldn't be a problem, too. I don't see any reason for CalInterim to not to work when used with Qt ui.

  6. #6
    Registered User
    Join Date
    Aug 2008
    Location
    Warsaw
    Posts
    11

    Re: Qt + Calendar Interim API

    I assume you know a bit of Symbian . Examples could be found on Nokia's web pages.


    #include <e32base.h>
    #include <calsession.h>
    #include <calprogresscallback.h>
    #include <calentryview.h>
    #include <caliterator.h>

    class MCalendarObserver
    {
    virtual void newEntryFound(CCalEntry* calEntry) =0;
    };

    class CCalendarEngine: public MCalProgressCallBack
    {
    public:
    static CCalendarEngine* NewL(MCalendarObserver& iObserver);
    CCalendarEngine(MCalendarObserver& aObserver);
    virtual ~CCalendarEngine();

    void SearchCalendar();

    // Overridden functions of MCalProgressCallBack class
    void Progress(TInt aPercentageCompleted);
    void Completed(TInt aError);
    TBool NotifyProgress();

    private:
    void ConstructL();

    public:
    CCalSession* iCalSession;
    CCalEntryView* iCalEntryView;
    CActiveSchedulerWait* iWaiter;

    private:
    MCalendarObserver& iObserver;

    };

    ---------------------------------

    #include "CalendarEngine.h"

    CCalendarEngine* CCalendarEngine::NewL(MCalendarObserver& iObserver)
    {
    CCalendarEngine* self = new (ELeave) CCalendarEngine(iObserver);
    CleanupStack::PushL(self);
    self->ConstructL();
    CleanupStack::Pop();
    return self;
    }

    CCalendarEngine::CCalendarEngine(MCalendarObserver& aObserver):iObserver(aObserver)
    {
    }

    void CCalendarEngine::ConstructL()
    {
    iCalSession = CCalSession::NewL();
    iCalSession->OpenL(iCalSession->DefaultFileNameL());
    iWaiter = new (ELeave) CActiveSchedulerWait;
    }

    CCalendarEngine::~CCalendarEngine()
    {
    if (iCalSession) {
    delete iCalSession;
    iCalSession = NULL;
    }
    if (iWaiter) {
    delete iWaiter;
    }
    }

    // Called during calendar entry view creation
    void CCalendarEngine::Progress(TInt aProgress)
    {
    }

    // Called on completion of calendar entry view creation
    void CCalendarEngine::Completed(TInt aError)
    {
    iWaiter->AsyncStop();
    }

    // Returns whether or not progress notification is required
    TBool CCalendarEngine::NotifyProgress()
    {
    // Progress notification is required
    return ETrue;
    }

    void CCalendarEngine::SearchCalendar()
    {
    if (iWaiter->IsStarted()) {
    iWaiter->AsyncStop();
    }

    iCalEntryView = CCalEntryView::NewL(*iCalSession, *this);
    iWaiter->Start();

    CCalIter* calIter = CCalIter::NewL(*iCalSession);
    TBuf8<150> iterUID;
    RPointerArray<CCalEntry> calEntryArray;
    iterUID = calIter->FirstL();

    while (iterUID != KNullDesC8) {
    // get entries associated with this UID
    iCalEntryView->FetchL(iterUID, calEntryArray);

    for (TInt k = 0; k < calEntryArray.Count(); k++) {
    // get information from this entry
    CCalEntry* calEntry = calEntryArray[k];
    iObserver.newEntryFound(calEntry);
    }
    iterUID = calIter->NextL();
    };
    calEntryArray.ResetAndDestroy();
    delete calIter;
    delete iCalEntryView;

    }

  7. #7
    Registered User
    Join Date
    Dec 2010
    Posts
    41

    Re: Qt + Calendar Interim API

    It doesn't work, how to instantiate MCalendarObserver?

  8. #8
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Qt + Calendar Interim API

    Quote Originally Posted by diorahman View Post
    It doesn't work, how to instantiate MCalendarObserver?
    basically you donot. in Symbian MCalendarObserver is used to help callbacks.

    If you donot want to go deep in to symbian.c++ then i suggest you check the "Organizer API" in Qt Mobility

  9. #9
    Registered User
    Join Date
    Dec 2010
    Posts
    41

    Re: Qt + Calendar Interim API

    Thanks,

    I tried to manage the example and try to connect it with Qt

    However,

    I found

    Code:
    CCalEntry* CCalHelperEntry::CreateAnnivL()
    {
    // Create unique ID.
    TTime now;
    now.HomeTime();
    TInt64 seed = now.Int64();
    TInt randNum = Math::Rand( seed );
    HBufC8* guid = HBufC8::NewLC(KGuidLength);
    guid->Des().Num( randNum );
    
    //CCalEntry::EMethodNone means that there's no group scheduling
    CCalEntry* anniv = CCalEntry::NewL( CCalEntry::EAnniv, guid,
    CCalEntry::EMethodNone, 0 );
    
    CleanupStack::Pop( guid );
    
    CleanupStack::PushL(anniv);
    TTime startDate(iDate);
    TCalTime time;
    time.SetTimeLocalL(startDate);
    anniv->SetStartAndEndTimeL(time, time);
    
    if (iAlarm) //if there is a alarm
    { 
    delete iAlarmPtr;
    iAlarmPtr=NULL;
    iAlarmPtr = CCalAlarm::NewL(); 
    
    iAlarmPtr->SetTimeOffset(-iAlarmMinutes.Int());
    anniv->SetAlarmL(iAlarmPtr);
    }
    
    CleanupStack::Pop(anniv);
    
    return anniv;
    }
    It introduces error on

    Code:
    anniv->SetStartAndEndTimeL(time, time);
    I initialized the helper as follows:

    Code:
    CCalEntry * nulli = NULL;
    iEntry = CCalHelperEntry::NewL(nulli);
    TTime now;
    now.HomeTime();
    iEntry->SetValues(_L("Test"),now.DateTime(),EFalse, now.DateTime(),0);
    iEntry->SaveValuesL();
    Did I so something wrong?

    Thanks!

Similar Threads

  1. Calendar API Problem
    By stylemeis in forum [Archived] Flash Lite on Nokia Devices
    Replies: 4
    Last Post: 2010-08-04, 11:58
  2. Replies: 5
    Last Post: 2008-05-19, 21:35
  3. Calendar api?
    By kayem in forum Symbian User Interface
    Replies: 7
    Last Post: 2007-11-19, 10:54
  4. Calendar API for 2-nd and 3-rd Edition
    By aisaxi in forum Symbian
    Replies: 0
    Last Post: 2007-10-21, 17:39
  5. Calendar API
    By ticktock in forum Symbian
    Replies: 6
    Last Post: 2007-05-01, 23:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×