aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-09-02 13:57:22 +0000
committerBibiko <bibiko@eva.mpg.de>2009-09-02 13:57:22 +0000
commit511b8720c8964de9c6d8d3d2780e271d18bd9c7c (patch)
tree39f0f42492e31ed31e1db8480531a5ed2de87d95 /Source
parent2f6b8c6ae98afc27202135d6d676a9a3282df966 (diff)
downloadsequelpro-511b8720c8964de9c6d8d3d2780e271d18bd9c7c.tar.gz
sequelpro-511b8720c8964de9c6d8d3d2780e271d18bd9c7c.tar.bz2
sequelpro-511b8720c8964de9c6d8d3d2780e271d18bd9c7c.zip
• simplified and unified the issue to set the title of a tableWindow
- everything will be configured in [TableDocument displayName] - to update the title call [TableDocument setTitle:[TableDocument displayName]] - this removes dozens of lines • first steps to support more the document-based approach ( a document is nothing else than a connection with view properties and preferences ) - renamed/added/changed in Main Menu items into "New", "Open", "Save", and "Save As" - if user opened a spf file -> fileURL will be set - "Save" will save the current connection/view data according to the "Save As" setting - ie if one saved a doc with do not "Remember window state" - "Save" won't save the window state; to enable this hit "Save As" [this works for encrypted file data as well] - if the current doc was opened from file and the user closes it or quits the entire app all connection/document-based preferences (up to now query favs and history) will be updated silently [not yet implemented fully in CustomQuery] [works for encrypted file as well] • delete saveSPFAccessory view from DBView since it was outsourced • fixed some issues for the NSSecureTextField in the Save accessory panel (but still a warning appears)
Diffstat (limited to 'Source')
-rw-r--r--Source/CustomQuery.h28
-rw-r--r--Source/CustomQuery.m23
-rw-r--r--Source/TableDocument.h6
-rw-r--r--Source/TableDocument.m505
-rw-r--r--Source/TablesList.m23
5 files changed, 388 insertions, 197 deletions
diff --git a/Source/CustomQuery.h b/Source/CustomQuery.h
index 0e6d2bc6..e6c9ad43 100644
--- a/Source/CustomQuery.h
+++ b/Source/CustomQuery.h
@@ -36,10 +36,10 @@
@class SPQueryFavoriteManager;
@interface CustomQuery : NSObject
-{
+{
IBOutlet id tableDocumentInstance;
IBOutlet id tableWindow;
-
+
IBOutlet id queryFavoritesButton;
IBOutlet NSMenuItem *queryFavoritesSearchMenuItem;
IBOutlet NSMenuItem *queryFavoritesSaveAsMenuItem;
@@ -49,7 +49,7 @@
IBOutlet NSMenuItem *queryHistorySearchMenuItem;
IBOutlet id queryHistorySearchFieldView;
IBOutlet NSSearchField *queryHistorySearchField;
-
+
IBOutlet CMTextView *textView;
IBOutlet CMCopyTable *customQueryView;
IBOutlet id errorText;
@@ -76,43 +76,47 @@
IBOutlet NSWindow *queryFavoritesSheet;
IBOutlet NSButton *saveQueryFavoriteButton;
IBOutlet NSTextField *queryFavoriteNameTextField;
-
+
IBOutlet NSWindow *helpWebViewWindow;
IBOutlet WebView *helpWebView;
IBOutlet NSSearchField *helpSearchField;
IBOutlet NSSearchFieldCell *helpSearchFieldCell;
IBOutlet NSSegmentedControl *helpNavigator;
IBOutlet NSSegmentedControl *helpTargetSelector;
-
+
SPQueryFavoriteManager *favoritesManager;
NSUserDefaults *prefs;
MCPConnection *mySQLConnection;
-
+
NSString *usedQuery;
NSRange currentQueryRange;
NSArray *currentQueryRanges;
BOOL hasBackgroundAttribute;
NSString *mySQLversion;
-
+
int queryStartPosition;
-
+
int helpTarget;
WebHistory *helpHistory;
NSString *helpHTMLTemplate;
-
+
NSMutableArray *fullResult;
NSArray *cqColumnDefinition;
NSString *lastExecutedQuery;
-
+
BOOL tableReloadAfterEditing;
BOOL queryIsTableSorter;
BOOL isDesc;
NSNumber *sortField;
NSString *fieldIDQueryString;
-
+
unsigned int numberOfQueries;
+
+ NSMutableArray *localFavorites;
+ NSMutableArray *localHistoryItems;
+
}
// IBAction methods
@@ -143,6 +147,8 @@
// Accessors
- (NSArray *)currentResult;
- (void)processResultIntoDataStorage:(MCPStreamingResult *)theResult;
+- (NSArray *)localFavorites;
+- (NSArray *)localHistoryItems;
// MySQL Help
- (NSString *)getHTMLformattedMySQLHelpFor:(NSString *)aString;
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index 2088642f..441144aa 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -1057,6 +1057,22 @@
return currentResult;
}
+/*
+ * Return the document-based favourites
+ */
+- (NSArray *)localFavorites
+{
+ return localFavorites;
+}
+
+/*
+ * Return the document-based history items
+ */
+- (NSArray *)localHistoryItems
+{
+ return localHistoryItems;
+}
+
#pragma mark -
#pragma mark Additional methods
@@ -2559,6 +2575,10 @@
// init tableView's data source
fullResult = [[NSMutableArray alloc] init];
+ // init local favorite and history item array
+ localHistoryItems = [[NSMutableArray alloc] init];
+ localFavorites = [[NSMutableArray alloc] init];
+
prefs = [NSUserDefaults standardUserDefaults];
}
@@ -2607,7 +2627,8 @@
[usedQuery release];
[fullResult release];
[favoritesManager release];
-
+ if (localFavorites) [localFavorites release];
+ if (localHistoryItems) [localHistoryItems release];
if (sortField) [sortField release];
[super dealloc];
diff --git a/Source/TableDocument.h b/Source/TableDocument.h
index 0ad2638f..fc99bf23 100644
--- a/Source/TableDocument.h
+++ b/Source/TableDocument.h
@@ -143,6 +143,8 @@ enum sp_current_query_mode
NSString *queryEditorInitString;
NSDictionary *spfSession;
+ NSMutableDictionary *spfDocData;
+
}
- (NSString *)getHTMLforPrint;
@@ -200,8 +202,8 @@ enum sp_current_query_mode
- (NSWindow *)getCreateTableSyntaxWindow;
- (void)refreshCurrentDatabase;
- (void)saveConnectionPanelDidEnd:(NSSavePanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo;
-- (IBAction)saveConnectionAccessoryPasswordButton:(id)sender;
-- (void)saveSPFtoFile:(NSString *)fileName;
+- (IBAction)validateSaveConnectionAccessory:(id)sender;
+- (void)saveSPFtoFile:(NSString *)fileName saveInBackground:(BOOL)saveInBackground saveOnlyPreferences:(BOOL)saveOnlyPreferences;
- (IBAction)closePasswordSheet:(id)sender;
// Getter methods
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index c58c21bf..946031a7 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -85,11 +85,9 @@
prefs = [NSUserDefaults standardUserDefaults];
queryEditorInitString = nil;
- [saveConnectionEncryptString setStringValue:@""];
- saveConnectionAccessory = nil;
- saveConnectionAutoConnect = nil;
spfSession = nil;
+ spfDocData = [[NSMutableDictionary alloc] init];
}
@@ -111,7 +109,7 @@
topLeftPoint.y += previousFrame.size.height;
[tableWindow setFrameTopLeftPoint:[tableWindow cascadeTopLeftFromPoint:topLeftPoint]];
- // iTry to check if new frame fits into the screen
+ // Try to check if new frame fits into the screen
NSRect screenFrame = [[NSScreen mainScreen] frame];
NSScreen* candidate;
for(candidate in [NSScreen screens])
@@ -181,10 +179,6 @@
if (![NSBundle loadNibNamed:@"ConnectionErrorDialog" owner:self]) {
NSLog(@"Connection error dialog could not be loaded; connection failure handling will not function correctly.");
}
- if(![NSBundle loadNibNamed:@"SaveSPFAccessory" owner:self]) {
- NSLog(@"SaveSPFAccessory accessory dialog could not be loaded.");
- return;
- }
}
- (void)initWithConnectionFile:(NSString *)path
@@ -202,7 +196,7 @@
int connectionType;
// Inform about the data source in the window title bar
- [tableWindow setTitle:[NSString stringWithFormat:NSLocalizedString(@"‘%@’ – Connecting…",@"‘%@’ – Connecting…"), [path lastPathComponent]]];
+ [tableWindow setTitle:[self displayName]];
// Clean fields
[connectionController setName:@""];
@@ -336,7 +330,6 @@
return;
}
- encryptpw = nil;
if(![data objectForKey:@"connection"]) {
NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while reading connection data file", @"error while reading connection data file")]
@@ -351,6 +344,13 @@
return;
}
+ [spfDocData setObject:[NSNumber numberWithBool:NO] forKey:@"encrypted"];
+ if(encryptpw != nil) {
+ [spfDocData setObject:[NSNumber numberWithBool:YES] forKey:@"encrypted"];
+ [spfDocData setObject:encryptpw forKey:@"e_string"];
+ }
+ encryptpw = nil;
+
connection = [NSDictionary dictionaryWithDictionary:[data objectForKey:@"connection"]];
if([connection objectForKey:@"type"]) {
@@ -394,17 +394,26 @@
if([connection objectForKey:@"database"])
[connectionController setDatabase:[connection objectForKey:@"database"]];
- if([data objectForKey:@"session"])
+ if([data objectForKey:@"session"]) {
spfSession = [[NSDictionary dictionaryWithDictionary:[data objectForKey:@"session"]] retain];
+ [spfDocData setObject:[NSNumber numberWithBool:YES] forKey:@"include_session"];
+ }
+ [spfDocData setObject:[NSNumber numberWithBool:YES] forKey:@"save_password"];
if(![connection objectForKey:@"password"]) {
// TODO How to set the focus to standardPasswordField in the connection nib?
// [[connectionController valueForKeyPath:@"standardPasswordField"] selectText:connectionController];
+ [spfDocData setObject:[NSNumber numberWithBool:NO] forKey:@"save_password"];
return;
}
+
+ [self setFileURL:[NSURL URLWithString:path]];
- if([connection objectForKey:@"auto_connect"] && [[connection valueForKey:@"auto_connect"] boolValue])
+ [spfDocData setObject:[NSNumber numberWithBool:NO] forKey:@"auto_connect"];
+ if([spf objectForKey:@"auto_connect"] && [[spf valueForKey:@"auto_connect"] boolValue]) {
+ [spfDocData setObject:[NSNumber numberWithBool:YES] forKey:@"auto_connect"];
[connectionController initiateConnection:self];
+ }
}
@@ -459,9 +468,12 @@
[[tablesListInstance valueForKeyPath:@"tablesListView"] scrollRowToVisible:[tables indexOfObject:[spfSession objectForKey:@"selectedTable"]]];
+ [tableWindow setTitle:[self displayName]];
+
// dealloc spfSession data
[spfSession release];
spfSession = nil;
+
}
/*
@@ -541,7 +553,7 @@
// Set the cutom query editor's MySQL version
[customQueryInstance setMySQLversion:mySQLVersion];
- [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@", mySQLVersion, [self name], ([self database]?[self database]:@"")]];
+ [tableWindow setTitle:[self displayName]];
[self viewStructure:self];
// Connected Growl notification
@@ -551,7 +563,9 @@
// Init Custom Query editor with the stored queries in a spf file if given.
+ [spfDocData setObject:[NSNumber numberWithBool:NO] forKey:@"save_editor_content"];
if(spfSession != nil && [spfSession objectForKey:@"queries"]) {
+ [spfDocData setObject:[NSNumber numberWithBool:YES] forKey:@"save_editor_content"];
if([[spfSession objectForKey:@"queries"] isKindOfClass:[NSData class]]) {
NSString *q = [[NSString alloc] initWithData:[[spfSession objectForKey:@"queries"] decompress] encoding:NSUTF8StringEncoding];
[self initQueryEditorWithString:q];
@@ -806,7 +820,8 @@
selectedDatabase = [[NSString alloc] initWithString:[chooseDatabaseButton titleOfSelectedItem]];
[tablesListInstance setConnection:mySQLConnection];
[tableDumpInstance setConnection:mySQLConnection];
- [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@", mySQLVersion, [self name], [self database]]];
+
+ [tableWindow setTitle:[self displayName]];
// Add a history entry
if (!historyStateChanging) {
@@ -888,7 +903,8 @@
[self setDatabases:self];
[tablesListInstance setConnection:mySQLConnection];
[tableDumpInstance setConnection:mySQLConnection];
- [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@", mySQLVersion, [self name], selectedDatabase]];
+
+ [tableWindow setTitle:[self displayName]];
}
/**
@@ -963,7 +979,8 @@
[self setDatabases:self];
[tablesListInstance setConnection:mySQLConnection];
[tableDumpInstance setConnection:mySQLConnection];
- [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/", mySQLVersion, [self name]]];
+
+ [tableWindow setTitle:[self displayName]];
}
}
@@ -1003,12 +1020,12 @@
if (selectedDatabase) [selectedDatabase release], selectedDatabase = nil;
selectedDatabase = [[NSString alloc] initWithString:dbName];
[chooseDatabaseButton selectItemWithTitle:selectedDatabase];
- [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@", mySQLVersion, [self name], selectedDatabase]];
+ [tableWindow setTitle:[self displayName]];
}
} else {
if (selectedDatabase) [selectedDatabase release], selectedDatabase = nil;
[chooseDatabaseButton selectItemAtIndex:0];
- [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/", mySQLVersion, [self name]]];
+ [tableWindow setTitle:[self displayName]];
}
}
@@ -1895,6 +1912,10 @@
*/
- (void)applicationWillTerminate:(NSNotification *)notification
{
+ // Auto-save spf file based connection
+ if([self fileURL] && [[[self fileURL] absoluteString] length])
+ [self saveSPFtoFile:[[self fileURL] absoluteString] saveInBackground:YES saveOnlyPreferences:YES];
+
[tablesListInstance selectionShouldChangeInTableView:nil];
}
@@ -1915,7 +1936,8 @@
[panel setAllowsOtherFileTypes:NO];
[panel setCanSelectHiddenExtension:YES];
- if( [sender tag] == 0 ) {
+ // Save Query…
+ if( [sender tag] == 1006 ) {
// Save the editor's content as SQL file
[panel setAccessoryView:[SPEncodingPopupAccessory encodingAccessory:[prefs integerForKey:@"lastSqlFileEncoding"]
@@ -1938,21 +1960,53 @@
[encodingPopUp setEnabled:YES];
- } else if([sender tag] == 1){
+ // Save As… or Save
+ } else if([sender tag] == 1005 || [sender tag] == 1004) {
+
+ // If Save was invoked check for fileURL and save the spf file without save panel
+ // otherwise ask for file name
+ if([sender tag] == 1004 && [[[self fileURL] absoluteString] length]) {
+ [self saveSPFtoFile:[[self fileURL] absoluteString] saveInBackground:YES saveOnlyPreferences:NO];
+ return;
+ }
+
+ // Load accessory nib each time
+ if(![NSBundle loadNibNamed:@"SaveSPFAccessory" owner:self]) {
+ NSLog(@"SaveSPFAccessory accessory dialog could not be loaded.");
+ return;
+ }
// Save current session (open connection windows as SPF file)
[panel setAllowedFileTypes:[NSArray arrayWithObjects:@"spf", nil]];
- [saveConnectionEncryptString setStringValue:@""];
+ //Restore accessory view settings if possible
+ if([spfDocData objectForKey:@"save_password"])
+ [saveConnectionSavePassword setState:[[spfDocData objectForKey:@"save_password"] boolValue]];
+ if([spfDocData objectForKey:@"auto_connect"])
+ [saveConnectionAutoConnect setState:[[spfDocData objectForKey:@"auto_connect"] boolValue]];
+ if([spfDocData objectForKey:@"encrypted"])
+ [saveConnectionEncrypt setState:[[spfDocData objectForKey:@"encrypted"] boolValue]];
+ if([spfDocData objectForKey:@"include_session"])
+ [saveConnectionIncludeData setState:[[spfDocData objectForKey:@"include_session"] boolValue]];
+ if([spfDocData objectForKey:@"include_session"])
+ [saveConnectionIncludeQuery setState:[[spfDocData objectForKey:@"save_editor_content"] boolValue]];
+
[saveConnectionIncludeQuery setEnabled:([[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] length])];
// Update accessory button states
- [self saveConnectionAccessoryPasswordButton:nil];
-
+ [self validateSaveConnectionAccessory:nil];
+
// TODO note: it seems that one has problems with a NSSecureTextField
// inside an accessory view - ask HansJB
+ [[saveConnectionEncryptString cell] setControlView:saveConnectionAccessory];
[panel setAccessoryView:saveConnectionAccessory];
- filename = [NSString stringWithFormat:@"%@", [self name]];
+
+ // Set file name
+ if([[[self fileURL] absoluteString] length])
+ filename = [[[self fileURL] absoluteString] lastPathComponent];
+ else
+ filename = [NSString stringWithFormat:@"%@", [self name]];
+
contextInfo = @"saveSPFfile";
} else {
@@ -1969,11 +2023,13 @@
/**
* Control the save connection panel's accessory view
*/
-- (IBAction)saveConnectionAccessoryPasswordButton:(id)sender
+- (IBAction)validateSaveConnectionAccessory:(id)sender
{
[saveConnectionAutoConnect setEnabled:([saveConnectionSavePassword state] == NSOnState)];
[saveConnectionSavePasswordAlert setHidden:([saveConnectionSavePassword state] == NSOffState)];
+
+ // If user checks the Encrypt check box set focus to password field
if(sender == saveConnectionEncrypt && [saveConnectionEncrypt state] == NSOnState)
[saveConnectionEncryptString selectText:sender];
@@ -1981,18 +2037,8 @@
if(sender == saveConnectionEncrypt && [saveConnectionEncrypt state] == NSOffState) {
// [saveConnectionEncryptString setStringValue:[saveConnectionEncryptString stringValue]];
// TODO how can one make it better ?
- [saveConnectionEncryptString setHidden:YES];
- [saveConnectionEncryptString setHidden:NO];
- }
-
- // Enforce to clear the password string after invoking NSSavePanel
- // TODO Why I cannot set it in saveConnectionSheet ?
- if(sender == NULL) {
- [saveConnectionEncryptString selectText:sender];
- [saveConnectionEncryptString setHidden:YES];
- [saveConnectionEncryptString setHidden:NO];
+ [[saveConnectionEncryptString window] makeFirstResponder:[[saveConnectionEncryptString window] initialFirstResponder]];
}
-
}
@@ -2026,154 +2072,83 @@
// Save connection and session as SPF file
else if(contextInfo == @"saveSPFfile") {
- // Abort editing of saveConnectionEncryptString
- // TODO How can one make it better?
- [saveConnectionEncryptString abortEditing];
- [saveConnectionEncryptString setStringValue:[saveConnectionEncryptString stringValue]];
+ // Save changes of saveConnectionEncryptString
+ [[saveConnectionEncryptString window] makeFirstResponder:[[saveConnectionEncryptString window] initialFirstResponder]];
- [self saveSPFtoFile:fileName];
+ [self saveSPFtoFile:fileName saveInBackground:NO saveOnlyPreferences:NO];
}
}
}
-- (void)saveSPFtoFile:(NSString *)fileName
+- (void)saveSPFtoFile:(NSString *)fileName saveInBackground:(BOOL)saveInBackground saveOnlyPreferences:(BOOL)saveOnlyPreferences
{
- NSString *aString;
-
- NSMutableDictionary *spfdata = [NSMutableDictionary dictionary];
- NSMutableDictionary *connection = [NSMutableDictionary dictionary];
- NSMutableDictionary *session = nil;
- NSMutableDictionary *data = [NSMutableDictionary dictionary];
-
- NSIndexSet *contentSelectedIndexSet = [tableContentInstance selectedRowIndexes];
-
- [spfdata setObject:[NSNumber numberWithInt:1] forKey:@"version"];
- [spfdata setObject:@"connection" forKey:@"format"];
- if([saveConnectionEncrypt isEnabled])
- [spfdata setObject:[NSNumber numberWithBool:([saveConnectionEncrypt state]==NSOnState) ? YES : NO ] forKey:@"encrypted"];
-
- if([saveConnectionSavePassword state] == NSOnState)
- [connection setObject:[NSNumber numberWithBool:([saveConnectionAutoConnect state]==NSOnState) ? YES : NO ] forKey:@"auto_connect"];
-
- [connection setObject:[self name] forKey:@"name"];
- [connection setObject:[self host] forKey:@"host"];
- [connection setObject:[self user] forKey:@"user"];
+ // Do not save if no connection is/was available
+ if(saveInBackground && ([self mySQLVersion] == nil || ![[self mySQLVersion] length]))
+ return;
- switch([connectionController type]) {
- case SP_CONNECTION_TCPIP:
- aString = @"SP_CONNECTION_TCPIP";
- break;
- case SP_CONNECTION_SOCKET:
- aString = @"SP_CONNECTION_SOCKET";
- [connection setObject:[connectionController socket] forKey:@"socket"];
- break;
- case SP_CONNECTION_SSHTUNNEL:
- aString = @"SP_CONNECTION_SSHTUNNEL";
- [connection setObject:[connectionController sshHost] forKey:@"ssh_host"];
- [connection setObject:[connectionController sshUser] forKey:@"ssh_user"];
- if([connectionController port] && [[connectionController port] length])
- [connection setObject:[NSNumber numberWithInt:[[connectionController sshPort] intValue]] forKey:@"ssh_port"];
- break;
- default:
- aString = @"SP_CONNECTION_TCPIP";
- }
- [connection setObject:aString forKey:@"type"];
+ NSMutableDictionary *spfDocData_temp = [NSMutableDictionary dictionary];
+
+ // Store save panel settings or take them from spfDocData
+ if(!saveInBackground) {
+ [spfDocData_temp setObject:[NSNumber numberWithBool:([saveConnectionEncrypt state]==NSOnState) ? YES : NO ] forKey:@"encrypted"];
+ if([[spfDocData_temp objectForKey:@"encrypted"] boolValue])
+ [spfDocData_temp setObject:[saveConnectionEncryptString stringValue] forKey:@"e_string"];
+ [spfDocData_temp setObject:[NSNumber numberWithBool:([saveConnectionAutoConnect state]==NSOnState) ? YES : NO ] forKey:@"auto_connect"];
+ [spfDocData_temp setObject:[NSNumber numberWithBool:([saveConnectionSavePassword state]==NSOnState) ? YES : NO ] forKey:@"save_password"];
+ [spfDocData_temp setObject:[NSNumber numberWithBool:([saveConnectionIncludeData state]==NSOnState) ? YES : NO ] forKey:@"include_session"];
+ [spfDocData_temp setObject:[NSNumber numberWithBool:NO] forKey:@"save_editor_content"];
+ if([[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] length])
+ [spfDocData_temp setObject:[NSNumber numberWithBool:([saveConnectionIncludeQuery state]==NSOnState) ? YES : NO ] forKey:@"save_editor_content"];
+ } else {
+ [spfDocData_temp addEntriesFromDictionary:spfDocData];
+ }
- if([saveConnectionSavePassword state] == NSOnState) {
- NSString *pw = [self keychainPasswordForConnection:nil];
- if(![pw length]) pw = [connectionController password];
- [connection setObject:pw forKey:@"password"];
- if([connectionController type] == SP_CONNECTION_SSHTUNNEL)
- [connection setObject:[connectionController sshPassword] forKey:@"ssh_password"];
- }
-
- if([connectionController port] && [[connectionController port] length])
- [connection setObject:[NSNumber numberWithInt:[[connectionController port] intValue]] forKey:@"port"];
+ // Update only query favourites, history, etc. by reading the file again
+ if(saveOnlyPreferences) {
+
+ // Check for save file URL
+ // TODO maybe alert ?
+ if(![[[self fileURL] absoluteString] length]) return;
+
+ NSError *readError = nil;
+ NSString *convError = nil;
+ NSPropertyListFormat format;
+ NSMutableDictionary *spf = [[NSMutableDictionary alloc] init];
+
+ NSData *pData = [NSData dataWithContentsOfFile:[[self fileURL] absoluteString] options:NSUncachedRead error:&readError];
- if([[self database] length])
- [connection setObject:[self database] forKey:@"database"];
+ [spf addEntriesFromDictionary:[NSPropertyListSerialization propertyListFromData:pData
+ mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError]];
- // Include session data like selected table, view etc. ?
- if([saveConnectionIncludeData state] == NSOnState) {
-
- session = [NSMutableDictionary dictionary];
-
- if([[self table] length])
- [session setObject:[self table] forKey:@"table"];
- if([tableContentInstance sortColumnName])
- [session setObject:[tableContentInstance sortColumnName] forKey:@"contentSortCol"];
-
- switch([spHistoryControllerInstance currentlySelectedView]){
- case SP_VIEW_STRUCTURE:
- aString = @"SP_VIEW_STRUCTURE";
- break;
- case SP_VIEW_CONTENT:
- aString = @"SP_VIEW_CONTENT";
- break;
- case SP_VIEW_CUSTOMQUERY:
- aString = @"SP_VIEW_CUSTOMQUERY";
- break;
- case SP_VIEW_STATUS:
- aString = @"SP_VIEW_STATUS";
- break;
- case SP_VIEW_RELATIONS:
- aString = @"SP_VIEW_RELATIONS";
- break;
- default:
- aString = @"SP_VIEW_STRUCTURE";
- }
- [session setObject:aString forKey:@"view"];
-
- [session setObject:[NSNumber numberWithBool:[tableContentInstance sortColumnIsAscending]] forKey:@"contentSortColIsAsc"];
- [session setObject:[NSNumber numberWithInt:[tableContentInstance limitStart]] forKey:@"contentLimitStartPosition"];
- [session setObject:NSStringFromRect([tableContentInstance viewport]) forKey:@"contentViewport"];
- if([tableContentInstance filterSettings])
- [session setObject:[tableContentInstance filterSettings] forKey:@"contentFilter"];
-
- if (contentSelectedIndexSet && [contentSelectedIndexSet count]) {
- NSMutableArray *indices = [NSMutableArray array];
- unsigned indexBuffer[[contentSelectedIndexSet count]];
- unsigned limit = [contentSelectedIndexSet getIndexes:indexBuffer maxCount:[contentSelectedIndexSet count] inIndexRange:NULL];
- unsigned idx;
- for (idx = 0; idx < limit; idx++) {
- [indices addObject:[NSNumber numberWithInt:indexBuffer[idx]]];
- }
- [session setObject:indices forKey:@"contentSelectedIndexSet"];
- }
- }
+ if(!spf || ![spf count] || readError != nil || [convError length] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0)) {
+ NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while reading connection data file", @"error while reading connection data file")]
+ defaultButton:NSLocalizedString(@"OK", @"OK button")
+ alternateButton:nil
+ otherButton:nil
+ informativeTextWithFormat:NSLocalizedString(@"Connection data file couldn't be read.", @"error while reading connection data file")];
- if([[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] length]
- && [saveConnectionIncludeQuery state] == NSOnState) {
-
- if(session == nil)
- session = [NSMutableDictionary dictionary];
-
- if([[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] length] > 50000)
- [session setObject:[[[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] dataUsingEncoding:NSUTF8StringEncoding] compress] forKey:@"queries"];
- else
- [session setObject:[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] forKey:@"queries"];
+ [alert setAlertStyle:NSCriticalAlertStyle];
+ [alert runModal];
+ [self close];
+ return;
}
- [data setObject:connection forKey:@"connection"];
- if(session != nil)
- [data setObject:session forKey:@"session"];
-
- if([saveConnectionEncrypt state] == NSOffState) {
- [spfdata setObject:data forKey:@"data"];
- } else {
- NSMutableData *encryptdata = [[[NSMutableData alloc] init] autorelease];
- NSKeyedArchiver *archiver = [[[NSKeyedArchiver alloc] initForWritingWithMutableData:encryptdata] autorelease];
- [archiver encodeObject:data forKey:@"data"];
- [archiver finishEncoding];
- [spfdata setObject:[encryptdata dataEncryptedWithPassword:[saveConnectionEncryptString stringValue]] forKey:@"data"];
+ // For dispatching later
+ if(![[spf objectForKey:@"format"] isEqualToString:@"connection"]) {
+ NSLog(@"SPF file format is not 'connection'.");
+ [self close];
+ return;
}
- // NSLog(@"%@", spfdata);
+ // Update the keys
+ [spf setObject:[customQueryInstance localFavorites] forKey:@"queryFavorites"];
+ [spf setObject:[customQueryInstance localHistoryItems] forKey:@"queryHistory"];
+ // Save it again
NSString *err = nil;
- NSData *plist = [NSPropertyListSerialization dataFromPropertyList:spfdata
+ NSData *plist = [NSPropertyListSerialization dataFromPropertyList:spf
format:NSPropertyListXMLFormat_v1_0
errorDescription:&err];
@@ -2190,12 +2165,185 @@
}
NSError *error = nil;
- [plist writeToFile:fileName options:NSAtomicWrite error:&error];
+ [plist writeToFile:[[self fileURL] absoluteString] options:NSAtomicWrite error:&error];
if(error != nil){
NSAlert *errorAlert = [NSAlert alertWithError:error];
[errorAlert runModal];
}
+ return;
+
+ }
+
+ NSString *aString;
+
+ NSMutableDictionary *spfdata = [NSMutableDictionary dictionary];
+ NSMutableDictionary *connection = [NSMutableDictionary dictionary];
+ NSMutableDictionary *session = nil;
+ NSMutableDictionary *data = [NSMutableDictionary dictionary];
+
+ NSIndexSet *contentSelectedIndexSet = [tableContentInstance selectedRowIndexes];
+
+ [spfdata setObject:[NSNumber numberWithInt:1] forKey:@"version"];
+ [spfdata setObject:@"connection" forKey:@"format"];
+ [spfdata setObject:@"mysql" forKey:@"rdbms_type"];
+ [spfdata setObject:[self mySQLVersion] forKey:@"rdbms_version"];
+
+ // Store the preferences
+ [spfdata setObject:[customQueryInstance localFavorites] forKey:@"queryFavorites"];
+ [spfdata setObject:[customQueryInstance localHistoryItems] forKey:@"queryHistory"];
+
+ [spfdata setObject:[spfDocData_temp objectForKey:@"encrypted"] forKey:@"encrypted"];
+
+ if([[spfDocData_temp objectForKey:@"save_password"] boolValue])
+ [spfdata setObject:[spfDocData_temp objectForKey:@"auto_connect"] forKey:@"auto_connect"];
+
+ [connection setObject:[self name] forKey:@"name"];
+ [connection setObject:[self host] forKey:@"host"];
+ [connection setObject:[self user] forKey:@"user"];
+
+ switch([connectionController type]) {
+ case SP_CONNECTION_TCPIP:
+ aString = @"SP_CONNECTION_TCPIP";
+ break;
+ case SP_CONNECTION_SOCKET:
+ aString = @"SP_CONNECTION_SOCKET";
+ [connection setObject:[connectionController socket] forKey:@"socket"];
+ break;
+ case SP_CONNECTION_SSHTUNNEL:
+ aString = @"SP_CONNECTION_SSHTUNNEL";
+ [connection setObject:[connectionController sshHost] forKey:@"ssh_host"];
+ [connection setObject:[connectionController sshUser] forKey:@"ssh_user"];
+ if([connectionController port] && [[connectionController port] length])
+ [connection setObject:[NSNumber numberWithInt:[[connectionController sshPort] intValue]] forKey:@"ssh_port"];
+ break;
+ default:
+ aString = @"SP_CONNECTION_TCPIP";
+ }
+ [connection setObject:aString forKey:@"type"];
+
+
+ if([[spfDocData_temp objectForKey:@"save_password"] boolValue]) {
+ NSString *pw = [self keychainPasswordForConnection:nil];
+ if(![pw length]) pw = [connectionController password];
+ [connection setObject:pw forKey:@"password"];
+ if([connectionController type] == SP_CONNECTION_SSHTUNNEL)
+ [connection setObject:[connectionController sshPassword] forKey:@"ssh_password"];
+ }
+
+ if([connectionController port] && [[connectionController port] length])
+ [connection setObject:[NSNumber numberWithInt:[[connectionController port] intValue]] forKey:@"port"];
+
+ if([[self database] length])
+ [connection setObject:[self database] forKey:@"database"];
+
+ // Include session data like selected table, view etc. ?
+ if([[spfDocData_temp objectForKey:@"include_session"] boolValue]) {
+
+ session = [NSMutableDictionary dictionary];
+
+ if([[self table] length])
+ [session setObject:[self table] forKey:@"table"];
+ if([tableContentInstance sortColumnName])
+ [session setObject:[tableContentInstance sortColumnName] forKey:@"contentSortCol"];
+
+ switch([spHistoryControllerInstance currentlySelectedView]){
+ case SP_VIEW_STRUCTURE:
+ aString = @"SP_VIEW_STRUCTURE";
+ break;
+ case SP_VIEW_CONTENT:
+ aString = @"SP_VIEW_CONTENT";
+ break;
+ case SP_VIEW_CUSTOMQUERY:
+ aString = @"SP_VIEW_CUSTOMQUERY";
+ break;
+ case SP_VIEW_STATUS:
+ aString = @"SP_VIEW_STATUS";
+ break;
+ case SP_VIEW_RELATIONS:
+ aString = @"SP_VIEW_RELATIONS";
+ break;
+ default:
+ aString = @"SP_VIEW_STRUCTURE";
+ }
+ [session setObject:aString forKey:@"view"];
+
+ [session setObject:[NSNumber numberWithBool:[tableContentInstance sortColumnIsAscending]] forKey:@"contentSortColIsAsc"];
+ [session setObject:[NSNumber numberWithInt:[tableContentInstance limitStart]] forKey:@"contentLimitStartPosition"];
+ [session setObject:NSStringFromRect([tableContentInstance viewport]) forKey:@"contentViewport"];
+ if([tableContentInstance filterSettings])
+ [session setObject:[tableContentInstance filterSettings] forKey:@"contentFilter"];
+
+ if (contentSelectedIndexSet && [contentSelectedIndexSet count]) {
+ NSMutableArray *indices = [NSMutableArray array];
+ unsigned indexBuffer[[contentSelectedIndexSet count]];
+ unsigned limit = [contentSelectedIndexSet getIndexes:indexBuffer maxCount:[contentSelectedIndexSet count] inIndexRange:NULL];
+ unsigned idx;
+ for (idx = 0; idx < limit; idx++) {
+ [indices addObject:[NSNumber numberWithInt:indexBuffer[idx]]];
+ }
+ [session setObject:indices forKey:@"contentSelectedIndexSet"];
+ }
+ }
+
+ if([[spfDocData_temp objectForKey:@"save_editor_content"] boolValue]) {
+ if(session == nil)
+ session = [NSMutableDictionary dictionary];
+
+ if([[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] length] > 50000)
+ [session setObject:[[[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] dataUsingEncoding:NSUTF8StringEncoding] compress] forKey:@"queries"];
+ else
+ [session setObject:[[[customQueryInstance valueForKeyPath:@"textView"] textStorage] string] forKey:@"queries"];
+ }
+
+ [data setObject:connection forKey:@"connection"];
+ if(session != nil)
+ [data setObject:session forKey:@"session"];
+
+ if(![[spfDocData_temp objectForKey:@"encrypted"] boolValue]) {
+ [spfdata setObject:data forKey:@"data"];
+ } else {
+ NSMutableData *encryptdata = [[[NSMutableData alloc] init] autorelease];
+ NSKeyedArchiver *archiver = [[[NSKeyedArchiver alloc] initForWritingWithMutableData:encryptdata] autorelease];
+ [archiver encodeObject:data forKey:@"data"];
+ [archiver finishEncoding];
+ [spfdata setObject:[encryptdata dataEncryptedWithPassword:[spfDocData_temp objectForKey:@"e_string"]] forKey:@"data"];
+ }
+
+ // NSLog(@"%@", spfdata);
+
+ NSString *err = nil;
+ NSData *plist = [NSPropertyListSerialization dataFromPropertyList:spfdata
+ format:NSPropertyListXMLFormat_v1_0
+ errorDescription:&err];
+
+ if(err != nil) {
+ NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while converting connection data", @"error while converting connection data")]
+ defaultButton:NSLocalizedString(@"OK", @"OK button")
+ alternateButton:nil
+ otherButton:nil
+ informativeTextWithFormat:err];
+
+ [alert setAlertStyle:NSCriticalAlertStyle];
+ [alert runModal];
+ return;
+ }
+
+ NSError *error = nil;
+ [plist writeToFile:fileName options:NSAtomicWrite error:&error];
+ if(error != nil){
+ NSAlert *errorAlert = [NSAlert alertWithError:error];
+ [errorAlert runModal];
+ }
+
+ [self setFileURL:[NSURL URLWithString:fileName]];
+
+ [tableWindow setTitle:[self displayName]];
+
+ // Store doc data permanently
+ [spfDocData removeAllObjects];
+ [spfDocData addEntriesFromDictionary:spfDocData_temp];
+
}
/**
@@ -2794,8 +2942,11 @@
if ( ![tablesListInstance selectionShouldChangeInTableView:nil] ) {
return NO;
} else {
- return YES;
+ // Auto-save spf file based connection
+ if([self fileURL] && [[[self fileURL] absoluteString] length])
+ [self saveSPFtoFile:[[self fileURL] absoluteString] saveInBackground:YES saveOnlyPreferences:YES];
}
+ return YES;
}
/**
@@ -2812,9 +2963,16 @@
*/
- (NSString *)displayName
{
- if (!_isConnected) return @"Connecting...";
+ if (!_isConnected) return [NSString stringWithFormat:@"%@%@",
+ ([[[self fileURL] absoluteString] length]) ? [NSString stringWithFormat:@"%@ – ",[[[self fileURL] absoluteString] lastPathComponent]] : @"",
+ NSLocalizedString(@"Connecting…", @"window title string indicating that sp is connecting")];
- return [NSString stringWithFormat:@"(MySQL %@) %@/%@", mySQLVersion, [self name], ([self database]?[self database]:@"")];
+ return [NSString stringWithFormat:@"%@(MySQL %@) %@%@%@",
+ ([[[self fileURL] absoluteString] length]) ? [NSString stringWithFormat:@"%@ – ",[[[self fileURL] absoluteString] lastPathComponent]] : @"",
+ mySQLVersion,
+ [self name],
+ ([self database]?[NSString stringWithFormat:@"/%@",[self database]]:@""),
+ ([[self table] length]?[NSString stringWithFormat:@"/%@",[self table]]:@"")];
}
@@ -2916,9 +3074,14 @@
[addDatabaseButton setEnabled:([[databaseNameField stringValue] length] > 0)];
}
- if (object == variablesSearchField) {
+ else if (object == variablesSearchField) {
[self _updateServerVariablesFilterForFilterString:[object stringValue]];
}
+
+ else if (object == saveConnectionEncryptString) {
+ [saveConnectionEncryptString setStringValue:[saveConnectionEncryptString stringValue]];
+ }
+
}
#pragma mark -
@@ -2995,6 +3158,7 @@
- (void)dealloc
{
+
[_encoding release];
[printWebView release];
if (connectionController) [connectionController release];
@@ -3006,6 +3170,7 @@
if(queryEditorInitString) [queryEditorInitString release];
if(spfSession) [spfSession release];
if(userManagerInstance) [userManagerInstance release];
+ if(spfDocData) [spfDocData release];
[super dealloc];
}
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 6e34c295..ef308ae7 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -783,9 +783,9 @@
[removeTableContextMenuItem setTitle:NSLocalizedString(@"Remove Function", @"remove func menu title")];
}
+
// set window title
- [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@/%@", [tableDocumentInstance mySQLVersion],
- [tableDocumentInstance name], [tableDocumentInstance database], selectedTableName]];
+ [tableWindow setTitle:[tableDocumentInstance displayName]];
// Update the "Show Create Syntax" window if it's already opened
// according to the selected table/view/proc/func
@@ -874,8 +874,8 @@
[separatorTableContextMenuItem setHidden:YES];
// set window title
- [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@", [tableDocumentInstance mySQLVersion],
- [tableDocumentInstance name], [tableDocumentInstance database]]];
+ [tableWindow setTitle:[tableDocumentInstance displayName]];
+
}
[spHistoryControllerInstance updateHistoryEntries];
@@ -1207,8 +1207,8 @@
}
// Set window title
- [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@/%@", [tableDocumentInstance mySQLVersion],
- [tableDocumentInstance name], [tableDocumentInstance database], anObject]];
+ [tableWindow setTitle:[tableDocumentInstance displayName]];
+
}
else {
// Error while renaming
@@ -1665,8 +1665,7 @@
[tablesListView reloadData];
// set window title
- [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@", [tableDocumentInstance mySQLVersion],
- [tableDocumentInstance name], [tableDocumentInstance database]]];
+ [tableWindow setTitle:[tableDocumentInstance displayName]];
if ( error ) {
NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
@@ -1774,7 +1773,7 @@
else if (selectedIndex == 3) {
[extendedTableInfoInstance loadTable:tableName];
structureLoaded = NO;
- contentLoaded = NO;
+ contentLoaded = NO;
statusLoaded = YES;
}
else {
@@ -1784,8 +1783,7 @@
}
// Set window title
- [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@/%@", [tableDocumentInstance mySQLVersion],
- [tableDocumentInstance name], [tableDocumentInstance database], tableName]];
+ [tableWindow setTitle:[tableDocumentInstance displayName]];
}
else {
// Error while creating new table
@@ -2059,8 +2057,7 @@
}
// Set window title
- [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@/%@/%@", [tableDocumentInstance mySQLVersion],
- [tableDocumentInstance name], [tableDocumentInstance database], [tableRenameField stringValue]]];
+ [tableWindow setTitle:[tableDocumentInstance displayName]];
}
@end
> 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637