1.1 --- a/exports.cpp Sun Jan 30 12:58:47 2005 +0000
1.2 +++ b/exports.cpp Mon Jul 25 20:35:01 2005 +0000
1.3 @@ -1,6 +1,9 @@
1.4 #include "exports.h"
1.5
1.6 +#include <qregexp.h>
1.7 +
1.8 #include "linkablemapobj.h"
1.9 +#include "texteditor.h"
1.10
1.11
1.12 Export::Export()
1.13 @@ -8,24 +11,6 @@
1.14 indentPerDepth=" ";
1.15 }
1.16
1.17 -bool Export::setOutputDir(QString dirname)
1.18 -{
1.19 - outdir.setPath (dirname);
1.20 - if ( outdir.exists() )
1.21 - {
1.22 - // FIXME
1.23 - // ask for confirmation
1.24 - // then delete outdir
1.25 - return true;
1.26 - } else
1.27 - {
1.28 - // try to create directory
1.29 - //return outdir.mkdir (outdir.absPath());
1.30 - // FIXME
1.31 - return true;
1.32 - }
1.33 -}
1.34 -
1.35 void Export::setPath (const QString &p)
1.36 {
1.37 filepath=p;
1.38 @@ -41,7 +26,7 @@
1.39 QFile file (filepath);
1.40 if ( !file.open( IO_WriteOnly ) )
1.41 {
1.42 - // FIXME
1.43 + // FIXME experimental, testing
1.44 cout << "Export::exportMap couldn't open "<<filepath<<endl;
1.45 return;
1.46 }
1.47 @@ -50,7 +35,7 @@
1.48 // Main loop over all branches
1.49 QString s;
1.50 QString actIndent("");
1.51 - int i;
1.52 + uint i;
1.53 BranchObj *bo;
1.54 bo=mapCenter->first();
1.55 while (bo)
1.56 @@ -60,18 +45,24 @@
1.57
1.58 // Write heading
1.59 // write (actIndent + getSectionString(bo) + bo->getHeading()+ "\n");
1.60 - if (bo->getDepth()==1)
1.61 - ts << (getSectionString(bo) + bo->getHeading()+ "\n");
1.62 + if (bo->getDepth()==0)
1.63 + {
1.64 + ts << (bo->getHeading()+ "\n");
1.65 + for (i=0;i<bo->getHeading().length();i++) ts<<"=";
1.66 + ts << "\n";
1.67 + } else if (bo->getDepth()==1)
1.68 + ts << ("\n"+getSectionString(bo) + bo->getHeading()+ "\n");
1.69 + else if (bo->getDepth()==2)
1.70 + ts << (actIndent + " o " + bo->getHeading()+ "\n");
1.71 else
1.72 ts << (actIndent + " - " + bo->getHeading()+ "\n");
1.73
1.74 // If necessary, write note
1.75 if (!bo->getNote().isEmpty())
1.76 {
1.77 - ts << ("-------------------Begin of Note-----------------\n");
1.78 - ts << (bo->getNote());
1.79 - ts << ("\n");
1.80 - ts << ("-------------------End of Note-------------------\n");
1.81 + s =textConvertToASCII(bo->getNote());
1.82 + s=s.replace ("\n","\n"+actIndent);
1.83 + ts << (s+"\n\n");
1.84 }
1.85
1.86 bo=bo->next();
1.87 @@ -97,36 +88,3 @@
1.88 return r + " ";
1.89 }
1.90
1.91 -void Export::exportAsHTML()
1.92 -{
1.93 - // FIXME just testing...
1.94 - // Main loop over all branches
1.95 - QString s;
1.96 - QString actIndent("");
1.97 - int i;
1.98 - BranchObj *bo;
1.99 - bo=mapCenter->first();
1.100 - while (bo)
1.101 - {
1.102 - // Make indentstring
1.103 - for (i=0;i<bo->getDepth();i++) actIndent+= indentPerDepth;
1.104 -
1.105 - // Write heading
1.106 - write (actIndent + getSectionString(bo) + bo->getHeading()+ "\n");
1.107 -
1.108 - // If necessary, write note
1.109 - if (!bo->getNote().isEmpty())
1.110 - {
1.111 - write (bo->getNote());
1.112 - }
1.113 -
1.114 - bo=bo->next();
1.115 - actIndent="";
1.116 - }
1.117 -}
1.118 -
1.119 -void Export::write(QString s)
1.120 -{
1.121 - cout << s;
1.122 -}
1.123 -