package what.the.fuck.package;

public class WtfDotInNameOfClass extends QDialog  {

    Ui_eDokumentRecipientsDialog ui;
    LinkedList<String> m_cc = new LinkedList();
    String m_recipient = null;

    public WtfDotInNameOfClass(String recipient) {
        this.m_recipient = recipient;
        this.ui = new Ui_eDokumentRecipientsDialog();
        ui.setupUi(this);
        ui.buttonBox.buttons().get(0).clicked.connect(this, "slotOK()");
        ui.lineEdit_extracted.setText(m_recipient);
    }

    private void slotOK() {
        this.m_recipient = ui.lineEdit_extracted.text();
        if (!ui.lineEdit_extracted.text().matches("^[_a-zA-Z0-9\\.\\-]+@[_a-zA-Z0-9\\.\\-]+\\.[a-zA-Z]{2,4}$")) {
            QMessageBox.information(null, tr("Information"), tr("Input string is not email."));
            return;
        }
        String addresses = ui.lineEdit_cc.text();
        addresses = addresses.replaceAll(",", ";");
        addresses = addresses.replaceAll("\\x20", ";");
        while (addresses.indexOf(";;") != -1) {
            addresses = addresses.replaceAll(";;", ";");
        }
        String[] adr_arr = addresses.split(";");
        if (adr_arr.length > 0) {
            for (String tmp : adr_arr) {
                if (tmp.matches("^[_a-zA-Z0-9\\.\\-]+@[_a-zA-Z0-9\\.\\-]+\\.[a-zA-Z]{2,4}$")) {
                    m_cc.add(tmp);
                }
            }
        }
        accept();
        hide();
    }
}