The timed safe mechanism now also saves all project files, if needed.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/projectcenter/trunk@12951 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Philippe C.D. Robert 2002-03-02 13:11:05 +00:00
parent 28fc83d068
commit 050cf77b3d
4 changed files with 31 additions and 6 deletions

View file

@ -54,6 +54,8 @@
// ==== File handling
// ===========================================================================
- (BOOL)saveAllFiles;
- (BOOL)saveFile;
- (BOOL)revertFile;

View file

@ -165,6 +165,26 @@
// ==== File handling
// ===========================================================================
- (BOOL)saveAllFiles
{
NSEnumerator *enumerator = [editorDict keyEnumerator];
PCEditor *editor;
NSString *key;
BOOL ret = YES;
while(( key = [enumerator nextObject] ))
{
editor = [editorDict objectForKey:key];
if( [editor saveFile] == NO )
{
ret = NO;
}
}
return ret;
}
- (BOOL)saveFile
{
NSEnumerator *enumerator = [editorDict keyEnumerator];

View file

@ -890,10 +890,12 @@
}
}
if (shouldKeep && [fm isReadableFileAtPath:file]) {
if (shouldKeep && [fm isReadableFileAtPath:file])
{
ret = [fm copyPath:file toPath:backup handler:nil];
if( ret == NO ) {
if( ret == NO )
{
NSRunAlertPanel(@"Attention!",
@"Could not save the project backup file '%@'!",
@"OK",nil,nil,file);
@ -907,6 +909,7 @@
[projectWindow setDocumentEdited:NO];
}
[self saveAllFiles];
[self writeMakefile];
return ret;
@ -924,9 +927,7 @@
- (BOOL)saveAllFiles
{
BOOL ret = NO;
return ret;
return [editorController saveAllFiles];
}
- (BOOL)saveAllFilesIfNeeded

View file

@ -246,7 +246,9 @@ NSString *ActiveProjectDidChangeNotification = @"ActiveProjectDidChange";
{
project = [loadedProjects objectForKey:key];
ret = [project save];
if( ret == NO ) {
if( ret == NO )
{
NSRunAlertPanel(@"Attention!",
@"Couldn't save project %@!",
@"OK",nil,nil,[project projectName]);