[Kst] [Bug 101130] Kst date code is not internationalized

Andrew Walker arwalker at sumusltd.com
Sat Mar 12 01:09:42 CET 2005


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=101130         
arwalker sumusltd com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From arwalker sumusltd com  2005-03-12 01:09 -------
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 }
 };


More information about the Kst mailing list