[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Sun Apr 17 17:46:46 CEST 2005


CVS commit by staikos: 

add the editable flag so we don't have to dynamic cast and hardcode checks.
May not be implemented everywhere for 1.1...


  M +2 -0      kstavector.cpp   1.3
  M +16 -0     kstvector.cpp   1.108
  M +8 -1      kstvector.h   1.70


--- kdeextragear-2/kst/kst/kstavector.cpp  #1.2:1.3
@@ -28,4 +28,5 @@
 KstAVector::KstAVector(const QDomElement &e)
 : KstVector() {
+  _editable = true;
   int in_n = 2;
   /* parse the DOM tree */
@@ -74,4 +75,5 @@ KstAVector::KstAVector(const QDomElement
 KstAVector::KstAVector(int n, const QString& tag)
 : KstVector(tag, n) {
+  _editable = true;
   _saveable = true;
   resize(n, true);

--- kdeextragear-2/kst/kst/kstvector.cpp  #1.107:1.108
@@ -51,4 +51,5 @@ KstVector::KstVector(const QString& name
   //kdDebug() << "+++ CREATING VECTOR: " << (void*) this << endl;
   KstObject::setTagName(name);
+  _editable = false;
   NumShifted = 0;
   NumNew = 0;
@@ -583,4 +584,19 @@ int KstVector::getUsage() const {
 
 
+bool KstVector::saveable() const {
+  return _saveable;
+}
+
+
+bool KstVector::editable() const {
+  return _editable;
+}
+
+
+void KstVector::setEditable(bool editable) {
+  _editable = editable;
+}
+
+
 #include "kstvector.moc"
 // vim: et sw=2 ts=2

--- kdeextragear-2/kst/kst/kstvector.h  #1.69:1.70
@@ -137,5 +137,8 @@ class KstVector : public KstObject {
     void setLabel(const QString& label_in);
 
-    bool saveable() {return _saveable;}
+    bool saveable() const;
+
+    bool editable() const;
+    void setEditable(bool editable);
 
   protected: // Protected attributes
@@ -172,4 +175,8 @@ class KstVector : public KstObject {
     bool _isScalarList : 1;
 
+    /** The user should not be permitted to edit the contents of the vector if
+    this is false. */
+    bool _editable : 1;
+
     /** Possibly null.  Be careful, this is non-standard usage of a KstShared.
      * The purpose of this is to trigger hierarchical updates properly.




More information about the Kst mailing list