File indexing completed on 2024-05-12 17:10:48
0001 /*************************************************************************** 0002 * Copyright (C) 2008 by Dario Freddi <drf@kde.org> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify * 0005 * it under the terms of the GNU General Public License as published by * 0006 * the Free Software Foundation; either version 2 of the License, or * 0007 * (at your option) any later version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, * 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0012 * GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License * 0015 * along with this program; if not, write to the * 0016 * Free Software Foundation, Inc., * 0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 0018 ***************************************************************************/ 0019 0020 #ifndef EDITPAGE_H 0021 #define EDITPAGE_H 0022 0023 #include <KCModule> 0024 #include <KSharedConfig> 0025 0026 #include "ui_profileEditPage.h" 0027 0028 class ActionEditWidget; 0029 namespace PowerDevil { 0030 } 0031 0032 class ErrorOverlay; 0033 0034 class EditPage : public KCModule, private Ui_profileEditPage 0035 { 0036 Q_OBJECT 0037 0038 public: 0039 explicit EditPage(QWidget *parent, const QVariantList &args); 0040 ~EditPage() override = default; 0041 0042 void load() override; 0043 void save() override; 0044 void defaults() override; 0045 0046 private Q_SLOTS: 0047 void onChanged(bool changed); 0048 0049 void restoreDefaultProfiles(); 0050 0051 void notifyDaemon(); 0052 0053 void onServiceRegistered(const QString &service); 0054 void onServiceUnregistered(const QString &service); 0055 0056 void checkAndEmitChanged(); 0057 0058 private: 0059 KSharedConfig::Ptr m_profilesConfig; 0060 QHash< QString, bool > m_profileEdited; 0061 ErrorOverlay *m_errorOverlay = nullptr; 0062 QHash< QString, ActionEditWidget* > m_editWidgets; 0063 }; 0064 0065 #endif /* EDITPAGE_H */