Ejemplo n.º 1
0
//
// display a fatal error notification
//
void systemError(const char *message) {
	AppLog("Fatal system error: %s", message);

	if (strspn(message, "Config file buggy:") > 0) {
		Tizen::Io::File::Remove(App::GetInstance()->GetAppDataPath() + DEFAULT_CONFIG_FILE);
		Application::GetInstance()->SendUserEvent(USER_MESSAGE_EXIT_ERR_CONFIG, NULL);
	} else {
		ArrayList *args = new ArrayList();
		args->Construct();
		args->Add(*(new String(message)));
		Application::GetInstance()->SendUserEvent(USER_MESSAGE_EXIT_ERR, args);
	}

	if (g_system) {
		TizenSystem *system = (TizenSystem *)g_system;
		system->exitSystem();
	}
}
Ejemplo n.º 2
0
void
InfoForm::GetProduct(int index)
{
	result r = E_SUCCESS;
	String samsungapps;
	// get appId of Samsung Apps
	r = SystemInfo::GetValue("SamsungAppsAppId", samsungapps);
	AppLog("SamsungAppsAppId %s", r);

	ArrayList *pArrayList = new ArrayList();
	pArrayList->Construct();
	String *uri= new String();
	uri->Append(L"samsungapps://ProductDetail/"+*__pProducts[index][0]);
	pArrayList->Add(*uri);

	AppManager *pAppManager = AppManager::GetInstance();
	// Launch Samsung Apps with uri
	pAppManager->LaunchApplication(samsungapps, pArrayList, AppManager::LAUNCH_OPTION_DEFAULT);
}
void ItemForm::OpenPostInDefaultBrowser() {

	String url;
	url.Append(L"url:");
	url.Append(pFeedItem->link);

	ArrayList* pDataList = null;
	pDataList = new ArrayList();
	pDataList->Construct();
	pDataList->Add(url);

	AppControl* pAc = AppManager::FindAppControlN(APPCONTROL_PROVIDER_BROWSER, APPCONTROL_OPERATION_VIEW);
	pAc->Start(pDataList, null);
	delete pAc;

	pDataList->RemoveAll(false);
	delete pDataList;

}
Ejemplo n.º 4
0
void
ShareMenu::LoadEmailWnd(void)
{
	ArrayList* pDataList = null;
	String text(__shareContent);

	pDataList = new ArrayList();
	pDataList->Construct();

	String* pData = null;
	pData = new String(L"subject:");

	String emailText;
	Application::GetInstance()->GetAppResource()->GetString(L"IDS_SHARE_SUBJECT", emailText);
	pData->SetCapacity(pData->GetCapacity() + emailText.GetCapacity());
	pData->Append(emailText);
	pDataList->Add(*pData);

	String* pData2 = null;
	pData2 = new String(L"text:");
	pData2->SetCapacity(pData2->GetCapacity() + __shareContent.GetCapacity());
	pData2->Append(__shareContent);
	pDataList->Add(*pData2);

	if(__isLink == false)
	{
	   String* pData3 = null;
	   pData3 = new String(L"attachments:");
	   pData3->SetCapacity(pData3->GetCapacity() + __shareContent.GetCapacity());
	   pData3->Append(__shareContent);
	   pDataList->Add(*pData3);
	}

	AppControl* pAc = AppManager::FindAppControlN(APPCONTROL_PROVIDER_EMAIL, APPCONTROL_OPERATION_EDIT);
	if(pAc)
	{
	  pAc->Start(pDataList, null);
	  delete pAc;
	}
	pDataList->RemoveAll(true);
	delete pDataList;
}
Ejemplo n.º 5
0
void
WebForm::LaunchBrowser(const String& url) {
	ArrayList* pDataList = null;
	pDataList = new ArrayList();
	pDataList->Construct();

	String* pData = null;
	pData = new String(L"url:");
	pData->Append(url);
	AppLogDebug("Launching Stock Browser with %S", pData->GetPointer());
	pDataList->Add(*pData);

	AppControl* pAc = AppManager::FindAppControlN(APPCONTROL_BROWSER, "");
	if(pAc) {
		pAc->Start(pDataList, null);
		delete pAc;
	}
	pDataList->RemoveAll(true);
	delete pDataList;
}
Ejemplo n.º 6
0
void
LoginForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
{
	SceneManager* pSceneManager = SceneManager::GetInstance();
	AppAssert(pSceneManager);

	ArrayList* pList = new (std::nothrow)ArrayList;
	AppAssert(pList);
	pList->Construct();

	switch(actionId)
	{
	case IDA_BUTTON_JOIN:
		pList->Add( new Tizen::Base::Integer(1) );	// isJoin
		pSceneManager->GoForward(ForwardSceneTransition(SCENE_JOIN, SCENE_TRANSITION_ANIMATION_TYPE_DEPTH_IN), pList);
		break;
	case IDA_BUTTON_LOGIN:
		doLogin();
		break;
	}
}
Ejemplo n.º 7
0
void
Kamera::GetPicture() {
	AppLogDebug("Taking picture");

	ArrayList* pDataList = null;
	pDataList = new ArrayList();
	pDataList->Construct();

	String* pData = null;
	pData = new String(L"type:camera");
	pDataList->Add(*pData);

	AppControl* pAc = AppManager::FindAppControlN(APPCONTROL_CAMERA, OPERATION_CAPTURE);
	if(pAc)
	{
	  pAc->Start(pDataList, this);
	  delete pAc;
	}
	pDataList->RemoveAll(true);
	delete pDataList;
}
Ejemplo n.º 8
0
/**
 * The entry function of Tizen C++ application called by the operating system.
 */
int
OspMain(int argc, char* pArgv[])
{
	result r = E_SUCCESS;

	AppLog("Application started.");
	ArrayList args;
	args.Construct();
	for (int i = 0; i < argc; i++)
	{
		args.Add(*(new (std::nothrow) String(pArgv[i])));
	}

	r = Tizen::App::Application::Execute(WebViewer::CreateInstance, &args);
	TryLog(r == E_SUCCESS, "Application execution failed-[%s].", GetErrorMessage(r));

	args.RemoveAll(true);
	AppLog("Application finished.");

	return static_cast< int >(r);
}
Ejemplo n.º 9
0
/**
 * The entry function of bada application called by the operating system.
 */
int OspMain(int argc, char *pArgv[]) {
	result r = E_SUCCESS;

	AppLog("Application started.");
	ArrayList* pArgs = new ArrayList();
	pArgs->Construct();
	for (int i = 0; i < argc; i++)
		pArgs->Add(*(new String(pArgv[i])));

	start_profile();
	r = Osp::App::Application::Execute(LearnABC::CreateInstance, pArgs);
	if (IsFailed(r)) {
		AppLogException("Application execution failed-[%s].", GetErrorMessage(r));
		r &= 0x0000FFFF;
	}
	end_profile();

	pArgs->RemoveAll(true);
	delete pArgs;
	AppLog("Application finished.");

	return static_cast<int>(r);
}
Ejemplo n.º 10
0
void UserForm::OpenDialog() {
	ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);

	JsonObject *dialogJson = new JsonObject();
	dialogJson->Construct();

	int uid;
	JsonParseUtils::GetInteger(*_pUserJson, L"id", uid);

	const String * userId = new String(L"user_id");
	JsonNumber *const userIdNumber = new JsonNumber(uid);
	dialogJson->Add(userId, userIdNumber);

	const String * userJson = new String(L"user_json");
	JsonObject *const constPtr = _pUserJson->CloneN();
	dialogJson->Add(userJson, constPtr);

	pList->Construct(1);
	pList->Add(dialogJson);

	SceneManager* pSceneManager = SceneManager::GetInstance();
	pSceneManager->GoForward(ForwardSceneTransition(SCENE_DIALOG, SCENE_TRANSITION_ANIMATION_TYPE_RIGHT), pList);
}
Ejemplo n.º 11
0
/**
 * The entry function of Tizen application called by the operating system.
 */
