Skip to content

Commit 5ca983b

Browse files
metsmamrts
authored andcommitted
Web eID about
WE2-427 Signed-off-by: Raul Metsma <[email protected]>
1 parent e3b99ec commit 5ca983b

File tree

7 files changed

+19
-12
lines changed

7 files changed

+19
-12
lines changed

src/controller/application.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ CommandWithArgumentsPtr Application::parseArgs()
122122
// https://bugs.chromium.org/p/chromium/issues/detail?id=354597#c2
123123
qDebug() << "Parent window handle is unused" << parser.value(parentWindow);
124124
}
125-
125+
if (arguments().size() == 1) {
126+
return std::make_unique<CommandWithArguments>(CommandType::ABOUT, QVariantMap());
127+
}
126128
return nullptr;
127129
}
128130

src/controller/commands.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class CommandType
3636
AUTHENTICATE,
3737
SIGN,
3838
QUIT,
39+
ABOUT,
3940
NONE = -1
4041
};
4142

src/controller/controller.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,17 @@ void Controller::run()
8989

9090
REQUIRE_NON_NULL(command)
9191
// If quit is requested, respond with empty JSON object and quit immediately.
92-
if (command->first == CommandType::QUIT) {
92+
switch (command->first) {
93+
case CommandType::ABOUT:
94+
WebEidUI::showAboutPage();
95+
return;
96+
case CommandType::QUIT:
9397
qInfo() << "Quit requested, exiting";
9498
writeResponseToStdOut(true, {}, "quit");
9599
emit quit();
96100
return;
101+
default:
102+
break;
97103
}
98104

99105
commandHandler = getCommandHandler(*command);
@@ -111,8 +117,7 @@ void Controller::startCommandExecution()
111117

112118
// Reader monitor thread setup.
113119
WaitForCardThread* waitForCardThread = new WaitForCardThread(this);
114-
connect(waitForCardThread, &WaitForCardThread::statusUpdate, this,
115-
&Controller::onReaderMonitorStatusUpdate);
120+
connect(waitForCardThread, &WaitForCardThread::statusUpdate, this, &Controller::statusUpdate);
116121
connect(waitForCardThread, &WaitForCardThread::cardsAvailable, this,
117122
&Controller::onCardsAvailable);
118123
saveChildThreadPtrAndConnectFailureFinish(waitForCardThread);
@@ -210,11 +215,6 @@ void Controller::runCommandHandler(const std::vector<electronic_id::CardInfo::pt
210215
}
211216
}
212217

213-
void Controller::onReaderMonitorStatusUpdate(const RetriableError reason)
214-
{
215-
emit statusUpdate(reason);
216-
}
217-
218218
void Controller::onCertificatesLoaded()
219219
{
220220
CardEventMonitorThread* cardEventMonitorThread =

src/controller/controller.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ class Controller : public QObject
5454
// Called either directly from run() or from the monitor thread when cards are available.
5555
void onCardsAvailable(const std::vector<electronic_id::CardInfo::ptr>& availableCards);
5656

57-
// Called on reader and card events from monitor thread.
58-
void onReaderMonitorStatusUpdate(const RetriableError reason);
59-
6057
// Called when CommandHandlerRunThread finishes execution.
6158
void onCertificatesLoaded();
6259

src/controller/ui.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class WebEidUI : public QDialog
4343
// Factory function that creates and shows the dialog that implements this interface.
4444
static ptr createAndShowDialog(const CommandType command);
4545

46+
static void showAboutPage();
4647
static void showFatalError();
4748

4849
virtual void showWaitingForCardPage(const CommandType commandType) = 0;

src/ui/ui.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ WebEidUI::ptr WebEidUI::createAndShowDialog(const CommandType command)
3333
return dialog;
3434
}
3535

36+
void WebEidUI::showAboutPage()
37+
{
38+
WebEidDialog::showAboutPage();
39+
}
40+
3641
void WebEidUI::showFatalError()
3742
{
3843
auto dialog = WebEidDialog {};

tests/mock-ui/mock-ui.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ WebEidUI::ptr WebEidUI::createAndShowDialog(const CommandType)
2828
return std::make_unique<MockUI>();
2929
}
3030

31+
void WebEidUI::showAboutPage() {}
3132
void WebEidUI::showFatalError() {}

0 commit comments

Comments
 (0)