treeitem.cpp
changeset 766 7a71a914afdb
parent 763 8c028a5d9083
child 767 6d2b32f305f9
     1.1 --- a/treeitem.cpp	Wed May 06 11:08:38 2009 +0000
     1.2 +++ b/treeitem.cpp	Thu May 07 08:48:53 2009 +0000
     1.3 @@ -218,6 +218,35 @@
     1.4  		default: return -1;
     1.5  	}
     1.6  }
     1.7 +void TreeItem::setType(const Type t)
     1.8 +{
     1.9 +	type=t;
    1.10 +	itemData[1]=getTypeName();
    1.11 +}
    1.12 +
    1.13 +TreeItem::Type TreeItem::getType()
    1.14 +{
    1.15 +	return type;
    1.16 +}
    1.17 +
    1.18 +bool TreeItem::isBranchLikeType() const
    1.19 +{
    1.20 +	if (type==Branch ||type==MapCenter) return true;
    1.21 +	return false;
    1.22 +}
    1.23 +
    1.24 +QString TreeItem::getTypeName()
    1.25 +{
    1.26 +	switch (type)
    1.27 +	{
    1.28 +		case Undefined: return QString ("Undefined");
    1.29 +		case MapCenter: return QString ("MapCenter");
    1.30 +		case Branch: return QString ("Branch");
    1.31 +		case Image: return QString ("Image");
    1.32 +		default: return QString ("TreeItem::getTypeName no typename defined?!");
    1.33 +	}
    1.34 +}
    1.35 +
    1.36  
    1.37  QVariant TreeItem::data(int column) const
    1.38  {
    1.39 @@ -290,33 +319,35 @@
    1.40      return note.getNoteOpenDoc();
    1.41  }
    1.42  
    1.43 -void TreeItem::setType(const Type t)
    1.44 +void TreeItem::activateStandardFlag (const QString &name)
    1.45  {
    1.46 -	type=t;
    1.47 -	itemData[1]=getTypeName();
    1.48 +	cout << "TI::activateStandardFlag "<<name.toStdString()<<" for item "<<getHeadingStd()<<endl;
    1.49 +	cout << "   lmo="<<lmo<< "  "<<isBranchLikeType()<<endl;
    1.50 +	standardFlags.activate (name);
    1.51 +	if (lmo &&isBranchLikeType() ) 
    1.52 +		((BranchObj*)lmo)->activateStandardFlag (name);
    1.53  }
    1.54  
    1.55 -TreeItem::Type TreeItem::getType()
    1.56 +void TreeItem::deactivateStandardFlag (const QString &name)
    1.57  {
    1.58 -	return type;
    1.59 +	cout << "TI::deactivateStandardFlag "<<name.toStdString()<<" for item "<<getHeadingStd()<<endl;
    1.60 +	standardFlags.deactivate (name);
    1.61 +	if (lmo &&isBranchLikeType() ) 
    1.62 +		((BranchObj*)lmo)->deactivateStandardFlag (name);
    1.63  }
    1.64  
    1.65 -bool TreeItem::isBranchLikeType() const
    1.66 +void TreeItem::toggleStandardFlag(const QString &name)
    1.67  {
    1.68 -	if (type==Branch ||type==MapCenter) return true;
    1.69 -	return false;
    1.70 +	cout << "TI::toggleStandardFlag "<<name.toStdString()<<" for item "<<getHeadingStd()<<endl;
    1.71 +	if (standardFlags.isActive (name))
    1.72 +		deactivateStandardFlag (name);
    1.73 +	else	
    1.74 +		activateStandardFlag (name);
    1.75  }
    1.76  
    1.77 -QString TreeItem::getTypeName()
    1.78 +bool TreeItem::isActiveStandardFlag (const QString &name)
    1.79  {
    1.80 -	switch (type)
    1.81 -	{
    1.82 -		case Undefined: return QString ("Undefined");
    1.83 -		case MapCenter: return QString ("MapCenter");
    1.84 -		case Branch: return QString ("Branch");
    1.85 -		case Image: return QString ("Image");
    1.86 -		default: return QString ("TreeItem::getTypeName no typename defined?!");
    1.87 -	}
    1.88 +	return standardFlags.isActive (name);
    1.89  }
    1.90  
    1.91  void TreeItem::setID (const QString &s)