static void OnSaveClicked(WndButton* pWnd){ int file_index; TCHAR task_name[MAX_PATH]; WndProperty* wp; DataFieldFileReader *dfe; wp = (WndProperty*)wf->FindByName(TEXT("prpFile")); if (!wp) return; dfe = (DataFieldFileReader*)wp->GetDataField(); file_index = dfe->GetAsInteger(); // TODO enhancement: suggest a good new name not already in the list _tcscpy(task_name,TEXT("NEW")); dlgTextEntryShowModal(task_name, 10); // max length if (_tcslen(task_name)>0) { _tcscat(task_name, TEXT(LKS_TSK)); dfe->Lookup(task_name); file_index = dfe->GetAsInteger(); if (file_index==0) { // good, this file is unique.. dfe->addFile(task_name, task_name); dfe->Lookup(task_name); wp->RefreshDisplay(); } } else { // TODO code: report error, task not saved since no name was given return; } if (file_index>0) { // file already exists! ask if want to overwrite TCHAR sTmp[500]; _sntprintf(sTmp, array_size(sTmp), TEXT("%s: '%s'"), // LKTOKEN _@M696_ = "Task file already exists" MsgToken(696), dfe->GetAsString()); if(MessageBoxX( sTmp, // LKTOKEN _@M510_ = "Overwrite?" MsgToken(510), mbYesNo) != IdYes) { return; } } TCHAR file_name[MAX_PATH]; LocalPath(file_name,TEXT(LKD_TASKS), task_name); SaveTask(file_name); UpdateCaption(); }
void CEditorAppView::Back() { TInt state = SHModel()->GetEditModel(); if (state == CSHModel::EEditmodelModify) SaveTask(); SHChangeView(ESimulateMessageMainScreenViewId); }
bool ProtectedTaskManager::TaskSave(const TCHAR* path) { OrderedTask* task = TaskClone(); bool retval = SaveTask(path, *task); delete task; return retval; }
void SaveDefaultTask(void) { LockTaskData(); TCHAR buffer[MAX_PATH]; LocalPath(buffer,TEXT(LKD_TASKS)); _tcscat(buffer,TEXT("\\")); _tcscat(buffer,_T(LKF_DEFAULTASK)); // 091101 SaveTask(buffer); UnlockTaskData(); }
void Task::SaveDefaultTask(void) { if (!isTaskAborted()) { TCHAR buffer[MAX_PATH]; #ifdef GNAV LocalPath(buffer, TEXT("persist/Default.tsk")); #else LocalPath(buffer, TEXT("Default.tsk")); #endif SaveTask(buffer); } }
bool OrderedTaskSave(OrderedTask &task) { TCHAR fname[69] = _T(""); if (!TextEntryDialog(fname, 64, _("Enter a task name"))) return false; const auto tasks_path = MakeLocalPath(_T("tasks")); _tcscat(fname, _T(".tsk")); task.SetName(StaticString<64>(fname)); SaveTask(AllocatedPath::Build(tasks_path, fname), task); return true; }
// // Save // // Save a list of tasks // void SaveTasks(FScope *fScope, const char *name, const NList<Task> &tasks) { // Save nothing if no tasks in list if (tasks.GetCount()) { // Write the name given fScope = fScope->AddFunction(name); // For each task in the list for (NList<Task>::Iterator t(&tasks); *t; t++) { SaveTask(fScope, "Task", **t); } } }
void SaveTask(Path path, const OrderedTask &task) { XMLNode root_node = XMLNode::CreateRoot(_T("Task")); { WritableDataNodeXML root(root_node); SaveTask(root, task); } FileOutputStream file(path); BufferedOutputStream buffered(file); root_node.Serialise(buffered, true); buffered.Flush(); file.Commit(); }
bool SaveTask(Path path, const OrderedTask &task) { XMLNode root_node = XMLNode::CreateRoot(_T("Task")); { WritableDataNodeXML root(root_node); SaveTask(root, task); } TextWriter writer(path); if (!writer.IsOpen()) return false; root_node.Serialise(writer, true); return true; }
void CEditorAppView::HandleCommandL(TInt aCommand) { switch (aCommand) { case ECommandAddTask: SaveTask(); break; case ECommandInsertContact: iContainer->DoUserAddRecipientL(); break; case EAknSoftkeyBack: Back(); break; default: AppUi()->HandleCommandL(aCommand); } }
void TaskActionsPanel::OnAction(int id) { switch (id) { case NEW_TASK: OnNewTaskClicked(); break; case DECLARE: OnDeclareClicked(); break; case BROWSE: OnBrowseClicked(); break; case SAVE: SaveTask(); break; } }
static void OnSaveClicked(WindowControl * Sender, WndListFrame::ListInfo_t *ListInfo){ (void)ListInfo; (void)Sender; int file_index; TCHAR task_name[MAX_PATH]; TCHAR file_name[MAX_PATH]; WndProperty* wp; DataFieldFileReader *dfe; wp = (WndProperty*)wf->FindByName(TEXT("prpFile")); if (!wp) return; dfe = (DataFieldFileReader*)wp->GetDataField(); file_index = dfe->GetAsInteger(); // TODO enhancement: suggest a good new name not already in the list _tcscpy(task_name,TEXT("NEW")); dlgTextEntryShowModal(task_name, 10); // max length if (_tcslen(task_name)>0) { _tcscat(task_name, TEXT(LKS_TSK)); LocalPath(file_name,TEXT(LKD_TASKS)); _tcscat(file_name,TEXT("\\")); _tcscat(file_name,task_name); // 091101 dfe->Lookup(file_name); file_index = dfe->GetAsInteger(); if (file_index==0) { // good, this file is unique.. dfe->addFile(task_name, file_name); dfe->Lookup(file_name); wp->RefreshDisplay(); } } else { // TODO code: report error, task not saved since no name was given return; } if (file_index>0) { // file already exists! ask if want to overwrite _stprintf(file_name, TEXT("%s: '%s'"), // LKTOKEN _@M696_ = "Task file already exists" gettext(TEXT("_@M696_")), dfe->GetAsString()); if(MessageBoxX(hWndMapWindow, file_name, // LKTOKEN _@M510_ = "Overwrite?" gettext(TEXT("_@M510_")), MB_YESNO|MB_ICONQUESTION) != IDYES) { return; } } SaveTask(dfe->GetPathFile()); UpdateCaption(); }
void SaveTasks() { // modif quand CMD.wd int i; for (i=0; i<sha->loaded; i++) { SaveTask(i); } }