#include "supprimerarticle.h"
#include "ui_supprimerarticle.h"
#include "articler.h"
#include <QSystemTrayIcon>
#include"smtp.h"

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

supprimerarticle::~supprimerarticle()
{
    delete ui;
}

void supprimerarticle::on_pushButton_clicked()
{
    QString nom = ui->lineEdit->text();
    bool test=tmparticle->supprimer(nom);
    if(test)

    {   Smtp* s = new Smtp( "hajmoussa2368@gmail.com", "Hm123456", "smtp.gmail.com", 465 );
        s->sendMail("hajmoussa2368@gmail.com","kais.kasmi@esprit.tn","un article a été supprimer avec succés","Mr Kais");
        notifier = new QSystemTrayIcon(this);
        notifier->setIcon(QIcon("notification.png"));
        notifier->show();
        notifier->showMessage("Fait","l'article a été supprimer",QSystemTrayIcon::Warning,10000);
        hide();



    }
    else
    {  notifier = new QSystemTrayIcon(this);
        notifier->setIcon(QIcon("notification.png"));
        notifier->show();
        notifier->showMessage("Erreur","",QSystemTrayIcon::Warning,10000);


}
}
