]> git.sven.stormbind.net Git - sven/vym.git/blobdiff - src/noteeditor.cpp
New upstream version 2.9.22
[sven/vym.git] / src / noteeditor.cpp
diff --git a/src/noteeditor.cpp b/src/noteeditor.cpp
new file mode 100644 (file)
index 0000000..56927d5
--- /dev/null
@@ -0,0 +1,47 @@
+#include "noteeditor.h"
+
+#include <QMenuBar>
+
+#include "settings.h"
+#include "vymnote.h"
+
+extern Settings settings;
+extern QString vymName;
+
+NoteEditor::NoteEditor(QString scope) : TextEditor()
+{
+    editorName = tr("Note Editor", "Name of editor shown as window title");
+    setWindowTitle("");
+
+    menuBar()->show();
+
+    setUseColorMapBackground(false);
+
+    // Load Settings
+    init(scope);
+}
+
+NoteEditor::~NoteEditor() {}
+
+VymNote NoteEditor::getNote()
+{
+    VymNote note;
+    if (actionFormatRichText->isChecked())
+        note.setRichText(getText());
+    else
+        note.setPlainText(getText());
+    note.setFontHint(getFontHint());
+    note.setFilenameHint(getFilenameHint());
+    return note;
+}
+
+void NoteEditor::setNote(const VymNote &note)
+{
+    if (note.isRichText())
+        setRichText(note.getText());
+    else {
+        setPlainText(note.getText());
+        setFontHint(note.getFontHint());
+    }
+    setFilenameHint(note.getFilenameHint());
+}