From e2810ccbe30371974a7df888dc5656ac9311677f Mon Sep 17 00:00:00 2001 From: drx777 Date: Thu, 29 Apr 2010 18:26:19 +0000 Subject: Now longer using [NSApp mainWindow] but a reference to the correct window for message sheets. It could have caused messages appearing in the wrong window. --- Source/SPDBActionCommons.h | 12 +++--------- Source/SPDBActionCommons.m | 3 +-- Source/SPDatabaseCopy.m | 4 ++-- Source/SPDatabaseInfo.m | 2 +- Source/SPDatabaseRename.m | 4 ++-- Source/SPTableCopy.m | 2 +- Source/TableDocument.m | 4 ++-- 7 files changed, 12 insertions(+), 19 deletions(-) diff --git a/Source/SPDBActionCommons.h b/Source/SPDBActionCommons.h index 042fd5dc..334b0c78 100644 --- a/Source/SPDBActionCommons.h +++ b/Source/SPDBActionCommons.h @@ -32,8 +32,7 @@ @interface SPDBActionCommons : NSObject { MCPConnection *connection; - NSObject *parent; - NSDocument *messageDocument; + NSWindow *messageWindow; } /** @@ -42,13 +41,8 @@ @property (retain) MCPConnection *connection; /** - * @property the parent object that issues the action, needs to provide stuff like tableWindow for messages + * @property the NSWindow instance to send message sheets to */ -@property (retain) NSObject *parent; - -/** - * @property the NSDocument instance to send message sheets to - */ -@property (retain) NSDocument *messageDocument; +@property (assign) NSWindow *messageWindow; @end diff --git a/Source/SPDBActionCommons.m b/Source/SPDBActionCommons.m index c0580622..977b3b5d 100644 --- a/Source/SPDBActionCommons.m +++ b/Source/SPDBActionCommons.m @@ -30,7 +30,6 @@ @implementation SPDBActionCommons @synthesize connection; -@synthesize parent; -@synthesize messageDocument; +@synthesize messageWindow; @end diff --git a/Source/SPDatabaseCopy.m b/Source/SPDatabaseCopy.m index e5daae0c..6fc52ae8 100644 --- a/Source/SPDatabaseCopy.m +++ b/Source/SPDatabaseCopy.m @@ -36,13 +36,13 @@ } else { dbInfo = [[SPDatabaseInfo alloc] init]; [dbInfo setConnection:[self connection]]; - [dbInfo setParent:[self parent]]; + [dbInfo setMessageWindow:messageWindow]; } return dbInfo; } - (NSObject *)getTableWindow { - return [NSApp mainWindow]; + return messageWindow; } - (BOOL)copyDatabaseFrom: (NSString *)sourceDatabaseName to: (NSString *)targetDatabaseName withContent:(BOOL)copyWithContent { diff --git a/Source/SPDatabaseInfo.m b/Source/SPDatabaseInfo.m index 9dbf2098..6c5b3f66 100644 --- a/Source/SPDatabaseInfo.m +++ b/Source/SPDatabaseInfo.m @@ -28,7 +28,7 @@ @implementation SPDatabaseInfo - (NSObject *)getTableWindow { - return [NSApp mainWindow]; + return messageWindow; } -(BOOL)databaseExists:(NSString *)databaseName { diff --git a/Source/SPDatabaseRename.m b/Source/SPDatabaseRename.m index 75478412..aa3a401a 100644 --- a/Source/SPDatabaseRename.m +++ b/Source/SPDatabaseRename.m @@ -37,13 +37,13 @@ } else { dbInfo = [[SPDatabaseInfo alloc] init]; [dbInfo setConnection:[self connection]]; - [dbInfo setParent:[self parent]]; + [dbInfo setMessageWindow:messageWindow]; } return dbInfo; } - (NSObject *)getTableWindow { - return [NSApp mainWindow]; + return messageWindow; } - (BOOL)renameDatabaseFrom: (NSString *)sourceDatabaseName to: (NSString *)targetDatabaseName { diff --git a/Source/SPTableCopy.m b/Source/SPTableCopy.m index 6a73bb20..19bff7c2 100644 --- a/Source/SPTableCopy.m +++ b/Source/SPTableCopy.m @@ -28,7 +28,7 @@ @implementation SPTableCopy - (NSObject *)getTableWindow { - return [NSApp mainWindow]; + return messageWindow; } - (NSString *)getCreateTableStatementFor: (NSString *)tableName inDB: (NSString *)sourceDB { diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 724afca6..7b5c3d2f 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -4146,7 +4146,7 @@ } SPDatabaseCopy *dbActionCopy = [[SPDatabaseCopy alloc] init]; [dbActionCopy setConnection: [self getConnection]]; - [dbActionCopy setParent: self]; + [dbActionCopy setMessageWindow: tableWindow]; BOOL copyWithContent = [copyOnlyStructureButton state] == NSOffState; @@ -4166,7 +4166,7 @@ } SPDatabaseRename *dbActionRename = [[SPDatabaseRename alloc] init]; [dbActionRename setConnection: [self getConnection]]; - [dbActionRename setParent: self]; + [dbActionRename setMessageWindow: tableWindow]; [dbActionRename renameDatabaseFrom: [self database] to: [databaseRenameNameField stringValue]]; -- cgit v1.2.3