// SPDX-FileCopyrightText: 2026 Matvey Shcherbinin // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL // everything that goes on disk is described in koutnetsettings.kcfg. What is // left here is what the generator cannot know: the group passphrase belongs in // SecretStore, and somebody has to decide when the file is written. #pragma once #include "koutnetsettings.h" #include class QTimer; namespace koutnet { class AppSettings : public KOutNetSettings { Q_OBJECT // not an entry in the kcfg: a passphrase in a config file is a // passphrase every process of this user can read. SecretStore owns it, and a // session without the store keeps it for that session only. Q_PROPERTY(QString groupPassphrase READ groupPassphrase WRITE setGroupPassphrase NOTIFY groupPassphraseChanged) public: explicit AppSettings(QObject *parent = nullptr); ~AppSettings() override; // Shared passphrase for group encryption (the PSK layer in CryptoManager). // Empty is not "send in the clear": NetworkManager::sendGroupMessage() // refuses to send, because a user who never set one has no reason to expect // plaintext on the wire. QString groupPassphrase() const { return m_groupPassphrase; } void setGroupPassphrase(const QString &passphrase); Q_SIGNALS: void groupPassphraseChanged(); // the group passphrase lives in the encrypted store, so a session without the store // cannot keep it at all. The UI has to say so rather than let the user // believe it saved. void secretStoreUnavailable(const QString &reason); private Q_SLOTS: // the generated setters only touch memory, so the file gets written from // here. Coalescing the writes keeps a volume drag from rewriting per pixel. void scheduleSave(); private: void connectAutoSave(); void migrateEscapedValues(); // Remaps a connection mode written before the three K-Server modes became // one. Gated on configVersion, so it runs once per config file. void migrateConnectionModes(); void adoptLegacyConnectionMode(); void adoptHandleAsDisplayName(); void loadGroupPassphrase(); void dropLegacyPassphrase(); void reportSecretStoreProblem(const QString &reason); QString m_groupPassphrase; QTimer *m_saveTimer = nullptr; }; } // namespace koutnet