From 0731b3a309f48ec0202e50d8d034b0723a20f8eb Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 6 Dec 2017 08:50:50 -0500 Subject: Make sure that on closing, it attempts to save *all* files with pending changes. If popup warnings are disabled just close the app (never automatically change the underlying file(s) - this can be disastrous) Add status reporting to all the "Save" functions so that it returns false if the user cancelled it. --- src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h') diff --git a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h index 0c83b7ce..ec6c6bf7 100644 --- a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h +++ b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h @@ -21,7 +21,7 @@ class PlainTextEditor : public QPlainTextEdit{ public: PlainTextEditor(QSettings *set, QWidget *parent = 0); ~PlainTextEditor(); - + //Functions for setting up the editor void showLineNumbers(bool show = true); void LoadSyntaxRule(QString type); @@ -29,7 +29,7 @@ public: //File loading/setting options void LoadFile(QString filepath); - void SaveFile(bool newname = false); + bool SaveFile(bool newname = false); QString currentFile(); bool hasChange(); @@ -37,10 +37,10 @@ public: //Functions for managing the line number widget (internal - do not need to run directly) int LNWWidth(); //replacing the LNW size hint detection void paintLNW(QPaintEvent *ev); //forwarded from the LNW paint event - void updateLNW(); + void updateLNW(); QFontMetrics *metrics; - + private: QWidget *LNW; //Line Number Widget bool showLNW; -- cgit From eee843173b5f1f3d7e7d7fc1a822f0e735378d38 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 6 Dec 2017 09:28:30 -0500 Subject: Add better handling of read-only files in LTE. --- src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h') diff --git a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h index ec6c6bf7..b0a6cbc7 100644 --- a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h +++ b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h @@ -33,6 +33,7 @@ public: QString currentFile(); bool hasChange(); + bool readOnlyFile(); //Functions for managing the line number widget (internal - do not need to run directly) int LNWWidth(); //replacing the LNW size hint detection @@ -55,8 +56,9 @@ private: void clearMatchData(); void highlightMatch(QChar ch, bool forward, int fromPos, QChar startch); - //Flags to keep track of changes - bool hasChanges; + //Flags to keep track of changes/status + bool hasChanges, readonly; + private slots: //Functions for managing the line number widget void LNW_updateWidth(); // Tied to the QPlainTextEdit::blockCountChanged() signal @@ -68,7 +70,7 @@ private slots: void textChanged(); void cursorMoved(); //Function for prompting the user if the file changed externally - void fileChanged(); + void fileChanged(); protected: void resizeEvent(QResizeEvent *ev); -- cgit