Bug 101130

Summary: Kst date code is not internationalized
Product: [Applications] kst Reporter: George Staikos <staikos>
Component: generalAssignee: kst
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.x   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description George Staikos 2005-03-08 22:46:43 UTC
The Kst date/time code does not use the necessary internationalization and 
localization functionality from KDE.  All dates and times should be output 
using the libraries, settings, and functionality provided by KDE.
Comment 1 Netterfield 2005-03-09 16:28:15 UTC
I can't see any behavioural problems with the current code.   There are two fixed, non ambiguous formats (at least as far as the menu is concerned), and then two QT internationalized formats.  It is important to have these fixed formats, so that the look of a plot can be fixed between locales if wanted.

So, I can't imediately see any reason to keep this bug open.  If there is a reason, George can re-open with a *specific incorrect behavior*. 
Comment 2 George Staikos 2005-03-11 20:59:07 UTC
On kicker clock, right menu button->Date & Time Format.  Set date format to:
"DD-MM-YY" and save.

Open Kst, with date set to Qt Local Date, or any other date format and plot a curve with the data wizard.  Dates are displayed in MM/DD/YYYY, but should be displayed DD-MM-YY.  Numeric dates are particularly confusing because it's impossible to know which is the month or day in many cases.

The same bug applies to Qt text date, which is why KCalendarSystem is needed.
Comment 3 Andrew Walker 2005-03-12 01:09:40 UTC
CVS commit by arwalker: 

Implement support for KDE formatted dates and times.

CCMAIL: 101130-done@bugs.kde.org


  M +38 -2     kst2dplot.cpp   1.373
  M +6 -2      kstplotdefines.h   1.10


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.372:1.373
@@ -1490,9 +1490,39 @@ void Kst2DPlot::convertJDToDateString(Ks
     case AXIS_DISPLAY_QTTEXTDATEHHMMSS_SS:
       date.setYMD(year, month, day);
-      label.sprintf("%s %02d:%02d:%02.*f", date.toString(Qt::TextDate).ascii(), hour, minute, accuracy, second);
+      label.sprintf("%s %02d:%02d:%02.*f", date.toString(Qt::TextDate).ascii(), 
+                                            hour, minute, accuracy, second);
       break;
     case AXIS_DISPLAY_QTLOCALDATEHHMMSS_SS:
       date.setYMD(year, month, day);
-      label.sprintf("%s %02d:%02d:%02.*f", date.toString(Qt::LocalDate).ascii(), hour, minute, accuracy, second);
+      label.sprintf("%s %02d:%02d:%02.*f", date.toString(Qt::LocalDate).ascii(), 
+                                            hour, minute, accuracy, second);
+      break;
+    case AXIS_DISPLAY_KDE_SHORTDATE:
+      label = QString("%1").arg(KGlobal::locale()->formatDateTime(
+                                               QDateTime(QDate(year, month, day), 
+                                               QTime(hour, minute, (int)second)), true, true));
+      //
+      // handle the fractional seconds
+      //
+      if (accuracy > 0) {
+        QString strSecond;
+        
+        strSecond.sprintf(" + %0.*f seconds", accuracy, second - floor(second));
+        label += strSecond;
+      }
+      break;
+    case AXIS_DISPLAY_KDE_LONGDATE:
+      label = QString("%1").arg(KGlobal::locale()->formatDateTime(
+                                               QDateTime(QDate(year, month, day), 
+                                               QTime(hour, minute, (int)second)), false, true));
+      //
+      // handle the fractional seconds
+      //
+      if (accuracy > 0) {
+        QString strSecond;
+        
+        strSecond.sprintf(" + %0.*f seconds", accuracy, second - floor(second));
+        label += strSecond;
+      }
       break;
     default:
@@ -1528,4 +1558,6 @@ void Kst2DPlot::convertTimeValueToString
     case AXIS_DISPLAY_QTTEXTDATEHHMMSS_SS:
     case AXIS_DISPLAY_QTLOCALDATEHHMMSS_SS:
+    case AXIS_DISPLAY_KDE_SHORTDATE:
+    case AXIS_DISPLAY_KDE_LONGDATE:
       convertJDToDateString(axisInterpretation, axisDisplay, axisTimezoneLocal, axisTimezoneHrs, label, length, value);
       break;
@@ -1570,4 +1602,6 @@ void Kst2DPlot::convertDiffTimevalueToSt
     case AXIS_DISPLAY_QTTEXTDATEHHMMSS_SS:
     case AXIS_DISPLAY_QTLOCALDATEHHMMSS_SS:
+    case AXIS_DISPLAY_KDE_SHORTDATE:
+    case AXIS_DISPLAY_KDE_LONGDATE:
       zdiff *= 24.0 * 60.0 * 60.0;
       break;
@@ -1697,4 +1731,6 @@ void Kst2DPlot::genAxisTickLabels(QPaint
       case AXIS_DISPLAY_QTTEXTDATEHHMMSS_SS:
       case AXIS_DISPLAY_QTLOCALDATEHHMMSS_SS:
+      case AXIS_DISPLAY_KDE_SHORTDATE:
+      case AXIS_DISPLAY_KDE_LONGDATE:
         if( range > 10.0 * 24.0 * 60.0 * 60.0 ) {
           scale /= 24.0 * 60.0 * 60.0;

--- kdeextragear-2/kst/kst/kstplotdefines.h  #1.9:1.10
@@ -42,5 +42,7 @@ enum KstAxisDisplay { 
   AXIS_DISPLAY_JD,
   AXIS_DISPLAY_MJD,
-  AXIS_DISPLAY_RJD };
+  AXIS_DISPLAY_RJD,
+  AXIS_DISPLAY_KDE_SHORTDATE,
+  AXIS_DISPLAY_KDE_LONGDATE };
 
 struct AxisInterpretation {
@@ -71,5 +73,7 @@ const AxisDisplay AxisDisplays[] = {
   { I18N_NOOP2("Julian Date", "JD"), AXIS_DISPLAY_JD },
   { I18N_NOOP2("Modified Julian Date", "MJD"), AXIS_DISPLAY_MJD },
-  { I18N_NOOP2("Reduced Julian Date", "RJD"), AXIS_DISPLAY_RJD }
+  { I18N_NOOP2("Reduced Julian Date", "RJD"), AXIS_DISPLAY_RJD },
+  { I18N_NOOP("<KDE Short Date and Time>"), AXIS_DISPLAY_KDE_SHORTDATE },
+  { I18N_NOOP("<KDE Long Date and Time>"), AXIS_DISPLAY_KDE_LONGDATE }
 };
 
Comment 4 Peter Kümmel 2010-08-14 14:40:36 UTC
Change version to 1.x