~ubuntu-branches/debian/stretch/kservice/stretch

« back to all changes in this revision

Viewing changes to src/services/kservicetypeprofile.cpp

  • Committer: Package Import Robot
  • Author(s): Scarlett Clark
  • Date: 2014-08-05 17:29:09 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140805172909-i30obau6w3p8glfr
Tags: 5.1.0-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include <QtCore/QHash>
32
32
#include <QtAlgorithms>
33
33
 
34
 
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 1)
35
 
// TODO: remove this when the new Q_GLOBAL_STATIC is in
36
 
static bool s_serviceTypeProfilesExists = false;
37
 
#endif
38
34
// servicetype -> profile
39
35
class KServiceTypeProfiles : public QHash<QString, KServiceTypeProfileEntry *>
40
36
{
41
37
public:
42
38
    KServiceTypeProfiles()
43
39
    {
44
 
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 1)
45
 
        s_serviceTypeProfilesExists = true;
46
 
#endif
47
40
        m_parsed = false; ensureParsed();
48
41
    }
49
42
    ~KServiceTypeProfiles()
50
43
    {
51
 
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 1)
52
 
        s_serviceTypeProfilesExists = false;
53
 
#endif
54
44
        clear();
55
45
    }
56
46
    void clear()
116
106
//static
117
107
void KServiceTypeProfile::clearCache()
118
108
{
119
 
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 1)
120
109
    if (s_serviceTypeProfiles.exists())
121
 
#else
122
 
    if (s_serviceTypeProfilesExists)
123
 
#endif
124
110
        s_serviceTypeProfiles()->clear();
125
111
}
126
112
 
240
226
 
241
227
    // Not threadsafe, but well the whole idea of using this method isn't
242
228
    // threadsafe in the first place.
243
 
#if QT_VERSION >= QT_VERSION_CHECK(5,1,1)
244
229
    if (s_serviceTypeProfiles.exists()) {
245
 
#else
246
 
    if (s_serviceTypeProfiles()) {
247
 
#endif
248
230
        delete s_serviceTypeProfiles()->take(serviceType);
249
231
    }
250
232
}