SoftwareUpdater: Handle message events, Exit on cancel press.

This commit is contained in:
Alexander von Gluck IV
2016-12-11 10:19:06 -06:00
parent c5dcedecae
commit 1e8a560196
2 changed files with 21 additions and 4 deletions
@@ -28,8 +28,8 @@
#define B_TRANSLATION_CONTEXT "SoftwareUpdater" #define B_TRANSLATION_CONTEXT "SoftwareUpdater"
const uint32 UPDATE_MESSAGE = 'iUPD'; const uint32 kMsgUpdate = 'iUPD';
const uint32 EXIT_MESSAGE = 'iEXT'; const uint32 kMsgExit = 'iEXT';
SoftwareUpdaterWindow::SoftwareUpdaterWindow() SoftwareUpdaterWindow::SoftwareUpdaterWindow()
@@ -50,10 +50,10 @@ SoftwareUpdaterWindow::SoftwareUpdaterWindow()
fStripeView = new StripeView(icon); fStripeView = new StripeView(icon);
BButton* updateButton = new BButton("Update now", BButton* updateButton = new BButton("Update now",
new BMessage(UPDATE_MESSAGE)); new BMessage(kMsgUpdate));
BButton* exitButton = new BButton("Cancel", BButton* exitButton = new BButton("Cancel",
new BMessage(EXIT_MESSAGE)); new BMessage(kMsgExit));
// Form text based on updates available // Form text based on updates available
BStringView* headerView; BStringView* headerView;
@@ -118,3 +118,18 @@ SoftwareUpdaterWindow::QuitRequested()
be_app->PostMessage(B_QUIT_REQUESTED); be_app->PostMessage(B_QUIT_REQUESTED);
return true; return true;
} }
void
SoftwareUpdaterWindow::MessageReceived(BMessage* message)
{
switch (message->what) {
case kMsgExit:
QuitRequested();
break;
case kMsgUpdate:
break;
default:
BWindow::MessageReceived(message);
}
}
@@ -22,6 +22,8 @@ public:
~SoftwareUpdaterWindow(); ~SoftwareUpdaterWindow();
bool QuitRequested(); bool QuitRequested();
void MessageReceived(BMessage* message);
private: private:
StripeView* fStripeView; StripeView* fStripeView;
app_info* fAppInfo; app_info* fAppInfo;