aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Interfaces/English.lproj/DBView.xib45
-rw-r--r--Source/TablesList.m49
2 files changed, 65 insertions, 29 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index 7ea22e41..4efff6ed 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -1,20 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02">
+<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">9G55</string>
- <string key="IBDocument.InterfaceBuilderVersion">670</string>
+ <string key="IBDocument.InterfaceBuilderVersion">677</string>
<string key="IBDocument.AppKitVersion">949.43</string>
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="5281"/>
<integer value="3994"/>
+ <integer value="4811"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ </object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="105205302">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="427689665">
@@ -363,7 +372,7 @@
<reference key="NSControlView" ref="1029554648"/>
<int key="NSButtonFlags">-2042609409</int>
<int key="NSButtonFlags2">35</int>
- <object class="NSCustomResource" key="NSNormalImage">
+ <object class="NSCustomResource" key="NSNormalImage" id="95983676">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">button_action</string>
</object>
@@ -378,10 +387,7 @@
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
- <object class="NSCustomResource" key="NSImage" id="565980969">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">button_action</string>
- </object>
+ <reference key="NSImage" ref="95983676"/>
<string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="753352469"/>
</object>
@@ -432,6 +438,7 @@
</object>
</object>
</object>
+ <int key="NSSelectedIndex">1</int>
<bool key="NSPullDown">YES</bool>
<int key="NSPreferredEdge">1</int>
<bool key="NSUsesItemFromMenu">YES</bool>
@@ -2258,8 +2265,8 @@
<bool key="NS.raise.underflow">YES</bool>
<bool key="NS.raise.dividebyzero">YES</bool>
</object>
- <string key="NS.decimal">.</string>
- <string key="NS.thousand">,</string>
+ <string key="NS.decimal">,</string>
+ <string key="NS.thousand">.</string>
<bool key="NS.hasthousands">NO</bool>
<bool key="NS.localized">YES</bool>
<bool key="NS.allowsfloats">NO</bool>
@@ -2945,7 +2952,7 @@
<reference key="NSControlView" ref="363916571"/>
<int key="NSButtonFlags">-2042609409</int>
<int key="NSButtonFlags2">35</int>
- <reference key="NSNormalImage" ref="565980969"/>
+ <reference key="NSNormalImage" ref="95983676"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">400</int>
@@ -2957,7 +2964,7 @@
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSImage" ref="565980969"/>
+ <reference key="NSImage" ref="95983676"/>
<string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="984501775"/>
</object>
@@ -20131,7 +20138,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{0, 824}, {200, 32}}</string>
+ <string>{{0, 724}, {200, 32}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{628, 654}</string>
<string>{{284, 769}, {200, 32}}</string>
@@ -20430,7 +20437,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{94, 194}, {175, 73}}</string>
+ <string>{{90, 158}, {175, 73}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary">
@@ -20438,7 +20445,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<object class="IBToolTipAttribute" key="NS.object.0">
<string key="name">ToolTip</string>
<reference key="object" ref="831803264"/>
- <string key="toolTip">Remove the selected table(s)</string>
+ <string key="toolTip">Remove the selected table(s) or view(s)</string>
</object>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -20452,8 +20459,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{81, 387}, {944, 550}}</string>
- <string>{{81, 387}, {944, 550}}</string>
+ <string>{{81, 206}, {944, 550}}</string>
+ <string>{{81, 206}, {944, 550}}</string>
<reference ref="9"/>
<reference ref="9"/>
<string>{{62, 352}, {845, 504}}</string>
@@ -20635,7 +20642,7 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{290, 512}, {236, 254}}</string>
+ <string>{{290, 331}, {236, 254}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -20658,7 +20665,7 @@ aGUgYWN0aXZlIHNlbGVjdGlvbiAo4oyl4oyYUik</string>
<string>{{679, 307}, {269, 112}}</string>
<reference ref="9"/>
<reference ref="9"/>
- <integer value="1"/>
+ <reference ref="9"/>
<string>{292, 112}</string>
<string>{269, 112}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 6d0925db..0d3aa48e 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -221,14 +221,36 @@
NSAlert *alert = [NSAlert alertWithMessageText:@"" defaultButton:NSLocalizedString(@"Delete", @"delete button") alternateButton:NSLocalizedString(@"Cancel", @"cancel button") otherButton:nil informativeTextWithFormat:@""];
[alert setAlertStyle:NSCriticalAlertStyle];
+
+ NSIndexSet *indexes = [tablesListView selectedRowIndexes];
+ NSString *tblTypes;
+ unsigned currentIndex = [indexes lastIndex];
if ([tablesListView numberOfSelectedRows] == 1) {
- [alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"Delete table '%@'?", @"delete table message"), [tables objectAtIndex:[tablesListView selectedRow]]]];
- [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete the table '%@'. This operation cannot be undone.", @"delete table informative message"), [tables objectAtIndex:[tablesListView selectedRow]]]];
+ if([[tableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_VIEW)
+ tblTypes = NSLocalizedString(@"view", @"view");
+ else
+ tblTypes = NSLocalizedString(@"table", @"table");
+ [alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"Delete %@ '%@'?", @"delete table/view message"), tblTypes, [tables objectAtIndex:[tablesListView selectedRow]]]];
+ [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete the %@ '%@'. This operation cannot be undone.", @"delete table/view informative message"), tblTypes, [tables objectAtIndex:[tablesListView selectedRow]]]];
}
else {
- [alert setMessageText:NSLocalizedString(@"Delete selected tables?", @"delete tables message")];
- [alert setInformativeText:NSLocalizedString(@"Are you sure you want to delete the selected tables. This operation cannot be undone.", @"delete tables informative message")];
+ int tblTypesChecksum = 0;
+ while (currentIndex != NSNotFound)
+ {
+ tblTypesChecksum += [[tableTypes objectAtIndex:currentIndex] intValue];
+ currentIndex = [indexes indexLessThanIndex:currentIndex];
+ }
+
+ if(tblTypesChecksum == 0)
+ tblTypes = NSLocalizedString(@"tables", @"tables");
+ else if(tblTypesChecksum == [indexes count])
+ tblTypes = NSLocalizedString(@"views", @"views");
+ else
+ tblTypes = NSLocalizedString(@"tables/views", @"tables/views");
+
+ [alert setMessageText:[NSString stringWithFormat:NSLocalizedString(@"Delete selected %@?", @"delete tables/views message"), tblTypes]];
+ [alert setInformativeText:[NSString stringWithFormat:NSLocalizedString(@"Are you sure you want to delete the selected %@. This operation cannot be undone.", @"delete tables/views informative message"), tblTypes]];
}
[alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"removeRow"];
@@ -375,10 +397,17 @@
unsigned currentIndex = [indexes lastIndex];
while (currentIndex != NSNotFound)
{
- [mySQLConnection queryString: [NSString stringWithFormat: @"DROP TABLE %@",
- [[tables objectAtIndex:currentIndex] backtickQuotedString]
- ]];
-
+
+ if([[tableTypes objectAtIndex:currentIndex] intValue] == SP_TABLETYPE_VIEW)
+ {
+ [mySQLConnection queryString: [NSString stringWithFormat: @"DROP VIEW %@",
+ [[tables objectAtIndex:currentIndex] backtickQuotedString]
+ ]];
+ } else {
+ [mySQLConnection queryString: [NSString stringWithFormat: @"DROP TABLE %@",
+ [[tables objectAtIndex:currentIndex] backtickQuotedString]
+ ]];
+ }
if ( [[mySQLConnection getLastErrorMessage] isEqualTo:@""] ) {
//dropped table with success
[tables removeObjectAtIndex:currentIndex];
@@ -669,7 +698,7 @@
if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0 ) {
[tableSourceInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
structureLoaded = YES;
- contentLoaded = NO;
+ contentLoaded = NO;
statusLoaded = NO;
} else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 1 ) {
[tableContentInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
@@ -679,7 +708,7 @@
} else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3 ) {
[tableStatusInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
structureLoaded = NO;
- contentLoaded = NO;
+ contentLoaded = NO;
statusLoaded = YES;
} else {
structureLoaded = NO;