Changeset View
Changeset View
Standalone View
Standalone View
src/document/katedocument.h
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Line(s) | |||||
64 | class KateDocumentConfig; | 64 | class KateDocumentConfig; | ||
65 | class KateHighlighting; | 65 | class KateHighlighting; | ||
66 | class KateUndoManager; | 66 | class KateUndoManager; | ||
67 | class KateOnTheFlyChecker; | 67 | class KateOnTheFlyChecker; | ||
68 | class KateDocumentTest; | 68 | class KateDocumentTest; | ||
69 | 69 | | |||
70 | class KateAutoIndent; | 70 | class KateAutoIndent; | ||
71 | class KateModOnHdPrompt; | 71 | class KateModOnHdPrompt; | ||
72 | class KToggleAction; | ||||
72 | 73 | | |||
73 | /** | 74 | /** | ||
74 | * @brief Backend of KTextEditor::Document related public KTextEditor interfaces. | 75 | * @brief Backend of KTextEditor::Document related public KTextEditor interfaces. | ||
75 | * | 76 | * | ||
76 | * @warning This file is @e private API and not part of the public | 77 | * @warning This file is @e private API and not part of the public | ||
77 | * KTextEditor interfaces. | 78 | * KTextEditor interfaces. | ||
78 | */ | 79 | */ | ||
79 | class KTEXTEDITOR_EXPORT KTextEditor::DocumentPrivate : public KTextEditor::Document, | 80 | class KTEXTEDITOR_EXPORT KTextEditor::DocumentPrivate : public KTextEditor::Document, | ||
▲ Show 20 Lines • Show All 675 Lines • ▼ Show 20 Line(s) | 745 | public: | |||
755 | * @return success | 756 | * @return success | ||
756 | */ | 757 | */ | ||
757 | bool saveFile() override; | 758 | bool saveFile() override; | ||
758 | 759 | | |||
759 | void setReadWrite(bool rw = true) override; | 760 | void setReadWrite(bool rw = true) override; | ||
760 | 761 | | |||
761 | void setModified(bool m) override; | 762 | void setModified(bool m) override; | ||
762 | 763 | | |||
764 | bool isAutoReload(); | ||||
765 | KToggleAction* autoReloadToggleAction() { return m_autoReloadMode; }; | ||||
766 | void delayAutoReload(); | ||||
767 | | ||||
768 | private Q_SLOTS: | ||||
769 | void autoReloadToggled(bool b); | ||||
770 | | ||||
763 | private: | 771 | private: | ||
764 | void activateDirWatch(const QString &useFileName = QString()); | 772 | void activateDirWatch(const QString &useFileName = QString()); | ||
765 | void deactivateDirWatch(); | 773 | void deactivateDirWatch(); | ||
766 | 774 | | |||
767 | QString m_dirWatchFile; | 775 | QString m_dirWatchFile; | ||
768 | 776 | | |||
769 | /** | 777 | /** | ||
770 | * Make backup copy during saveFile, if configured that way. | 778 | * Make backup copy during saveFile, if configured that way. | ||
▲ Show 20 Lines • Show All 206 Lines • ▼ Show 20 Line(s) | |||||
977 | 985 | | |||
978 | private: | 986 | private: | ||
979 | // helper to handle the embedded notification for externally modified files | 987 | // helper to handle the embedded notification for externally modified files | ||
980 | QPointer<KateModOnHdPrompt> m_modOnHdHandler; | 988 | QPointer<KateModOnHdPrompt> m_modOnHdHandler; | ||
981 | 989 | | |||
982 | private Q_SLOTS: | 990 | private Q_SLOTS: | ||
983 | void onModOnHdSaveAs(); | 991 | void onModOnHdSaveAs(); | ||
984 | void onModOnHdReload(); | 992 | void onModOnHdReload(); | ||
993 | void onModOnHdAutoReload(); | ||||
985 | void onModOnHdIgnore(); | 994 | void onModOnHdIgnore(); | ||
986 | 995 | | |||
987 | public: | 996 | public: | ||
988 | bool setEncoding(const QString &e) override; | 997 | bool setEncoding(const QString &e) override; | ||
989 | QString encoding() const override; | 998 | QString encoding() const override; | ||
990 | 999 | | |||
991 | public Q_SLOTS: | 1000 | public Q_SLOTS: | ||
992 | void setWordWrap(bool on); | 1001 | void setWordWrap(bool on); | ||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Line(s) | 1053 | public: | |||
1069 | * set indentation mode by user | 1078 | * set indentation mode by user | ||
1070 | * this will remember that a user did set it and will avoid reset on save | 1079 | * this will remember that a user did set it and will avoid reset on save | ||
1071 | */ | 1080 | */ | ||
1072 | void rememberUserDidSetIndentationMode() | 1081 | void rememberUserDidSetIndentationMode() | ||
1073 | { | 1082 | { | ||
1074 | m_indenterSetByUser = true; | 1083 | m_indenterSetByUser = true; | ||
1075 | } | 1084 | } | ||
1076 | 1085 | | |||
1077 | /** | 1086 | /** | ||
dhaumann: What about this: make this a QAction with setCheckable(true). Then, you could reuse this action… | |||||
I'm working on a toggle action added to the View menu, so you can then enable that in advance. Surprising much effort :-/ but maybe I'm too stupid to do it in a simple way loh.tar: - That would be the first action member in katedocument
- How that can add to the KTextEditor… | |||||
1078 | * User did set encoding for next reload => enforce it! | 1087 | * User did set encoding for next reload => enforce it! | ||
1079 | */ | 1088 | */ | ||
1080 | void userSetEncodingForNextReload() | 1089 | void userSetEncodingForNextReload() | ||
1081 | { | 1090 | { | ||
1082 | m_userSetEncodingForNextReload = true; | 1091 | m_userSetEncodingForNextReload = true; | ||
1083 | } | 1092 | } | ||
1084 | 1093 | | |||
1085 | // | 1094 | // | ||
1086 | // REALLY internal data ;) | 1095 | // REALLY internal data ;) | ||
1087 | // | 1096 | // | ||
1088 | private: | 1097 | private: | ||
1089 | // text buffer | 1098 | // text buffer | ||
1090 | KateBuffer *const m_buffer; | 1099 | KateBuffer *const m_buffer; | ||
1091 | 1100 | | |||
1092 | // indenter | 1101 | // indenter | ||
1093 | KateAutoIndent *const m_indenter; | 1102 | KateAutoIndent *const m_indenter; | ||
1094 | 1103 | | |||
1095 | bool m_hlSetByUser = false; | 1104 | bool m_hlSetByUser = false; | ||
1096 | bool m_bomSetByUser = false; | 1105 | bool m_bomSetByUser = false; | ||
1097 | bool m_indenterSetByUser = false; | 1106 | bool m_indenterSetByUser = false; | ||
1098 | bool m_userSetEncodingForNextReload = false; | 1107 | bool m_userSetEncodingForNextReload = false; | ||
1099 | 1108 | | |||
1100 | bool m_modOnHd = false; | 1109 | bool m_modOnHd = false; | ||
1110 | KToggleAction* m_autoReloadMode; | ||||
1111 | QTimer m_autoReloadThrottle; | ||||
1101 | ModifiedOnDiskReason m_modOnHdReason = OnDiskUnmodified; | 1112 | ModifiedOnDiskReason m_modOnHdReason = OnDiskUnmodified; | ||
1102 | ModifiedOnDiskReason m_prevModOnHdReason = OnDiskUnmodified; | 1113 | ModifiedOnDiskReason m_prevModOnHdReason = OnDiskUnmodified; | ||
1103 | 1114 | | |||
1104 | QString m_docName; | 1115 | QString m_docName; | ||
1105 | int m_docNameNumber = 0; | 1116 | int m_docNameNumber = 0; | ||
1106 | 1117 | | |||
1107 | // file type !!! | 1118 | // file type !!! | ||
1108 | QString m_fileType; | 1119 | QString m_fileType; | ||
▲ Show 20 Lines • Show All 321 Lines • Show Last 20 Lines |
What about this: make this a QAction with setCheckable(true). Then, you could reuse this action in the KTextEditor::Message. You can put this action then into the menu as well.
...then again, this could also be in tbe DocumentConfig just like many other settings we have.