diff options
Diffstat (limited to 'kcontrol/hwmanager/hwmanager.cpp')
-rw-r--r-- | kcontrol/hwmanager/hwmanager.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/kcontrol/hwmanager/hwmanager.cpp b/kcontrol/hwmanager/hwmanager.cpp index a82daf1be..1cd8b04e0 100644 --- a/kcontrol/hwmanager/hwmanager.cpp +++ b/kcontrol/hwmanager/hwmanager.cpp @@ -42,11 +42,14 @@ #include <kgenericfactory.h> #include <unistd.h> +#include <kpassdlg.h> #include <ksimpleconfig.h> #include <string> #include <stdio.h> #include <tqstring.h> +#include <tdecryptographiccarddevice.h> + #include "hwmanager.h" using namespace std; @@ -144,6 +147,12 @@ void TDEHWManager::populateTreeView() TDEGenericHardwareList hwlist = hwdevices->listByDeviceClass(TDEGenericDeviceType::RootSystem); TDEGenericDevice *hwdevice; for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) { + if (hwdevice->type() == TDEGenericDeviceType::CryptographicCard) { + 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)) { base->deviceTree->ensureItemVisible(item); @@ -160,6 +169,12 @@ void TDEHWManager::populateTreeView() TDEGenericDevice *hwdevice; TDEGenericHardwareList hwlist = hwdevices->listByDeviceClass((TDEGenericDeviceType::TDEGenericDeviceType)i); for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) { + if (hwdevice->type() == TDEGenericDeviceType::CryptographicCard) { + 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)) { base->deviceTree->ensureItemVisible(item); @@ -177,6 +192,12 @@ void TDEHWManager::populateTreeViewLeaf(DeviceIconItem *parent, bool show_by_con TDEGenericHardwareList hwlist = hwdevices->listAllPhysicalDevices(); TDEGenericDevice *hwdevice; for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) { + if (hwdevice->type() == TDEGenericDeviceType::CryptographicCard) { + 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); if ((!selected_syspath.isNull()) && (hwdevice->systemPath() == selected_syspath)) { @@ -207,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"); |