revert to saved confirmation dialog added
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1859 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -657,32 +657,47 @@ StyledEditWindow::OpenFile(entry_ref *ref)
|
|||||||
|
|
||||||
void
|
void
|
||||||
StyledEditWindow::RevertToSaved()
|
StyledEditWindow::RevertToSaved()
|
||||||
{ //translationutils here as well
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
|
int32 buttonIndex= 0;
|
||||||
|
BAlert *revertAlert;
|
||||||
|
BString alertText;
|
||||||
|
alertText.SetTo("Revert to the last version of \"");
|
||||||
|
alertText<< Title();
|
||||||
|
alertText<<"\"? ";
|
||||||
|
revertAlert= new BAlert("revertAlert",alertText.String(), "Cancel", "Ok", 0,
|
||||||
|
B_WIDTH_AS_USUAL, B_EVEN_SPACING, B_WARNING_ALERT);
|
||||||
|
revertAlert->SetShortcut(0, B_ESCAPE);
|
||||||
|
buttonIndex= revertAlert->Go();
|
||||||
|
|
||||||
|
if (buttonIndex!=2) { // some sort of cancel, don't revert
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fSaveMessage->FindRef("directory", &ref);
|
fSaveMessage->FindRef("directory", &ref);
|
||||||
fSaveMessage->FindString("name", &name);
|
fSaveMessage->FindString("name", &name);
|
||||||
|
|
||||||
BDirectory dir(&ref);
|
|
||||||
|
|
||||||
BFile file(&dir, name, B_READ_ONLY | B_CREATE_FILE);
|
|
||||||
fTextView->Reset(); //clear the textview...
|
|
||||||
fTextView->GetStyledText(&file); //and fill it from the file
|
|
||||||
|
|
||||||
// clear undo modes
|
BDirectory dir(&ref);
|
||||||
fUndoItem->SetLabel("Can't Undo");
|
|
||||||
fUndoItem->SetEnabled(false);
|
BFile file(&dir, name, B_READ_ONLY | B_CREATE_FILE);
|
||||||
fUndoFlag = false;
|
fTextView->Reset(); //clear the textview...
|
||||||
fCanUndo = false;
|
fTextView->GetStyledText(&file); //and fill it from the file
|
||||||
fRedoFlag = false;
|
|
||||||
fCanRedo = false;
|
// clear undo modes
|
||||||
// clear clean modes
|
fUndoItem->SetLabel("Can't Undo");
|
||||||
fSaveItem->SetEnabled(false);
|
fUndoItem->SetEnabled(false);
|
||||||
fRevertItem->SetEnabled(false);
|
fUndoFlag = false;
|
||||||
fUndoCleans = false;
|
fCanUndo = false;
|
||||||
fRedoCleans = false;
|
fRedoFlag = false;
|
||||||
fClean = true;
|
fCanRedo = false;
|
||||||
|
// clear clean modes
|
||||||
|
fSaveItem->SetEnabled(false);
|
||||||
|
fRevertItem->SetEnabled(false);
|
||||||
|
fUndoCleans = false;
|
||||||
|
fRedoCleans = false;
|
||||||
|
fClean = true;
|
||||||
}/***StyledEditWindow::RevertToSaved()***/
|
}/***StyledEditWindow::RevertToSaved()***/
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
|
|||||||
Reference in New Issue
Block a user