Skip to content

Commit

Permalink
added canQuietlySaveDocument method
Browse files Browse the repository at this point in the history
  • Loading branch information
Jurriaan Pruis committed Jan 20, 2011
1 parent 5eb4856 commit aab1844
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/KDocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ extern NSString *const KDocumentWillCloseNotification;

@property(assign, nonatomic) BOOL isDirty;
@property BOOL hasMetaRuler;
@property(readonly) BOOL canQuietlySaveDocument;
@property(readonly) BOOL canSaveDocument;
@property(readonly) BOOL hasRemoteSource;
@property(assign) NSStringEncoding textEncoding;
Expand Down
13 changes: 10 additions & 3 deletions src/KDocument.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1627,11 +1627,18 @@ - (BOOL)readFromData:(NSData *)data

// Returns true to indicate a saveDocument: message is allowed, saving the
// document to it's current URL
- (BOOL)canSaveDocument {
- (BOOL)canQuietlySaveDocument {
NSURL *url = self.fileURL;
KURLHandler *urlHandler =
[[KDocumentController kodController] urlHandlerForURL:url];
return ( (urlHandler && [urlHandler canWriteURL:url]) || !url );
[[KDocumentController kodController] urlHandlerForURL:url];
return ( (urlHandler && [urlHandler canWriteURL:url]) );
}

// Returns true to indicate a saveDocument: message is allowed, saving the
// document to it's current URL or that it's OK save to a new file
- (BOOL)canSaveDocument {
NSURL *url = self.fileURL;
return ( [self canQuietlySaveDocument] || !url );
}


Expand Down

0 comments on commit aab1844

Please sign in to comment.