Fix for bug #1007093 (GUI: removing game configuration from Launcher buggy); moral: either document how things work, or at least provide well named constants for certain return values... using the cheap way out here, i.e. method (b) :-)

svn-id: r14557
This commit is contained in:
Max Horn 2004-08-11 21:49:58 +00:00
parent 39137da10d
commit ee70457667
7 changed files with 14 additions and 7 deletions

View File

@ -187,7 +187,7 @@ bool CEActionsPocket::perform(ActionType action, bool pushed) {
return true;
case POCKET_ACTION_QUIT:
GUI::MessageDialog alert("Do you want to quit ?", "Yes", "No");
if (alert.runModal() == 1)
if (alert.runModal() == GUI::kMessageOK)
_mainSystem->quit();
return true;
}

View File

@ -156,7 +156,7 @@ void CELauncherDialog::automaticScanDirectory(const FilesystemNode *node) {
void CELauncherDialog::addGame() {
MessageDialog alert("Do you want to perform an automatic scan ?", "Yes", "No");
if (alert.runModal() == 1 && _browser->runModal() > 0) {
if (alert.runModal() == kMessageOK && _browser->runModal() > 0) {
// Clear existing domains
ConfigManager::DomainMap &domains = (ConfigManager::DomainMap&)ConfMan.getGameDomains();
domains.clear();

View File

@ -581,7 +581,7 @@ void LauncherDialog::addGame() {
void LauncherDialog::removeGame(int item) {
MessageDialog alert("Do you really want to remove this game configuration?", "Yes", "No");
if (alert.runModal() > 0) {
if (alert.runModal() == GUI::kMessageOK) {
// Remove the currently selected game from the list
assert(item >= 0);
ConfMan.removeGameDomain(_domains[item]);

View File

@ -142,11 +142,12 @@ int MessageDialog::addLine(StringList &lines, const char *line, int size) {
}
void MessageDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
// FIXME: It's a really bad thing that we use two arbitrary constants
if (cmd == kOkCmd) {
setResult(1);
setResult(kMessageOK);
close();
} else if (cmd == kCancelCmd) {
setResult(2);
setResult(kMessageCancel);
close();
} else {
Dialog::handleCommand(sender, cmd, data);

View File

@ -26,6 +26,12 @@
namespace GUI {
enum {
kMessageOK = 1,
kMessageCancel = 0
};
/**
* Simple message dialog ("alert box"): presents a text message in a dialog with up to two buttons.
*/

View File

@ -419,7 +419,7 @@ void ScummEngine::askForDisk(const char *filename, int disknum) {
#endif
result = displayMessage("Quit", buf);
if (result == 2) {
if (!result) {
#ifdef __PALM_OS__
error("Cannot find file: '%s'", filename);
#else

View File

@ -1078,7 +1078,7 @@ void SwordEngine::checkCdFiles(void) { // check if we're running from cd, hdd or
test.close();
} else {
const char msg[] = "Unable to find the game files.\nPlease read the ScummVM documentation";
GUI::MessageDialog dialog(msg);
GUI::MessageDialog dialog(msg);
dialog.runModal();
error(msg);
}