Commit 9d1523e7 authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

use QFileSystemWatcher

parent af3cb343
Pipeline #170164 failed with stage
in 8 minutes and 20 seconds
......@@ -42,10 +42,11 @@ KateSessionManager::KateSessionManager(QObject *parent, const QString &sessionsD
Q_ASSERT(!m_sessionsDir.isEmpty());
QDir().mkpath(m_sessionsDir);
m_dirWatch = std::make_unique<KDirWatch>(this);
m_dirWatch->addDir(m_sessionsDir);
connect(m_dirWatch.get(), &KDirWatch::dirty, this, &KateSessionManager::updateSessionList);
// monitor our session directory for outside changes
m_dirWatch.addPath(m_sessionsDir);
connect(&m_dirWatch, &QFileSystemWatcher::directoryChanged, this, &KateSessionManager::updateSessionList);
// initial creation of the session list from disk files
updateSessionList();
}
......
......@@ -9,13 +9,10 @@
#include "katesession.h"
#include <KDirWatch>
#include <QFileSystemWatcher>
#include <QHash>
#include <QObject>
#include <memory>
typedef QList<KateSession::Ptr> KateSessionList;
class KATE_TESTS_EXPORT KateSessionManager : public QObject
......@@ -248,7 +245,11 @@ private:
*/
KateSession::Ptr m_activeSession;
std::unique_ptr<KDirWatch> m_dirWatch;
/**
* watcher for the session directory
* allows to monitor outside changes
*/
QFileSystemWatcher m_dirWatch;
};
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment