Changeset View
Changeset View
Standalone View
Standalone View
src/buffer/katesecuretextbuffer_p.h
Context not available. | |||||
43 | 43 | | |||
---|---|---|---|---|---|
44 | public: | 44 | public: | ||
45 | 45 | | |||
46 | /** | | |||
47 | * We support Prepare action for temporary file creation | | |||
48 | * and Move action for moving final file to its destination | | |||
49 | */ | | |||
50 | enum ActionMode { | | |||
51 | Prepare = 1, | | |||
52 | Move = 2 | | |||
53 | }; | | |||
54 | | ||||
55 | SecureTextBuffer() {} | 46 | SecureTextBuffer() {} | ||
56 | 47 | | |||
57 | ~SecureTextBuffer() {} | 48 | ~SecureTextBuffer() {} | ||
58 | 49 | | |||
59 | /** | 50 | /** | ||
60 | * Common helper methods | 51 | * Common helper method | ||
61 | */ | 52 | */ | ||
62 | static void setOwner(const QString &filename, const uint ownerId, const uint groupId); | 53 | static void setOwner(const QString &filename, const uint ownerId, const uint groupId); | ||
63 | static void syncToDisk(const int fd); | | |||
64 | 54 | | |||
65 | private: | 55 | private: | ||
66 | static const qint64 bufferLength = 4096; | 56 | static const qint64 bufferLength = 4096; | ||
67 | 57 | | |||
68 | /** | 58 | /** | ||
69 | * Creates temporary file based on given target file path. | 59 | * Saves file contents using QSaveFile and sets permissions. | ||
70 | * Temporary file is set to not be deleted on object destroy | | |||
71 | * so KTextEditor can save contents in it. | | |||
72 | */ | | |||
73 | static QString prepareTempFileInternal(const QString &targetFile, const uint ownerId); | | |||
74 | | ||||
75 | /** | | |||
76 | * Move file to its given destination and set owner. | | |||
77 | */ | 60 | */ | ||
78 | static bool moveFileInternal(const QString &sourceFile, const QString &targetFile, const uint ownerId, const uint groupId); | 61 | static bool saveFileInternal(const QString &targetFile, const QByteArray &fileData, const uint ownerId, const uint groupId); | ||
79 | 62 | | |||
80 | public Q_SLOTS: | 63 | public Q_SLOTS: | ||
81 | /** | 64 | /** | ||
Context not available. |