int
OspMain(int argc, char *pArgv[])
{
    result r = E_SUCCESS;

    ArrayList* pArgs = new ArrayList();
    pArgs->Construct();
    for (int i = 0; i < argc; i++)
    {
        pArgs->Add(*(new String(pArgv[i])));
    }

    r = Tizen::App::UiApp::Execute(QrCodeRecognizer::CreateInstance, pArgs);
    if (IsFailed(r))
    {
        AppSecureLogException("Application execution failed-[%s].", GetErrorMessage(r));
        r &= 0x0000FFFF;
    }

    pArgs->RemoveAll(true);
    delete pArgs;

    return static_cast<int>(r);
}
result
CameraRecorderForm::__ViewVideo(Osp::Base::String& videoPath)
{
	result r = E_SUCCESS;
	AppControl* pAc = AppManager::FindAppControlN(APPCONTROL_PROVIDER_VIDEO, APPCONTROL_OPERATION_PLAY);
	if(pAc != null)
	{
		AppLog("Video player started.");
		ArrayList* pDataList = null;
		pDataList = new ArrayList();
		pDataList->Construct();
		String* pData = null;

		pData = new String(L"type:video");
		pDataList->Add(*pData);

		pData = new String(L"path:");
		(*pData).Append(videoPath);
		pDataList->Add(*pData);

		r = pAc->Start(pDataList, null);

		delete pAc;
		pAc = null;

		pDataList->RemoveAll(true);
		delete pDataList;

	}
	else
	{
		r  = E_OBJ_NOT_FOUND;
	}

	return r;
}
ArrayList * VKUMessagesListItemProvider::GetMessageElementsN(const JsonObject *pMessageJson, int itemWidth) {
	AppLog("enter VKUMessagesListItemProvider::GetMessageElementsN");
	result r;

	// general
	ArrayList* pResultArray;

	// body stuff
	String messageText;
	MessageTextElement *pMessageTextElement;

	// attachs stuff
	IJsonValue *attachs;
	JsonArray * pAttachArray;
	int out;
	int emoji = 0;

	pResultArray = new ArrayList(SingleObjectDeleter);
	r = pResultArray->Construct(1);
	TryCatch(r == E_SUCCESS, , "pResultArray->Construct");
	JsonParseUtils::GetInteger(*pMessageJson, L"out", out);

	JsonObject * geoObject;
	r = JsonParseUtils::GetObject(pMessageJson, L"geo", geoObject);

	if (r == E_SUCCESS) {
		AppLog("Message has geo entry, receiving");
		MessageLocationElement * pLocationElement = new MessageLocationElement();
		pLocationElement->Construct(Rectangle(0, 0, 400, 400), geoObject);

		pResultArray->Add(pLocationElement);
	}

	r = JsonParseUtils::GetString(*pMessageJson, L"body", messageText);
	TryCatch(r == E_SUCCESS, , "JsonParseUtils::GetString body");

	JsonParseUtils::GetInteger(*pMessageJson, L"emoji", emoji);

	if (messageText.GetLength() != 0) {
		AppLog("Message has text entry, receiving");
		pMessageTextElement = new MessageTextElement();
		pMessageTextElement->Construct(Rectangle(0, 0, itemWidth-200, 10000));
		pMessageTextElement->SetText(messageText, emoji);

		pResultArray->Add(pMessageTextElement);
	}


	static const String attachConst(L"attachments");
	r = pMessageJson->GetValue(&attachConst, attachs);

	if (r == E_SUCCESS)
		pAttachArray = static_cast<JsonArray *>(attachs);

	for (int i=0; r == E_SUCCESS && i<pAttachArray->GetCount(); i++) {
		AppLog("Message has %d attachments, receiving %d", pAttachArray->GetCount(), i);

		IJsonValue *pAttachValue;
		JsonObject *pAttachObject;
		String attachType;

		MessageElement *pMessageElement;

		pAttachArray->GetAt(i, pAttachValue);

		pAttachObject = static_cast<JsonObject *>(pAttachValue);

		JsonParseUtils::GetString(*pAttachObject, L"type", attachType);

		if (attachType == L"photo") {
			AppLog("Message has photo, receiving");
			String imageUrl;

			IJsonValue *pPhotoValue;
			JsonObject *pPhotoObject;

			Rectangle thumbSize;

			int width = 0, height = 0;

			static const String photoConst(L"photo");

			pAttachObject->GetValue(&photoConst, pPhotoValue);
			pPhotoObject = static_cast<JsonObject *>(pPhotoValue);

			JsonParseUtils::GetString(*pPhotoObject, L"photo_604", imageUrl);
			JsonParseUtils::GetInteger(*pPhotoObject, L"width", width);
			JsonParseUtils::GetInteger(*pPhotoObject, L"height", height);

			if (width != 0 && height != 0) {
				thumbSize = ImageUtils::ScaleTo(320, Rectangle(0, 0, width, height));
			} else {
				thumbSize = Rectangle(0, 0, 320, 240);
			}

			MessagePhotoElement * pPhotoElement = new MessagePhotoElement();
			pPhotoElement->Construct(thumbSize, imageUrl);

			pMessageElement = static_cast<MessageElement *>(pPhotoElement);;

		} else if (attachType == L"video") {
			AppLog("Message has video, receiving");

//			IJsonValue *pVideoValue;
//			JsonObject *pVideoObject;
//
//			static const String videoConst(L"video");
//
//			pAttachObject->GetValue(&videoConst, pVideoValue);
//			pVideoObject = static_cast<JsonObject *>(pVideoValue);

			JsonObject *pVideoObject;
			JsonParseUtils::GetObject(pAttachObject, L"video", pVideoObject);

			MessageVideoElement *pVideoElement = new MessageVideoElement();
			pVideoElement->Construct(Rectangle(0, 0, 320, 240), pVideoObject);

			pMessageElement = static_cast<MessageElement *>(pVideoElement);

		} else if (attachType == L"audio") {
			AppLog("Message has audio, receiving");

			JsonObject *pAudioObject;
			JsonParseUtils::GetObject(pAttachObject, L"audio", pAudioObject);

			MessageAudioElement *pMessageAudioEleemnt = new MessageAudioElement();
			pMessageAudioEleemnt->Construct(Rectangle(0, 0, 520, 240), pAudioObject, out);

			pMessageElement = dynamic_cast<MessageElement *>(pMessageAudioEleemnt);

		} else if (attachType == L"doc") {
			AppLog("Message has doc, receiving");

			JsonObject *pDocObject;
			JsonParseUtils::GetObject(pAttachObject, L"doc", pDocObject);

			MessageDocElement * pDocElement = new MessageDocElement();
			pDocElement->Construct(Rectangle(0, 0, 520, 90), pDocObject, out);

			pMessageElement = static_cast<MessageElement * >(pDocElement);
		} else if (attachType == L"wall") {
			AppLog("Message has wall, receiving");

			JsonObject *pWallObject;
			JsonParseUtils::GetObject(pAttachObject, L"wall", pWallObject);

			MessageWallElement * pWallElement = new MessageWallElement();
			pWallElement->Construct(Rectangle(0, 0, 320, 240), pWallObject, out);

			pMessageElement = dynamic_cast<MessageElement *>(pWallElement);
		}

		pResultArray->Add(pMessageElement);
	}

	JsonArray *forwardedMessages;
	r = JsonParseUtils::GetArray(pMessageJson, L"fwd_messages", forwardedMessages);
	AppLog("Message has forwardedMessages?");
	for (int i=0; r == E_SUCCESS && i<forwardedMessages->GetCount(); i++) {
		AppLog("Message has forwardedMessages, receiving %d", i);

		JsonObject *fwdMessage;

		JsonParseUtils::GetObject(forwardedMessages, i, fwdMessage);

		MessageForwardedElement *pForwardedElement = new MessageForwardedElement();
		pForwardedElement->Construct(Rectangle(0, 0, 500, 40000), fwdMessage, out);

		MessageElement *pMessageElement;
		pMessageElement = static_cast<MessageForwardedElement *>(pForwardedElement);

		pResultArray->Add(pMessageElement);
	}

	AppLog("Message has done");

	return pResultArray;

CATCH:
	AppLogException("VKUMessagesListItemProvider::GetMessageElementsN is failed. %s", GetErrorMessage(r));
	return pResultArray;
}
Ejemplo n.º 14
0
void
ProjectGiraffeTab4::connectionDidFinish(HttpConnection *connection, HashMap *response)
{
	/*
	if (response) {
		String userKey("user");
		String messageKey("message");
		String errorKey("error");
		if (response->ContainsKey(userKey)) {
			HashMap *userDict = (HashMap *)response->GetValue(userKey);
			User::currentUser()->updateFromDictionary(userDict);

//			showProfile();

			String *message = (String *)response->GetValue(messageKey);
			showStatus("User Update Status", *message, false);
		} else if (response->ContainsKey(errorKey)) {
			String *errorMessage = (String *)response->GetValue(errorKey);

			// Flash error message
			showStatus("User Update Status", *errorMessage, true);

			Draw();
		}

		delete connection;
//		delete response;
	}
	*/
	AppLog("HttpConnection finished");
	if (response) {
		// TODO: check for the return value
		ArrayList *graffitiList = static_cast<ArrayList *>(response->GetValue(kHTTPParamNameGraffiti));
		if (graffitiList) {
			AppLog("Retrieved list");
			ArrayList *newItems = new ArrayList(SingleObjectDeleter);
			newItems->Construct();

			for (int i = 0; i < graffitiList->GetCount(); i++) {
				HashMap *graffitiDictionary = static_cast<HashMap *>(graffitiList->GetAt(i));
				AppLog("updating dictionary");
				if (graffitiDictionary) {
					Graffiti *newGraffiti = new Graffiti();
					newGraffiti->updateFromDictionary(graffitiDictionary);
					newGraffiti->setUser(User::currentUser());
					AppLog("Updated from dictionary");
					newItems->Add(newGraffiti);
				}
			}
			if(graffitiList->GetCount() == 0){
				AppLog("No graffiti to display");
				displayNoGraffiti();
			}
			AppLog("Setting new items");
			setItems(newItems);
		}else{
			AppLog("Failed to retrieve graffiti list");
			displayNoGraffiti();
		}
	} else {

		connectionDidFail(connection);
	}
}
Ejemplo n.º 15
0
void
EditEventForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
{
	result r = E_SUCCESS;

	SceneManager* pSceneManager = SceneManager::GetInstance();
	AppAssert(pSceneManager);

	ScrollPanel* pScrollPanel = static_cast< ScrollPanel* >(GetControl(0));
	AppAssert(pScrollPanel);

	static const int CONTEXT_POSITION = 200;

	switch (actionId)
	{
	case ID_BUTTON_REMINDER:
		__pReminderContextMenu->SetAnchorPosition(Point(__pReminderContextMenu->GetAnchorPosition().x, source.GetBounds().y + CONTEXT_POSITION - pScrollPanel->GetScrollPosition()));
		__pReminderContextMenu->SetFocusable(true);
		__pReminderContextMenu->SetShowState(true);
		__pReminderContextMenu->Show();
		break;

	case ID_CONTEXT_REMINDER_MINUTE:
		__selectedReminder = REMINDER_TIME_UNIT_MINUTE;
		__pReminderContextButton->SetText(L"Minute(s)");
		__pReminderContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_REMINDER_HOUR:
		__selectedReminder = REMINDER_TIME_UNIT_HOUR;
		__pReminderContextButton->SetText(L"Hour(s)");
		__pReminderContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_REMINDER_DAY:
		__selectedReminder = REMINDER_TIME_UNIT_DAY;
		__pReminderContextButton->SetText(L"Day(s)");
		__pReminderContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_REMINDER_WEEK:
		__selectedReminder = REMINDER_TIME_UNIT_WEEK;
		__pReminderContextButton->SetText(L"Week(s)");
		__pReminderContextButton->Invalidate(false);
		break;

	case ID_BUTTON_RECURRENCE:
	{
		ArrayList* pList = new (std::nothrow) ArrayList();
		pList->Construct();

		DateTime startDate = __pStartEditDate->GetDate();
		DateTime endDate = __pEndEditDate->GetDate();

		pList->Add(*(new (std::nothrow) DateTime(startDate)));
		pList->Add(*(new (std::nothrow) DateTime(endDate)));

		if (__pRecurrence != null)
		{
			pList->Add(*(new (std::nothrow) Recurrence(*__pRecurrence)));
		}

		pSceneManager->GoForward(ForwardSceneTransition(SCENE_EVENT_SETRECURRENCE), pList);
	}
	break;

	case ID_BUTTON_PRIORITY:
		__pPriorityContextMenu->SetAnchorPosition(Point(__pPriorityContextMenu->GetAnchorPosition().x, source.GetBounds().y + CONTEXT_POSITION - pScrollPanel->GetScrollPosition()));
		__pPriorityContextMenu->SetFocusable(true);
		__pPriorityContextMenu->SetShowState(true);
		__pPriorityContextMenu->Show();
		break;

	case ID_CONTEXT_PRIORITY_HIGH:
		__selectedPriority = EVENT_PRIORITY_HIGH;
		__pPriorityContextButton->SetText(L"High");
		__pPriorityContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_PRIORITY_NORMAL:
		__selectedPriority = EVENT_PRIORITY_NORMAL;
		__pPriorityContextButton->SetText(L"Normal");
		__pPriorityContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_PRIORITY_LOW:
		__selectedPriority = EVENT_PRIORITY_LOW;
		__pPriorityContextButton->SetText(L"Low");
		__pPriorityContextButton->Invalidate(false);
		break;

	case ID_BUTTON_SENSITIVITY:
		__pSensitivityContextMenu->SetAnchorPosition(Point(__pSensitivityContextMenu->GetAnchorPosition().x, source.GetBounds().y + CONTEXT_POSITION - pScrollPanel->GetScrollPosition()));
		__pSensitivityContextMenu->SetFocusable(true);
		__pSensitivityContextMenu->SetShowState(true);
		__pSensitivityContextMenu->Show();
		break;

	case ID_CONTEXT_SENSITIVITY_PUBLIC:
		__selectedSensitivity = SENSITIVITY_PUBLIC;
		__pSensitivityContextButton->SetText(L"Public");
		__pSensitivityContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_SENSITIVITY_PRIVATE:
		__selectedSensitivity = SENSITIVITY_PRIVATE;
		__pSensitivityContextButton->SetText(L"Private");
		__pSensitivityContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_SENSITIVITY_CONFIDENTIAL:
		__selectedSensitivity = SENSITIVITY_CONFIDENTIAL;
		__pSensitivityContextButton->SetText(L"Confidential");
		__pSensitivityContextButton->Invalidate(false);
		break;

	case ID_BUTTON_STATUS:
		__pStatusContextMenu->SetAnchorPosition(Point(__pStatusContextMenu->GetAnchorPosition().x, source.GetBounds().y + CONTEXT_POSITION - pScrollPanel->GetScrollPosition()));
		__pStatusContextMenu->SetFocusable(true);
		__pStatusContextMenu->SetShowState(true);
		__pStatusContextMenu->Show();
		break;

	case ID_CONTEXT_STATUS_NONE:
		__selectedStatus = EVENT_STATUS_NONE;
		__pStatusContextButton->SetText(L"None");
		__pStatusContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_STATUS_CONFIRMED:
		__selectedStatus = EVENT_STATUS_CONFIRMED;
		__pStatusContextButton->SetText(L"Confirmed");
		__pStatusContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_STATUS_CANCELLED:
		__selectedStatus = EVENT_STATUS_CANCELLED;
		__pStatusContextButton->SetText(L"Cancelled");
		__pStatusContextButton->Invalidate(false);
		break;

	case ID_CONTEXT_STATUS_TENTATIVE:
		__selectedStatus = EVENT_STATUS_TENTATIVE;
		__pStatusContextButton->SetText(L"Tentative");
		__pStatusContextButton->Invalidate(false);
		break;

	case ID_CHKBUTTON_ISALLDAY_CHECKED:
	{
		if (__pStartEditTime != null)
		{
			__pStartEditTime->SetShowState(false);
		}

		if (__pEndEditTime != null)
		{
			__pEndEditTime->SetShowState(false);
		}
	}
	break;

	case ID_CHKBUTTON_ISALLDAY_UNCHECKED:
	{
		if (__pStartEditTime != null)
		{
			__pStartEditTime->SetShowState(true);
		}

		if (__pEndEditTime != null)
		{
			__pEndEditTime->SetShowState(true);
		}
	}
	break;

	case ID_FOOTER_SAVE:
		if (__pSubjectEditField->GetText().IsEmpty())
		{
			MessageBox messageBox;
			messageBox.Construct(L"Error", "Please enter the subject", MSGBOX_STYLE_OK, 0);
			int doModal;
			messageBox.ShowAndWait(doModal);
		}
		else
		{
			if (__pCalEvent != null)
			{
				r = UpdateEvent();
				TryReturnVoid(!IsFailed(r), "[%s] Failed to edit event.", GetErrorMessage(r));
			}
			else
			{
				MessageBox messageBox;
				messageBox.Construct(L"Error", "Failed to edit the event.", MSGBOX_STYLE_OK, 0);
				int doModal;
				messageBox.ShowAndWait(doModal);
			}

			pSceneManager->GoBackward(BackwardSceneTransition(SCENE_EVENT_LIST));
		}
		break;

	}

}
Ejemplo n.º 16
0
void
FCarAddEdit::OnActionPerformed(const Control& source, int actionId)
{
	Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
	if (actionId == ID_CANCEL){
		bool issaved = false;
		if (!this->detailmode) {
		if (CheckIfDataChanged()) {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Confirm cancel", "Car data changed. Save data?", MSGBOX_STYLE_YESNO, 10000);
			msgbox.ShowAndWait(modalResult);
			if (modalResult == MSGBOX_RESULT_YES) {
				if (Save() == false) {
					return;
				} else {
					issaved = true;
				}
			}
		}
		}
		if (this->formtype == 2) {
			FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
			if (issaved) {
				carconclass_->SetLastSelectedID(this->itemid);
				FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
				pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
			} else {
				ArrayList * list = new ArrayList;
				list->Construct();
				list->Add(*(new Integer(2)));
				pFormMgr->SendUserEvent(FormMgr::REQUEST_SETTINGSFORM, list);
			}
		} else {
		if ((!this->detailform) || (this->detailmode)) {
			FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
			ArrayList * list = new ArrayList;
			list->Construct();
			list->Add(*(new Integer(this->itemid)));
			pFormMgr->SendUserEvent(FormMgr::REQUEST_CARSELECTFORM, list);
		} else {
			OnActionPerformed(source, ID_DETAIL);
		}
		}
	} else if (actionId == ID_SAVE) {
		if (Save() == false) {
			return;
		}
		if (this->formtype == 2) {
		carconclass_->SetLastSelectedID(this->itemid);
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
		} else {
		if (!this->detailform) {
			FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
			ArrayList * list = new ArrayList;
			list->Construct();
			list->Add(*(new Integer(this->itemid)));
			pFormMgr->SendUserEvent(FormMgr::REQUEST_CARSELECTFORM, list);
		} else {
			OnActionPerformed(source, ID_DETAIL);
		}
		}
	} else if (actionId == ID_SELECTFUELTYPEPOPUPOK) {
		fueltypesselectedarray_.RemoveAll();
		int checkeditemindex;
		int fueltypeid;
		checkeditemindex = pListSelectFuelTypes_->GetFirstCheckedItemIndex();
		while (checkeditemindex > -1) {
			fueltypeid = pListSelectFuelTypes_->GetItemIdAt(checkeditemindex);
			fueltypesselectedarray_.Add(fueltypeid);
			checkeditemindex = pListSelectFuelTypes_->GetNextCheckedItemIndexAfter(checkeditemindex);
		}
		controlhandler_->SetValue(this,L"CB_4_fueltypestring", GetFuelTypesString());
		pPopup_->SetShowState(false);
		this->SetFocus();
		RequestRedraw(true);
	} else if (actionId == ID_ADDNEWFUELTYPEPOPUPCANCEL) {
		pAddnewfueltypepopup_->SetShowState(false);
		this->SetFocus();
		RequestRedraw(true);
	} else if (actionId == ID_ADDNEWFUELTYPEPOPUPSAVE) {
		Osp::Ui::Controls::EditField *pAddnewfueltypepopupEditField_ = static_cast<EditField *>(pAddnewfueltypepopup_->GetControl(L"IDC_EDITFIELD1"));
		String tmps = pAddnewfueltypepopupEditField_->GetText();
		tmps.Trim();
		if (tmps == "") {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Empty value!", "Input fuel type caption!", MSGBOX_STYLE_OK, 10000);
			msgbox.ShowAndWait(modalResult);
		} else {
			FuelTypeData fueltypedata_;
			fueltypedata_.Caption = tmps;
			fueltypedata_.ID = 0;
			carconclass_->SaveFuelTypeData(fueltypedata_);
			pListSelectFuelTypes_->AddItem(&fueltypedata_.Caption, null, null, null, fueltypedata_.ID);
			int selecteditemindex = pListSelectFuelTypes_->GetItemIndexFromItemId(fueltypedata_.ID);
			if (selecteditemindex > -1) {
				pListSelectFuelTypes_->SetItemChecked(selecteditemindex, true);
			}
			pListSelectFuelTypes_->ScrollToBottom();
			pAddnewfueltypepopup_->SetShowState(false);
			RequestRedraw(true);
		}
	} else if (actionId == ID_SELECTFUELTYPEPOPUPADD) {
		Osp::Ui::Controls::EditField *pAddnewfueltypepopupEditField_ = static_cast<EditField *>(pAddnewfueltypepopup_->GetControl(L"IDC_EDITFIELD1"));
		pAddnewfueltypepopupEditField_->SetText(L"");
		pAddnewfueltypepopup_->SetShowState(true);
		pAddnewfueltypepopup_->Show();
	} else if (actionId == ID_BUTTON_EDITFIELD_DONE) {
		int actiondone = controlhandler_->ActionDone(this, source);
		if ((actiondone == ControlHandler::ACTIONDONERESULT_HIDEKEYPAD) || (actiondone == ControlHandler::ACTIONDONERESULT_OPENCOMBOBOX)) {
			ScrollPanel * vpScrollPanel = static_cast<ScrollPanel *> (GetControl(L"IDC_SCROLLPANEL1"));
			vpScrollPanel->CloseOverlayWindow();
		}
		if (actiondone == ControlHandler::ACTIONDONERESULT_OPENCOMBOBOX) {
			pPopup_->SetShowState(true);
			pPopup_->Show();
		}
	} else if (actionId == ID_BUTTON_EDITFIELD_CLOSE) {
		ScrollPanel * vpScrollPanel = static_cast<ScrollPanel *> (GetControl(L"IDC_SCROLLPANEL1"));
		vpScrollPanel->CloseOverlayWindow();
	} else if ((actionId == ID_EDIT) || (actionId == ID_DETAIL)) {
		this->SetFocus();
		if (actionId == ID_DETAIL) {
			ReloadSavedData();
		}
		this->detailmode = (actionId == ID_DETAIL);
		DetailEditMode();
		RequestRedraw(true);
	}
}
Ejemplo n.º 17
0
	void SendEvent(Control *control) {
		ArrayList *list = new ArrayList(NoOpDeleter);
		list->Construct(1);
		list->Add(_bitmap);
		control->SendUserEvent(BITMAP_LOADED, list); // BITMAP_LOADED_EVENT
	}
