aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Interfaces/English.lproj/FieldEditorSheet.xib44
-rw-r--r--Source/SPFieldEditorController.h5
-rw-r--r--Source/SPFieldEditorController.m24
-rw-r--r--Source/TableContent.m2
4 files changed, 66 insertions, 9 deletions
diff --git a/Interfaces/English.lproj/FieldEditorSheet.xib b/Interfaces/English.lproj/FieldEditorSheet.xib
index fd7a21f9..e4f5ccdf 100644
--- a/Interfaces/English.lproj/FieldEditorSheet.xib
+++ b/Interfaces/English.lproj/FieldEditorSheet.xib
@@ -464,7 +464,6 @@
</object>
<string key="NSFrameSize">{667, 370}</string>
<reference key="NSSuperview" ref="983787914"/>
- <reference key="NSNextKeyView" ref="459839028"/>
<reference key="NSDocView" ref="459839028"/>
<reference key="NSBGColor" ref="940290613"/>
<object class="NSCursor" key="NSCursor" id="956874367">
@@ -497,7 +496,6 @@
</object>
<string key="NSFrame">{{0, 39}, {667, 370}}</string>
<reference key="NSSuperview" ref="559857537"/>
- <reference key="NSNextKeyView" ref="1068411389"/>
<int key="NSsFlags">528</int>
<reference key="NSVScroller" ref="977735067"/>
<reference key="NSHScroller" ref="426249328"/>
@@ -614,7 +612,6 @@
</object>
<string key="NSFrameSize">{667, 370}</string>
<reference key="NSSuperview" ref="604699677"/>
- <reference key="NSNextKeyView" ref="702566211"/>
<reference key="NSDocView" ref="702566211"/>
<reference key="NSBGColor" ref="940290613"/>
<reference key="NSCursor" ref="956874367"/>
@@ -644,7 +641,6 @@
</object>
<string key="NSFrame">{{0, 39}, {667, 370}}</string>
<reference key="NSSuperview" ref="559857537"/>
- <reference key="NSNextKeyView" ref="967441740"/>
<int key="NSsFlags">528</int>
<reference key="NSVScroller" ref="699979333"/>
<reference key="NSHScroller" ref="393370468"/>
@@ -910,6 +906,30 @@
</object>
<int key="connectionID">66</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">editSheetOkButton</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="315097820"/>
+ </object>
+ <int key="connectionID">67</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">editSheetCancelButton</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="760872156"/>
+ </object>
+ <int key="connectionID">68</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">editSheetOpenButton</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="16151679"/>
+ </object>
+ <int key="connectionID">69</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -1379,7 +1399,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">66</int>
+ <int key="maxID">69</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1408,6 +1428,14 @@
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
+ <string key="className">SPEditSheetTextView</string>
+ <string key="superclassName">NSTextView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBDocumentRelativeSource</string>
+ <string key="minorKey">../../Source/SPEditSheetTextView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">SPFieldEditorController</string>
<string key="superclassName">NSWindowController</string>
<object class="NSMutableDictionary" key="actions">
@@ -1437,6 +1465,9 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>editImage</string>
<string>editSheet</string>
+ <string>editSheetCancelButton</string>
+ <string>editSheetOkButton</string>
+ <string>editSheetOpenButton</string>
<string>editSheetProgressBar</string>
<string>editSheetQuickLookButton</string>
<string>editSheetSegmentControl</string>
@@ -1458,6 +1489,9 @@
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
diff --git a/Source/SPFieldEditorController.h b/Source/SPFieldEditorController.h
index f369951f..1b54cfab 100644
--- a/Source/SPFieldEditorController.h
+++ b/Source/SPFieldEditorController.h
@@ -36,6 +36,9 @@
IBOutlet id editTextScrollView;
IBOutlet id hexTextScrollView;
IBOutlet id editSheet;
+ IBOutlet id editSheetCancelButton;
+ IBOutlet id editSheetOkButton;
+ IBOutlet id editSheetOpenButton;
id sheetEditData;
BOOL editSheetWillBeInitialized;
@@ -58,7 +61,7 @@
- (IBAction)quickLookFormatButton:(id)sender;
- (IBAction)dropImage:(id)sender;
-- (id)editWithObject:(id)data usingEncoding:(NSStringEncoding)anEncoding isObjectBlob:(BOOL)isFieldBlob withWindow:(NSWindow *)tableWindow;
+- (id)editWithObject:(id)data usingEncoding:(NSStringEncoding)anEncoding isObjectBlob:(BOOL)isFieldBlob isEditable:(BOOL)isEditable withWindow:(NSWindow *)tableWindow;
- (void)processPasteImageData;
- (void)processUpdatedImageData:(NSData *)data;
diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m
index 1a5a19a3..af5addf9 100644
--- a/Source/SPFieldEditorController.m
+++ b/Source/SPFieldEditorController.m
@@ -50,7 +50,7 @@
}
- (id)editWithObject:(id)data usingEncoding:(NSStringEncoding)anEncoding
- isObjectBlob:(BOOL)isFieldBlob withWindow:(NSWindow *)tableWindow
+ isObjectBlob:(BOOL)isFieldBlob isEditable:(BOOL)isEditable withWindow:(NSWindow *)tableWindow
{
prefs = [NSUserDefaults standardUserDefaults];
@@ -70,6 +70,16 @@
[editTextView setHidden:YES];
[editTextScrollView setHidden:YES];
+ if(!isEditable) {
+ [editSheetOkButton setTitle:NSLocalizedString(@"Close", @"close button title")];
+ [editSheetCancelButton setHidden:YES];
+ [editSheetOpenButton setEnabled:NO];
+ } else {
+ [editSheetOkButton setTitle:NSLocalizedString(@"OK", @"ok button title")];
+ [editSheetCancelButton setHidden:NO];
+ [editSheetOpenButton setEnabled:YES];
+ }
+
editSheetWillBeInitialized = YES;
encoding = anEncoding;
@@ -88,6 +98,15 @@
// Hide QuickLook button and text/iamge/hex control for text data
[editSheetQuickLookButton setHidden:(!isBlob)];
[editSheetSegmentControl setHidden:(!isBlob)];
+
+ // Set window's min size since no segment and quicklook buttons are hidden
+ if(isBlob)
+ [editSheet setMinSize:NSMakeSize(560, 200)];
+ else
+ [editSheet setMinSize:NSMakeSize(340, 150)];
+
+ [editTextView setEditable:isEditable];
+ [editImage setEditable:isEditable];
[NSApp beginSheet:editSheet modalForWindow:tableWindow modalDelegate:self didEndSelector:nil contextInfo:nil];
@@ -173,7 +192,7 @@
// For safety reasons inform QuickLook to quit
quickLookCloseMarker = 1;
- return ( code ) ? [sheetEditData retain] : nil;
+ return ( code && isEditable ) ? [sheetEditData retain] : nil;
}
@@ -473,6 +492,7 @@
-(void)processPasteImageData
{
+
editSheetWillBeInitialized = YES;
NSImage *image = nil;
diff --git a/Source/TableContent.m b/Source/TableContent.m
index e6381555..e5dc4141 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -1934,7 +1934,7 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
SPFieldEditorController *fieldEditor = [[SPFieldEditorController alloc] init];
id editData = [[fieldEditor editWithObject:[[filteredResult objectAtIndex:rowIndex] objectAtIndex:[[aTableColumn identifier] intValue]]
- usingEncoding:[mySQLConnection encoding] isObjectBlob:isBlob withWindow:tableWindow] retain];
+ usingEncoding:[mySQLConnection encoding] isObjectBlob:isBlob isEditable:YES withWindow:tableWindow] retain];
if ( editData ) {
if ( !isEditingRow ) {