bool ProfileListForm::DeleteProfile(int index) { AppLog("State Changed!!!! - 2"); MessageBox msgbox; String getDeleteProfileMsg, getDialogTitle; Application::GetInstance()->GetAppResource()->GetString(IDS_DELETE_PROFILE, getDeleteProfileMsg); Application::GetInstance()->GetAppResource()->GetString(IDS_DIALOG_TITLE, getDialogTitle); msgbox.Construct(getDialogTitle, getDeleteProfileMsg, MSGBOX_STYLE_YESNO, 3000); int modalResult = 0; msgbox.ShowAndWait(modalResult); switch(modalResult){ case MSGBOX_RESULT_YES: { String sql; sql.Append(L"DELETE FROM profile WHERE id = "); Integer* itemId = static_cast<Integer*>(__pIndexList.GetAt(index)); sql.Append(itemId->ToInt()); __pProfileDatabase->BeginTransaction(); __pProfileDatabase->ExecuteSql(sql, true); __pProfileDatabase->CommitTransaction(); ListUpdate(); __isUpdateMode = false; } return true; } return false; }
void EditEventForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs) { result r = E_SUCCESS; if (previousSceneId == SCENE_EVENT_SETRECURRENCE) { if (pArgs != null) { if (__pRecurrence != null) { delete __pRecurrence; __pRecurrence = null; } if (pArgs->GetCount() > 0) { __pRecurrence = static_cast< Recurrence* >(pArgs->GetAt(0)); } __pSetRecurrenceButton->SetText(GetRecurrenceString()); pArgs->RemoveAll(false); delete pArgs; } } else if (previousSceneId == SCENE_EVENT_DETAIL) { if (pArgs != null) { Integer* pInteger = static_cast< Integer* >(pArgs->GetAt(0)); int eventId = pInteger->ToInt(); __pCalEvent = __pCalendarbook->GetEventN(eventId); r = GetLastResult(); if (IsFailed(r)) { MessageBox messageBox; messageBox.Construct(L"Error", "Failed to get event instance", MSGBOX_STYLE_OK, 0); int doModal; messageBox.ShowAndWait(doModal); AppLogException("[%s] Failed to get the Event.", GetErrorMessage(r)); } else { LoadEvent(); } pArgs->RemoveAll(false); delete pArgs; } } }
void UsersPanel::OnFastScrollIndexSelected(Tizen::Ui::Control& source, Tizen::Base::String& index) { AppLog("OnFastScrollIndexSelected %ls", index.GetPointer()); String upperLetter; index.ToUpper(upperLetter); AppLog("Upper letter %ls", index.GetPointer()); Integer * pos = static_cast<Integer *>(_pLetterNav->GetValue(upperLetter)); if (pos != null) { int item = pos->ToInt(); AppLog("Found at %d.", item); _pTableView->ScrollToItem(item, -1); Invalidate(true); } else { AppLog("Pointer is null..."); } }
bool JMChattControl::LoadImageInArray() { int nArrayCount=0, nIndex=0; nArrayCount = __pArrayNeedLoadImage->GetCount(); if( nArrayCount < 1 ) return false; Integer* pIndex = static_cast<Integer*>(__pArrayNeedLoadImage->GetAt(nArrayCount-1)); nIndex = pIndex->ToInt(); __pArrayNeedLoadImage->RemoveAt(nArrayCount-1); stCHATT_DATA* pChattData = (stCHATT_DATA*)(__pArrayChattData->GetAt(nIndex)); if( pChattData->strImageFile.GetLength() < 1 ) return false; if( pChattData->pBitmapImage ) return false; //pChattData->strImageFile = L""; if( pChattData->pBitmapImage == null ) return false; SetImageRectToSize(pChattData->rtElementBox, pChattData->pBitmapImage); CreateElementCaptureImage(nIndex); delete pChattData->pBitmapImage; pChattData->pBitmapImage = null; return true; }
void ProfileDetailForm::OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs) { result r = E_SUCCESS; if (pArgs != null) { Integer* pId = static_cast< Integer* >(pArgs->GetAt(0)); if (pId == null) { MessageBox messageBox; String getError, getFailGet; Application::GetInstance()->GetAppResource()->GetString(IDS_ERROR, getError); Application::GetInstance()->GetAppResource()->GetString(IDS_FAIL_GET, getFailGet); messageBox.Construct(getError, getFailGet, MSGBOX_STYLE_OK, 0); int doModal; messageBox.ShowAndWait(doModal); AppLogException("[%s] Failed to get Profile.", GetErrorMessage(r)); } else { __currentID = pId->ToInt(); String* pSubjectValue = static_cast< String* >(pArgs->GetAt(1)); if (pSubjectValue == null) { __pSubjectLabelData->SetText(L"(No subject)"); } else { __pSubjectLabelData->SetText(*pSubjectValue); } Integer* pYear = static_cast< Integer* >(pArgs->GetAt(2)); Integer* pMonth = static_cast< Integer* >(pArgs->GetAt(3)); Integer* pDay = static_cast< Integer* >(pArgs->GetAt(4)); Integer* pHour = static_cast< Integer* >(pArgs->GetAt(5)); Integer* pMinute = static_cast< Integer* >(pArgs->GetAt(6)); String startString; startString.Format(30, L"%d/%02d/%02d %02d:%02d", pYear->ToInt(), pMonth->ToInt(), pDay->ToInt(), pHour->ToInt(), pMinute->ToInt()); __pStartDateLabelData->SetText(startString); Integer* pYear2 = static_cast< Integer* >(pArgs->GetAt(7)); Integer* pMonth2 = static_cast< Integer* >(pArgs->GetAt(8)); Integer* pDay2 = static_cast< Integer* >(pArgs->GetAt(9)); Integer* pHour2 = static_cast< Integer* >(pArgs->GetAt(10)); Integer* pMinute2 = static_cast< Integer* >(pArgs->GetAt(11)); String startString2; startString2.Format(30, L"%d/%02d/%02d %02d:%02d", pYear2->ToInt(), pMonth2->ToInt(), pDay2->ToInt(), pHour2->ToInt(), pMinute2->ToInt()); __pDueDateLabelData->SetText(startString2); //TODO: Should be modified!!!! Double* pX = static_cast< Double* > ( pArgs->GetAt(12)); Double* pY = static_cast< Double* > ( pArgs->GetAt(13)); String pointStr = pX->ToString() + " , " + pY->ToString(); __pLocationLabelData->SetText(pointStr); Integer* pVolume = static_cast< Integer* >(pArgs->GetAt(14)); __pVolumeLabelData->SetText(pVolume->ToString()); Integer* pWifi = static_cast< Integer* >(pArgs->GetAt(15)); __pWifiLabelData->SetText(pWifi->ToInt()==1?"On":"Off"); String* pMemo = static_cast< String* >(pArgs->GetAt(16)); String PropertyValue = L"(No description)"; if (pMemo != null) { PropertyValue = *pMemo; } __pDescriptionLabelData->SetText(PropertyValue); Invalidate(true); } pArgs->RemoveAll(true); delete pArgs; } }
void ProfileListForm::SaveUsingmodeProfile(Tizen::Base::String title, int year, int month, int day, int hour, int minute, int year2, int month2, int day2, int hour2, int minute2, double latitude, double longitude, int volume, int wifi, Tizen::Base::String memo) { AppLog("%s, %s", title.GetPointer(), memo.GetPointer()); DbStatement* pStmt; DbEnumerator* pEnum; long long id; Tizen::System::SystemTime::GetTicks(id); __pProfileDatabase->BeginTransaction(); if (__isUpdateMode) { pStmt = __pProfileDatabase->CreateStatementN(L"UPDATE profile SET title = ?, " "year = ?, month = ?, day = ?, hour = ?, minute = ?, " "year2 = ?, month2 = ?, day2 = ?, hour2 = ?, minute2 = ?, " "latitude = ?, longitude = ?, volume = ?, wifi = ?, memo = ? WHERE id = ?"); pStmt->BindString(0, title); pStmt->BindInt(1, year); pStmt->BindInt(2, month); pStmt->BindInt(3, day); pStmt->BindInt(4, hour); pStmt->BindInt(5, minute); pStmt->BindInt(6, year); pStmt->BindInt(7, month); pStmt->BindInt(8, day); pStmt->BindInt(9, hour); pStmt->BindInt(10, minute); pStmt->BindDouble(11, latitude); pStmt->BindDouble(12, longitude); pStmt->BindInt(13, volume); pStmt->BindInt(14, wifi); pStmt->BindString(15, memo); Integer* itemId = static_cast<Integer*>(__pIndexList.GetAt(__currentIndex)); pStmt->BindInt(16, itemId->ToInt()); __isUpdateMode = false; } else { AppLog("Normal Save"); pStmt = __pProfileDatabase->CreateStatementN(L"INSERT INTO profile (id, title, " "year, month, day, hour, minute, " "year2, month2, day2, hour2, minute2, " "latitude, longitude, volume, wifi, memo) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); pStmt->BindInt(0, id); pStmt->BindString(1, title); pStmt->BindInt(2, year); pStmt->BindInt(3, month); pStmt->BindInt(4, day); pStmt->BindInt(5, hour); pStmt->BindInt(6, minute); pStmt->BindInt(7, year2); pStmt->BindInt(8, month2); pStmt->BindInt(9, day2); pStmt->BindInt(10, hour2); pStmt->BindInt(11, minute2); pStmt->BindDouble(12, latitude); pStmt->BindDouble(13, longitude); pStmt->BindInt(14, volume); pStmt->BindInt(15, wifi); pStmt->BindString(16, memo); } pEnum = __pProfileDatabase->ExecuteStatementN(*pStmt); __pProfileDatabase->CommitTransaction(); delete pStmt; delete pEnum; ListUpdate(); }
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; } }
void Enrollment::OnSceneActivatedN( const Tizen::Ui::Scenes::SceneId& previousSceneId, const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs) { AppLog("ChatFrm::OnSceneActivatedN"); Ip4Address* pAddress = null; if (pArgs != null) { if (pArgs->GetCount()) { Boolean* pServer = dynamic_cast<Boolean*>(pArgs->GetAt(0)); TryCatch(pServer != null, , "Failed to retrieve the client/server from the Array list."); __isServer = pServer->ToBool(); if (__isServer) { Integer* pPort = dynamic_cast<Integer*>(pArgs->GetAt(1)); TryCatch(pPort != null, , "Failed to retrieve the port number from the Array list."); __port = pPort->ToInt(); Boolean* pProtocol = dynamic_cast<Boolean*>(pArgs->GetAt(2)); TryCatch(pProtocol != null, , "Failed to retrieve the protocol type from the Array list."); __isTcp = pProtocol->ToBool(); Integer* pYear = dynamic_cast<Integer*>(pArgs->GetAt(3)); TryCatch(pProtocol != null, , "Failed to retrieve the year from the Array list."); __year = pYear->ToInt(); Integer* pMonth = dynamic_cast<Integer*>(pArgs->GetAt(4)); TryCatch(pProtocol != null, , "Failed to retrieve the month from the Array list."); __month = pMonth->ToInt(); Integer* pDay = dynamic_cast<Integer*>(pArgs->GetAt(5)); TryCatch(pProtocol != null, , "Failed to retrieve the month from the Array list."); __day = ""; __day = pDay->ToString(); if (__day == "") { AppLog("Day Error"); }; String myDay = ""; myDay.Append(__year); myDay.Append("/"); myDay.Append(__month); myDay.Append("/"); myDay.Append(__day); myDay.Append(""); __pDate->SetText(myDay); } else { pAddress = dynamic_cast<Ip4Address*>(pArgs->GetAt(1)); TryCatch(pAddress !=null, , "Failed to retrieve the Ipaddress from the Array list."); Integer* pPort = dynamic_cast<Integer*>(pArgs->GetAt(2)); TryCatch(pPort != null, , "Failed to retrieve the port number from the Array list."); __port = pPort->ToInt(); Boolean* pProtocol = dynamic_cast<Boolean*>(pArgs->GetAt(3)); TryCatch(pProtocol != null, , "Failed to retrieve the protocol type from the Array list."); __isTcp = pProtocol->ToBool(); Integer* pYear = dynamic_cast<Integer*>(pArgs->GetAt(3)); TryCatch(pProtocol != null, , "Failed to retrieve the year from the Array list."); __year = pYear->ToInt(); Integer* pMonth = dynamic_cast<Integer*>(pArgs->GetAt(4)); TryCatch(pProtocol != null, , "Failed to retrieve the month from the Array list."); __month = pMonth->ToInt(); Integer* pDay = dynamic_cast<Integer*>(pArgs->GetAt(5)); TryCatch(pProtocol != null, , "Failed to retrieve the month from the Array list."); __day = ""; __day = pDay->ToString(); if (__day == "") { AppLog("Day Error"); }; String myDay = ""; myDay.Append(__year); myDay.Append("/"); myDay.Append(__month); myDay.Append("/"); myDay.Append(__day); myDay.Append("."); __pDate->SetText(myDay); } }