Permalink
Browse files

#2600: Remember copy content when duplicating a table.

  • Loading branch information...
stuconnolly committed Oct 8, 2018
1 parent dc48447 commit 7c114b88c90160821f60f186efb5aef43c298ec2
@@ -3099,15 +3099,18 @@ Gw
</textFieldCell>
</textField>
<button id="514">
<rect key="frame" x="19" y="43" width="223" height="18"/>
<rect key="frame" x="17" y="43" width="227" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<buttonCell key="cell" type="check" title="Duplicate table content" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="3832">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="smallSystem"/>
</buttonCell>
<connections>
<binding destination="1907" name="value" keyPath="values.CopyContentOnTableCopy" id="4I8-Es-EDn"/>
</connections>
</button>
<button verticalHuggingPriority="750" tag="1" id="515">
<rect key="frame" x="148" y="13" width="97" height="28"/>
<rect key="frame" x="150" y="13" width="97" height="28"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<buttonCell key="cell" type="push" title="Duplicate" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" tag="1" inset="2" id="3833">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -3121,7 +3124,7 @@ DQ
</connections>
</button>
<button verticalHuggingPriority="750" id="516">
<rect key="frame" x="59" y="13" width="91" height="28"/>
<rect key="frame" x="61" y="13" width="91" height="28"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" inset="2" id="3834">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -3139,7 +3142,7 @@ Gw
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="n3P-gU-pX8">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
@@ -3148,6 +3151,7 @@ Gw
</textField>
</subviews>
</view>
<point key="canvasLocation" x="183" y="402.5"/>
</window>
<window title="Key Sheet" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="409" userLabel="Key Sheet">
<windowStyleMask key="styleMask" titled="YES"/>
@@ -201,5 +201,7 @@
<true/>
<key>DisplayBinaryDataAsHex</key>
<false/>
<key>CopyContentOnTableCopy</key>
<false/>
</dict>
</plist>
View
@@ -455,6 +455,7 @@ extern NSString *SPSSLCipherListKey;
extern NSString *SPQueryFavoritesHaveBeenUpdatedNotification;
extern NSString *SPHistoryItemsHaveBeenUpdatedNotification;
extern NSString *SPContentFiltersHaveBeenUpdatedNotification;
extern NSString *SPCopyContentOnTableCopy;
// URLs
extern NSString *SPDonationsURL;
View
@@ -101,15 +101,9 @@
NSString *SPTableRowCountQueryLevel = @"TableRowCountQueryLevel";
NSString *SPTableRowCountCheapSizeBoundary = @"TableRowCountCheapLookupSizeBoundary";
NSString *SPNewFieldsAllowNulls = @"NewFieldsAllowNulls";
#ifndef SP_CODA
NSString *SPLimitResults = @"LimitResults";
NSString *SPLimitResultsValue = @"LimitResultsValue";
NSString *SPNullValue = @"NullValue";
#else
NSString *SPLimitResults = @"SPLimitResults";
NSString *SPLimitResultsValue = @"SPLimitResultsValue";
NSString *SPNullValue = @"SPNullValue";
#endif
NSString *SPGlobalResultTableFont = @"GlobalResultTableFont";
NSString *SPFilterTableDefaultOperator = @"FilterTableDefaultOperator";
NSString *SPFilterTableDefaultOperatorLastItems = @"FilterTableDefaultOperatorLastItems";
@@ -127,15 +121,9 @@
NSString *SPConsoleEnableErrorLogging = @"ConsoleEnableErrorLogging";
// Network Prefpane
#ifndef SP_CODA
NSString *SPConnectionTimeoutValue = @"ConnectionTimeoutValue";
NSString *SPUseKeepAlive = @"UseKeepAlive";
NSString *SPKeepAliveInterval = @"KeepAliveInterval";
#else
NSString *SPConnectionTimeoutValue = @"SPConnectionTimeoutValue";
NSString *SPUseKeepAlive = @"SPUseKeepAlive";
NSString *SPKeepAliveInterval = @"SPKeepAliveInterval";
#endif
// Editor Prefpane
NSString *SPCustomQueryEditorFont = @"CustomQueryEditorFont";
@@ -207,16 +195,16 @@
NSString *SPLastExportSettings = @"LastExportSettings";
// Export filename tokens
NSString *SPFileNameDatabaseTokenName = @"database";
NSString *SPFileNameHostTokenName = @"host";
NSString *SPFileNameDateTokenName = @"date";
NSString *SPFileNameYearTokenName = @"year";
NSString *SPFileNameMonthTokenName = @"month";
NSString *SPFileNameDayTokenName = @"day";
NSString *SPFileNameTimeTokenName = @"time";
NSString *SPFileName24HourTimeTokenName = @"time24";
NSString *SPFileNameFavoriteTokenName = @"favorite";
NSString *SPFileNameTableTokenName = @"table";
NSString *SPFileNameDatabaseTokenName = @"database";
NSString *SPFileNameHostTokenName = @"host";
NSString *SPFileNameDateTokenName = @"date";
NSString *SPFileNameYearTokenName = @"year";
NSString *SPFileNameMonthTokenName = @"month";
NSString *SPFileNameDayTokenName = @"day";
NSString *SPFileNameTimeTokenName = @"time";
NSString *SPFileName24HourTimeTokenName = @"time24";
NSString *SPFileNameFavoriteTokenName = @"favorite";
NSString *SPFileNameTableTokenName = @"table";
// Misc
NSString *SPContentFilters = @"ContentFilters";
@@ -252,6 +240,7 @@
NSString *SPQueryFavoritesHaveBeenUpdatedNotification = @"QueryFavoritesHaveBeenUpdatedNotification";
NSString *SPHistoryItemsHaveBeenUpdatedNotification = @"HistoryItemsHaveBeenUpdatedNotification";
NSString *SPContentFiltersHaveBeenUpdatedNotification = @"ContentFiltersHaveBeenUpdatedNotification";
NSString *SPCopyContentOnTableCopy = @"CopyContentOnTableCopy";
// URLs
NSString *SPDonationsURL = @"https://www.sequelpro.com/donate/";
View
@@ -568,38 +568,37 @@ - (IBAction)removeTable:(id)sender
*/
- (IBAction)copyTable:(id)sender
{
NSString *tableType = @"";
if ([tablesListView numberOfSelectedRows] != 1) return;
if (![tableSourceInstance saveRowOnDeselect] || ![tableContentInstance saveRowOnDeselect]) return;
[[tableDocumentInstance parentWindow] endEditingFor:nil];
NSInteger tblType = [[filteredTableTypes objectAtIndex:[tablesListView selectedRow]] integerValue];
NSInteger objectType = [[filteredTableTypes objectAtIndex:[tablesListView selectedRow]] integerValue];
[copyTableContentSwitch setState:NSOffState];
[copyTableContentSwitch setEnabled:objectType == SPTableTypeTable];
NSString *tableType = @"";
switch (tblType)
switch (objectType)
{
case SPTableTypeTable:
tableType = NSLocalizedString(@"table", @"table");
[copyTableContentSwitch setEnabled:YES];
[copyTableContentSwitch setState:[[[NSUserDefaults standardUserDefaults] objectForKey:SPCopyContentOnTableCopy] boolValue]];
break;
case SPTableTypeView:
tableType = NSLocalizedString(@"view", @"view");
[copyTableContentSwitch setEnabled:NO];
break;
case SPTableTypeProc:
tableType = NSLocalizedString(@"procedure", @"procedure");
[copyTableContentSwitch setEnabled:NO];
break;
case SPTableTypeFunc:
tableType = NSLocalizedString(@"function", @"function");
[copyTableContentSwitch setEnabled:NO];
break;
}
[copyTableMessageField setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Duplicate %@ '%@' to:", @"duplicate object message"), tableType, [self tableName]]];
[copyTableNameField setStringValue:[NSString stringWithFormat:@"%@_copy", [filteredTables objectAtIndex:[tablesListView selectedRow]]]];
[copyTableContentSwitch setState:NSOffState];
[NSApp beginSheet:copyTableSheet
modalForWindow:[tableDocumentInstance parentWindow]

0 comments on commit 7c114b8

Please sign in to comment.