# HG changeset patch # User insilmaril # Date 1242304978 0 # Node ID 382a444f5b0cb56768c4131a87e0cd3ad98a3d4b # Parent 6d2b32f305f94bb2017992b3771a36eaf9152394 flag of NoteEditor works again diff -r 6d2b32f305f9 -r 382a444f5b0c branchitem.cpp --- a/branchitem.cpp Wed May 13 08:26:27 2009 +0000 +++ b/branchitem.cpp Thu May 14 12:42:58 2009 +0000 @@ -54,9 +54,8 @@ QString s,a; BranchObj *bo=(BranchObj*)lmo; - /* // Update of note is usually done while unselecting a branch - if (isNoteInEditor) getNoteFromTextEditor(); + // if (isNoteInEditor) getNoteFromTextEditor(); // FIXME-0 check that this still works... QString scrolledAttr; if (scrolled) @@ -64,7 +63,9 @@ else scrolledAttr=""; - // save area, if not scrolled + /* + // save area, if not scrolled // FIXME-3 not needed if HTML is rewritten... + // also we should check if _any_ of parents is scrolled QString areaAttr; if (!((BranchObj*)(parObj))->isScrolled() ) { @@ -88,7 +89,7 @@ s=beginElement ("branch" +getAttr() // +getOrnXMLAttr() - // +scrolledAttr + +scrolledAttr // +areaAttr // +idAttr // +getIncludeImageAttr() @@ -103,10 +104,12 @@ // Save frame if (frame->getFrameType()!=FrameObj::NoFrame) s+=frame->saveToDir (); +*/ // save names of flags set - s+=standardFlags->saveToDir(tmpdir,prefix,0); + s+=standardFlags.saveToDir(tmpdir,prefix,0); +/* // Save FloatImages for (int i=0; i<floatimage.size(); ++i) s+=floatimage.at(i)->saveToDir (tmpdir,prefix); diff -r 6d2b32f305f9 -r 382a444f5b0c mainwindow.cpp --- a/mainwindow.cpp Wed May 13 08:26:27 2009 +0000 +++ b/mainwindow.cpp Thu May 14 12:42:58 2009 +0000 @@ -3364,7 +3364,7 @@ void Main::changeSelection (VymModel *model, const QItemSelection &newsel, const QItemSelection &oldsel) { - //branchPropertyWindow->setModel (model ); //FIXME-2 this used to be called from BranchObj::select() + //branchPropertyWindow->setModel (model ); //FIXME-2 this used to be called from BranchObj::select(). Maybe use signal now... if (model && model==currentModel() ) { @@ -3373,33 +3373,32 @@ if (!oldsel.indexes().isEmpty() ) { ti=model->getItem(oldsel.indexes().first()); - //cout << "Main::changeSel getting note from "<<ti->getHeading().toStdString()<<": \""<<ti->getNote().toStdString()<<"\""<<endl; - ti->setNoteObj (textEditor->getNoteObj(),false ); + + // Don't update note if both treeItem and textEditor are empty + //if (! (ti->hasEmptyNote() && textEditor->isEmpty() )) + // ti->setNoteObj (textEditor->getNoteObj(),false ); } if (!newsel.indexes().isEmpty() ) { ti=model->getItem(newsel.indexes().first()); - if (!ti->getNoteObj().isEmpty() ) - { - //cout << "Main::changeSel setting note of "<<ti->getHeading().toStdString()<<" m=("<<ti->getModel()<<") to \""<<ti->getNote().toStdString()<<"\""<<endl; + if (!ti->hasEmptyNote() ) textEditor->setNote(ti->getNoteObj() ); - } else - textEditor->setNote(NoteObj() ); + else + textEditor->setNote(NoteObj() ); //FIXME-4 maybe add a clear() to TE } else textEditor->setInactive(); - // Show URL and link in statusbar // FIXME-2 - /* + // Show URL and link in statusbar QString status; QString s=model->getURL(); if (!s.isEmpty() ) status+="URL: "+s+" "; s=model->getVymLink(); if (!s.isEmpty() ) status+="Link: "+s; if (!status.isEmpty() ) statusMessage (status); -*/ - - // Update Toolbar // FIXME-0, was so far in BranchObj - //updateFlagsToolbar(); + + // Update Toolbar + //updateFlagsToolbar(); // FIXME-0, was so far in BranchObj + updateActions(); } diff -r 6d2b32f305f9 -r 382a444f5b0c treeitem.cpp --- a/treeitem.cpp Wed May 13 08:26:27 2009 +0000 +++ b/treeitem.cpp Thu May 14 12:42:58 2009 +0000 @@ -337,9 +337,10 @@ systemFlags.deactivate ("system-note"); } -void TreeItem::setNoteObj(const NoteObj &n, bool updateNoteEditor) +void TreeItem::setNoteObj(const NoteObj &n, bool updateNoteEditor) //FIXME-1 setNoteObj is called for every select or so??? { note=n; + cout << "TI::setNoteObj of "<<getHeadingStd()<<endl; if (!note.isEmpty() && !systemFlags.isActive ("system-note")) systemFlags.activate ("system-note"); if (note.isEmpty() && systemFlags.isActive ("system-note")) @@ -351,6 +352,11 @@ return note.getNote(); } +bool TreeItem::hasEmptyNote() +{ + return note.isEmpty(); +} + NoteObj TreeItem::getNoteObj() { return note; diff -r 6d2b32f305f9 -r 382a444f5b0c treeitem.h --- a/treeitem.h Wed May 13 08:26:27 2009 +0000 +++ b/treeitem.h Thu May 14 12:42:58 2009 +0000 @@ -97,6 +97,7 @@ virtual void setNote(const QString &s); virtual void clearNote(); virtual QString getNote(); + virtual bool hasEmptyNote(); virtual void setNoteObj(const NoteObj &, bool updateNoteEditor=true); virtual NoteObj getNoteObj(); virtual QString getNoteASCII(const QString &indent, const int &width); // returns note (ASCII) @@ -146,6 +147,9 @@ virtual void setLastSelectedBranch(int i); //! Set last selected branch directly virtual TreeItem* getLastSelectedBranch(); +protected: + bool hideExport; //! Hide this item in export +public: virtual void setHideTmp (HideTmpMode); virtual bool hasHiddenExportParent (); virtual void setHideInExport(bool); // set export of object (and children) @@ -167,7 +171,6 @@ int imageOffset; int imageCounter; - bool hideExport;//! Hide this item in export bool hidden; //! Hidden in export if true }; diff -r 6d2b32f305f9 -r 382a444f5b0c xml-vym.cpp --- a/xml-vym.cpp Wed May 13 08:26:27 2009 +0000 +++ b/xml-vym.cpp Thu May 14 12:42:58 2009 +0000 @@ -282,8 +282,15 @@ case StateMap: mainWindow->removeProgressBar(); break; + case StateMapCenter: + model->selectParent(); + model->emitDataHasChanged (lastBranchItem); + lastBranchItem=model->getSelectedBranchItem(); + lastBranchItem->setLastSelectedBranch (0); // Reset last selected to first child branch + break; case StateBranch: model->selectParent(); + model->emitDataHasChanged (lastBranchItem); lastBranchItem=model->getSelectedBranchItem(); lastBranchItem->setLastSelectedBranch (0); // Reset last selected to first child branch break; @@ -434,17 +441,18 @@ return false; // Couldn't read absPos } } - /* FIXME-2 - if (!a.value( "id").isEmpty() ) - lastBranchItem->setID (a.value ("id")); + //if (!a.value( "id").isEmpty() ) + // lastBranchItem->setID (a.value ("id")); + if (!a.value( "url").isEmpty() ) - lastOO->setURL (a.value ("url")); + lastBranchItem->setURL (a.value ("url")); if (!a.value( "vymLink").isEmpty() ) - lastOO->setVymLink (a.value ("vymLink")); + lastBranchItem->setVymLink (a.value ("vymLink")); if (!a.value( "hideInExport").isEmpty() ) if (a.value("hideInExport")=="true") - lastOO->getTreeItem()->setHideInExport(true); + lastBranchItem->setHideInExport(true); + /* FIXME-2 if (!a.value( "hideLink").isEmpty()) { if (a.value ("hideLink") =="true")