summaryrefslogtreecommitdiffstats
path: root/decryptdatadialog.cpp
blob: 0f654a08305bf06c00e0454d01f9badca31d1532 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "decryptdatadialog.h"
#include "ui_decryptdatadialog.h"

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

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

void DecryptDataDialog::accept()
{
    if (!ui->lineEditFilePath->text().isEmpty())
    {
        m_outFile = QFileDialog::getSaveFileName(this, tr("Datei Speichern"),
                    QDir::homePath(), tr("Alle Dateien"));

        if (!m_outFile.isEmpty())
        {
            QDialog::accept();
        }
    }
    else
    {
        QMessageBox::information(this, tr("Keine verschlüsselte Datei"),
                                 tr("Bitte wählen Sie eine verschlüsselte Datei aus,\nbevor Sie entschlüsseln."));
    }

}

void DecryptDataDialog::on_pushButtonOpenFile_clicked()
{
    QString filename = QFileDialog::getOpenFileName(this, tr("Datei Öffnen"),
                       QDir::homePath(), tr("Alle Dateien"));

    if (!filename.isEmpty())
    {
        ui->lineEditFilePath->setText(filename);
    }
}

QString DecryptDataDialog::getCipherFilename() const
{
    return ui->lineEditFilePath->text();
}

QString DecryptDataDialog::getOutFileName() const
{
    return m_outFile;
}