summaryrefslogtreecommitdiff
path: root/src/gui/updatewindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/updatewindow.cpp')
-rw-r--r--src/gui/updatewindow.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index 801bd161..afb87430 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -28,6 +28,8 @@
#include "gui/widgets/progressbar.h"
#include "gui/widgets/scrollarea.h"
+#include "gui/sdlinput.h"
+
#include "configuration.h"
#include "log.h"
#include "main.h"
@@ -105,6 +107,8 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost,
Layout &layout = getLayout();
layout.setRowHeight(0, Layout::AUTO_SET);
+ addKeyListener(this);
+
center();
setVisible(true);
mCancelButton->requestFocus();
@@ -162,6 +166,29 @@ void UpdaterWindow::action(const gcn::ActionEvent &event)
}
}
+void UpdaterWindow::keyPressed(gcn::KeyEvent &keyEvent)
+{
+ gcn::Key key = keyEvent.getKey();
+
+ if (key.getValue() == Key::ESCAPE)
+ {
+ action(gcn::ActionEvent(NULL, mCancelButton->getActionEventId()));
+ state = STATE_WORLD_SELECT;
+ }
+ else if (key.getValue() == Key::ENTER)
+ {
+ if (mDownloadStatus == UPDATE_COMPLETE ||
+ mDownloadStatus == UPDATE_ERROR)
+ {
+ action(gcn::ActionEvent(NULL, mPlayButton->getActionEventId()));
+ }
+ else
+ {
+ action(gcn::ActionEvent(NULL, mCancelButton->getActionEventId()));
+ }
+ }
+}
+
void UpdaterWindow::loadNews()
{
if (!mMemoryBuffer)