13 #ifndef MAGICSMOKE_MSINTERFACE_H
14 #define MAGICSMOKE_MSINTERFACE_H
18 #define req (MSInterface::instance())
20 #ifndef MSIFACE_EXPORT
21 #define MSIFACE_EXPORT Q_DECL_IMPORT
32 Q_PROPERTY(QString currentUser READ currentUser)
33 Q_PROPERTY(QString hostName READ hostName)
35 Q_PROPERTY(QString settingsGroup READ settingsGroup)
36 Q_PROPERTY(QString sessionId READ sessionId)
37 Q_PROPERTY(QString profileId READ profileId)
51 Q_INVOKABLE QString
hostName()
const{
return m_host;}
54 Q_INVOKABLE
bool hasRole(QString s)
const{
return userroles.contains(s);}
57 Q_INVOKABLE
bool hasRight(Right)
const;
60 Q_INVOKABLE
bool hasFlag(QString f)
const{
return userflags.contains(f);}
63 Q_INVOKABLE
bool checkFlags(
const QStringList&)
const;
69 Q_INVOKABLE QString
dataDir()
const;
71 Q_INVOKABLE QString settingsGroup()
const;
73 Q_INVOKABLE QString configSettingsGroup()
const;
79 Q_INVOKABLE QString
sessionId()
const{
return m_sessid;}
82 virtual QMap<QString,QString> headers(QString)
const;
94 QString profileName()
const;
106 QUrl parentUrl()
const;
115 static QString appDataDir();
118 static void setAppDataDir(QString);
124 static QString resolveDir(
const QString&dir);
131 bool login(QString username,QString passwd);
133 bool loginSession(QString username,QString sessionid);
141 virtual void sslErrors(QNetworkReply *,
const QList<QSslError>&);
143 void updateTemplates();
149 QString profileid,m_sessid,m_uname,m_passwd,m_host,m_hostkey,m_statusbartext;
150 mutable QList<Right>userrights;
151 mutable QStringList userroles,userflags;
152 QByteArray servertranslation;
154 bool didsslerror=
false,autologout=
false;
Q_INVOKABLE QString sessionId() const
returns the current session ID
Definition: msinterface.h:79
Q_INVOKABLE bool checkFlags(const QString &s) const
checks the space separeted flags in the string and returns true if all of them match ...
Definition: msinterface.h:66
static MSInterface * instance()
returns the singleton instance of the interface
Definition: msinterface.h:45
bool autoLogout() const
returns whether this instance automatically logs out on closure
Definition: msinterface.h:109
void setAutoLogout(bool a)
sets whether this instance automatically logs out on closure
Definition: msinterface.h:112
Helper class: stores and compares SSL-Exceptions.
Definition: sslexception.h:31
Q_INVOKABLE QString currentUser() const
returns the name of the current user
Definition: msinterface.h:48
this class implements the storage end of the template subsystem, its only instance exists in the webr...
Definition: templates.h:149
QString statusBarText() const
returns the status bar text
Definition: msinterface.h:127
Q_INVOKABLE bool hasFlag(QString f) const
returns whether the user has a particular flag
Definition: msinterface.h:60
MagicSmoke interface class.
Definition: srcMInterface.h:212
static QString dataDir
Definition: msinterface.cpp:36
Q_INVOKABLE bool hasRole(QString s) const
returns whether the user is part of this role
Definition: msinterface.h:54
Q_INVOKABLE QString hostName() const
returns the name used for the host in this session
Definition: msinterface.h:51
QString profileId() const
returns the profile ID of this session
Definition: msinterface.h:91
static MInterface * instance(QString name="MagicSmoke")
convenience override: returns a pointer to an instance with the given name if it is of the correct ty...
Definition: srcMInterface.h:218
QStringList allRoles() const
return all roles of the current user
Definition: msinterface.h:100
QList< Right > allRights() const
return all rights of the current user
Definition: msinterface.h:97
the MagicSmoke specific interface class - enhances the basic interface by some functionality needed i...
Definition: msinterface.h:29
QStringList allFlags() const
return all flags of the current user
Definition: msinterface.h:103
#define MSIFACE_EXPORT
Definition: msinterface.h:21
Q_INVOKABLE MTemplateStore * templateStore()
returns a pointer to the template storage engine
Definition: msinterface.h:88
void setSessionId(QString sid)
sets the session id to be transmitted
Definition: msinterface.h:139