Menu

[357496]: / export-orgmode.cpp  Maximize  Restore  History

Download this file

56 lines (48 with data), 1.4 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "export-orgmode.h"
#include <QMessageBox>
#include "mainwindow.h"
extern Main *mainWindow;
ExportOrgMode::ExportOrgMode()
{
exportName="OrgMode";
filter="org-mode (*.org);;All (* *.*)";
}
void ExportOrgMode::doExport()
{
// Exports a map to an org-mode file.
// This file needs to be read
// by EMACS into an org mode buffer
QFile file (filePath);
if ( !file.open( QIODevice::WriteOnly ) )
{
QMessageBox::critical (0, QObject::tr("Critical Export Error"), QObject::tr("Could not export as OrgMode to %1").arg(filePath));
mainWindow->statusMessage(QString(QObject::tr("Export failed.")));
return;
}
QTextStream ts( &file );
ts.setCodec("UTF-8");
// Main loop over all branches
QString s;
int i;
BranchItem *cur=NULL;
BranchItem *prev=NULL;
model->nextBranch(cur,prev);
while (cur)
{
if (!cur->hasHiddenExportParent() )
{
for(i=0;i<=cur->depth();i++)
ts << ("*");
ts << (" " + cur->getHeadingPlain()+ "\n");
// If necessary, write note
if (!cur->isNoteEmpty())
{
ts << (cur->getNoteASCII());
ts << ("\n");
}
}
model->nextBranch(cur,prev);
}
file.close();
completeExport();
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.