Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
abhaymulye
Posts: 28
Registered: ‎09-15-2009
My Device: Not Specified

Re: Setting calendar Event "endTime" not working

Still I did not get,  How can we open the Calendar using Card Invocation ?

 

Please use plain text.
Developer
ekke
Posts: 1,504
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: Setting calendar Event "endTime" not working

you can open Calendar Event using Invokation as Card

you can Open a new event with some data in there - but NOT the end date

So you at first have to create - behind the scenes unvisible for user - the Event conatining start and end time.

THEN you can open this Event in edit mode with CARD invokation

as I understood right - if user cancels you don't want this event in Calendar

so you can ask the ChildCardDone if the user saves or canceled

if canceled you can remove the event using Calendar Services

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

Open Source Enthusiast
blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.
Developer
abhaymulye
Posts: 28
Registered: ‎09-15-2009
My Device: Not Specified

Re: Setting calendar Event "endTime" not working

Still no solution to this.

I created the CalendarEvent in background & then invoked the Calendar as a card, with data as map of already created event.

 

The calendar is opened with correct Subject, Start Date but if i click on "Save" button it shows same message "End time must be after the start time ".

 

If I go manually to calendaer & Events the Event is displayed with correct Start & end time.

 

 

Please use plain text.
Developer
ekke
Posts: 1,504
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: Setting calendar Event "endTime" not working

something like this should work

 

        InvokeRequest request;
	request.setMimeType("text/calendar");
	request.setTarget("sys.pim.calendar.viewer.eventcreate");
	request.setAction("bb.calendar.EDIT");
	QVariantMap map = QVariantMap();
	map["accountId"] = accountId;
	map["eventId"] = eventId;
	map["folder"] = folderId;
	map["startTime"] = startTime;
	request.setData(bb::PpsObject::encode(map));
	mInvokeManager->invoke(request);

 

doing this always

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

Open Source Enthusiast
blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.
Developer
Tobster_
Posts: 262
Registered: ‎07-20-2012
My Device: Blackberry Z10 (White), BlackBerry Dev Alpha C
My Carrier: O2 UK

Re: Setting calendar Event "endTime" not working

Hi Ekke, 

 

I tried your invocation in my applicationUI file:

 

#include "applicationui.hpp"

#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <bb/cascades/AbstractPane>
#include <bb/cascades/LocaleHandler>

#include "timer.hpp"
#include <bb/cascades/SceneCover>
#include <bb/cascades/Container>

using namespace bb::cascades;
using namespace bb::system;

ApplicationUI::ApplicationUI(bb::cascades::Application *app) :
        QObject(app)
{

    m_invokeManager = new InvokeManager(this);
    // prepare the localization
    m_pTranslator = new QTranslator(this);
    m_pLocaleHandler = new LocaleHandler(this);

    bool res = QObject::connect(m_pLocaleHandler, SIGNAL(systemLanguageChanged()), this,
            SLOT(onSystemLanguageChanged()));
    // This is only available in Debug builds
    Q_ASSERT(res);
    // Since the variable is not used in the app, this is added to avoid a
    // compiler warning
    Q_UNUSED(res);

    // initial load
    onSystemLanguageChanged();

    qmlRegisterType<Timer>("CustomTimer", 1, 0, "Timer");

    // Create scene document from main.qml asset, the parent is set
    // to ensure the document gets destroyed properly at shut down.
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);

    qml->setContextProperty("_app", this);

    // Create root object for the UI
    AbstractPane *root = qml->createRootObject<AbstractPane>();

    // Set created root object as the application scene
    Application::instance()->setScene(root);

    QmlDocument *qmlCover = QmlDocument::create("asset:///AppCover.qml").parent(this);

    if (!qmlCover->hasErrors()) {
        // Create the QML Container from using the QMLDocument.
        Container *coverContainer = qmlCover->createRootObject<Container>();

        // Create a SceneCover and set the application cover
        SceneCover *sceneCover = SceneCover::create().content(coverContainer);
        Application::instance()->setCover(sceneCover);
    }
}

void ApplicationUI::onSystemLanguageChanged()
{
    QCoreApplication::instance()->removeTranslator(m_pTranslator);
    // Initiate, load and install the application translation files.
    QString locale_string = QLocale().name();
    QString file_name = QString("WorldCup2014_%1").arg(locale_string);
    if (m_pTranslator->load(file_name, "app/native/qm")) {
        QCoreApplication::instance()->installTranslator(m_pTranslator);
    }
}

void ApplicationUI::invoke()
{
    // Create a new invocation request
    InvokeRequest request;
    request.setMimeType("text/calendar");
    request.setTarget("sys.pim.calendar.viewer.eventcreate");
    request.setAction("bb.calendar.EDIT");
    QVariantMap map = QVariantMap();
    map["accountId"] = accountId;
    map["eventId"] = eventId;
    map["folder"] = folderId;
    map["startTime"] = startTime;
    request.setData(bb::PpsObject::encode(map));
    mInvokeManager->invoke(request);
}

 All of the map objects come up with the error of "... has not been defined in this scop"

Please use plain text.
Developer
ekke
Posts: 1,504
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: Setting calendar Event "endTime" not working

accountId, eventId ... are parameters of my method

you haven#t defined them so the error

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

Open Source Enthusiast
blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.
Developer
oniongarlic
Posts: 72
Registered: ‎10-19-2012
My Device: Playbook, BB10DevAlphaB
My Carrier: Sonera, Saunalahti

Re: Setting calendar Event "endTime" not working

There is no mention of an endTime in the calendar invokation documentation so obviously you can't set that then.

But what there is, is duration, so instead of setting a specific time & date just the duration of your event. That works great in my application.

...
map.insert("subject", title);
map.insert("body", body);
map.insert("startTime", start.toString());
map.insert("duration", duration);
...
Duration is an int, in minutes.
Please use plain text.
Developer
abhaymulye
Posts: 28
Registered: ‎09-15-2009
My Device: Not Specified

Re: Setting calendar Event "endTime" not working

Thanks!!

Setting the "duration" solved my problem.

Please use plain text.
Developer
ekke
Posts: 1,504
Registered: ‎04-08-2010
My Device: Z10 (red Limited Edition), Q10, Z30
My Carrier: Telekom.de, O2, Vodafone

Re: Setting calendar Event "endTime" not working


abhaymulye wrote:

Thanks!!

Setting the "duration" solved my problem.


good to hear

 

I remember a year or more ago where it didn't work

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
International Development Mobile Apps BlackBerry 10 Cascades
Cascades - Workshops / Trainings / Bootcamps

Open Source Enthusiast
blog: http://ekkes-corner.org videos: http://www.youtube.com/user/ekkescorner
bb10-development: http://appbus.org Twitter: @ekkescorner
Please use plain text.