summaryrefslogtreecommitdiffstats
path: root/kcontrol/hwmanager/hwmanager.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2015-09-14 20:46:15 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2015-09-14 20:46:15 -0500
commit6095bc10ad5fc08d8202e3a8f05a7998253f6e6c (patch)
tree15332ae5fcab1282ff24ad1a5cdc6b3ad6e805bd /kcontrol/hwmanager/hwmanager.cpp
parent9556cd9e6908d6906717a89fff12b046beaeb7fd (diff)
downloadtdebase-6095bc10ad5fc08d8202e3a8f05a7998253f6e6c.tar.gz
tdebase-6095bc10ad5fc08d8202e3a8f05a7998253f6e6c.zip
Add cryptographic card support to LUKS configuration
Diffstat (limited to 'kcontrol/hwmanager/hwmanager.cpp')
-rw-r--r--kcontrol/hwmanager/hwmanager.cpp27
1 files changed, 24 insertions, 3 deletions
diff --git a/kcontrol/hwmanager/hwmanager.cpp b/kcontrol/hwmanager/hwmanager.cpp
index 00b5143bf..1cd8b04e0 100644
--- a/kcontrol/hwmanager/hwmanager.cpp
+++ b/kcontrol/hwmanager/hwmanager.cpp
@@ -42,6 +42,7 @@
#include <kgenericfactory.h>
#include <unistd.h>
+#include <kpassdlg.h>
#include <ksimpleconfig.h>
#include <string>
#include <stdio.h>
@@ -147,7 +148,10 @@ void TDEHWManager::populateTreeView()
TDEGenericDevice *hwdevice;
for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) {
if (hwdevice->type() == TDEGenericDeviceType::CryptographicCard) {
- static_cast<TDECryptographicCardDevice*>(hwdevice)->enableCardMonitoring(true);
+ TDECryptographicCardDevice* cdevice = static_cast<TDECryptographicCardDevice*>(hwdevice);
+ connect(cdevice, SIGNAL(pinRequested(TQString,TDECryptographicCardDevice*)), this, SLOT(cryptographicCardPinRequested(TQString,TDECryptographicCardDevice*)));
+ cdevice->enableCardMonitoring(true);
+ cdevice->enablePINEntryCallbacks(true);
}
DeviceIconItem* item = new DeviceIconItem(base->deviceTree, hwdevice->detailedFriendlyName(), hwdevice->icon(base->deviceTree->iconSize()), hwdevice);
if ((!selected_syspath.isNull()) && (hwdevice->systemPath() == selected_syspath)) {
@@ -166,7 +170,10 @@ void TDEHWManager::populateTreeView()
TDEGenericHardwareList hwlist = hwdevices->listByDeviceClass((TDEGenericDeviceType::TDEGenericDeviceType)i);
for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) {
if (hwdevice->type() == TDEGenericDeviceType::CryptographicCard) {
- static_cast<TDECryptographicCardDevice*>(hwdevice)->enableCardMonitoring(true);
+ TDECryptographicCardDevice* cdevice = static_cast<TDECryptographicCardDevice*>(hwdevice);
+ connect(cdevice, SIGNAL(pinRequested(TQString,TDECryptographicCardDevice*)), this, SLOT(cryptographicCardPinRequested(TQString,TDECryptographicCardDevice*)));
+ cdevice->enableCardMonitoring(true);
+ cdevice->enablePINEntryCallbacks(true);
}
DeviceIconItem* item = new DeviceIconItem(rootitem, hwdevice->detailedFriendlyName(), hwdevice->icon(base->deviceTree->iconSize()), hwdevice);
if ((!selected_syspath.isNull()) && (hwdevice->systemPath() == selected_syspath)) {
@@ -186,7 +193,10 @@ void TDEHWManager::populateTreeViewLeaf(DeviceIconItem *parent, bool show_by_con
TDEGenericDevice *hwdevice;
for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) {
if (hwdevice->type() == TDEGenericDeviceType::CryptographicCard) {
- static_cast<TDECryptographicCardDevice*>(hwdevice)->enableCardMonitoring(true);
+ TDECryptographicCardDevice* cdevice = static_cast<TDECryptographicCardDevice*>(hwdevice);
+ connect(cdevice, SIGNAL(pinRequested(TQString,TDECryptographicCardDevice*)), this, SLOT(cryptographicCardPinRequested(TQString,TDECryptographicCardDevice*)));
+ cdevice->enableCardMonitoring(true);
+ cdevice->enablePINEntryCallbacks(true);
}
if (hwdevice->parentDevice() == parent->device()) {
DeviceIconItem* item = new DeviceIconItem(parent, hwdevice->detailedFriendlyName(), hwdevice->icon(base->deviceTree->iconSize()), hwdevice);
@@ -218,6 +228,17 @@ void TDEHWManager::deviceChanged(TDEGenericDevice* device) {
}
}
+void TDEHWManager::cryptographicCardPinRequested(TQString prompt, TDECryptographicCardDevice* cdevice) {
+ TQCString password;
+ int result = KPasswordDialog::getPassword(password, prompt);
+ if (result == KPasswordDialog::Accepted) {
+ cdevice->setProvidedPin(password);
+ }
+ else {
+ cdevice->setProvidedPin(TQString::null);
+ }
+}
+
TQString TDEHWManager::quickHelp() const
{
return i18n("<h1>TDE Hardware Device Manager</h1> This module allows you to configure hardware devices on your system");