SftpPlugin: Do not use global static for variable

We only load it in one case anyway, meaning we can make it static in the method scope
This commit is contained in:
Alexander Lohnau 2023-07-25 21:37:02 +02:00
parent eedbfe9b49
commit e4c743a680

View file

@ -23,8 +23,6 @@
K_PLUGIN_CLASS_WITH_JSON(SftpPlugin, "kdeconnect_sftp.json")
static const QSet<QString> fields_c = QSet<QString>() << QStringLiteral("user") << QStringLiteral("port") << QStringLiteral("path");
struct SftpPlugin::Pimpl {
Pimpl()
: m_mounter(nullptr)
@ -123,6 +121,7 @@ bool SftpPlugin::startBrowsing()
bool SftpPlugin::receivePacket(const NetworkPacket &np)
{
static const QSet<QString> fields_c{QStringLiteral("user"), QStringLiteral("port"), QStringLiteral("path")};
const QStringList keysList = np.body().keys();
const auto keys = QSet(keysList.begin(), keysList.end());
if (!(fields_c - keys).isEmpty() && !np.has(QStringLiteral("errorMessage"))) {