aboutsummaryrefslogtreecommitdiffstats
path: root/verifynotification.cpp
blob: b9db07142ae49da1811af095d0f4923152538eab (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

#include "verifynotification.h"

VerifyNotification::VerifyNotification(GpgME::Context *ctx, QWidget *parent ) :
    QWidget(parent)
{
    mCtx = ctx;
    verifyLabel = new QLabel(this);

    notificationWidgetLayout = new QHBoxLayout(this);
    notificationWidgetLayout->setContentsMargins(0,0,0,0);
    notificationWidgetLayout->addWidget(verifyLabel,2);

    this->setLayout(notificationWidgetLayout);

    QAction *importFromKeyserverAct = new QAction(tr("Import missing key from Keyserver"), this);
    connect(importFromKeyserverAct, SIGNAL(triggered()), this, SLOT(importFromKeyserver()));

    QMenu *detailMenu = new QMenu(this);
    detailMenu->addAction(importFromKeyserverAct);
    keysNotInList = new QStringList();
    QPushButton *verifyButton = new QPushButton("Details",this);
    verifyButton->setMenu(detailMenu);
    notificationWidgetLayout->addWidget(verifyButton);
}

void VerifyNotification::importFromKeyserver(){
    KeyServerImportDialog *importDialog =new KeyServerImportDialog(mCtx,this);
    foreach (QString keyid, *keysNotInList) {
        importDialog->import(keyid);
    }
}

void VerifyNotification::setVerifyLabel(QString text)
{
    verifyLabel->setText(text);
    return;
}