summaryrefslogtreecommitdiffstats
path: root/kcontrol/hwmanager/cryptpassworddlg.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2015-09-14 20:46:15 -0500
committerTimothy Pearson <[email protected]>2015-09-14 20:46:15 -0500
commit6095bc10ad5fc08d8202e3a8f05a7998253f6e6c (patch)
tree15332ae5fcab1282ff24ad1a5cdc6b3ad6e805bd /kcontrol/hwmanager/cryptpassworddlg.cpp
parent9556cd9e6908d6906717a89fff12b046beaeb7fd (diff)
downloadtdebase-6095bc10ad5fc08d8202e3a8f05a7998253f6e6c.tar.gz
tdebase-6095bc10ad5fc08d8202e3a8f05a7998253f6e6c.zip
Add cryptographic card support to LUKS configuration
Diffstat (limited to 'kcontrol/hwmanager/cryptpassworddlg.cpp')
-rw-r--r--kcontrol/hwmanager/cryptpassworddlg.cpp33
1 files changed, 29 insertions, 4 deletions
diff --git a/kcontrol/hwmanager/cryptpassworddlg.cpp b/kcontrol/hwmanager/cryptpassworddlg.cpp
index 43d714e12..1d66d89c1 100644
--- a/kcontrol/hwmanager/cryptpassworddlg.cpp
+++ b/kcontrol/hwmanager/cryptpassworddlg.cpp
@@ -46,11 +46,13 @@
#include <kpushbutton.h>
#include <kstdguiitem.h>
#include <tdemessagebox.h>
+#include <ksslcertificate.h>
#include "cryptpassworddlg.h"
-CryptPasswordDialog::CryptPasswordDialog(TQWidget *parent, TQString passwordPrompt, TQString caption)
- : KDialogBase(Plain, ((caption == "")?i18n("Enter Password"):caption), Ok|Cancel, Ok, parent, 0L, true, true)
+CryptPasswordDialog::CryptPasswordDialog(TQWidget *parent, TQString passwordPrompt, TQString caption, bool allow_card, KSSLCertificate* card_cert, bool* use_card)
+ : KDialogBase(Plain, ((caption == "")?i18n("Enter Password"):caption), Ok|Cancel, Ok, parent, 0L, true, true),
+ m_useCard(use_card)
{
m_base = new CryptPasswordDialogBase(plainPage());
@@ -61,8 +63,19 @@ CryptPasswordDialog::CryptPasswordDialog(TQWidget *parent, TQString passwordProm
m_base->passwordPrompt->setText(passwordPrompt);
m_base->passwordIcon->setPixmap(SmallIcon("password.png"));
+ if (!allow_card) {
+ m_base->cardKeyButton->hide();
+ m_base->cardKeyInfo->hide();
+ }
+ else {
+ if (card_cert) {
+ m_base->cardKeyInfo->setText(card_cert->getSubject());
+ }
+ }
+
connect(m_base->textPasswordButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(processLockouts()));
connect(m_base->filePasswordButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(processLockouts()));
+ connect(m_base->cardKeyButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(processLockouts()));
connect(m_base->textPasswordEntry, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(processLockouts()));
connect(m_base->filePasswordURL, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(processLockouts()));
@@ -78,9 +91,14 @@ CryptPasswordDialog::~CryptPasswordDialog()
TQByteArray CryptPasswordDialog::password() {
if (m_base->textPasswordButton->isOn() == true) {
m_password.duplicate(m_base->textPasswordEntry->password(), strlen(m_base->textPasswordEntry->password()));
+ if (m_useCard) *m_useCard = false;
}
- else {
+ else if (m_base->filePasswordButton->isOn() == true) {
m_password = TQFile(m_base->filePasswordURL->url()).readAll();
+ if (m_useCard) *m_useCard = false;
+ }
+ else {
+ if (m_useCard) *m_useCard = true;
}
return m_password;
@@ -90,6 +108,7 @@ void CryptPasswordDialog::processLockouts() {
if (m_base->textPasswordButton->isOn() == true) {
m_base->textPasswordEntry->setEnabled(true);
m_base->filePasswordURL->setEnabled(false);
+ m_base->textPasswordEntry->setFocus();
if (strlen(m_base->textPasswordEntry->password()) > 0) {
enableButtonOK(true);
}
@@ -97,9 +116,10 @@ void CryptPasswordDialog::processLockouts() {
enableButtonOK(false);
}
}
- else {
+ else if (m_base->filePasswordButton->isOn() == true) {
m_base->textPasswordEntry->setEnabled(false);
m_base->filePasswordURL->setEnabled(true);
+ m_base->filePasswordURL->setFocus();
if (TQFile(m_base->filePasswordURL->url()).exists()) {
enableButtonOK(true);
}
@@ -107,6 +127,11 @@ void CryptPasswordDialog::processLockouts() {
enableButtonOK(false);
}
}
+ else {
+ m_base->textPasswordEntry->setEnabled(false);
+ m_base->filePasswordURL->setEnabled(false);
+ enableButtonOK(true);
+ }
}
void CryptPasswordDialog::virtual_hook( int id, void* data )