SuppressionTache::SuppressionTache(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SuppressionTache)
{
    ui->setupUi(this);

    //boucle pour remplir la combobox proposant les projets
    ui->comboBoxProjet->addItem(" ");
    for(QMap<QString, Projet*>::const_iterator it= ProjetManager::getInstance().getProjets().cbegin();it!=ProjetManager::getInstance().getProjets().cend(); it++){
        if (!(*it)->getTaches().empty())
            ui->comboBoxProjet->addItem((*it)->getNom());
    }

     QObject::connect(ui->comboBoxProjet, SIGNAL(currentIndexChanged(QString)), this, SLOT(remplirComboTache(QString))); //affiche les tâches possibles en fonction du projet séléctionné
     QObject::connect(ui->pushButtonValider, SIGNAL(clicked()), this, SLOT(supprimerTache()));
     QObject::connect(ui->pushButtonValider, SIGNAL(clicked()),parent,SLOT(updateTree()));
     QObject::connect(ui->pushButtonAnnuler, SIGNAL(clicked()), this, SLOT(close()));
     QObject::connect(this, SIGNAL(finished(int)),parent,SLOT(updateTree()));
}
Tache* TacheManager::remplacerTache(Tache* t, Tache* t2){
    Tache* old =t;
    t = t2;
    supprimerTache(old);
    return t;
};