//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool RimWellLogFile::readFile(QString* errorMessage) { if (!m_wellLogDataFile.p()) { m_wellLogDataFile = new RigWellLogFile; } m_name = QFileInfo(m_fileName).fileName(); if (!m_wellLogDataFile->open(m_fileName, errorMessage)) { m_wellLogDataFile = nullptr; return false; } m_wellName = m_wellLogDataFile->wellName(); QDateTime date = RiaDateStringParser::parseDateString(m_wellLogDataFile->date()); m_lasFileHasValidDate = isDateValid(date); if (m_lasFileHasValidDate) { m_date = date; } else if(!isDateValid(m_date())) { QMessageBox msgBox; QString message = QString("The LAS-file '%1' contains no recognizable date. Please assign a date in the LAS-file property panel") .arg(m_name()); msgBox.setText(message); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.exec(); m_date = DEFAULT_DATE_TIME; } m_wellLogChannelNames.deleteAllChildObjects(); QStringList wellLogNames = m_wellLogDataFile->wellLogChannelNames(); for (int logIdx = 0; logIdx < wellLogNames.size(); logIdx++) { RimWellLogFileChannel* wellLog = new RimWellLogFileChannel(); wellLog->setName(wellLogNames[logIdx]); m_wellLogChannelNames.push_back(wellLog); } RimWellPath* wellPath; firstAncestorOrThisOfType(wellPath); if (wellPath) { if (wellPath->filepath().isEmpty()) { wellPath->setName(m_wellName); } } return true; }
// -------------------------------------------------------------------------------- // schreibt die Tokens aus tmpToken() in Datumszeiger und setzt von dort aus Zeiger // in die angelegte Datumsstruktur // -------------------------------------------------------------------------------- int getDateFromString(char *Eingabe, TDate *Datum) { i = 0; //zurücksetzen auf erste Stelle von (der) Eingabe char *pTag; char *pMonth; char *pJahr; // pTag = tmpToken(Eingabe, PUNKT); Datum->Day = atoi(pTag); pMonth = tmpToken(Eingabe, PUNKT); Datum->Month = atoi(pMonth); pJahr = tmpToken(Eingabe, PUNKT); Datum->Year = atoi(pJahr); //ruft Pruefungs-Unterfunktion auf if (isDateValid(Datum->Day, Datum->Month, Datum->Year)) { return 1; } else { return 0; } };
// -------------------------------------------------------------------------------- // schreibt die Tokens aus tmpToken() in Datumszeiger und setzt von dort aus Zeiger // in die angelegte Datumsstruktur // Prüft in Unterprogramm Validität der Eingabe. // -------------------------------------------------------------------------------- int getDateFromString(char *Eingabe, TDate *Datum) { q = 0; //zurücksetzen auf erste Stelle von (der) Eingabe int calcWithYear; if(*Eingabe) { tmpToken(Eingabe, PUNKT); Datum->Day = atoi(tmp); tmpToken(Eingabe, PUNKT); Datum->Month = atoi(tmp); tmpToken(Eingabe, PUNKT); Datum->Year = atoi(tmp); calcWithYear = Datum->Year; // ab hier Berechnung des Wochentages static int t[] = { 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 }; calcWithYear -= Datum->Month < 3; int W = ( calcWithYear + calcWithYear/4 - calcWithYear/100 + calcWithYear/400 + t[Datum->Month-1] + Datum->Day) % 7; // W = Tag der Woche if (W == 0) W = 7; Datum->DayOfTheWeek = (TDayOfTheWeek)W; if (isDateValid(Datum->Day, Datum->Month, Datum->Year)) //ruft Pruefungs-Unterfunktion auf return 1; } return 0; }
//trennt die Eingegebene Zeichenkette bei den ":", und schreibt den Zwischenstring in die angelegte Datumsstruktur int getDateFromString(char *Eingabe, TDate *Datum) { i = 0; // char **Pos = &Eingabe; tmpToken(Eingabe, PUNKT); i++; Datum->Day = atoi(tmp); tmpToken(Eingabe, PUNKT); i++; Datum->Month = atoi(tmp); tmpToken(Eingabe, PUNKT); i++; Datum->Year = atoi(tmp); //ruft Pruefungs-Unterfunktion auf if (isDateValid(Datum->Day, Datum->Month, Datum->Year)) { return 1; } else { return 0; } };
internal int32 sundayCount() { int32 count = 0; int32 year = 1900, month = 1, date = 1, day = 1, isLeapYear = 0; while (year < 2001) { while(isDateValid(year, month, date, isLeapYear)) { while(isDateValid(year, month, date, isLeapYear)) { ++date; ++day; if (day == 8) day = 1; } ++month; date = 1; if(year > 1900 && year < 2001 && day == 7) { ++count; } } ++year; month = 1; date = 1; if (((year % 4) == 0) && ((year % 100) > 0 || (year % 400) == 0)) { isLeapYear = 1; } else { isLeapYear = 0; } } return count; }
int main(int argc, char *argv[]) { unsigned short Mon; unsigned int Day; //usage example to compare with wikipedia's table for (int j = 0; j<40; j++) { easterGregDate(1994+j, &Mon, &Day); if (false == isDateValid(2014, Mon, Day)) printf("WRONG NUMBER; WRONG CALCULATED!/r/n"); printf("A.D.%d Gregorian Easter@ Month=%d Day=%d ",1994+j, Mon, Day); easterJulianDate(1994+j, &Mon, &Day); add13Days(1994+j, &Mon, &Day); if (false == isDateValid(2014, Mon, Day)) printf("WRONG NUMBER; WRONG CALCULATED!/r/n"); printf("Orthodox Easter in Gregorian calendar@ Mon=%d Day=%d\r\n", Mon, Day); } return 0; }
//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimWellLogFile::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) { uiOrdering.add(&m_fileName); uiOrdering.add(&m_date); m_date.uiCapability()->setUiReadOnly(m_lasFileHasValidDate); auto timespec = m_date().timeSpec(); if (!isDateValid(m_date())) { uiOrdering.add(&m_invalidDateMessage); } if (hasFlowData()) { uiOrdering.add(&m_wellFlowCondition); } uiOrdering.skipRemainingFields(true); }
bool MrgSorter::sort ( // No params ) { int index; DateType check; sortGood = true; for( index = 0; index < this->getSize(); index++ ) { getValueAt( index, check ); if( !isDateValid( check ) ) { sortGood = false; return sortGood; } } mergeSort( 0, this->getSize() - 1 ); return sortGood; }
extern short getDateFromString(char const *pUserInput, TDate *pReturnDate) { char *pDayAsString = NULL, *pMonthAsString = NULL, *pYearAsString = NULL; // Tag, Monat, Jahr als Teilstring von pUserInput TDate TempDate; // Damit das übergebene pUserInput im Fehlerfall nicht verändert werden muss. unsigned short countOfDots = 0; // Es dürfen maximal zwei Punkte vorkommen char *pLocalDate; // lokales Datum ( = datum-Parameter) char *p ; // Iterator // Datum kopieren, damit der datum-Parameter nicht verändert werden muss. pLocalDate = calloc(strlen(pUserInput) + 1, sizeof(char)); if (pLocalDate == NULL) return 0; p = pLocalDate; strncpy(pLocalDate, pUserInput, strlen(pUserInput)); while (*p != '\0') { if (*p >= '0' && *p <= '9') { if (pDayAsString == NULL) pDayAsString = p; // Der Tag ist noch nicht gesetzt. Er kommt als erstes. else if (pMonthAsString == NULL) pMonthAsString = p; // Der Monat ist noch nicht gesetzt. Er kommt als zweites. else if (pYearAsString == NULL) pYearAsString = p; // Das Jahr ist noch nicht gesetzt. Es kommt als letztes. else { free(pLocalDate); return 0; } while ((*(p + 1) >= '0' && *(p + 1) <= '9') && *(p + 1) != '\0')// Die Zahl bis zum Ende durchlaufen ++p; } else if (*p == '.') { ++countOfDots; *p = '\0'; // Punkte werden durch \0 ersetzt. } else { free(pLocalDate); return 0; // Es ist ein ungltiges Zeichen enthalten. } ++p; } if (pDayAsString == NULL || pMonthAsString == NULL || pYearAsString == NULL) { free(pLocalDate); return 0; // Tag, Monat und Jahr müssen im Datum enthalten sein. } if (countOfDots != 2) { free(pLocalDate); return 0; // Es müssen genau zwei Punkte vorkommen } // Die Typecast (int -> unsigned short) sollten immer funktionieren, // da für Tag, Monat und Jahr eh nur kleine positive Zahlen zulässig sind. TempDate.day = atoi(pDayAsString); /* if (errno != 0) //return 0;*/ TempDate.month = atoi(pMonthAsString); /* if (errno != 0) //return 0;*/ TempDate.year = atoi(pYearAsString); /* if (errno != 0) //return 0;*/ // Zur Sicherheit if (isDateValid(&TempDate) == 0) return 0; pReturnDate->day = TempDate.day; pReturnDate->month = TempDate.month; pReturnDate->year = TempDate.year; //date->dayOfWeek = getDayOfWeek(date); free(pLocalDate); return 1; }
void KfindTabWidget::setQuery(KQuery *query) { TDEIO::filesize_t size; TDEIO::filesize_t sizeunit; bool itemAlreadyContained(false); // only start if we have valid dates if (!isDateValid()) return; query->setPath(KURL(dirBox->currentText().stripWhiteSpace())); for (int idx=0; idx<dirBox->count(); idx++) if (dirBox->text(idx)==dirBox->currentText()) itemAlreadyContained=true; if (!itemAlreadyContained) dirBox->insertItem(dirBox->currentText().stripWhiteSpace(),0); TQString regex = nameBox->currentText().isEmpty() ? "*" : nameBox->currentText(); query->setRegExp(regex, caseSensCb->isChecked()); itemAlreadyContained=false; for (int idx=0; idx<nameBox->count(); idx++) if (nameBox->text(idx)==nameBox->currentText()) itemAlreadyContained=true; if (!itemAlreadyContained) nameBox->insertItem(nameBox->currentText(),0); query->setRecursive(subdirsCb->isChecked()); switch (sizeUnitBox->currentItem()) { case 0: sizeunit = 1; //one byte break; case 2: sizeunit = 1048576; //1M break; case 3: sizeunit = 1073741824; //1GB break; case 1: //fall to default case default: sizeunit = 1024; //1k break; } size = sizeEdit->value() * sizeunit; // TODO: troeder: do we need this check since it is very unlikely- // to exceed ULLONG_MAX with INT_MAX * 1024^3.- // Or is there an arch where this can happen? #if 0 if (size < 0) // overflow if (KMessageBox::warningYesNo(this, i18n("Size is too big. Set maximum size value?"), i18n("Error"),i18n("Set"),i18n("Do Not Set")) == KMessageBox::Yes) { sizeEdit->setValue(INT_MAX); sizeUnitBox->setCurrentItem(0); size = INT_MAX; } else return; #endif // set range mode and size value query->setSizeRange(sizeBox->currentItem(),size,0); // dates TQDateTime epoch; epoch.setTime_t(0); // Add date predicate if (findCreated->isChecked()) { // Modified if (rb[0]->isChecked()) { // Between dates TQDate q1, q2; fromDate->getDate(&q1); toDate->getDate(&q2); // do not generate negative numbers .. find doesn't handle that time_t time1 = epoch.secsTo(TQDateTime(q1)); time_t time2 = epoch.secsTo(TQDateTime(q2.addDays(1))) - 1; // Include the last day query->setTimeRange(time1, time2); } else { time_t cur = time(NULL); time_t minutes = cur; switch (betweenType->currentItem()) { case 0: // minutes minutes = timeBox->value(); break; case 1: // hours minutes = 60 * timeBox->value(); break; case 2: // days minutes = 60 * 24 * timeBox->value(); break; case 3: // months minutes = 60 * 24 * (time_t)(timeBox->value() * 30.41667); break; case 4: // years minutes = 12 * 60 * 24 * (time_t)(timeBox->value() * 30.41667); break; } query->setTimeRange(cur - minutes * 60, 0); } } else query->setTimeRange(0, 0); query->setUsername( m_usernameBox->currentText() ); query->setGroupname( m_groupBox->currentText() ); query->setFileType(typeBox->currentItem()); int id = typeBox->currentItem()-10; if ((id >= -3) && (id < (int) m_types.count())) { switch(id) { case -3: query->setMimeType( m_ImageTypes ); break; case -2: query->setMimeType( m_VideoTypes ); break; case -1: query->setMimeType( m_AudioTypes ); break; default: query->setMimeType( m_types[id]->name() ); } } else { query->setMimeType( TQString() ); } //Metainfo query->setMetaInfo(metainfoEdit->text(), metainfokeyEdit->text()); //Use locate to speed-up search ? query->setUseFileIndex(useLocateCb->isChecked()); query->setContext(textEdit->text(), caseContextCb->isChecked(), binaryContextCb->isChecked(), regexpContentCb->isChecked()); }
//! \brief try to fix some common errors in the csv representation of invoices //! * corrects the date format //! * corrects ambigous values in multi line invoices //! * ensures customer exists //! * if quantity is unset, set to 1 //! * if price is unset, delete row void gnc_bi_import_fix_bis (GtkListStore * store, guint * fixed, guint * deleted, GString * info, gchar *type) { GtkTreeIter iter; gboolean valid, row_deleted, row_fixed; gchar *id, *date_opened, *date_posted, *due_date, *owner_id, *date, *quantity, *price; GString *prev_id, *prev_date_opened, *prev_date_posted, *prev_owner_id, *prev_date; // needed to fix multi line invoices guint dummy; gint row = 1; const gchar* date_format_string = qof_date_format_get_string (qof_date_format_get()); // Get the user set date format string //date_format_string = qof_date_format_get_string (qof_date_format_get()); DEBUG("date_format_string: %s",date_format_string); // allow the call to this function with only GtkListeStore* specified if (!fixed) fixed = &dummy; if (!deleted) deleted = &dummy; *fixed = 0; *deleted = 0; // init strings prev_id = g_string_new (""); prev_date_opened = g_string_new (""); prev_date_posted = g_string_new (""); prev_owner_id = g_string_new (""); prev_date = g_string_new (""); valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter); while (valid) { row_deleted = FALSE; row_fixed = FALSE; // Walk through the list, reading each row gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, ID, &id, DATE_OPENED, &date_opened, DATE_POSTED, &date_posted, DUE_DATE, &due_date, OWNER_ID, &owner_id, DATE, &date, QUANTITY, &quantity, PRICE, &price, -1); if (strlen (price) == 0) { // invalid row (no price given) // no fix possible -> delete row valid = gtk_list_store_remove (store, &iter); row_deleted = TRUE; g_string_append_printf (info, _("ROW %d DELETED, PRICE_NOT_SET: id=%s\n"), row, id); } // TODO: QTY get set to 1 later if field is empty. Delete this section? else if (strlen (quantity) == 0) { // invalid row (no quantity given) // no fix possible -> delete row valid = gtk_list_store_remove (store, &iter); row_deleted = TRUE; g_string_append_printf (info, _("ROW %d DELETED, QTY_NOT_SET: id=%s\n"), row, id); } else { // TODO: If id is empty get the next one in the series. Bug 731105 if (strlen (id) == 0) { // no invoice id specified if (prev_id->len == 0) { // cannot fix -> delete row valid = gtk_list_store_remove (store, &iter); row_deleted = TRUE; g_string_append_printf (info, _("ROW %d DELETED, ID_NOT_SET\n"), row); } else { // this is a fixable multi line invoice gtk_list_store_set (store, &iter, ID, prev_id->str, -1); row_fixed = TRUE; } } else { // remember invoice id (to be able to fix multi line invoices) g_string_assign (prev_id, id); // new invoice => reset all other fixable entries g_string_assign (prev_date_opened, ""); g_string_assign (prev_date_posted, ""); g_string_assign (prev_owner_id, ""); g_string_assign (prev_date, ""); } } if (!row_deleted) { // the row is valid (price and id are valid) if(!isDateValid(date_opened)) { if (prev_date_opened->len == 0) { // fix this by using the current date gchar temp[20]; GDate date; g_date_clear (&date, 1); gnc_gdate_set_today (&date); g_date_strftime (temp, 20, date_format_string, &date); // Create a user specified date string. g_string_assign (prev_date_opened, temp); } // fix this by using the previous date_opened value (multi line invoice) gtk_list_store_set (store, &iter, DATE_OPENED, prev_date_opened->str, -1); row_fixed = TRUE; } else { // remember date_opened (to be able to fix multi line invoices) g_string_assign (prev_date_opened, date_opened); } // date_opened is valid if(!isDateValid(date_posted)) { if (prev_date_posted->len == 0) { // this invoice will have to get posted manually } else { // multi line invoice => fix it gtk_list_store_set (store, &iter, DATE_POSTED, prev_date_posted->str, -1); row_fixed = TRUE; } } else { // remember date_opened (to be able to fix multi line invoices) g_string_assign (prev_date_posted, date_posted); } // date_posted is valid /* // Check if due date is valid. Set it to date_posted if not valid or missing. if(!isDateValid(due_date)) { gtk_list_store_set (store, &iter, DUE_DATE, date_posted, -1); row_fixed = TRUE; } // due_date is valid */ if (strlen (quantity) == 0) { // quantity is unset => set to 1 gtk_list_store_set (store, &iter, QUANTITY, "1", -1); row_fixed = TRUE; } // quantity is valid if (strlen (owner_id) == 0) { if (prev_owner_id->len == 0) { // no customer given and not fixable => delete row valid = gtk_list_store_remove (store, &iter); row_deleted = TRUE; g_string_append_printf (info, _("ROW %d DELETED, OWNER_NOT_SET: id=%s\n"), row, id); } else { gtk_list_store_set (store, &iter, owner_id, prev_owner_id->str, -1); row_fixed = TRUE; } } else { // remember owner_id g_string_assign (prev_owner_id, owner_id); } if (g_ascii_strcasecmp (type, "BILL") == 0) { // BILL: check, if vendor exists if (!gnc_search_vendor_on_id (gnc_get_current_book (), prev_owner_id->str)) { // vendor not found => delete row valid = gtk_list_store_remove (store, &iter); row_deleted = TRUE; g_string_append_printf (info, _("ROW %d DELETED, VENDOR_DOES_NOT_EXIST: id=%s\n"), row, id); } } else if (g_ascii_strcasecmp (type, "INVOICE") == 0) { // INVOICE: check, if customer exists if (!gnc_search_customer_on_id (gnc_get_current_book (), prev_owner_id->str)) { // customer not found => delete row valid = gtk_list_store_remove (store, &iter); row_deleted = TRUE; g_string_append_printf (info, _("ROW %d DELETED, CUSTOMER_DOES_NOT_EXIST: id=%s\n"), row, id); } } // owner_id is valid } g_free (id); g_free (date_opened); g_free (date_posted); g_free (owner_id); g_free (date); g_free (quantity); g_free (price); if (row_deleted) { (*deleted)++; // reset all remembered values g_string_assign (prev_id, ""); g_string_assign (prev_date_opened, ""); g_string_assign (prev_date_posted, ""); g_string_assign (prev_owner_id, ""); g_string_assign (prev_date, ""); } else if (row_fixed) (*fixed)++; if (!row_deleted) valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter); row++; } // deallocate strings g_string_free (prev_id, TRUE); g_string_free (prev_date_opened, TRUE); g_string_free (prev_date_posted, TRUE); g_string_free (prev_owner_id, TRUE); g_string_free (prev_date, TRUE); if (info && (info->len > 0)) { g_string_prepend (info, "\n\n"); g_string_prepend (info, _("These rows were deleted:")); } }
int addTransactionWizard(char* wallet) { Transaction tx; tx.date.year = getCurrentYear(); tx.date.month = getCurrentMonth(); tx.date.day = getCurrentDay(); tx.time.hour = getCurrentHour(); tx.time.minute = getCurrentMinute(); tx.time.second = getCurrentSecond(); strcpy(tx.description, (char*)""); int curstep = 0; while(1) { SetBackGround(0x0A); drawScreenTitle("Add transaction"); // < (first label), SELECT of on date step, and Next or Finish (last label) drawFkeyLabels(curstep>0 ? 0x036F : -1, curstep == 2 ? 0x000F : 0, 0, 0, 0, curstep==4 ? 0x04A4 : 0x04A3); if(curstep == 0) { MenuItem menuitems[5]; menuitems[0].text = (char*)"Debit"; menuitems[1].text = (char*)"Credit"; Menu menu; menu.items=menuitems; menu.type=MENUTYPE_FKEYS; menu.numitems=2; menu.height=2; menu.startY=3; menu.pBaRtR=1; int inloop=1; while(inloop) { // this must be here, inside this loop: SetBackGround(0x0A); drawScreenTitle("Add transaction", "Select type:"); drawFkeyLabels(-1, -1, -1, -1, -1, 0x04A3); int res = doMenu(&menu); if(res == MENU_RETURN_EXIT) return 0; else if(res == KEY_CTRL_F6 || res == MENU_RETURN_SELECTION) { tx.credit = menu.selection == 2; curstep++; break; } } } else if(curstep == 1) { drawScreenTitle(NULL, "Amount:"); char samount[20] = ""; if(tx.amount.val) { currencyToString(samount, &tx.amount); } textInput input; input.charlimit=12; input.acceptF6=1; input.symbols = 0; // allow the decimal separator input.forcetext = 1; input.buffer = (char*)samount; input.type = INPUTTYPE_NUMERIC; while(1) { input.key=0; int res = doTextInput(&input); if (res==INPUT_RETURN_EXIT) return 0; // user aborted else if (res==INPUT_RETURN_CONFIRM) { if(!stringToCurrency(&tx.amount, samount)) { if(!tx.amount.val) { AUX_DisplayErrorMessage(0x4B); } else { curstep++; } break; } else AUX_DisplayErrorMessage(0x43); } else if (res==INPUT_RETURN_KEYCODE && input.key == KEY_CTRL_F1) { curstep--; break; } } } else if(curstep == 2) { drawScreenTitle(NULL, "Date:"); mPrintXY(7, 4, getInputDateFormatHint(), TEXT_MODE_TRANSPARENT_BACKGROUND, TEXT_COLOR_BLACK); textInput input; input.x=7; input.width=8; input.charlimit=8; input.acceptF6=1; input.type=INPUTTYPE_DATE; char datebuffer[15]; fillInputDate(&tx.date, datebuffer); input.buffer = (char*)datebuffer; while(1) { input.key=0; int res = doTextInput(&input); if (res==INPUT_RETURN_EXIT) return 0; // user aborted else if (res==INPUT_RETURN_CONFIRM) { int len = strlen(datebuffer); if(len == input.charlimit) { int yr,m,d; stringToDate(datebuffer, &yr, &m, &d); if(isDateValid(yr, m, d)) { tx.date.year = yr; tx.date.month = m; tx.date.day = d; curstep++; break; // continue to next step } else invalidFieldMsg(0); } else invalidFieldMsg(0); } else if (res==INPUT_RETURN_KEYCODE) { if(input.key==KEY_CTRL_F1) { curstep=curstep-1; break; } else if(input.key==KEY_CTRL_F2) { int ey=0, em=0, ed=0; if(!selectDateScreen(&ey, &em, &ed, (char*)"Select transaction date:", NULL, 1)) { tx.date.year = ey; tx.date.month = em; tx.date.day = ed; curstep++; break; // continue to next step } break; //redraw } } } } else if(curstep == 3) { drawScreenTitle(NULL, "Time:"); mPrintXY(8, 4, "HHMMSS", TEXT_MODE_TRANSPARENT_BACKGROUND, TEXT_COLOR_BLACK); textInput input; input.x=8; input.width=6; input.charlimit=6; input.acceptF6=1; input.type=INPUTTYPE_TIME; char tbuffer[15]; fillInputTime(&tx.time, tbuffer); input.buffer = (char*)tbuffer; while(1) { input.key=0; int res = doTextInput(&input); if (res==INPUT_RETURN_EXIT) return 0; // user aborted else if (res==INPUT_RETURN_CONFIRM) { if((int)strlen(tbuffer) == input.charlimit) { int h, m, s; stringToTime(tbuffer, &h, &m, &s); if(isTimeValid(h, m, s)) { tx.time.hour = h; tx.time.minute = m; tx.time.second = s; curstep++; break; // continue to next step } else invalidFieldMsg(1); } else invalidFieldMsg(1); } else if (res==INPUT_RETURN_KEYCODE && input.key==KEY_CTRL_F1) { curstep--; break; } } } else if(curstep == 4) { drawScreenTitle(NULL, "Description:"); textInput input; input.charlimit=128; input.acceptF6=1; input.buffer = (char*)tx.description; int inloop = 1; while(inloop) { input.key=0; int res = doTextInput(&input); if (res==INPUT_RETURN_EXIT) return 0; // user aborted else if (res==INPUT_RETURN_CONFIRM) inloop = 0; // all fields complete, continue with transaction adding else if (res==INPUT_RETURN_KEYCODE && input.key == KEY_CTRL_F1) { curstep--; break; } } if(!inloop) break; } } addTransaction(&tx, wallet); return 1; }