From cf2d0ca3d5ba890dca4e2735915739430a43cfa0 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 20 Mar 2017 15:04:16 -0400 Subject: Simplify date time code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL removes the CFX_DateTime class and moves the one used method into the CFX_Unitime class. Change-Id: I89f6d099b2c436d8f12b9dc2c5f10ac236ad56ef Reviewed-on: https://pdfium-review.googlesource.com/3104 Reviewed-by: Nicolás Peña Commit-Queue: dsinclair --- xfa/fxfa/app/xfa_ffnotify.cpp | 1 + xfa/fxfa/app/xfa_fftextedit.cpp | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'xfa/fxfa/app') diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp index ce6d7db4e2..fb154d8a9a 100644 --- a/xfa/fxfa/app/xfa_ffnotify.cpp +++ b/xfa/fxfa/app/xfa_ffnotify.cpp @@ -264,6 +264,7 @@ void CXFA_FFNotify::OpenDropDownList(CXFA_FFWidget* hWidget) { CFX_WideString CXFA_FFNotify::GetCurrentDateTime() { CFX_Unitime dataTime; dataTime.Now(); + CFX_WideString wsDateTime; wsDateTime.Format(L"%d%02d%02dT%02d%02d%02d", dataTime.GetYear(), dataTime.GetMonth(), dataTime.GetDay(), dataTime.GetHour(), diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index 50685c7e40..b4560c88ed 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -522,7 +522,7 @@ bool CXFA_FFDateTimeEdit::LoadWidget() { if (!wsText.IsEmpty()) { CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc); CFX_Unitime date = lcValue.GetDate(); - if (date.ToInt64() != 0) + if (date.IsSet()) pWidget->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay()); } } break; @@ -619,8 +619,8 @@ bool CXFA_FFDateTimeEdit::UpdateFWLData() { CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc); CFX_Unitime date = lcValue.GetDate(); if (lcValue.IsValid()) { - if (date.ToInt64() != 0) { - ((CFWL_DateTimePicker*)m_pNormalWidget) + if (date.IsSet()) { + static_cast(m_pNormalWidget) ->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay()); } } @@ -646,9 +646,8 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(CFWL_Widget* pWidget, CFX_WideString wsPicture; m_pDataAcc->GetPictureContent(wsPicture, XFA_VALUEPICTURE_Edit); CXFA_LocaleValue date(XFA_VT_DATE, GetDoc()->GetXFADoc()->GetLocalMgr()); - CFX_Unitime dt; - dt.Set(iYear, iMonth, iDay, 0, 0, 0, 0); - date.SetDate(dt); + date.SetDate(CFX_Unitime(iYear, iMonth, iDay, 0, 0, 0, 0)); + CFX_WideString wsDate; date.FormatPatterns(wsDate, wsPicture, m_pDataAcc->GetLocal(), XFA_VALUEPICTURE_Edit); -- cgit v1.2.3