]> git.sven.stormbind.net Git - sven/vym.git/blob - src/noteeditor.cpp
New upstream version 2.9.22
[sven/vym.git] / src / noteeditor.cpp
1 #include "noteeditor.h"
2
3 #include <QMenuBar>
4
5 #include "settings.h"
6 #include "vymnote.h"
7
8 extern Settings settings;
9 extern QString vymName;
10
11 NoteEditor::NoteEditor(QString scope) : TextEditor()
12 {
13     editorName = tr("Note Editor", "Name of editor shown as window title");
14     setWindowTitle("");
15
16     menuBar()->show();
17
18     setUseColorMapBackground(false);
19
20     // Load Settings
21     init(scope);
22 }
23
24 NoteEditor::~NoteEditor() {}
25
26 VymNote NoteEditor::getNote()
27 {
28     VymNote note;
29     if (actionFormatRichText->isChecked())
30         note.setRichText(getText());
31     else
32         note.setPlainText(getText());
33     note.setFontHint(getFontHint());
34     note.setFilenameHint(getFilenameHint());
35     return note;
36 }
37
38 void NoteEditor::setNote(const VymNote &note)
39 {
40     if (note.isRichText())
41         setRichText(note.getText());
42     else {
43         setPlainText(note.getText());
44         setFontHint(note.getFontHint());
45     }
46     setFilenameHint(note.getFilenameHint());
47 }