From c84d39d22cdc466b6a3d0c0e71966d074789b090 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sat, 4 Dec 2010 22:57:26 +0000 Subject: - Show and hide the custom query info area based on whether custom query errors occurred, starting off hidden - Add "errors"/"no errors" prefix to the custom query status area - Add an import cancelled line to the import error list when stopping imports after errors - Fix custom query error highlighting by scrolling to the error - Update localisable strings --- Interfaces/English.lproj/DBView.xib | 412 +++++++++++++++++------ Resources/English.lproj/BundleEditor.strings | Bin 15018 -> 18482 bytes Resources/English.lproj/BundleHTMLOutput.strings | Bin 0 -> 166 bytes Resources/English.lproj/DBView.strings | Bin 100418 -> 100620 bytes Resources/English.lproj/Localizable.strings | Bin 195712 -> 197540 bytes Source/SPCustomQuery.h | 2 + Source/SPCustomQuery.m | 94 ++++-- Source/SPDataImport.m | 1 + 8 files changed, 367 insertions(+), 142 deletions(-) create mode 100644 Resources/English.lproj/BundleHTMLOutput.strings diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index 73902c1b..1e9085a1 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -23,13 +23,13 @@ YES - + YES com.brandonwalkin.BWToolkit - com.apple.WebKitIBPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin PluginDependencyRecalculationVersion @@ -222,7 +222,7 @@ controlColor 3 - MC42NjY2NjY2ODY1AA + MC42NjY2NjY2NjY3AA @@ -1065,7 +1065,7 @@ source - + 256 YES @@ -2536,7 +2536,6 @@ {{10, 7}, {706, 544}} - Structure @@ -3317,7 +3316,7 @@ customQuery - + 256 YES @@ -3508,7 +3507,30 @@ 6418 - {{0, 2}, {694, 14}} + + YES + + YES + Apple HTML pasteboard type + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple PNG pasteboard type + Apple URL pasteboard type + CorePasteboardFlavorType 0x6D6F6F76 + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT Encapsulated PostScript v1.2 pasteboard type + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + NeXT font pasteboard type + NeXT ruler pasteboard type + WebURLsWithTitlesPboardType + public.url + + + {{0, -8}, {694, 14}} @@ -3567,7 +3589,7 @@ - {{1, 1}, {694, 148}} + {{1, 1}, {694, 140}} @@ -3599,7 +3621,7 @@ 0.94565218687057495 - {696, 150} + {696, 142} 530 @@ -3608,7 +3630,7 @@ - {696, 150} + {696, 142} NSView @@ -3630,7 +3652,7 @@ 4352 - {694, 221} + {694, 206} YES @@ -3692,7 +3714,7 @@ 0 - {{1, 17}, {694, 221}} + {{1, 17}, {694, 206}} @@ -3735,7 +3757,7 @@ - {{0, -1}, {696, 239}} + {{0, -1}, {696, 224}} 562 @@ -3749,7 +3771,7 @@ 268 - {{156, 237}, {98, 22}} + {{156, 222}, {98, 22}} YES @@ -3862,7 +3884,7 @@ 264 - {{38, 237}, {108, 22}} + {{38, 222}, {108, 22}} YES @@ -3976,7 +3998,7 @@ 268 - {{-10, 236}, {48, 25}} + {{-10, 221}, {48, 25}} YES @@ -4316,7 +4338,7 @@ 265 - {{563, 239}, {124, 17}} + {{563, 224}, {124, 17}} YES @@ -4337,7 +4359,7 @@ 265 - {{404, 239}, {151, 17}} + {{404, 224}, {151, 17}} YES @@ -4369,7 +4391,7 @@ NeXT TIFF v4.0 pasteboard type - {{32, 237}, {664, 23}} + {{32, 222}, {664, 23}} YES @@ -4384,16 +4406,16 @@ YES - {{0, 159}, {696, 260}} + {{0, 151}, {696, 245}} NSView - {696, 419} + {696, 396} - {696, 419} + {696, 396} NSView @@ -4402,10 +4424,183 @@ 256 YES + + + 274 + + YES + + + 2304 + + YES + + + 2322 + {672, 13} + + + + + + No errors + + + YES + + YES + NSFont + NSParagraphStyle + + + YES + + + 4 + + YES + + 28 + + + 56 + + + 84 + + + 112 + + + 140 + + + 168 + + + 196 + + + 224 + + + 252 + + + 280 + + + 308 + + + 336 + + + + + + + + + YES + + + 134 + + + + 672 + 1 + + + 12005 + 0 + + + + YES + + YES + NSBackgroundColor + NSColor + + + YES + + + + + + + YES + + YES + NSColor + NSCursor + NSUnderline + + + YES + + 1 + MCAwIDEAA + + + {8, -8} + 13 + + + + + + + 6 + {672, 1e+07} + {223, 3} + + + + {672, 66} + + + + + + 2 + + + + -2147483392 + {{656, 1}, {15, 64}} + + + _doScroller: + 0.98496240601503759 + + + + -2147483392 + {{-100, -100}, {87, 18}} + + 1 + + _doScroller: + 1 + 0.94565218687057495 + + + {{12, 12}, {672, 66}} + + + 528 + + + + 268 - {{15, 63}, {363, 14}} + {{15, 86}, {363, 14}} YES @@ -4418,27 +4613,8 @@ - - - 274 - {{15, 12}, {662, 45}} - - YES - - 69336577 - 4329472 - - - - - - 1 - MCAwIDAAA - - - - {{0, 420}, {696, 88}} + {{0, 397}, {696, 111}} NSView @@ -4495,6 +4671,7 @@ {{10, 7}, {706, 544}} + Custom Query @@ -4579,10 +4756,7 @@ YES - - 1 - MCAwIDEAA - + @@ -6284,14 +6458,14 @@ - + 134217731 YES YES YES - + @@ -7031,7 +7205,7 @@ View - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} {213, 107} @@ -7185,7 +7359,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 0}, {1440, 878}} {213, 129} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} 7 @@ -7195,7 +7369,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 Reset Auto Increment NSWindow - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} {255, 95} @@ -7358,7 +7532,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 0}, {1280, 1002}} {255, 117} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} 1 @@ -7368,7 +7542,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 New Relation NSPanel - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} 256 @@ -7969,7 +8143,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {302, 307} {{0, 0}, {1440, 878}} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} 9 @@ -7979,7 +8153,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 New Trigger NSPanel - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} {360, 348} @@ -8386,7 +8560,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 0}, {1680, 1028}} {360, 370} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} 3 @@ -8398,7 +8572,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 View - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} {213, 50} @@ -8518,7 +8692,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 0}, {1920, 1178}} {213, 72} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} 9 @@ -8530,7 +8704,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 View - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} {213, 107} @@ -8665,7 +8839,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 0}, {1440, 878}} {213, 129} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} 15 @@ -8677,7 +8851,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 View - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} {350, 200} @@ -8900,7 +9074,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 0}, {1680, 1028}} {350, 222} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} SPCreateSyntaxSheet @@ -8913,7 +9087,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 View - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} {213, 107} @@ -9083,7 +9257,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 0}, {1440, 878}} {213, 129} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} 31 @@ -9093,7 +9267,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 MySQL Help NSPanel - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} {351, 120} @@ -9491,7 +9665,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 0}, {1280, 1002}} {351, 136} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} MYSQL_HELP_WINDOW @@ -9502,7 +9676,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 Filter NSPanel - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} {380, 170} @@ -9880,10 +10054,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 YES - - {8, -8} - 13 - + @@ -10147,7 +10318,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8 {{0, 0}, {1280, 778}} {380, 192} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} SPTableFilterPanel @@ -10647,7 +10818,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA Secure Text Input Sheet NSPanel - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} 256 @@ -10751,7 +10922,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA {338, 150} {{0, 0}, {1280, 778}} - {3.40282e+38, 3.40282e+38} + {1.79769e+308, 1.79769e+308} @@ -10934,7 +11105,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA disabledControlTextColor 3 - MC4zMzMzMzMzNDMzAA + MC4zMzMzMzMzMzMzAA @@ -15850,14 +16021,6 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA 7395 - - - errorText - - - - 7432 - exportCustomQueryResultAsFormat: @@ -16378,6 +16541,22 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA 7715 + + + errorTextScrollView + + + + 7725 + + + + errorText + + + + 7726 + @@ -21532,8 +21711,8 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA YES - + @@ -22090,15 +22269,6 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA - - 7428 - - - YES - - - - 7429 @@ -22113,11 +22283,6 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA - - 7431 - - - 7438 @@ -22958,6 +23123,32 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA + + 7721 + + + YES + + + + + + + + 7722 + + + + + 7723 + + + + + 7724 + + + @@ -24118,10 +24309,8 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA 7409.IBPluginDependency 7410.IBPluginDependency 7412.IBPluginDependency - 7428.IBPluginDependency 7429.IBPluginDependency 7430.IBPluginDependency - 7431.IBPluginDependency 7438.IBPluginDependency 7439.IBPluginDependency 7440.IBPluginDependency @@ -24275,6 +24464,10 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA 7695.ImportedFromIB2 7696.CustomClassName 7696.IBPluginDependency + 7721.IBPluginDependency + 7722.IBPluginDependency + 7723.IBPluginDependency + 7724.IBPluginDependency 858.IBPluginDependency 858.ImportedFromIB2 959.IBEditorWindowLastContentRect @@ -25607,7 +25800,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{76, 64}, {943, 549}} + {{58, 273}, {943, 549}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -25875,8 +26068,6 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin ToolTip @@ -26076,6 +26267,10 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA SPTableTextFieldCell com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin {{265, 489}, {405, 267}} com.apple.InterfaceBuilder.CocoaPlugin @@ -26113,7 +26308,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA - 7720 + 7726 @@ -26673,6 +26868,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA editorFontMenuItem encodingPopUp errorText + errorTextScrollView helpNavigator helpSearchField helpSearchFieldCell @@ -26728,6 +26924,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA NSMenuItem NSPopUpButton id + NSScrollView NSSegmentedControl NSSearchField NSSearchFieldCell @@ -26786,6 +26983,7 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA editorFontMenuItem encodingPopUp errorText + errorTextScrollView helpNavigator helpSearchField helpSearchFieldCell @@ -26886,6 +27084,10 @@ bGQgTmFtZQkgID0gQAoJCQkJICBMRU5HVEgoYEBgKSA+IEA errorText id + + errorTextScrollView + NSScrollView + helpNavigator NSSegmentedControl diff --git a/Resources/English.lproj/BundleEditor.strings b/Resources/English.lproj/BundleEditor.strings index 34048acb..70fce557 100644 Binary files a/Resources/English.lproj/BundleEditor.strings and b/Resources/English.lproj/BundleEditor.strings differ diff --git a/Resources/English.lproj/BundleHTMLOutput.strings b/Resources/English.lproj/BundleHTMLOutput.strings new file mode 100644 index 00000000..1191d0d2 Binary files /dev/null and b/Resources/English.lproj/BundleHTMLOutput.strings differ diff --git a/Resources/English.lproj/DBView.strings b/Resources/English.lproj/DBView.strings index d3b1b5ee..b2b0b4b9 100644 Binary files a/Resources/English.lproj/DBView.strings and b/Resources/English.lproj/DBView.strings differ diff --git a/Resources/English.lproj/Localizable.strings b/Resources/English.lproj/Localizable.strings index 4fed6b8e..93af30f2 100644 Binary files a/Resources/English.lproj/Localizable.strings and b/Resources/English.lproj/Localizable.strings differ diff --git a/Source/SPCustomQuery.h b/Source/SPCustomQuery.h index d1147ecb..439ec8e3 100644 --- a/Source/SPCustomQuery.h +++ b/Source/SPCustomQuery.h @@ -78,6 +78,7 @@ IBOutlet SPCopyTable *customQueryView; IBOutlet NSScrollView *customQueryScrollView; IBOutlet id errorText; + IBOutlet NSScrollView *errorTextScrollView; IBOutlet id affectedRowsText; IBOutlet id valueSheet; IBOutlet id valueTextField; @@ -155,6 +156,7 @@ NSUInteger numberOfQueries; NSUInteger queryTextViewStartPosition; + NSUInteger queryInfoPanePaddingHeight; NSInteger currentHistoryOffsetIndex; BOOL historyItemWasJustInserted; diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index 415bf2fa..372fa512 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -118,6 +118,7 @@ [textView setSelectedRange:NSMakeRange(oldThreadedQueryRange.location,0)]; [textView insertText:@""]; [textView setSelectedRange:oldRange]; + [textView scrollRangeToVisible:oldRange]; } } @@ -506,7 +507,7 @@ taskString = NSLocalizedString(@"Running query...", @"Running single query string"); } [tableDocumentInstance startTaskWithDescription:taskString]; - [errorText setStringValue:taskString]; + [errorText setString:taskString]; [affectedRowsText setStringValue:@""]; NSValue *encodedCallbackMethod = nil; @@ -580,7 +581,7 @@ if (i > 0) { NSString *taskString = [NSString stringWithFormat:NSLocalizedString(@"Running query %ld of %lu...", @"Running multiple queries string"), (long)(i+1), (unsigned long)queryCount]; [[tableDocumentInstance onMainThread] setTaskDescription:taskString]; - [[errorText onMainThread] setStringValue:taskString]; + [[errorText onMainThread] setString:taskString]; } NSString *query = [NSArrayObjectAtIndex(queries, i) stringByTrimmingCharactersInSet:whitespaceAndNewlineSet]; @@ -661,7 +662,7 @@ [errors appendFormat:NSLocalizedString(@"[ERROR in query %ld] %@\n", @"error text when multiple custom query failed"), (long)(i+1), errorString]; - [[errorText onMainThread] setStringValue:errors]; + [[errorText onMainThread] setString:errors]; // ask the user to continue after detecting an error if (![mySQLConnection queryCancelled]) { @@ -748,45 +749,51 @@ [self performSelectorOnMainThread:@selector(updateStatusInterfaceWithDetails:) withObject:statusDetails waitUntilDone:YES]; // Set up the status string + NSString *statusString = nil; + NSString *statusErrorString = [errors length]?NSLocalizedString(@"Errors", @"Errors title"):NSLocalizedString(@"No errors", @"No errors title"); if ( [mySQLConnection queryCancelled] ) { if (totalQueriesRun > 1) { - [[affectedRowsText onMainThread] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Cancelled in query %ld, after %@", @"text showing multiple queries were cancelled"), - (long)totalQueriesRun, - [NSString stringForTimeInterval:executionTime] - ]]; + statusString = [NSString stringWithFormat:NSLocalizedString(@"%@; Cancelled in query %ld, after %@", @"text showing multiple queries were cancelled"), + statusErrorString, + (long)totalQueriesRun, + [NSString stringForTimeInterval:executionTime] + ]; } else { - [[affectedRowsText onMainThread] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Cancelled after %@", @"text showing a query was cancelled"), - [NSString stringForTimeInterval:executionTime] - ]]; + statusString = [NSString stringWithFormat:NSLocalizedString(@"%@; Cancelled after %@", @"text showing a query was cancelled"), + statusErrorString, + [NSString stringForTimeInterval:executionTime] + ]; } } else if ( totalQueriesRun > 1 ) { if (totalAffectedRows==1) { - [[affectedRowsText onMainThread] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"1 row affected in total, by %ld queries taking %@", @"text showing one row has been affected by multiple queries"), - (long)totalQueriesRun, - [NSString stringForTimeInterval:executionTime] - ]]; - + statusString = [NSString stringWithFormat:NSLocalizedString(@"%@; 1 row affected in total, by %ld queries taking %@", @"text showing one row has been affected by multiple queries"), + statusErrorString, + (long)totalQueriesRun, + [NSString stringForTimeInterval:executionTime] + ]; } else { - [[affectedRowsText onMainThread] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%ld rows affected in total, by %ld queries taking %@", @"text showing how many rows have been affected by multiple queries"), - (long)totalAffectedRows, - (long)totalQueriesRun, - [NSString stringForTimeInterval:executionTime] - ]]; - + statusString = [NSString stringWithFormat:NSLocalizedString(@"%@; %ld rows affected in total, by %ld queries taking %@", @"text showing how many rows have been affected by multiple queries"), + statusErrorString, + (long)totalAffectedRows, + (long)totalQueriesRun, + [NSString stringForTimeInterval:executionTime] + ]; } } else { if (totalAffectedRows==1) { - [[affectedRowsText onMainThread] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"1 row affected, taking %@", @"text showing one row has been affected by a single query"), - [NSString stringForTimeInterval:executionTime] - ]]; + statusString = [NSString stringWithFormat:NSLocalizedString(@"%@; 1 row affected, taking %@", @"text showing one row has been affected by a single query"), + statusErrorString, + [NSString stringForTimeInterval:executionTime] + ]; } else { - [[affectedRowsText onMainThread] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%ld rows affected, taking %@", @"text showing how many rows have been affected by a single query"), - (long)totalAffectedRows, - [NSString stringForTimeInterval:executionTime] - ]]; - + statusString = [NSString stringWithFormat:NSLocalizedString(@"%@; %ld rows affected, taking %@", @"text showing how many rows have been affected by a single query"), + statusErrorString, + (long)totalAffectedRows, + [NSString stringForTimeInterval:executionTime] + ]; } } + [[affectedRowsText onMainThread] setStringValue:statusString]; // Restore automatic query retries [mySQLConnection setAllowQueryRetries:YES]; @@ -802,7 +809,7 @@ // Perform the Growl notification for query completion [[SPGrowlController sharedGrowlController] notifyWithTitle:@"Query Finished" - description:[NSString stringWithFormat:NSLocalizedString(@"%@",@"description for query finished growl notification"), [errorText stringValue]] + description:[NSString stringWithFormat:NSLocalizedString(@"%@",@"description for query finished growl notification"), [errorText string]] document:tableDocumentInstance notificationName:@"Query Finished"]; @@ -833,7 +840,7 @@ // Query finished Growl notification [[SPGrowlController sharedGrowlController] notifyWithTitle:@"Query Finished" - description:[NSString stringWithFormat:NSLocalizedString(@"%@",@"description for query finished growl notification"), [errorText stringValue]] + description:[NSString stringWithFormat:NSLocalizedString(@"%@",@"description for query finished growl notification"), [errorText string]] document:tableDocumentInstance notificationName:@"Query Finished"]; @@ -1214,8 +1221,10 @@ // If errors occur, display them if ( [mySQLConnection queryCancelled] || ([errorsString length] && !queryIsTableSorter)) { + // set the error text - [errorText setStringValue:errorsString]; + [errorText setString:[errorsString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]]; + [[errorTextScrollView verticalScroller] setFloatValue:1.0]; // try to select the line x of the first error if error message with ID 1064 contains "at line x" // by capturing the last number of the error string @@ -1274,10 +1283,19 @@ } } else if ( [errorsString length] && queryIsTableSorter ) { - [errorText setStringValue:NSLocalizedString(@"Couldn't sort column.", @"text shown if an error occured while sorting the result table")]; + [errorText setString:NSLocalizedString(@"Couldn't sort column.", @"text shown if an error occured while sorting the result table")]; NSBeep(); } else { - [errorText setStringValue:NSLocalizedString(@"There were no errors.", @"text shown when query was successfull")]; + [errorText setString:NSLocalizedString(@"There were no errors.", @"text shown when query was successfull")]; + } + + // Show or hide the error area if necessary + if ([errorsString length] && [queryInfoPaneSplitView collapsibleSubviewCollapsed]) { + [queryInfoButton setState:NSOnState]; + [self toggleQueryInfoPaneCollapse:queryInfoButton]; + } else if (![errorsString length] && ![queryInfoPaneSplitView collapsibleSubviewCollapsed]) { + [queryInfoButton setState:NSOffState]; + [self toggleQueryInfoPaneCollapse:queryInfoButton]; } } @@ -1884,7 +1902,7 @@ NSString *tableForColumn = [columnDefinition objectForKey:@"org_table"]; if(!tableForColumn || ![tableForColumn length]) { - [errorText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Couldn't identify field origin unambiguously. The column '%@' contains data from more than one table.", @"Custom Query result editing error - could not identify a corresponding column"), [columnDefinition objectForKey:@"name"]]]; + [errorText setString:[NSString stringWithFormat:NSLocalizedString(@"Couldn't identify field origin unambiguously. The column '%@' contains data from more than one table.", @"Custom Query result editing error - could not identify a corresponding column"), [columnDefinition objectForKey:@"name"]]]; NSBeep(); return; } @@ -3757,7 +3775,9 @@ [prefs addObserver:self forKeyPath:SPGlobalResultTableFont options:NSKeyValueObservingOptionNew context:NULL]; // Collapse the query information pane - /*if ([queryInfoPaneSplitView collapsibleSubview]) { + if ([queryInfoPaneSplitView collapsibleSubview]) { + queryInfoPanePaddingHeight = [[queryInfoPaneSplitView collapsibleSubview] frame].size.height - [errorTextScrollView frame].size.height; + [queryInfoButton setNextState]; [queryInfoButton setToolTip:NSLocalizedString(@"Show Query Information", @"Show Query Information")]; @@ -3766,7 +3786,7 @@ [[queryInfoPaneSplitView collapsibleSubview] setFrameSize:NSMakeSize([queryInfoPaneSplitView collapsibleSubview].frame.size.width, 0)]; [queryInfoPaneSplitView setCollapsibleSubviewCollapsed:YES]; [[queryInfoPaneSplitView collapsibleSubview] setAutoresizesSubviews:YES]; - }*/ + } } /** diff --git a/Source/SPDataImport.m b/Source/SPDataImport.m index 0879228a..0a521cc2 100644 --- a/Source/SPDataImport.m +++ b/Source/SPDataImport.m @@ -592,6 +592,7 @@ // Otherwise, stop default: + [errors appendString:NSLocalizedString(@"Import cancelled!\n", @"import cancelled message")]; progressCancelled = YES; } } -- cgit v1.2.3