summaryrefslogtreecommitdiffstats
path: root/mainwindow.cpp
blob: 2f5c9e73f551f4430d91658d0261ab98c46e83e2 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include "mainwindow.h"
#include "ui_mainwindow.h"

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

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


void MainWindow::on_pushButtonDecrypt_clicked()
{

}

void MainWindow::on_pushButtonEncrypt_clicked()
{
    PublicKeyImportDialog *temp = new PublicKeyImportDialog;

    if (temp->exec()&&!ui->lineEditFilePath->isEnabled())
    {
        qDebug() << "Entschlüsseln möglich.";
       // HybridCrypt::encrypt();
    }
    delete temp;

}

void MainWindow::on_pushButtonOpenFile_clicked()
{
    QString fielname = QFileDialog::getOpenFileName(this, "Datei öffnen",
                       "/home", tr("Datei(*)"));
    ui->lineEditFilePath->setText(fielname);
    qDebug() << fielname;

}


void MainWindow::on_actionImport_triggered()
{
    QString filename = readKeyFilename("Importiren eines Schlüsselpaares");

    qDebug() << filename;

    if (!filename.isEmpty())
    {
        QString password = readPassword();
        qDebug() << password;
    }

}



void MainWindow::on_actionClose_triggered()
{
    close();
}

void MainWindow::on_actionExportMyPublicKey_triggered()
{

}

QString MainWindow::readKeyFilename(QString titel)
{
    return QFileDialog::getOpenFileName(this, titel,
                                        "/home", tr("key(*.net *.der *.pem *.asc)"));
}

QString MainWindow::readPassword()
{
    PasswordDialog  w;


    if (w.exec())
    {
        return w.getPassword();
    }
    return "";
}