1 #include "export-orgmode.h"
3 #include "mainwindow.h"
6 extern Main *mainWindow;
8 ExportOrgMode::ExportOrgMode()
10 exportName = "OrgMode";
11 filter = "org-mode (*.org);;All (* *.*)";
14 void ExportOrgMode::doExport()
16 // Exports a map to an org-mode file.
17 // This file needs to be read
18 // by EMACS into an org mode buffer
20 if (!file.open(QIODevice::WriteOnly)) {
21 QMessageBox::critical(
22 0, QObject::tr("Critical Export Error"),
23 QObject::tr("Could not export as OrgMode to %1").arg(filePath));
24 mainWindow->statusMessage(QString(QObject::tr("Export failed.")));
27 QTextStream ts(&file);
30 // Main loop over all branches
33 BranchItem *cur = NULL;
34 BranchItem *prev = NULL;
35 model->nextBranch(cur, prev);
37 if (!cur->hasHiddenExportParent()) {
38 for (i = 0; i <= cur->depth(); i++)
40 ts << (" " + cur->getHeadingPlain() + "\n");
41 // If necessary, write note
42 if (!cur->isNoteEmpty()) {
43 ts << (cur->getNoteASCII(0, 80));
47 model->nextBranch(cur, prev);
51 result = ExportBase::Success;
53 displayedDestination = filePath;