aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-05-03 22:56:42 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-05-03 22:57:18 +0900
commit0378e830c40a1d7302a8108d460940b6cd15201e (patch)
tree38ddbdadc983845c8f4eaca55954584563dbc750 /lib/connection.h
parent52a81dfa8a5415be369d819837f445479b833cde (diff)
downloadlibquotient-0378e830c40a1d7302a8108d460940b6cd15201e.tar.gz
libquotient-0378e830c40a1d7302a8108d460940b6cd15201e.zip
Connection::stateCacheDir
Same as stateCachePath but returns QDir.
Diffstat (limited to 'lib/connection.h')
-rw-r--r--lib/connection.h28
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/connection.h b/lib/connection.h
index 42e678ff..2ff27ea6 100644
--- a/lib/connection.h
+++ b/lib/connection.h
@@ -26,6 +26,7 @@
#include <QtCore/QObject>
#include <QtCore/QUrl>
#include <QtCore/QSize>
+#include <QtCore/QDir>
#include <functional>
#include <memory>
@@ -305,8 +306,8 @@ namespace QMatrixClient
* Call this before first sync to load from previously saved file.
*
* \param fromFile A local path to read the state from. Uses QUrl
- * to be QML-friendly. Empty parameter means using a path
- * defined by stateCachePath().
+ * to be QML-friendly. Empty parameter means saving to the directory
+ * defined by stateCachePath() / stateCacheDir().
*/
Q_INVOKABLE void loadState();
/**
@@ -315,23 +316,30 @@ namespace QMatrixClient
* loadState() on a next run of the client.
*
* \param toFile A local path to save the state to. Uses QUrl to be
- * QML-friendly. Empty parameter means using a path defined by
- * stateCachePath().
+ * QML-friendly. Empty parameter means saving to the directory
+ * defined by stateCachePath() / stateCacheDir().
*/
Q_INVOKABLE void saveState() const;
/// This method saves the current state of a single room.
void saveRoomState(Room* r) const;
+ /// Get the default directory path to save the room state to
+ /** \sa stateCacheDir */
+ Q_INVOKABLE QString stateCachePath() const;
+
+ /// Get the default directory to save the room state to
/**
- * The default path to store the cached room state, defined as
- * follows:
+ * This function returns the default directory to store the cached
+ * room state, defined as follows:
+ * \code
* QStandardPaths::writeableLocation(QStandardPaths::CacheLocation) + _safeUserId + "_state.json"
- * where `_safeUserId` is userId() with `:` (colon) replaced with
- * `_` (underscore)
- * /see loadState(), saveState()
+ * \endcode
+ * where `_safeUserId` is userId() with `:` (colon) replaced by
+ * `_` (underscore), as colons are reserved characters on Windows.
+ * \sa loadState, saveState, stateCachePath
*/
- Q_INVOKABLE QString stateCachePath() const;
+ QDir stateCacheDir() const;
bool cacheState() const;
void setCacheState(bool newValue);