diff -r 316e9237794c -r 8fb5b3956b3e exports.cpp --- a/exports.cpp Tue Oct 23 13:05:22 2007 +0000 +++ b/exports.cpp Wed Oct 24 12:21:24 2007 +0000 @@ -142,45 +142,65 @@ // Main loop over all branches QString s; - QString actIndent(""); - int i,j; + QString curIndent; + int i; BranchObj *bo; bo=mapCenter->first(); while (bo) { // Make indentstring - for (i=0;igetDepth();i++) actIndent+= indentPerDepth; + curIndent=""; + for (i=0;igetDepth()-1;i++) curIndent+= indentPerDepth; if (!bo->hasHiddenExportParent() ) { - if (bo->getDepth()==0) + switch (bo->getDepth()) { - ts << (bo->getHeading()+ "\n"); - for (j=0;jgetHeading().length();j++) ts<<"="; - ts << "\n"; - } else if (bo->getDepth()==1) - ts << ("\n"+getSectionString(bo) + bo->getHeading()+ "\n"); - else if (bo->getDepth()==2) - ts << (actIndent + " * " + bo->getHeading()+ "\n"); - else if (bo->getDepth()==3) - ts << (actIndent + " o " + bo->getHeading()+ "\n"); - else - ts << (actIndent + " - " + bo->getHeading()+ "\n"); - + case 0: + ts << underline (bo->getHeading(),QString("=")); + ts << "\n"; + break; + case 1: + ts << "\n"; + ts << (underline (getSectionString(bo) + bo->getHeading(), QString("-") ) ); + ts << "\n"; + break; + case 2: + ts << "\n"; + ts << (curIndent + "* " + bo->getHeading()); + ts << "\n"; + break; + case 3: + ts << (curIndent + "- " + bo->getHeading()); + ts << "\n"; + break; + default: + ts << (curIndent + "- " + bo->getHeading()); + ts << "\n"; + break; + } + // If necessary, write note if (!bo->getNote().isEmpty()) { - s =bo->getNoteASCII(); - s=s.replace ("\n","\n"+actIndent); - ts << (s+"\n\n"); + curIndent +=" | "; + s =curIndent + bo->getNoteASCII( curIndent, 80); + s=s.replace ("\n","\n"+curIndent); + ts << QString (s+"\n"); } } bo=bo->next(); - actIndent=""; } file.close(); } +QString ExportASCII::underline (const QString &text, const QString &line) +{ + QString r=text + "\n"; + for (int j=0;jfirst(); @@ -210,20 +230,20 @@ if (!bo->getNote().isEmpty()) { s =bo->getNoteASCII(); - s=s.replace ("\n","\n"+actIndent); + s=s.replace ("\n","\n"+curIndent); ts << ("\""+s+"\","); } else ts <<"\"\","; // Make indentstring - for (i=0;igetDepth();i++) actIndent+= "\"\","; + for (i=0;igetDepth();i++) curIndent+= "\"\","; // Write heading - ts << actIndent << "\"" << bo->getHeading()<<"\""<getHeading()<<"\""<next(); - actIndent=""; + curIndent=""; } file.close(); } @@ -341,7 +361,7 @@ // Main loop over all branches QString s; - // QString actIndent(""); + // QString curIndent(""); // int i; BranchObj *bo; bo=mapCenter->first();