void SMV::buttonClicked(Widget* button) { mEditBox->hideKeyboard(); MAUtil::String str; str = mEditBox->getText(); strcpy(engine->url_path, str.c_str()); int str_c = strlen(engine->url_path); if(engine->url_path[str_c-1] != '/') { engine->url_path[str_c++] = '/'; engine->url_path[str_c] = '\0'; //mEditBox->setText(engine->url_path); } MAHandle directory = maFileOpen(engine->url_path, MA_ACCESS_READ); if (directory < 0) maMessageBox("Uwaga!", "Blad FileOpen!"); else { if (!maFileExists(directory)) maMessageBox("Uwaga!", "Katalog nie istnieje!"); else { maWidgetScreenShow(0); int res = maLocationStart(); if(res<0) maPanic(1, "No GPS available"); engine->read_conf_file(); engine->env_init(); engine->draw(); } } }
/** * Here we handle events from the web view. We turn on or off * location tracking depending of the message sent from JavaScript. */ void handleWidgetEvent(MAWidgetEventData* widgetEvent) { // Handle messages from the WebView widget. if (MAW_EVENT_WEB_VIEW_HOOK_INVOKED == widgetEvent->eventType) { // Get message content, this is the url set in JavaScript. MAUtil::String message = Util::createTextFromHandle( widgetEvent->urlData); // Note: It is very important to free the data handle // when we are done with using it, since a new data object // is allocated for each message. (In the high-level library // this is done automatically.) maDestroyPlaceholder(widgetEvent->urlData); // Check the message string and execute the corresponding syscall. if (0 == message.find("StartTrackingGeoLocation")) { maLocationStart(); } else if (0 == message.find("StopTrackingGeoLocation")) { maLocationStop(); } } }
void SMV::listViewItemClicked(ListView* listView, int index) { maWidgetScreenShow(0); int res = maLocationStart(); if(res<0) maPanic(1, "No GPS available"); engine->selected_dir = index; engine->read_conf_file(); engine->env_init(); engine->draw(); }
/** * Processes Accelerometer Requests from PhoneGap JavaScript */ void PhoneGapSensors::processLocationRequest( MAUtil::String callbackID, bool isWatched) { //Enable accelerometer which is supported in PhoneGap int res = maLocationStart(); if (res < 0) { mMessageHandler->callError( callbackID, PHONEGAP_CALLBACK_STATUS_ERROR, "MoSync: Failed to Start LocationService"); return; } mLocationWatchCallBack = callbackID; mLocationWatchStarted = isWatched; }