aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Frameworks/PSMTabBar/PSMTabBarController.m3
-rw-r--r--Source/SPDatabaseDocument.h1
-rw-r--r--Source/SPDatabaseDocument.m31
-rw-r--r--Source/SPWindowController.m31
4 files changed, 38 insertions, 28 deletions
diff --git a/Frameworks/PSMTabBar/PSMTabBarController.m b/Frameworks/PSMTabBar/PSMTabBarController.m
index 8f8631b0..76f3a91b 100644
--- a/Frameworks/PSMTabBar/PSMTabBarController.m
+++ b/Frameworks/PSMTabBar/PSMTabBarController.m
@@ -613,7 +613,8 @@ static NSInteger potentialMinimumForArray(NSArray *array, NSInteger minimum)
keyEquivalent:@""];
[menuItem setTarget:_control];
[menuItem setRepresentedObject:[cell representedObject]];
-
+ if([[[cell representedObject] identifier] respondsToSelector:@selector(tabTitleForTooltip)])
+ [menuItem setToolTip:[[[cell representedObject] identifier] tabTitleForTooltip]];
if ([cell count] > 0) {
[menuItem setTitle:[[menuItem title] stringByAppendingFormat:@" (%lu)", (unsigned long)[cell count]]];
}
diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h
index 7ce9d573..36070bc4 100644
--- a/Source/SPDatabaseDocument.h
+++ b/Source/SPDatabaseDocument.h
@@ -291,6 +291,7 @@
- (NSString *)user;
- (NSString *)keyChainID;
- (NSString *)connectionID;
+- (NSString *)tabTitleForTooltip;
// Notification center methods
- (void)willPerformQuery:(NSNotification *)notification;
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 6b2b22f1..d76479b3 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -2584,6 +2584,37 @@
}
/**
+ * Returns the full window title which is mainly used for tab tooltips
+ */
+- (NSString *)tabTitleForTooltip
+{
+ NSMutableString *tabTitle;
+
+ // Determine name details
+ NSString *pathName = @"";
+ if ([[[self fileURL] path] length] && ![self isUntitled])
+ pathName = [NSString stringWithFormat:@"%@ — ", [[[self fileURL] path] lastPathComponent]];
+
+ if ([self getConnection] == nil)
+ return [NSString stringWithFormat:@"%@%@", pathName, @"Sequel Pro"];
+
+ tabTitle = [NSMutableString string];
+
+ // Add the MySQL version to the window title if enabled in prefs
+ if ([prefs boolForKey:SPDisplayServerVersionInWindowTitle]) [tabTitle appendFormat:@"(MySQL %@)\n", [self mySQLVersion]];
+
+ [tabTitle appendString:[self name]];
+ if ([self database]) {
+ if ([tabTitle length]) [tabTitle appendString:@"/"];
+ [tabTitle appendString:[self database]];
+ }
+ if ([[self table] length]) {
+ if ([tabTitle length]) [tabTitle appendString:@"/"];
+ [tabTitle appendString:[self table]];
+ }
+ return tabTitle;
+}
+/**
* Returns the currently selected database
*/
- (NSString *)database
diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m
index 1a90592c..da23113b 100644
--- a/Source/SPWindowController.m
+++ b/Source/SPWindowController.m
@@ -404,33 +404,10 @@
// if cell is not selected show full title plus MySQL version is enabled as tooltip
} else {
-
- SPDatabaseDocument *doc = [tabViewItem identifier];
- NSMutableString *tabTitle;
-
- // Determine name details
- NSString *pathName = @"";
- if ([[[doc fileURL] path] length] && ![doc isUntitled])
- pathName = [NSString stringWithFormat:@"%@ — ", [[[doc fileURL] path] lastPathComponent]];
-
- if ([doc getConnection] == nil)
- return [NSString stringWithFormat:@"%@%@", pathName, @"Sequel Pro"];
-
- tabTitle = [NSMutableString string];
-
- // Add the MySQL version to the window title if enabled in prefs
- if ([[NSUserDefaults standardUserDefaults] boolForKey:SPDisplayServerVersionInWindowTitle]) [tabTitle appendFormat:@"(MySQL %@)\n", [doc mySQLVersion]];
-
- [tabTitle appendString:[doc name]];
- if ([doc database]) {
- if ([tabTitle length]) [tabTitle appendString:@"/"];
- [tabTitle appendString:[doc database]];
- }
- if ([[doc table] length]) {
- if ([tabTitle length]) [tabTitle appendString:@"/"];
- [tabTitle appendString:[doc table]];
- }
- return tabTitle;
+ if([[tabViewItem identifier] respondsToSelector:@selector(tabTitleForTooltip)])
+ return [[tabViewItem identifier] tabTitleForTooltip];
+
+ return @"";
}