AusweisApp2
ActivationHandler.h
gehe zur Dokumentation dieser Datei
1 
5 #pragma once
6 
7 #include "EnumHelper.h"
8 #include "UIPlugIn.h"
9 
10 #include <QMap>
11 #include <QUrl>
12 
13 namespace governikus
14 {
15 
16 class ActivationContext;
17 
21 defineEnumType(StatusFormat,
22  PLAIN,
23  JSON
24  )
25 
26 
27 
34 class ActivationHandler
35  : public QObject
36 {
37  Q_OBJECT
38 
39  private:
40  static bool isPlugIn(const QJsonObject& pJson);
41 
42  protected:
43  ActivationHandler() = default;
44  virtual ~ActivationHandler() = default;
45 
49  static QMap<QString, QString> getQueryParameter(const QUrl& pUrl);
50 
51  public:
52  static const QVector<ActivationHandler*>& getInstances();
53 
54  template<typename T> static T* getInstance()
55  {
56  for (auto handler : ActivationHandler::getInstances())
57  {
58  if (auto obj = qobject_cast<T*>(handler))
59  {
60  return obj;
61  }
62  }
63 
64  qCritical() << "Cannot find requested ActivationHandler";
65  return nullptr;
66  }
67 
68 
69  virtual bool start() = 0;
70  virtual void stop() = 0;
71 
72  public Q_SLOTS:
73  virtual void onApplicationActivated();
74 
75  Q_SIGNALS:
76  void fireShowUserInformation(const QString& pErrorMessage = QString());
77  void fireShowUiRequest(UiModule pModule);
78  void fireAuthenticationRequest(const QSharedPointer<ActivationContext>& pActivationContext);
79 };
80 
81 } // namespace governikus
82 
83 Q_DECLARE_INTERFACE(governikus::ActivationHandler, "governikus.ActivationHandler")
#define T(v)
Definition: http_parser.cpp:237
Implementation of ActivationContext for Intent based activation on Android systems.
Definition: ActivationContext.h:15
defineEnumType(KeyAgreementType, DH, ECDH) defineEnumType(MappingType
Method used for key agreement: