flag of NoteEditor works again
authorinsilmaril
Thu, 14 May 2009 12:42:58 +0000
changeset 768382a444f5b0c
parent 767 6d2b32f305f9
child 769 a6931cd6309a
flag of NoteEditor works again
branchitem.cpp
mainwindow.cpp
treeitem.cpp
treeitem.h
xml-vym.cpp
     1.1 --- a/branchitem.cpp	Wed May 13 08:26:27 2009 +0000
     1.2 +++ b/branchitem.cpp	Thu May 14 12:42:58 2009 +0000
     1.3 @@ -54,9 +54,8 @@
     1.4      QString s,a;
     1.5  	BranchObj *bo=(BranchObj*)lmo;
     1.6  
     1.7 -	/* 
     1.8  	// Update of note is usually done while unselecting a branch
     1.9 -	if (isNoteInEditor) getNoteFromTextEditor();
    1.10 +	// if (isNoteInEditor) getNoteFromTextEditor();	// FIXME-0 check that this still works...
    1.11  	
    1.12  	QString scrolledAttr;
    1.13  	if (scrolled) 
    1.14 @@ -64,7 +63,9 @@
    1.15  	else
    1.16  		scrolledAttr="";
    1.17  
    1.18 -	// save area, if not scrolled
    1.19 +	/* 
    1.20 +	// save area, if not scrolled	// FIXME-3 not needed if HTML is rewritten...
    1.21 +									// also we should check if _any_ of parents is scrolled
    1.22  	QString areaAttr;
    1.23  	if (!((BranchObj*)(parObj))->isScrolled() )
    1.24  	{
    1.25 @@ -88,7 +89,7 @@
    1.26      s=beginElement ("branch" 
    1.27  		+getAttr()
    1.28  	//	+getOrnXMLAttr() 
    1.29 -	//	+scrolledAttr 
    1.30 +		+scrolledAttr 
    1.31  	//	+areaAttr 
    1.32  	//	+idAttr 
    1.33  	//	+getIncludeImageAttr() 
    1.34 @@ -103,10 +104,12 @@
    1.35  	// Save frame
    1.36  	if (frame->getFrameType()!=FrameObj::NoFrame) 
    1.37  		s+=frame->saveToDir ();
    1.38 +*/		
    1.39  
    1.40  	// save names of flags set
    1.41 -	s+=standardFlags->saveToDir(tmpdir,prefix,0);
    1.42 +	s+=standardFlags.saveToDir(tmpdir,prefix,0);
    1.43  	
    1.44 +/*	
    1.45  	// Save FloatImages
    1.46  	for (int i=0; i<floatimage.size(); ++i)
    1.47  		s+=floatimage.at(i)->saveToDir (tmpdir,prefix);
     2.1 --- a/mainwindow.cpp	Wed May 13 08:26:27 2009 +0000
     2.2 +++ b/mainwindow.cpp	Thu May 14 12:42:58 2009 +0000
     2.3 @@ -3364,7 +3364,7 @@
     2.4  
     2.5  void Main::changeSelection (VymModel *model, const QItemSelection &newsel, const QItemSelection &oldsel)
     2.6  {
     2.7 -	//branchPropertyWindow->setModel (model ); //FIXME-2 this used to be called from BranchObj::select()
     2.8 +	//branchPropertyWindow->setModel (model ); //FIXME-2 this used to be called from BranchObj::select(). Maybe use signal now...
     2.9  
    2.10  	if (model && model==currentModel() )
    2.11  	{
    2.12 @@ -3373,33 +3373,32 @@
    2.13  		if (!oldsel.indexes().isEmpty() )
    2.14  		{
    2.15  			ti=model->getItem(oldsel.indexes().first());
    2.16 -			//cout << "Main::changeSel getting note from "<<ti->getHeading().toStdString()<<":  \""<<ti->getNote().toStdString()<<"\""<<endl; 
    2.17 -			ti->setNoteObj (textEditor->getNoteObj(),false );
    2.18 +
    2.19 +			// Don't update note if both treeItem and textEditor are empty
    2.20 +			//if (! (ti->hasEmptyNote() && textEditor->isEmpty() ))
    2.21 +			//	ti->setNoteObj (textEditor->getNoteObj(),false );
    2.22  		} 
    2.23  		if (!newsel.indexes().isEmpty() )
    2.24  		{
    2.25  			ti=model->getItem(newsel.indexes().first());
    2.26 -			if (!ti->getNoteObj().isEmpty()  )
    2.27 -			{
    2.28 -				//cout << "Main::changeSel setting note of "<<ti->getHeading().toStdString()<<" m=("<<ti->getModel()<<")  to \""<<ti->getNote().toStdString()<<"\""<<endl; 
    2.29 +			if (!ti->hasEmptyNote() )
    2.30  				textEditor->setNote(ti->getNoteObj() );
    2.31 -			} else
    2.32 -				textEditor->setNote(NoteObj() );
    2.33 +			else
    2.34 +				textEditor->setNote(NoteObj() );	//FIXME-4 maybe add a clear() to TE
    2.35  		} else
    2.36  			textEditor->setInactive();
    2.37  
    2.38 -		// Show URL and link in statusbar	// FIXME-2
    2.39 -		/*
    2.40 +		// Show URL and link in statusbar	
    2.41  		QString status;
    2.42  		QString s=model->getURL();
    2.43  		if (!s.isEmpty() ) status+="URL: "+s+"  ";
    2.44  		s=model->getVymLink();
    2.45  		if (!s.isEmpty() ) status+="Link: "+s;
    2.46  		if (!status.isEmpty() ) statusMessage (status);
    2.47 -*/
    2.48 -
    2.49 -		// Update Toolbar // FIXME-0, was so far in BranchObj
    2.50 -		//updateFlagsToolbar();
    2.51 +
    2.52 +		// Update Toolbar 
    2.53 +		//updateFlagsToolbar();  // FIXME-0, was so far in BranchObj
    2.54 +
    2.55  
    2.56  		updateActions();
    2.57  	}
     3.1 --- a/treeitem.cpp	Wed May 13 08:26:27 2009 +0000
     3.2 +++ b/treeitem.cpp	Thu May 14 12:42:58 2009 +0000
     3.3 @@ -337,9 +337,10 @@
     3.4  	systemFlags.deactivate ("system-note");
     3.5  }
     3.6  
     3.7 -void TreeItem::setNoteObj(const NoteObj &n, bool updateNoteEditor)
     3.8 +void TreeItem::setNoteObj(const NoteObj &n, bool updateNoteEditor) //FIXME-1 setNoteObj is called for every select or so???
     3.9  {
    3.10  	note=n;
    3.11 +	cout << "TI::setNoteObj of "<<getHeadingStd()<<endl;
    3.12  	if (!note.isEmpty() && !systemFlags.isActive ("system-note"))
    3.13  		systemFlags.activate ("system-note");
    3.14  	if (note.isEmpty() && systemFlags.isActive ("system-note"))
    3.15 @@ -351,6 +352,11 @@
    3.16  	return note.getNote();
    3.17  }
    3.18  
    3.19 +bool TreeItem::hasEmptyNote()
    3.20 +{
    3.21 +	return note.isEmpty();
    3.22 +}
    3.23 +
    3.24  NoteObj TreeItem::getNoteObj()
    3.25  {
    3.26  	return note;
     4.1 --- a/treeitem.h	Wed May 13 08:26:27 2009 +0000
     4.2 +++ b/treeitem.h	Thu May 14 12:42:58 2009 +0000
     4.3 @@ -97,6 +97,7 @@
     4.4  	virtual void setNote(const QString &s);
     4.5  	virtual void clearNote();
     4.6  	virtual QString getNote();
     4.7 +	virtual bool hasEmptyNote();
     4.8  	virtual void setNoteObj(const NoteObj &, bool updateNoteEditor=true);
     4.9  	virtual NoteObj getNoteObj();			
    4.10  	virtual QString getNoteASCII(const QString &indent, const int &width); // returns note	(ASCII)
    4.11 @@ -146,6 +147,9 @@
    4.12  	virtual void setLastSelectedBranch(int i);	//! Set last selected branch directly
    4.13  	virtual TreeItem* getLastSelectedBranch();
    4.14  
    4.15 +protected:
    4.16 +	bool hideExport;							//! Hide this item in export
    4.17 +public:
    4.18  	virtual void setHideTmp (HideTmpMode);
    4.19  	virtual bool hasHiddenExportParent ();
    4.20  	virtual void setHideInExport(bool);		// set export of object (and children)
    4.21 @@ -167,7 +171,6 @@
    4.22  	int imageOffset;
    4.23  	int imageCounter;
    4.24  
    4.25 -	bool hideExport;//! Hide this item in export
    4.26  	bool hidden;	//! Hidden in export if true
    4.27  };
    4.28  
     5.1 --- a/xml-vym.cpp	Wed May 13 08:26:27 2009 +0000
     5.2 +++ b/xml-vym.cpp	Thu May 14 12:42:58 2009 +0000
     5.3 @@ -282,8 +282,15 @@
     5.4  		case StateMap:
     5.5  			mainWindow->removeProgressBar();
     5.6  			break;
     5.7 +        case StateMapCenter: 
     5.8 +			model->selectParent();
     5.9 +			model->emitDataHasChanged (lastBranchItem);
    5.10 +			lastBranchItem=model->getSelectedBranchItem();
    5.11 +			lastBranchItem->setLastSelectedBranch (0);	// Reset last selected to first child branch
    5.12 +            break;
    5.13          case StateBranch: 
    5.14  			model->selectParent();
    5.15 +			model->emitDataHasChanged (lastBranchItem);
    5.16  			lastBranchItem=model->getSelectedBranchItem();
    5.17  			lastBranchItem->setLastSelectedBranch (0);	// Reset last selected to first child branch
    5.18              break;
    5.19 @@ -434,17 +441,18 @@
    5.20  					return false;   // Couldn't read absPos
    5.21  			}           
    5.22  		}           
    5.23 -		/* FIXME-2
    5.24 -		if (!a.value( "id").isEmpty() ) 
    5.25 -			lastBranchItem->setID (a.value ("id"));
    5.26 +		//if (!a.value( "id").isEmpty() ) 
    5.27 +		//	lastBranchItem->setID (a.value ("id"));
    5.28 +			
    5.29  		if (!a.value( "url").isEmpty() ) 
    5.30 -			lastOO->setURL (a.value ("url"));
    5.31 +			lastBranchItem->setURL (a.value ("url"));
    5.32  		if (!a.value( "vymLink").isEmpty() ) 
    5.33 -			lastOO->setVymLink (a.value ("vymLink"));
    5.34 +			lastBranchItem->setVymLink (a.value ("vymLink"));
    5.35  		if (!a.value( "hideInExport").isEmpty() ) 
    5.36  			if (a.value("hideInExport")=="true")
    5.37 -				lastOO->getTreeItem()->setHideInExport(true);
    5.38 +				lastBranchItem->setHideInExport(true);
    5.39  
    5.40 +		/* FIXME-2
    5.41  		if (!a.value( "hideLink").isEmpty()) 
    5.42  		{
    5.43  			if (a.value ("hideLink") =="true")