improve feedback and add shortcuts for alerts

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4177 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
shatty 2003-08-01 01:09:50 +00:00
parent 8e3121a82b
commit 65035166ae
2 changed files with 17 additions and 3 deletions

View File

@ -4,6 +4,8 @@
#include <MenuItem.h>
#include <CharacterSet.h>
#include <CharacterSetRoster.h>
#include <Alert.h>
#include <stdio.h>
#include "Constants.h"
#include "StyledEditApp.h"
#include "StyledEditWindow.h"
@ -155,14 +157,23 @@ StyledEditApp::ArgvReceived(int32 argc, const char *argv[], const char * cwd)
path.SetTo(cwd,argv[i]);
}
if (path.InitCheck() != B_OK) {
continue; // TODO: alert the user?
printf("path.InitCheck failed: \"");
if (argv[i][0] == '/') {
printf("%s",argv[i]);
} else {
printf("%s/%s",cwd,argv[i]);
}
printf("\".\n");
continue;
}
entry_ref ref;
if (get_ref_for_path(path.Path(), &ref) != B_OK) {
continue; // TODO: alert the user?
printf("get_ref_for_path failed: \"");
printf("%s",path.Path());
printf("\".\n");
continue;
}
OpenDocument(&ref);
}
}

View File

@ -770,6 +770,8 @@ StyledEditWindow::QuitRequested()
saveAlert= new BAlert("savealert",alertText.String(), "Cancel", "Don't save","Save",
B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
saveAlert->SetShortcut(0, B_ESCAPE);
saveAlert->SetShortcut(1,'d');
saveAlert->SetShortcut(2,'s');
buttonIndex= saveAlert->Go();
if (buttonIndex==0) { //"cancel": dont save, dont close the window
@ -1021,6 +1023,7 @@ StyledEditWindow::RevertToSaved()
revertAlert= new BAlert("revertAlert",alertText.String(), "Cancel", "OK", 0,
B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT);
revertAlert->SetShortcut(0, B_ESCAPE);
revertAlert->SetShortcut(1, 'o');
buttonIndex= revertAlert->Go();
if (buttonIndex!=1) { // some sort of cancel, don't revert