File indexing completed on 2024-04-28 05:46:11
0001 /*************************************************************************** 0002 * Copyright © 2009 Jonathan Thomas <echidnaman@kubuntu.org> * 0003 * Copyright © 2014-2015 Harald Sitter <sitter@kde.org> * 0004 * Copyright © 2009 Amichai Rothman <amichai2@amichais.net> * 0005 * * 0006 * This program is free software; you can redistribute it and/or * 0007 * modify it under the terms of the GNU General Public License as * 0008 * published by the Free Software Foundation; either version 2 of * 0009 * the License or (at your option) version 3 or any later version * 0010 * accepted by the membership of KDE e.V. (or its successor approved * 0011 * by the membership of KDE e.V.), which shall act as a proxy * 0012 * defined in Section 14 of version 3 of the license. * 0013 * * 0014 * This program is distributed in the hope that it will be useful, * 0015 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0017 * GNU General Public License for more details. * 0018 * * 0019 * You should have received a copy of the GNU General Public License * 0020 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 0021 ***************************************************************************/ 0022 0023 #ifndef HOOKPARSER_H 0024 #define HOOKPARSER_H 0025 0026 #include <QObject> 0027 #include <QString> 0028 #include <QStringList> 0029 #include <QMap> 0030 0031 class Hook : public QObject 0032 { 0033 Q_OBJECT 0034 public: 0035 // FIXME: standard argument order is (stuff, QObject=nullptr) 0036 Hook(QObject* parent, const QString &hookPath); 0037 0038 virtual ~Hook(); 0039 0040 QString locale(); 0041 void setLocale(const QString &locale); 0042 0043 public Q_SLOTS: 0044 bool isValid() const; 0045 bool isNotificationRequired() const; 0046 QString getField(const QString &name) const; 0047 void runCommand(); 0048 void setFinished(); 0049 0050 private: 0051 QString m_hookPath; 0052 QMap<QString, QString> m_fields; 0053 bool m_finished; 0054 QString m_locale; 0055 0056 private Q_SLOTS: 0057 QMap<QString, QString> parse(const QString &hookPath); 0058 QString calculateSignature() const; 0059 void loadConfig(); 0060 void saveConfig(); 0061 }; 0062 0063 #endif