Mercurial > trustbridge
comparison ui/certificateitemwidget.cpp @ 627:566ee111e331 trustbridge-refactor
Added state to certificate list item and updated certificate list widget.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Mon, 23 Jun 2014 12:46:53 +0200 |
parents | 88c9bdc74175 |
children | 9d806f140bd5 |
comparison
equal
deleted
inserted
replaced
584:ebfe1128ee97 | 627:566ee111e331 |
---|---|
21 void CertificateItemWidget::setupGUI() | 21 void CertificateItemWidget::setupGUI() |
22 { | 22 { |
23 mLabel = new QLabel(mCertificate.subjectCN()); | 23 mLabel = new QLabel(mCertificate.subjectCN()); |
24 mComboBox = new QComboBox; | 24 mComboBox = new QComboBox; |
25 mComboBox->setFixedWidth(46); | 25 mComboBox->setFixedWidth(46); |
26 connect(mComboBox, SIGNAL(currentIndexChanged(int)), | |
27 this, SLOT(currentStateChanged(int))); | |
26 | 28 |
27 if (mCertificate.isInstallCert()) { | 29 if (mCertificate.isInstallCert()) { |
28 mComboBox->addItem(QIcon(":/img/list-add.png"), tr("add"), QVariant("true")); | 30 mComboBox->addItem(QIcon(":/img/list-add.png"), tr("add"), QVariant("true")); |
29 mComboBox->addItem(QIcon(":/img/list-remove.png"), | 31 mComboBox->addItem(QIcon(":/img/list-remove.png"), |
30 tr("remove"), QVariant("false")); | 32 tr("remove"), QVariant("false")); |
37 QHBoxLayout *layout = new QHBoxLayout; | 39 QHBoxLayout *layout = new QHBoxLayout; |
38 layout->addWidget(mComboBox); | 40 layout->addWidget(mComboBox); |
39 layout->addWidget(mLabel); | 41 layout->addWidget(mLabel); |
40 this->setLayout(layout); | 42 this->setLayout(layout); |
41 } | 43 } |
44 | |
45 bool CertificateItemWidget::state() | |
46 { | |
47 return mComboBox->currentData().toBool(); | |
48 } | |
49 | |
50 Certificate CertificateItemWidget::certificate() | |
51 { | |
52 return mCertificate; | |
53 } | |
54 | |
55 void CertificateItemWidget::currentStateChanged(int) | |
56 { | |
57 bool state = mComboBox->currentData().toBool(); | |
58 emit stateChanged(state, mCertificate); | |
59 } |