Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added canQuietlySaveDocument method

  • Loading branch information...
commit aab184492e9b112ccdbf6c3a356cbd9025710a78 1 parent 5eb4856
@jurriaan authored
Showing with 11 additions and 3 deletions.
  1. +1 −0  src/KDocument.h
  2. +10 −3 src/KDocument.mm
View
1  src/KDocument.h
@@ -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;
View
13 src/KDocument.mm
@@ -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 );
}
Please sign in to comment.
Something went wrong with that request. Please try again.