/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you wish to add, delete or rename functions or slots use
** Qt Designer which will update this file, preserving your code. Create an
** init() function in place of a constructor, and a destroy() function in
** place of a destructor.
*****************************************************************************/


//------------------------------------- initDialog -------------------------------------
int Dlg_Categories::initDialog(CMoteurCCAM_Base* pCMoteurCCAM_Base,const QString &numero_serie,const QString &code_utilisateur)
{    
    // récupère les variables passées par l'appel
    m_pCMoteurCCAM_Base = pCMoteurCCAM_Base;
    m_Numero_Serie = numero_serie;
    m_Utilisateur = code_utilisateur;
    // rempli la combo box categorie
    m_pCMoteurCCAM_Base->GetComboCategorie(combo_Categorie,m_Utilisateur);
    // positionne la combo box categorie sur l'élément categorie et rempli le lineEdit_LibelleUsuel
    m_pCMoteurCCAM_Base->GetInfoActeThesaurus(combo_Categorie,lineEdit_LibelleUsuel,m_Numero_Serie);
    return 1;
}

//------------------------------------- bouton_Annuler_clicked -------------------------------------
void Dlg_Categories::bouton_Annuler_clicked()
{
    reject();
    return;
}

//------------------------------------- bouton_OK_clicked -------------------------------------
void Dlg_Categories::bouton_OK_clicked()
{
    QString categorie = combo_Categorie->currentText();
    QString lib_usuel = lineEdit_LibelleUsuel->text();
    m_pCMoteurCCAM_Base->MAJActeThesaurus(m_Numero_Serie,categorie,lib_usuel);
    accept();
}

//------------------------------------- combo_Categorie_textChanged -------------------------------------
void Dlg_Categories::combo_Categorie_textChanged( const QString & )
{
    QString texte_combo = combo_Categorie->currentText();
    if (texte_combo.length() > 40){
	texte_combo = texte_combo.right(40);
	combo_Categorie->setCurrentText(texte_combo);
    }
}
