summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Melnikov <alexey.melnikov@isode.com>2012-03-09 20:19:19 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-04-11 10:25:16 (GMT)
commitd5f885dd9aa65d18145a99826a1c30aeb62aca8e (patch)
treebef9f1478f3dcc602d3aa8595ab27eb7356d4da8 /Swift/QtUI
parent1e61cace31a3395f5470a03c3bcf2b7f32d79d03 (diff)
downloadswift-contrib-d5f885dd9aa65d18145a99826a1c30aeb62aca8e.zip
swift-contrib-d5f885dd9aa65d18145a99826a1c30aeb62aca8e.tar.bz2
Added support for determining SmartCard Reader associated with a certificate (if any)
This patch implements monitoring for SmartCard ejection. This is done by periodically (currently every second) polling smart card reader for the smart card status. If the smart card status becomes "absent" or "unknown" (an error to query the smartcard), the TLS session is aborted. This usually results in an attempt to reestablish TLS which will pop up "please insert the smart card" dialog. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtLoginWindow.cpp4
-rw-r--r--Swift/QtUI/QtLoginWindow.h5
-rw-r--r--Swift/QtUI/QtSwift.cpp2
-rw-r--r--Swift/QtUI/QtUIFactory.cpp4
-rw-r--r--Swift/QtUI/QtUIFactory.h4
-rw-r--r--Swift/QtUI/SConscript3
6 files changed, 14 insertions, 8 deletions
diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp
index dc6001b..7612720 100644
--- a/Swift/QtUI/QtLoginWindow.cpp
+++ b/Swift/QtUI/QtLoginWindow.cpp
@@ -49,7 +49,7 @@
namespace Swift{
-QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream, SettingsProvider* settings) : QMainWindow(), settings_(settings) {
+QtLoginWindow::QtLoginWindow(UIEventStream* uiEventStream, SettingsProvider* settings, TimerFactory* timerFactory) : QMainWindow(), settings_(settings), timerFactory_(timerFactory) {
uiEventStream_ = uiEventStream;
setWindowTitle("Swift");
@@ -351,7 +351,7 @@ void QtLoginWindow::loginClicked() {
std::string certificateString = Q2PSTRING(certificateFile_);
#if defined(HAVE_SCHANNEL)
if (isCAPIURI(certificateString)) {
- certificate = boost::make_shared<CAPICertificate>(certificateString);
+ certificate = boost::make_shared<CAPICertificate>(certificateString, timerFactory_);
} else {
certificate = boost::make_shared<PKCS12Certificate>(certificateString, createSafeByteArray(Q2PSTRING(password_->text())));
}
diff --git a/Swift/QtUI/QtLoginWindow.h b/Swift/QtUI/QtLoginWindow.h
index dcd7c18..1add2f4 100644
--- a/Swift/QtUI/QtLoginWindow.h
+++ b/Swift/QtUI/QtLoginWindow.h
@@ -25,6 +25,8 @@ class QComboBox;
namespace Swift {
class SettingsProvider;
+ class TimerFactory;
+
class QtLoginWindow : public QMainWindow, public LoginWindow {
Q_OBJECT
public:
@@ -35,7 +37,7 @@ namespace Swift {
};
public:
- QtLoginWindow(UIEventStream* uiEventStream, SettingsProvider* settings);
+ QtLoginWindow(UIEventStream* uiEventStream, SettingsProvider* settings, TimerFactory* timerFactory);
void morphInto(MainWindow *mainWindow);
virtual void loggedOut();
@@ -98,5 +100,6 @@ namespace Swift {
SettingsProvider* settings_;
QAction* xmlConsoleAction_;
QAction* fileTransferOverviewAction_;
+ TimerFactory* timerFactory_;
};
}
diff --git a/Swift/QtUI/QtSwift.cpp b/Swift/QtUI/QtSwift.cpp
index 9dabf21..60f93cc 100644
--- a/Swift/QtUI/QtSwift.cpp
+++ b/Swift/QtUI/QtSwift.cpp
@@ -172,7 +172,7 @@ QtSwift::QtSwift(const po::variables_map& options) : networkFactories_(&clientMa
// Don't add the first tray (see note above)
systemTrays_.push_back(new QtSystemTray());
}
- QtUIFactory* uiFactory = new QtUIFactory(settingsHierachy_, qtSettings_, tabs_, splitter_, systemTrays_[i], chatWindowFactory_, startMinimized);
+ QtUIFactory* uiFactory = new QtUIFactory(settingsHierachy_, qtSettings_, tabs_, splitter_, systemTrays_[i], chatWindowFactory_, networkFactories_.getTimerFactory(), startMinimized);
uiFactories_.push_back(uiFactory);
MainController* mainController = new MainController(
&clientMainThreadCaller_,
diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp
index c686442..a8b693d 100644
--- a/Swift/QtUI/QtUIFactory.cpp
+++ b/Swift/QtUI/QtUIFactory.cpp
@@ -30,7 +30,7 @@
namespace Swift {
-QtUIFactory::QtUIFactory(SettingsProviderHierachy* settings, QtSettingsProvider* qtOnlySettings, QtChatTabs* tabs, QSplitter* netbookSplitter, QtSystemTray* systemTray, QtChatWindowFactory* chatWindowFactory, bool startMinimized) : settings(settings), qtOnlySettings(qtOnlySettings), tabs(tabs), netbookSplitter(netbookSplitter), systemTray(systemTray), chatWindowFactory(chatWindowFactory), lastMainWindow(NULL), loginWindow(NULL), startMinimized(startMinimized) {
+QtUIFactory::QtUIFactory(SettingsProviderHierachy* settings, QtSettingsProvider* qtOnlySettings, QtChatTabs* tabs, QSplitter* netbookSplitter, QtSystemTray* systemTray, QtChatWindowFactory* chatWindowFactory, TimerFactory* timerFactory, bool startMinimized) : settings(settings), qtOnlySettings(qtOnlySettings), tabs(tabs), netbookSplitter(netbookSplitter), systemTray(systemTray), chatWindowFactory(chatWindowFactory), timerFactory_(timerFactory), lastMainWindow(NULL), loginWindow(NULL), startMinimized(startMinimized) {
chatFontSize = settings->getSetting(QtUISettingConstants::CHATWINDOW_FONT_SIZE);
}
@@ -60,7 +60,7 @@ MainWindow* QtUIFactory::createMainWindow(UIEventStream* eventStream) {
}
LoginWindow* QtUIFactory::createLoginWindow(UIEventStream* eventStream) {
- loginWindow = new QtLoginWindow(eventStream, settings);
+ loginWindow = new QtLoginWindow(eventStream, settings, timerFactory_);
if (netbookSplitter) {
netbookSplitter->insertWidget(0, loginWindow);
}
diff --git a/Swift/QtUI/QtUIFactory.h b/Swift/QtUI/QtUIFactory.h
index c9e2f2e..8b8e3ce 100644
--- a/Swift/QtUI/QtUIFactory.h
+++ b/Swift/QtUI/QtUIFactory.h
@@ -23,11 +23,12 @@ namespace Swift {
class QtChatTheme;
class QtChatWindowFactory;
class QtChatWindow;
+ class TimerFactory;
class QtUIFactory : public QObject, public UIFactory {
Q_OBJECT
public:
- QtUIFactory(SettingsProviderHierachy* settings, QtSettingsProvider* qtOnlySettings, QtChatTabs* tabs, QSplitter* netbookSplitter, QtSystemTray* systemTray, QtChatWindowFactory* chatWindowFactory, bool startMinimized);
+ QtUIFactory(SettingsProviderHierachy* settings, QtSettingsProvider* qtOnlySettings, QtChatTabs* tabs, QSplitter* netbookSplitter, QtSystemTray* systemTray, QtChatWindowFactory* chatWindowFactory, TimerFactory* timerFactory, bool startMinimized);
virtual XMLConsoleWidget* createXMLConsoleWidget();
virtual MainWindow* createMainWindow(UIEventStream* eventStream);
@@ -57,6 +58,7 @@ namespace Swift {
QtMainWindow* lastMainWindow;
QtLoginWindow* loginWindow;
std::vector<QPointer<QtChatWindow> > chatWindows;
+ TimerFactory* timerFactory_;
bool startMinimized;
int chatFontSize;
};
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index 8d7697a..0622cc6 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -40,7 +40,8 @@ if myenv.get("HAVE_SNARL", False) :
myenv.UseFlags(myenv["SNARL_FLAGS"])
myenv.Append(CPPDEFINES = ["HAVE_SNARL"])
if env["PLATFORM"] == "win32" :
- myenv.Append(LIBS = ["cryptui"])
+ myenv.Append(LIBS = ["cryptui"])
+ myenv.Append(LIBS = ["Winscard"])
myenv.UseFlags(myenv["PLATFORM_FLAGS"])
myenv.Tool("qt4", toolpath = ["#/BuildTools/SCons/Tools"])