qdesktopservices.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/util/qdesktopservices.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8class QOpenUrlHandlerRegistry : public QObject-
9{-
10 public: template <typename ThisObject> inline void qt_check_for_QOBJECT_macro(const ThisObject &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; }-
11#pragma GCC diagnostic push-
12 static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **);-
13#pragma GCC diagnostic pop-
14 struct QPrivateSignal {};-
15public:-
16 inline QOpenUrlHandlerRegistry() : mutex(QMutex::Recursive) {}
never executed: end of block
0
17-
18 QMutex mutex;-
19-
20 struct Handler-
21 {-
22 QObject *receiver;-
23 QByteArray name;-
24 };-
25 typedef QHash<QString, Handler> HandlerHash;-
26 HandlerHash handlers;-
27-
28public :-
29 void handlerDestroyed(QObject *handler);-
30-
31};-
32-
33namespace { namespace Q_QGS_handlerRegistry { typedef QOpenUrlHandlerRegistry Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEnever evaluated
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
never executed: guard.store(QtGlobalStatic::Destroyed);
}
never executed: end of block
}; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
never executed: return &holder.value;
&holder.value;
never executed: return &holder.value;
} } } static QGlobalStatic<QOpenUrlHandlerRegistry, Q_QGS_handlerRegistry::innerFunction, Q_QGS_handlerRegistry::guard> handlerRegistry;
0
34-
35void QOpenUrlHandlerRegistry::handlerDestroyed(QObject *handler)-
36{-
37 HandlerHash::Iterator it = handlers.begin();-
38 while (it != handlers.end()
it != handlers.end()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
39 if (it->receiver == handler
it->receiver == handlerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
40 it = handlers.erase(it);-
41 }
never executed: end of block
else {
0
42 ++it;-
43 }
never executed: end of block
0
44 }-
45}
never executed: end of block
0
46bool QDesktopServices::openUrl(const QUrl &url)-
47{-
48 QOpenUrlHandlerRegistry *registry = handlerRegistry();-
49 QMutexLocker locker(&registry->mutex);-
50 static bool insideOpenUrlHandler = false;-
51-
52 if (!insideOpenUrlHandler
!insideOpenUrlHandlerDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
53 QOpenUrlHandlerRegistry::HandlerHash::ConstIterator handler = registry->handlers.constFind(url.scheme());-
54 if (handler != registry->handlers.constEnd()
handler != reg...ers.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
55 insideOpenUrlHandler = true;-
56 bool result = QMetaObject::invokeMethod(handler->receiver, handler->name.constData(), Qt::DirectConnection, QArgument<QUrl >("QUrl", url));-
57 insideOpenUrlHandler = false;-
58 return
never executed: return result;
result;
never executed: return result;
0
59 }-
60 }
never executed: end of block
0
61 if (!url.isValid()
!url.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
62 return
never executed: return false;
false;
never executed: return false;
0
63-
64 QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration();-
65 if (!platformIntegration
!platformIntegrationDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
66 return
never executed: return false;
false;
never executed: return false;
0
67-
68 QPlatformServices *platformServices = platformIntegration->services();-
69 if (!platformServices
!platformServicesDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
70 QMessageLogger(__FILE__, 206, __PRETTY_FUNCTION__).warning("The platform plugin does not support services.");-
71 return
never executed: return false;
false;
never executed: return false;
0
72 }-
73 return
never executed: return url.scheme() == QLatin1String("file") ? platformServices->openDocument(url) : platformServices->openUrl(url);
url.scheme() == QLatin1String("file") ?
never executed: return url.scheme() == QLatin1String("file") ? platformServices->openDocument(url) : platformServices->openUrl(url);
0
74 platformServices->openDocument(url) : platformServices->openUrl(url);
never executed: return url.scheme() == QLatin1String("file") ? platformServices->openDocument(url) : platformServices->openUrl(url);
0
75}-
76void QDesktopServices::setUrlHandler(const QString &scheme, QObject *receiver, const char *method)-
77{-
78 QOpenUrlHandlerRegistry *registry = handlerRegistry();-
79 QMutexLocker locker(&registry->mutex);-
80 if (!receiver
!receiverDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
81 registry->handlers.remove(scheme.toLower());-
82 return;
never executed: return;
0
83 }-
84 QOpenUrlHandlerRegistry::Handler h;-
85 h.receiver = receiver;-
86 h.name = method;-
87 registry->handlers.insert(scheme.toLower(), h);-
88 QObject::connect(receiver, qFlagLocation("2""destroyed(QObject*)" "\0" __FILE__ ":" "247"),-
89 registry, qFlagLocation("1""handlerDestroyed(QObject*)" "\0" __FILE__ ":" "248"));-
90}
never executed: end of block
0
91-
92-
93-
94-
95-
96-
97void QDesktopServices::unsetUrlHandler(const QString &scheme)-
98{-
99 setUrlHandler(scheme, 0, 0);-
100}
never executed: end of block
0
101extern __attribute__((visibility("default"))) QString qt_applicationName_noFallback();-
102-
103QString QDesktopServices::storageLocationImpl(QStandardPaths::StandardLocation type)-
104{-
105 if (type == QStandardPaths::AppLocalDataLocation
type == QStand...alDataLocationDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
106-
107-
108-
109 const QString compatAppName = qt_applicationName_noFallback();-
110 const QString baseDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);-
111 const QString organizationName = QCoreApplication::organizationName();-
112 return
never executed: return baseDir + QLatin1String("/data/") + organizationName + QLatin1Char('/') + compatAppName;
baseDir + QLatin1String("/data/")
never executed: return baseDir + QLatin1String("/data/") + organizationName + QLatin1Char('/') + compatAppName;
0
113 + organizationName + QLatin1Char('/') + compatAppName;
never executed: return baseDir + QLatin1String("/data/") + organizationName + QLatin1Char('/') + compatAppName;
0
114-
115 }-
116 return
never executed: return QStandardPaths::writableLocation(type);
QStandardPaths::writableLocation(type);
never executed: return QStandardPaths::writableLocation(type);
0
117}-
118-
119-
120-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9