File indexing completed on 2024-05-05 04:45:35

0001 /*
0002     SnoreNotify is a Notification Framework based on Qt
0003     Copyright (C) 2014-2015  Hannah von Reth <vonreth@kde.org>
0004 
0005     SnoreNotify is free software: you can redistribute it and/or modify
0006     it under the terms of the GNU Lesser General Public License as published by
0007     the Free Software Foundation, either version 3 of the License, or
0008     (at your option) any later version.
0009 
0010     SnoreNotify is distributed in the hope that it will be useful,
0011     but WITHOUT ANY WARRANTY; without even the implied warranty of
0012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013     GNU Lesser General Public License for more details.
0014 
0015     You should have received a copy of the GNU Lesser General Public License
0016     along with SnoreNotify.  If not, see <http://www.gnu.org/licenses/>.
0017 */
0018 
0019 #ifndef NOTIFICATIONACTION_H
0020 #define NOTIFICATIONACTION_H
0021 
0022 #include "libsnore/snore_exports.h"
0023 
0024 #include <QDataStream>
0025 
0026 namespace  Snore
0027 {
0028 
0029 /**
0030  * Action contains informations about possible interactions with the notification system.
0031  * Some notification systems don't support actions but will report one if the notification was clicked,
0032  * in this case an invalid Action will be emitted.
0033  * @see isValid
0034  * @author Hannah von Reth \<vonreth at kde.org\>
0035  */
0036 
0037 class SNORE_EXPORT Action
0038 {
0039 public:
0040     Action();
0041 
0042     /**
0043      * Creates an Action
0044      * @param id can be used to identify the action
0045      * @param name will be displayed in the notification system.
0046      */
0047     Action(int id, const QString &name);
0048 
0049     /**
0050      *
0051      * @return the id
0052      */
0053     int id() const;
0054 
0055     /**
0056      *
0057      * @return the name
0058      */
0059     QString name() const;
0060 
0061     /**
0062      *
0063      * @return whether this is a valid Action
0064      */
0065     bool isValid() const;
0066 
0067 private:
0068     int m_id;
0069     QString m_name;
0070 };
0071 }
0072 
0073 QDataStream &operator<< (QDataStream &stream, const Snore::Action &action);
0074 #endif // NOTIFICATIONACTION_H