diff -r 7a71a914afdb -r 01f2f6d6789d ornamentedobj.cpp --- a/ornamentedobj.cpp Thu May 07 08:48:53 2009 +0000 +++ b/ornamentedobj.cpp Mon May 18 11:22:41 2009 +0000 @@ -6,9 +6,6 @@ #include "linkablemapobj.h" extern TextEditor *textEditor; -extern FlagRowObj *systemFlagsDefault; -extern FlagRowObj *standardFlagsDefault; - ///////////////////////////////////////////////////////////////// // OrnamentedObj @@ -46,20 +43,9 @@ heading->move (absPos.x(), absPos.y()); systemFlags=new FlagRowObj(scene); - systemFlags->clone(systemFlagsDefault); - systemFlags->setName ("systemFlags"); - standardFlags=new FlagRowObj(scene); - standardFlags->clone(standardFlagsDefault); - standardFlags->setName ("standardFlags"); - - attributes.clear(); frame = new FrameObj (scene); - - url=""; - vymLink=""; - } void OrnamentedObj::copy (OrnamentedObj* other) @@ -72,9 +58,6 @@ standardFlags->copy (other->standardFlags); ornamentsBBox=other->ornamentsBBox; - - url=other->url; - vymLink=other->vymLink; } void OrnamentedObj::setLinkColor() @@ -246,90 +229,9 @@ move2RelPos (p.x(),p.y()); } -void OrnamentedObj::setURL(QString s) +void OrnamentedObj::activateStandardFlag(Flag *flag) { - url=s; - if (!url.isEmpty()) - systemFlags->activate("url"); - else - systemFlags->deactivate("url"); - calcBBoxSize(); // recalculate bbox - positionBBox(); // rearrange contents - forceReposition(); -} - -QString OrnamentedObj::getURL() -{ - return url; -} - -void OrnamentedObj::setVymLink(QString s) -{ - if (!s.isEmpty()) - { - // We need the relative (from loading) - // or absolute path (from User event) - // and build the absolute path. - // Note: If we have relative, use path of - // current map to build absolute path - QDir d(s); - if (!d.path().startsWith ("/")) - { - QString p=model->getDestPath(); - int i=p.findRev("/",-1); - d.setPath(p.left(i)+"/"+s); - d.convertToAbs(); - } - vymLink=d.path(); - systemFlags->activate("vymLink"); - } - else - { - systemFlags->deactivate("vymLink"); - vymLink=""; - } - calcBBoxSize(); // recalculate bbox - positionBBox(); // rearrange contents - forceReposition(); -} - -QString OrnamentedObj::getVymLink() -{ - return vymLink; -} - - -void OrnamentedObj::setAttributes (const QList &al) -{ - attributes=al; -} - -QList OrnamentedObj::getAttributes() -{ - return attributes; -} - -void OrnamentedObj::clearStandardFlags() -{ - standardFlags->deactivateAll(); - calcBBoxSize(); - positionBBox(); - move (absPos.x(), absPos.y() ); - forceReposition(); -} - -void OrnamentedObj::toggleStandardFlag(const QString &name) -{ - standardFlags->toggle(name); - calcBBoxSize(); - positionBBox(); - move (absPos.x(), absPos.y() ); - forceReposition(); -} - -void OrnamentedObj::activateStandardFlag(const QString &name) -{ - standardFlags->activate(name); + standardFlags->activate(flag); calcBBoxSize(); positionBBox(); move (absPos.x(), absPos.y() ); @@ -345,22 +247,12 @@ forceReposition(); } -bool OrnamentedObj::isSetStandardFlag (const QString &name) -{ - return standardFlags->isActive(name); -} QString OrnamentedObj::getSystemFlagName(const QPointF &p) { return systemFlags->getFlagName(p); } -bool OrnamentedObj::isActiveFlag (const QString &name) -{ - if (standardFlags->isActive (name) ) return true; - return false; -} - /* FIXME-3 should move to VymView ?! void OrnamentedObj::getNoteFromTextEditor () { note.setFilenameHint (textEditor->getFilename()); @@ -369,41 +261,7 @@ } */ -void OrnamentedObj::updateSystemFlags() -{ - // FIXME-3 check if note here and text in editor are still in sync!! - // Best would be to always have current text here... - bool noteEmpty=treeItem->getNoteObj().isEmpty(); - /* - if (isNoteInEditor) - noteEmpty=textEditor->isEmpty(); - else - noteEmpty=note.isEmpty(); - */ - - if (!noteEmpty) - { - if (systemFlags->isActive ("note")) return; - systemFlags->activate("note"); - } - else - { - if (!systemFlags->isActive ("note")) return; - systemFlags->deactivate("note"); - } - //model->setChanged(); - calcBBoxSize(); - positionBBox(); - move (absPos.x(), absPos.y() ); - forceReposition(); -} - -void OrnamentedObj::updateFlagsToolbar() -{ - standardFlags->updateToolbar(); -} - -QString OrnamentedObj::getOrnXMLAttr() +QString OrnamentedObj::getOrnXMLAttr() //FIXME-2 { QString posAttr; @@ -424,20 +282,12 @@ posAttr=""; } - QString urlAttr; - if (!url.isEmpty()) - urlAttr=attribut ("url",url); - - QString vymLinkAttr; - if (!vymLink.isEmpty()) - vymLinkAttr=attribut ("vymLink",convertToRel(model->getDestPath(),vymLink) ); - /* FIXME-2 QString hideExpAttr; if (hideExport) hideExpAttr= attribut("hideInExport","true"); else hideExpAttr=""; */ - return posAttr +urlAttr +vymLinkAttr +getLinkAttr() ;//+hideExpAttr; + return posAttr +getLinkAttr() ;//+hideExpAttr; }