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:
@@ -4,6 +4,8 @@
|
|||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <CharacterSet.h>
|
#include <CharacterSet.h>
|
||||||
#include <CharacterSetRoster.h>
|
#include <CharacterSetRoster.h>
|
||||||
|
#include <Alert.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
#include "StyledEditApp.h"
|
#include "StyledEditApp.h"
|
||||||
#include "StyledEditWindow.h"
|
#include "StyledEditWindow.h"
|
||||||
@@ -155,14 +157,23 @@ StyledEditApp::ArgvReceived(int32 argc, const char *argv[], const char * cwd)
|
|||||||
path.SetTo(cwd,argv[i]);
|
path.SetTo(cwd,argv[i]);
|
||||||
}
|
}
|
||||||
if (path.InitCheck() != B_OK) {
|
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;
|
entry_ref ref;
|
||||||
if (get_ref_for_path(path.Path(), &ref) != B_OK) {
|
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);
|
OpenDocument(&ref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -770,6 +770,8 @@ StyledEditWindow::QuitRequested()
|
|||||||
saveAlert= new BAlert("savealert",alertText.String(), "Cancel", "Don't save","Save",
|
saveAlert= new BAlert("savealert",alertText.String(), "Cancel", "Don't save","Save",
|
||||||
B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
|
B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
|
||||||
saveAlert->SetShortcut(0, B_ESCAPE);
|
saveAlert->SetShortcut(0, B_ESCAPE);
|
||||||
|
saveAlert->SetShortcut(1,'d');
|
||||||
|
saveAlert->SetShortcut(2,'s');
|
||||||
buttonIndex= saveAlert->Go();
|
buttonIndex= saveAlert->Go();
|
||||||
|
|
||||||
if (buttonIndex==0) { //"cancel": dont save, dont close the window
|
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,
|
revertAlert= new BAlert("revertAlert",alertText.String(), "Cancel", "OK", 0,
|
||||||
B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT);
|
B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT);
|
||||||
revertAlert->SetShortcut(0, B_ESCAPE);
|
revertAlert->SetShortcut(0, B_ESCAPE);
|
||||||
|
revertAlert->SetShortcut(1, 'o');
|
||||||
buttonIndex= revertAlert->Go();
|
buttonIndex= revertAlert->Go();
|
||||||
|
|
||||||
if (buttonIndex!=1) { // some sort of cancel, don't revert
|
if (buttonIndex!=1) { // some sort of cancel, don't revert
|
||||||
|
|||||||
Reference in New Issue
Block a user