Bug 116453 - Time zone in settings does the wrong thing.
Summary: Time zone in settings does the wrong thing.
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-15 22:55 UTC by Netterfield
Modified: 2005-11-20 19:38 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Netterfield 2005-11-15 22:55:49 UTC
Version:           1.2.0_devel (using KDE 3.4.1, Gentoo)
Compiler:          gcc version 3.3.5-20050130 (Gentoo 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1)
OS:                Linux (i686) release 2.6.9-gentoo-r6

Create a plot with timezone interpretation on the X axis.

Go into settings->configure Kst and change the timezone.  

The plot doesn't change.  (BAD)

Reloading changes the plot... but it changes the day, not the hour. (BAD)
Comment 1 Andrew Walker 2005-11-15 23:38:08 UTC
The latter problem has been fixed.
Comment 2 George Staikos 2005-11-20 19:38:54 UTC
SVN commit 481822 by staikos:

- update the plots when the timezone changes
- small cleanups and use const iterators where possible in the legend code
BUG: 116453


 M  +13 -2     kst2dplot.cpp  
 M  +2 -0      kst2dplot.h  
 M  +21 -13    kstviewlegend.cpp  


--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #481821:481822
@@ -505,6 +505,7 @@
                                 double ymax_in,
                                 bool x_log,
                                 bool y_log) {
+  connect(KstApp::inst(), SIGNAL(timezoneChanged(const QString&, int)), this, SLOT(timezoneChanged(const QString&, int)));
   _xLabel = new KstPlotLabel;
   _yLabel = new KstPlotLabel(270);
   _topLabel = new KstPlotLabel;
@@ -6456,13 +6457,23 @@
     appendChild(KstViewObjectPtr(vl), true);
     vl->resizeFromAspect(0.1, 0.1, 0.2, 0.1);
     for (KstBaseCurveList::Iterator it = Curves.begin(); it != Curves.end(); ++it) {
-      vl->addCurve((*it));
+      vl->addCurve(*it);
     }
   }
   return vl;
 }
 
-QRect Kst2DPlot::contentsRect() const{
+
+void Kst2DPlot::timezoneChanged(const QString& tz, int utcOffset) {
+  Q_UNUSED(tz)
+  Q_UNUSED(utcOffset)
+  setDirty();
+  KstViewWidget *view = KstApp::inst()->activeView()->widget();
+  static_cast<KstViewWidget*>(view)->paint();
+}
+
+
+QRect Kst2DPlot::contentsRect() const {
   return QRect(PlotRegion.left() + geometry().left(), 
                PlotRegion.top() + geometry().top(),
                PlotRegion.width(),
--- trunk/extragear/graphics/kst/kst/kst2dplot.h #481821:481822
@@ -391,6 +391,8 @@
   void menuNextMarker();
   void menuPrevMarker();
 
+  void timezoneChanged(const QString& tz, int utcOffset);
+
 protected:
   virtual KstViewObjectFactoryMethod factory() const;
 
--- trunk/extragear/graphics/kst/kst/kstviewlegend.cpp #481821:481822
@@ -35,6 +35,7 @@
 
 #include <qapplication.h>
 #include <qbitmap.h>
+#include <qdeepcopy.h>
 #include <qmetaobject.h>
 #include <qptrstack.h>
 #include <qstylesheet.h>
@@ -87,9 +88,10 @@
   }
 
   KstBaseCurveList l = kstObjectSubList<KstDataObject,KstBaseCurve>(KST::dataObjectList);
-  for (QStringList::iterator str = ctaglist.begin(); str!=ctaglist.end(); ++str) {
-    KstBaseCurveList::Iterator it = l.findTag(*str);
-    if (it != l.end()) {
+  KstBaseCurveList::ConstIterator end = l.end();
+  for (QStringList::ConstIterator str = ctaglist.begin(); str != ctaglist.end(); ++str) {
+    KstBaseCurveList::ConstIterator it = l.findTag(*str);
+    if (it != end) {
       addCurve(*it);
     }
   }
@@ -99,6 +101,7 @@
 KstViewLegend::~KstViewLegend() {
 }
 
+
 void KstViewLegend::resize(const QSize& size) {
   KstBorderedViewObject::resize(size);
   drawToBuffer();
@@ -122,11 +125,12 @@
   return _fontName;
 }
 
+
 void KstViewLegend::save(QTextStream &ts, const QString& indent) {
   ts << indent << "<" << type() << ">" << endl;
   KstBorderedViewObject::save(ts, indent + "  ");
   
-  for (KstBaseCurveList::Iterator j = Curves.begin(); j != Curves.end(); ++j) {
+  for (KstBaseCurveList::ConstIterator j = Curves.begin(); j != Curves.end(); ++j) {
     (*j)->readLock();
     ts << indent+"  " << "<curvetag>" << QStyleSheet::escape((*j)->tagName()) << "</curvetag>" << endl;
     (*j)->readUnlock();
@@ -135,6 +139,7 @@
   ts << indent << "</" << type() << ">" << endl;
 }
 
+
 void KstViewLegend::drawToBuffer() {
   setDirty(false);
 
@@ -192,6 +197,7 @@
   QApplication::syncX();
 }
 
+
 void KstViewLegend::computeTextSize() {
   _textWidth = 0;
   _ascent = 0;
@@ -219,9 +225,9 @@
   } else {
     _textWidth += Curves.count()*_ascent;
   }
-
 }
 
+
 void KstViewLegend::paint(KstPaintType type, QPainter& p, const QRegion& bounds) {
   if (type == P_PRINT) {
     p.save();
@@ -336,6 +342,7 @@
   return true;
 }
 
+
 KstViewObjectPtr create_KstViewLegend() {
   return KstViewObjectPtr(new KstViewLegend());
 }
@@ -386,30 +393,31 @@
   return map;
 }
 
+
+bool KstViewLegend::transparent() const {
+  return KstViewObject::transparent();
+}
+
+
 void KstViewLegend::setTransparent(bool transparent) {
   KstViewObject::setTransparent(transparent);
 }
 
 
-bool KstViewLegend::transparent() const {
-  return KstViewObject::transparent();
-}
-
 void KstViewLegend::addCurve(KstBaseCurvePtr incurve) {
   Curves.append(incurve);
   setDirty();
 }
 
+
 void KstViewLegend::removeCurve(KstBaseCurvePtr incurve) {
   Curves.remove(incurve);
   setDirty();
 }
 
+
 void KstViewLegend::setCurveList(Kst2DPlot *pl) {
-  Curves.clear();
-  for (KstBaseCurveList::Iterator i = pl->Curves.begin(); i != pl->Curves.end(); ++i) {
-    Curves.append(*i);
-  }
+  Curves = QDeepCopy<KstBaseCurveList>(pl->Curves);
 }
 
 #include "kstviewlegend.moc"