#ifndef C_APP_H
#define C_APP_H

#include <qobject.h>
#include <qstring.h>
#include "../../MedinTuxTools/CMedicaBase.h"
#include "../../MedinTuxTools/CW_EditText.h"
#include "../../MedinTuxTools/CSetupBase.h"
#include "../../MedinTuxTools/CMedicaBase.h"

#include "../../drtux/src/CMoteur_Base.h"

#include <qapplication.h>
//#include <qsqldatabase.h>

#ifdef COMMERCIAL_VERSION
    #include "../../Commercial/C_Cps.h"
    #include "../../Commercial/C_Vitale.h"
#endif


//================================================= CApp ================= =============================================
class CApp : public QApplication
{
 public:

     CApp(int & argc, char ** argv, QString &erreur, const char*user = 0, const char*password = 0);
    ~CApp();
    QString  AdjustGlobalDroits(const QString &droits);
    void     AddDroit( QString &listDroits, QString droitToadd);
    void     RemoveDroit( QString &listDroits, QString droitToRemove);
    bool     IsThisDroitExist(const char *listDroits, const char *droitToFind);
    QString  GetListDroitsPossibles(QStringList *plist_droits=0, int clearList = 1);
    bool     IsAdministrator();
    int      AuthentifyAndSelectUser(QWidget * parent, const QString &newUser, const QString &newSignUser, bool passwordMustBeRecorded  = 1 );
    void     saveLastUserOn_Ini( bool passwordMustBeRecorded  = 1 );
    bool     IsAppStartWithUser();
 public:
    CMoteurBase         *m_pCMoteurBase;          // moteur de la base de donnée

//......................... contexte ......................................................


    QString              m_PathAppli;
    QString              m_PathIni;
    QString              m_PathCfg_Base;
    QString              m_User;
    QString              m_CriptedPassWord;
    QString              m_Droits;
    bool                 m_Contacts_Run;
    bool                 m_IsAppStartWithUser;
    QString              m_PermsChoice;
    QString              m_PathTheme;
//......................... carte PS .............................
#ifdef COMMERCIAL_VERSION
    C_Cps  *m_pCps;
#endif
};

extern CApp* G_pCApp;

#endif