Ejemplo n.º 18
0
void
ProfileListForm::OnListViewItemStateChanged(Tizen::Ui::Controls::ListView& listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status)
{
	if (status == LIST_ITEM_STATUS_SELECTED)
	{
	    AppLog("OnListViewItemLongPressed.2222");

	    SceneManager* pSceneManager = SceneManager::GetInstance();
		AppAssert(pSceneManager);

		ArrayList* pList = new (std::nothrow) ArrayList();
		pList->Construct();
	    result r= E_SUCCESS;
	    __currentIndex = index;

	    DbEnumerator* pEnum;
	    DbStatement* pStmt;

	    pStmt = __pProfileDatabase->CreateStatementN(L"SELECT title, "
	    		"year, month, day, hour, minute, "
	    		"year2, month2, day2, hour2, minute,2 "
	    				"latitude, longitude, volume, wifi, memo FROM profile WHERE id = ?");
	    Integer* itemId = static_cast<Integer*>(__pIndexList.GetAt(index));
	    pList->Add(*new (std::nothrow) Integer(index/**itemId*/));
	    r = pStmt->BindInt(0, itemId->ToInt());
	    pEnum = __pProfileDatabase->ExecuteStatementN(*pStmt);
	    if (pEnum) {
	        String title;
	        pEnum->MoveNext();
	        r = pEnum->GetStringAt(0, title);
		    pList->Add(*new (std::nothrow) String(title));
		    int intItem;
		    double item;
	        r = pEnum->GetIntAt(1, intItem);	//year
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(2, intItem);	//month
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(3, intItem);	//day
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(4, intItem);	//hour
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(5, intItem);	//minute
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(6, intItem);	//year2
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(7, intItem);	//month2
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(8, intItem);	//day2
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(9, intItem);	//hour2
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(10, intItem);	//minute2
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetDoubleAt(11, item);	//latitude
		    pList->Add(*new (std::nothrow) Double(item));
	        r = pEnum->GetDoubleAt(12, item);	//longitude
		    pList->Add(*new (std::nothrow) Double(item));
	        r = pEnum->GetIntAt(13, intItem);	//volume
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetIntAt(14, intItem);	//wifi
		    pList->Add(*new (std::nothrow) Integer(intItem));
	        r = pEnum->GetStringAt(15, title);	//memo
		    pList->Add(*new (std::nothrow) String(title));
	        delete pEnum;
	    }
	    delete pStmt;
		pSceneManager->GoForward(ForwardSceneTransition(SCENE_DETAIL), pList);
	    __isUpdateMode = true;
	}
}
Ejemplo n.º 19
0
void
FTrip::OnActionPerformed(const Control& source, int actionId)
{
	Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame();
	if ((actionId == ID_EDIT) || (actionId == ID_DETAIL)) {
		if (this->selecteditemid > 0) {
			FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
			ArrayList * list = new ArrayList;
			list->Construct();
			list->Add(*(new Integer(this->selecteditemid)));
			if (actionId == ID_EDIT) {
				pFormMgr->SendUserEvent(FormMgr::REQUEST_TRIPADDEDIT, list);
			} else {
				pFormMgr->SendUserEvent(FormMgr::REQUEST_TRIPDETAIL, list);
			}
		} else {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Record not selected!", "Please select record you want to edit.", MSGBOX_STYLE_OK, 10000);
			msgbox.ShowAndWait(modalResult);
		}
	} else if (actionId == ID_DELETE) {
		if (this->selecteditemid > 0) {
			MessageBox msgbox;
			int modalResult = 0;
			if (carconclass_->DeleteTripData(this->selecteditemid, true) == false) {
				msgbox.Construct("Can't delete trip!", "Trip is selected in reference table!", MSGBOX_STYLE_OK, 10000);
				msgbox.ShowAndWait(modalResult);
			} else {
				msgbox.Construct("Delete trip?", "Do you really want to delete trp?", MSGBOX_STYLE_YESNO, 10000);
				msgbox.ShowAndWait(modalResult);
				if (modalResult == MSGBOX_RESULT_YES) {
					Osp::Ui::Controls::Popup* pPopup_;
					pPopup_ = new Popup();
					Dimension dim(300, 50);
					pPopup_->Construct(true, dim);
					pPopup_->SetTitleText(L"Deleting please wait...");
					pPopup_->SetShowState(true);
					pPopup_->Show();
					carconclass_->DeleteTripData(this->selecteditemid);
					int selecteditemindex = pExList->GetItemIndexFromItemId(this->selecteditemid);
					if (selecteditemindex > -1) {
						pExList->RemoveItemAt(selecteditemindex);
					}
					this->selecteditemid = 0;
					pPopup_->SetShowState(false);
					delete pPopup_;
					RequestRedraw(true);
				}
			}
		} else {
			MessageBox msgbox;
			int modalResult = 0;
			msgbox.Construct("Record not selected!", "Please select record you want to delete.", MSGBOX_STYLE_OK, 10000);
			msgbox.ShowAndWait(modalResult);
		}
	} else if (actionId == ID_ADD) {
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->SendUserEvent(FormMgr::REQUEST_TRIPADDEDIT, null);
	} else if (actionId == ID_BACK) {
		FormMgr *pFormMgr = static_cast<FormMgr *>(pFrame->GetControl("FormMgr"));
		pFormMgr->SendUserEvent(FormMgr::REQUEST_MAINFORM, null);
	} else if (actionId == ID_CLEARSEARCH) {
		SearchAction(L"");
	}
}
void ForUsDocForm::OnActionPerformed(const Tizen::Ui::Control& source,
		int actionId) {

	int year = __pSelectCalendar->GetTimeField(TIME_FIELD_YEAR);
	int month = __pSelectCalendar->GetTimeField(TIME_FIELD_MONTH);

	result r = E_SUCCESS;

	String port = "39000";
	int __iport = 39000;
	bool __isProtocol = false;
	bool __isServer = true;

	SceneManager* pSceneManager = SceneManager::GetInstance();
	AppAssert(pSceneManager);

	ArrayList* pList = new (std::nothrow) ArrayList;
	AppAssert(pList);

	__year = year;
	__month = month;

	switch (actionId) {
	case ID_BUTTON_PREV_MONTH_ID:
		TryReturnVoid((year > 1) || (month > 1), "At first page");
		__pSelectCalendar->AddTimeField(TIME_FIELD_MONTH, -1);
		AppLog("PREV_MONTH Button is clicked\n");
		break;
	case ID_BUTTON_NEXT_MONTH_ID:
		TryReturnVoid((year < 9999) || (month < 12), "At last page");
		__pSelectCalendar->AddTimeField(TIME_FIELD_MONTH, 1);
		AppLog("NEXT_MONTH Button is clicked\n");
		break;
	case ID_BUTTON_PREV_YEAR_ID:
		TryReturnVoid(year > 1, "At starting year");
		__pSelectCalendar->AddTimeField(TIME_FIELD_YEAR, -1);
		AppLog("PREV_YEAR Button is clicked\n");
		break;
	case ID_BUTTON_NEXT_YEAR_ID:
		TryReturnVoid(year < 9999, "At starting year");
		__pSelectCalendar->AddTimeField(TIME_FIELD_YEAR, 1);
		AppLog("NEXT_YEAR Button is clicked\n");
		break;
	case dayBtn0:
	case dayBtn1:
	case dayBtn2:
	case dayBtn3:
	case dayBtn4:
	case dayBtn5:
	case dayBtn6:
	case dayBtn7:
	case dayBtn8:
	case dayBtn9:
	case dayBtn10:
	case dayBtn11:
	case dayBtn12:
	case dayBtn13:
	case dayBtn14:
	case dayBtn15:
	case dayBtn16:
	case dayBtn17:
	case dayBtn18:
	case dayBtn19:
	case dayBtn20:
	case dayBtn21:
	case dayBtn22:
	case dayBtn23:
	case dayBtn24:
	case dayBtn25:
	case dayBtn26:
	case dayBtn27:
	case dayBtn28:
	case dayBtn29:
	case dayBtn30:
	case dayBtn31:
	case dayBtn32:
	case dayBtn33:
	case dayBtn34:
	case dayBtn35:
	case dayBtn36:
	case dayBtn37:
	case dayBtn38:
	case dayBtn39:
	case dayBtn40:
	case dayBtn41: {
		int temp = actionId;
		AppLog("DayBtn is clicked");
		AppLog("Btn Num is &d", temp);

		r = pList->Construct();
		{
			TryCatch(r == E_SUCCESS, , "Failed to construct the Array list.");
			CATCH: {
			}
		}

		r = pList->Add(*(new (std::nothrow) Boolean(__isServer)));
		{
			TryCatch(r == E_SUCCESS, ,
				"Failed to add the client/server to the Array list.");

		}

		r = pList->Add(*(new (std::nothrow) Integer(__iport)));
		TryCatch(r == E_SUCCESS, ,
				"Failed to add port number to the Array list.");

		r = pList->Add(*(new (std::nothrow) Boolean(__isProtocol)));
		TryCatch(r == E_SUCCESS, ,
				"Failed to add the protocol to the Array list.");

		r = pList->Add(*(new (std::nothrow) Integer(__year)));
		TryCatch(r == E_SUCCESS, , "Failed to add year to the Array list.");

		r = pList->Add(*(new (std::nothrow) Integer(__month)));
		TryCatch(r == E_SUCCESS, , "Failed to add month to the Array list.");

		String strTmp = __pDayBtn[actionId]->GetText();

		int day;
		r = Tizen::Base::Integer::Parse(strTmp, day);
		r = pList->Add(*new (std::nothrow) Integer(day));
		TryCatch(r == E_SUCCESS, , "Failed to add day to the Array list.");

		if (__pEnrollment != null) {
			delete __pEnrollment;
			__pEnrollment = null;
		}

		pSceneManager->GoForward(ForwardSceneTransition(SCENE_ENROLLMENT),
				pList);

	}
		break;

	default:
		break;
	}

	UpdateCalendarDisplay();

}