File indexing completed on 2024-05-19 05:29:58
0001 /* 0002 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0003 SPDX-FileCopyrightText: 2024 Harald Sitter <sitter@kde.org> 0004 */ 0005 0006 #include <KPluginFactory> 0007 #include <KQuickConfigModule> 0008 0009 #include "CommandOutputContext.h" 0010 0011 using namespace Qt::StringLiterals; 0012 0013 class KCMBlockDevices : public KQuickConfigModule 0014 { 0015 Q_OBJECT 0016 Q_PROPERTY(CommandOutputContext *infoOutputContext READ outputContext CONSTANT FINAL) 0017 public: 0018 explicit KCMBlockDevices(QObject *parent, const KPluginMetaData &data) 0019 : KQuickConfigModule(parent, data) 0020 { 0021 // NOTE: careful when using -o, it tends to incorrectly print multiple mountpoints as a single path 0022 // (e.g. when different btrfs subvolumes are mounted at various points in the system it ought to enumerate all mountpoints) 0023 m_outputContext = new CommandOutputContext(u"lsblk"_s, {}, parent); 0024 } 0025 CommandOutputContext *outputContext() const 0026 { 0027 return m_outputContext; 0028 } 0029 0030 private: 0031 CommandOutputContext *m_outputContext; 0032 }; 0033 0034 K_PLUGIN_CLASS_WITH_JSON(KCMBlockDevices, "kcm_block_devices.json") 0035 0036 #include "main.moc"