Bug 144373

Summary: Embedded data (in .kst file) is not used
Product: [Applications] kst Reporter: Matthew Truch <matt>
Component: generalAssignee: kst
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.x   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: 144373.patch

Description Matthew Truch 2007-04-18 05:13:30 UTC
Version:           1.4.0 (using KDE KDE 3.5.4)
Installed from:    Fedora RPMs
OS:                Linux

Kst has a great* new feature, allowing one to embed data in the .kst file.  But the data embedded in the .kst doesn't seem to be used, and therefore is useless.  

Steps to reproduce:
1. Start kst, load some data from a file, make the plot look pretty.
2. Set "Save Data" from the file menu, and save a .kst file of the session.
3. Quit kst.
4. Delete the data file.  
5. Start kst and open the saved .kst session

Results: the plot is empty, and checking the "Debug Kst" dialog box indicates the warning that kst couldn't load vectors from the deleted data file.

Expected results: kst used the embedded data (which you can verify is there inside the .kst file)

*Where great is defined as a feature that you really want, and you think exists, but is totally a lie.
Comment 1 Netterfield 2007-04-18 05:36:38 UTC
The entertaining* thing is that the data does appear to be stored in the data 
file.  It just can't be read.

*Where entertaining is defined as something that makes you think that the 
feature actually works until such time as you have the guts to delete the 
data file and find out that it doesn't.
Comment 2 George Staikos 2007-05-01 05:13:14 UTC
    I think we failed to fully define how this should work, which is  
the problem.  Attached is a patch that should change RVector to save  
as AVector when Save Data is checked.  However the problem is that  
this is a hack which only really works for RVectors.  Also we lose  
any information about where the RVector came from when we do this.   
I'm not sure it's the most ideal choice.

--
George Staikos
KDE Developer				http://www.kde.org/
Staikos Computing Services Inc.		http://www.staikos.net/


Created an attachment (id=20448)
144373.patch
Comment 3 Andrew Walker 2007-06-26 19:05:48 UTC
SVN commit 680600 by arwalker:

BUG:144373 Apply George's patch

 M  +7 -1      kstrvector.cpp  


--- branches/work/kst/1.5/kst/src/libkst/kstrvector.cpp #680599:680600
@@ -330,7 +330,12 @@
 
 /** Save vector information */
 void KstRVector::save(QTextStream &ts, const QString& indent, bool saveAbsolutePosition) {
-  if (_file) {    
+  if (_saveData) {
+    // This is ugly.  Really we need a way to change vector types at runtime.
+    ts << indent << "<avector>" << endl;
+    KstVector::save(ts, indent + "  ", saveAbsolutePosition);
+    ts << indent << "</avector>" << endl;
+  } else if (_file) {
     ts << indent << "<vector>" << endl;
     KstVector::save(ts, indent + "  ", saveAbsolutePosition);
     _file->readLock();
@@ -346,6 +351,7 @@
       ts << indent << "  <start>" << ReqF0 << "</start>" << endl;
       ts << indent << "  <num>" << ReqNF << "</num>" << endl;
     }
+
     if (doSkip()) {
       ts << indent << "  <skip>" << Skip << "</skip>" << endl;
       if (doAve()) {