1.1 --- a/exports.cpp Mon Oct 22 09:50:03 2007 +0000
1.2 +++ b/exports.cpp Thu Dec 06 18:30:29 2007 +0000
1.3 @@ -142,45 +142,65 @@
1.4
1.5 // Main loop over all branches
1.6 QString s;
1.7 - QString actIndent("");
1.8 - int i,j;
1.9 + QString curIndent;
1.10 + int i;
1.11 BranchObj *bo;
1.12 bo=mapCenter->first();
1.13 while (bo)
1.14 {
1.15 // Make indentstring
1.16 - for (i=0;i<bo->getDepth();i++) actIndent+= indentPerDepth;
1.17 + curIndent="";
1.18 + for (i=0;i<bo->getDepth()-1;i++) curIndent+= indentPerDepth;
1.19
1.20 if (!bo->hasHiddenExportParent() )
1.21 {
1.22 - if (bo->getDepth()==0)
1.23 + switch (bo->getDepth())
1.24 {
1.25 - ts << (bo->getHeading()+ "\n");
1.26 - for (j=0;j<bo->getHeading().length();j++) ts<<"=";
1.27 - ts << "\n";
1.28 - } else if (bo->getDepth()==1)
1.29 - ts << ("\n"+getSectionString(bo) + bo->getHeading()+ "\n");
1.30 - else if (bo->getDepth()==2)
1.31 - ts << (actIndent + " * " + bo->getHeading()+ "\n");
1.32 - else if (bo->getDepth()==3)
1.33 - ts << (actIndent + " o " + bo->getHeading()+ "\n");
1.34 - else
1.35 - ts << (actIndent + " - " + bo->getHeading()+ "\n");
1.36 -
1.37 + case 0:
1.38 + ts << underline (bo->getHeading(),QString("="));
1.39 + ts << "\n";
1.40 + break;
1.41 + case 1:
1.42 + ts << "\n";
1.43 + ts << (underline (getSectionString(bo) + bo->getHeading(), QString("-") ) );
1.44 + ts << "\n";
1.45 + break;
1.46 + case 2:
1.47 + ts << "\n";
1.48 + ts << (curIndent + "* " + bo->getHeading());
1.49 + ts << "\n";
1.50 + break;
1.51 + case 3:
1.52 + ts << (curIndent + "- " + bo->getHeading());
1.53 + ts << "\n";
1.54 + break;
1.55 + default:
1.56 + ts << (curIndent + "- " + bo->getHeading());
1.57 + ts << "\n";
1.58 + break;
1.59 + }
1.60 +
1.61 // If necessary, write note
1.62 if (!bo->getNote().isEmpty())
1.63 {
1.64 - s =bo->getNoteASCII();
1.65 - s=s.replace ("\n","\n"+actIndent);
1.66 - ts << (s+"\n\n");
1.67 + curIndent +=" | ";
1.68 + s =curIndent + bo->getNoteASCII( curIndent, 80);
1.69 + s=s.replace ("\n","\n"+curIndent);
1.70 + ts << QString (s+"\n");
1.71 }
1.72 }
1.73 bo=bo->next();
1.74 - actIndent="";
1.75 }
1.76 file.close();
1.77 }
1.78
1.79 +QString ExportASCII::underline (const QString &text, const QString &line)
1.80 +{
1.81 + QString r=text + "\n";
1.82 + for (int j=0;j<text.length();j++) r+=line;
1.83 + return r;
1.84 +}
1.85 +
1.86
1.87 ////////////////////////////////////////////////////////////////////////
1.88 void ExportCSV::doExport()
1.89 @@ -198,7 +218,7 @@
1.90
1.91 // Main loop over all branches
1.92 QString s;
1.93 - QString actIndent("");
1.94 + QString curIndent("");
1.95 int i;
1.96 BranchObj *bo;
1.97 bo=mapCenter->first();
1.98 @@ -210,20 +230,20 @@
1.99 if (!bo->getNote().isEmpty())
1.100 {
1.101 s =bo->getNoteASCII();
1.102 - s=s.replace ("\n","\n"+actIndent);
1.103 + s=s.replace ("\n","\n"+curIndent);
1.104 ts << ("\""+s+"\",");
1.105 } else
1.106 ts <<"\"\",";
1.107
1.108 // Make indentstring
1.109 - for (i=0;i<bo->getDepth();i++) actIndent+= "\"\",";
1.110 + for (i=0;i<bo->getDepth();i++) curIndent+= "\"\",";
1.111
1.112 // Write heading
1.113 - ts << actIndent << "\"" << bo->getHeading()<<"\""<<endl;
1.114 + ts << curIndent << "\"" << bo->getHeading()<<"\""<<endl;
1.115 }
1.116
1.117 bo=bo->next();
1.118 - actIndent="";
1.119 + curIndent="";
1.120 }
1.121 file.close();
1.122 }
1.123 @@ -341,7 +361,7 @@
1.124
1.125 // Main loop over all branches
1.126 QString s;
1.127 - // QString actIndent("");
1.128 + // QString curIndent("");
1.129 // int i;
1.130 BranchObj *bo;
1.131 bo=mapCenter->first();