KNotifications

knotifyconfig.h
1 /*
2  SPDX-FileCopyrightText: 2005-2009 Olivier Goffart <ogoffart at kde.org>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 
7 #ifndef KNOTIFYCONFIG_H
8 #define KNOTIFYCONFIG_H
9 
10 #include <KSharedConfig>
11 
12 #include "knotifications_export.h"
13 #include <QImage>
14 #include <QObject> //for Wid
15 #include <QPair>
16 
18 
19 /**
20  * @class KNotifyImage knotifyconfig.h KNotifyConfig
21  *
22  * An image with lazy loading from the byte array
23  */
24 class KNOTIFICATIONS_EXPORT KNotifyImage
25 {
26 public:
27  KNotifyImage()
28  : dirty(false)
29  {
30  }
31  KNotifyImage(const QByteArray &data)
32  : source(data)
33  , dirty(true)
34  {
35  }
36  QImage toImage();
37  bool isNull()
38  {
39  return dirty ? source.isEmpty() : image.isNull();
40  }
41  QByteArray data() const
42  {
43  return source;
44  }
45 
46 private:
47  QByteArray source;
48  QImage image;
49  bool dirty;
50 };
51 
52 /**
53  * @class KNotifyConfig knotifyconfig.h KNotifyConfig
54  *
55  * Represent the configuration for an event
56  * @author Olivier Goffart <[email protected]>
57  */
58 class KNOTIFICATIONS_EXPORT KNotifyConfig
59 {
60 public:
61  KNotifyConfig(const QString &appname, const ContextList &_contexts, const QString &_eventid);
62  ~KNotifyConfig();
63 
64  KNotifyConfig *copy() const;
65 
66  /**
67  * @return entry from the knotifyrc file
68  *
69  * This will return the configuration from the user for the given key.
70  * It first look into the user config file, and then in the global config file.
71  *
72  * return a null string if the entry doesn't exist
73  */
74  QString readEntry(const QString &entry, bool path = false);
75 
76  /**
77  * the pixmap to put on the notification
78  */
80 
81  /**
82  * the name of the application that triggered the notification
83  */
85 
86  /**
87  * @internal
88  */
89  KSharedConfig::Ptr eventsfile, configfile;
90  ContextList contexts;
91 
92  /**
93  * the name of the notification
94  */
96 
97  /**
98  * reparse the cached configs. to be used when the config may have changed
99  */
100  static void reparseConfiguration();
101 
102  static void reparseSingleConfiguration(const QString &app);
103 };
104 
105 #endif
QString appname
the name of the application that triggered the notification
Definition: knotifyconfig.h:84
QString eventid
the name of the notification
Definition: knotifyconfig.h:95
KNotifyImage image
the pixmap to put on the notification
Definition: knotifyconfig.h:79
KSharedConfig::Ptr eventsfile
Definition: knotifyconfig.h:89
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:49:15 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.