Changeset 1267
- Timestamp:
- 05/19/04 23:34:28 (5 years ago)
- Files:
-
- WiredClient/trunk/WCAccount.h (modified) (2 diffs)
- WiredClient/trunk/WCClient.h (modified) (2 diffs)
- WiredClient/trunk/WCFile.h (modified) (3 diffs)
- WiredClient/trunk/WCFile.m (modified) (5 diffs)
- WiredClient/trunk/WCFileInfo.h (modified) (2 diffs)
- WiredClient/trunk/WCFileInfo.m (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
WiredClient/trunk/WCAccount.h
r1086 r1267 1 /* $Id: WCAccount.h,v 1. 2 2004/03/27 21:36:15morris Exp $ */1 /* $Id: WCAccount.h,v 1.3 2004/05/19 21:34:28 morris Exp $ */ 2 2 3 3 /* … … 57 57 - (BOOL) uploadAnywhere; 58 58 - (BOOL) createFolders; 59 - (BOOL) moveFiles;59 - (BOOL) changeFiles; 60 60 - (BOOL) deleteFiles; 61 61 - (BOOL) viewDropBoxes; WiredClient/trunk/WCClient.h
r1232 r1267 1 /* $Id: WCClient.h,v 1. 7 2004/05/18 16:46:01morris Exp $ */1 /* $Id: WCClient.h,v 1.8 2004/05/19 21:34:28 morris Exp $ */ 2 2 3 3 /* … … 55 55 #define WCClearNewsCommand @"CLEARNEWS" 56 56 #define WCClientCommand @"CLIENT" 57 #define WCCommentCommand @"COMMENT" 57 58 #define WCCreateUserCommand @"CREATEUSER" 58 59 #define WCCreateGroupCommand @"CREATEGROUP" WiredClient/trunk/WCFile.h
r1155 r1267 1 /* $Id: WCFile.h,v 1. 4 2004/05/13 17:58:09morris Exp $ */1 /* $Id: WCFile.h,v 1.5 2004/05/19 21:34:28 morris Exp $ */ 2 2 3 3 /* … … 37 37 NSDate *_modified; 38 38 NSString *_checksum; 39 NSString *_comment; 39 40 } 40 41 … … 72 73 - (NSString *) checksum; 73 74 75 - (void) setComment:(NSString *)value; 76 - (NSString *) comment; 77 74 78 - (NSString *) kind; 75 79 - (NSString *) humanReadableSize; WiredClient/trunk/WCFile.m
r1155 r1267 1 /* $Id: WCFile.m,v 1. 5 2004/05/13 17:58:09morris Exp $ */1 /* $Id: WCFile.m,v 1.6 2004/05/19 21:34:28 morris Exp $ */ 2 2 3 3 /* … … 50 50 [_kind release]; 51 51 [_checksum release]; 52 [_comment release]; 52 53 53 54 [super dealloc]; … … 71 72 _modified = [[coder decodeObject] retain]; 72 73 _checksum = [[coder decodeObject] retain]; 74 _comment = [[coder decodeObject] retain]; 73 75 74 76 return self; … … 88 90 [coder encodeObject:_modified]; 89 91 [coder encodeObject:_checksum]; 92 [coder encodeObject:_comment]; 90 93 } 91 94 … … 215 218 - (NSString *)checksum { 216 219 return _checksum; 220 } 221 222 223 224 #pragma mark - 225 226 - (void)setComment:(NSString *)value { 227 [value retain]; 228 [_comment release]; 229 230 _comment = value; 231 } 232 233 234 235 - (NSString *)comment { 236 return _comment; 217 237 } 218 238 WiredClient/trunk/WCFileInfo.h
r944 r1267 1 /* $Id: WCFileInfo.h,v 1. 1 2004/03/08 19:23:43morris Exp $ */1 /* $Id: WCFileInfo.h,v 1.2 2004/05/19 21:34:28 morris Exp $ */ 2 2 3 3 /* … … 47 47 IBOutlet NSTextField *_checksumTitleTextField; 48 48 IBOutlet NSTextField *_checksumTextField; 49 IBOutlet NSTextField *_commentTitleTextField; 50 IBOutlet NSTextField *_commentTextField; 49 51 50 52 WCFile *_file; WiredClient/trunk/WCFileInfo.m
r1251 r1267 1 /* $Id: WCFileInfo.m,v 1. 4 2004/05/18 23:52:29morris Exp $ */1 /* $Id: WCFileInfo.m,v 1.5 2004/05/19 21:34:28 morris Exp $ */ 2 2 3 3 /* … … 99 99 100 100 - (void)windowWillClose:(NSNotification *)notification { 101 NSString *oldFileName, *newFileName, *filePath; 102 103 oldFileName = [[_file path] lastPathComponent]; 104 newFileName = [_fileTextField stringValue]; 105 filePath = [[_file path] stringByDeletingLastPathComponent]; 101 NSString *path; 102 103 path = [[_file path] stringByDeletingLastPathComponent]; 106 104 107 105 // --- compare the existing file name with the one in the text field 108 if([[self window] isVisible] && [[_connection account] moveFiles] && 109 ![oldFileName isEqualToString:newFileName]) { 106 if([[self window] isVisible] && 107 [[_connection account] changeFiles] && 108 ![[[_file path] lastPathComponent] isEqualToString:[_fileTextField stringValue]]) { 110 109 // --- send the move command 111 110 [[_connection client] sendCommand:[NSString stringWithFormat: … … 114 113 [_file path], 115 114 WCFieldSeparator, 116 [ filePath stringByAppendingPathComponent:newFileName]]];115 [path stringByAppendingPathComponent:[_fileTextField stringValue]]]]; 117 116 118 117 // --- reload all files affected 119 118 [[NSNotificationCenter defaultCenter] 120 119 postNotificationName:WCFilesShouldReload 121 object:[NSArray arrayWithObjects:_connection, filePath, NULL]]; 122 } 123 120 object:[NSArray arrayWithObjects:_connection, path, NULL]]; 121 } 122 123 // --- compare the existing comment with the one in the text field 124 if([[self window] isVisible] && 125 [[_connection account] changeFiles] && 126 [_connection protocol] >= 1.1 && 127 ![[_file comment] isEqualToString:[_commentTextField stringValue]]) { 128 // --- send the comment command 129 [[_connection client] sendCommand:[NSString stringWithFormat: 130 @"%@ %@%@%@", 131 WCCommentCommand, 132 [_file path], 133 WCFieldSeparator, 134 [_commentTextField stringValue]]]; 135 } 136 124 137 [super windowWillClose:notification]; 125 138 … … 138 151 - (void)fileInfoShouldShowInfo:(NSNotification *)notification { 139 152 NSArray *fields; 140 NSString *argument, * size, *type, *created, *modified, *checksum, *path;153 NSString *argument, *path, *size, *type, *created, *modified, *checksum, *comment = NULL; 141 154 NSScanner *scanner; 142 155 NSImage *icon = NULL; … … 144 157 WCConnection *connection; 145 158 unsigned long long size_l; 146 int last = 0;159 int last = 68; 147 160 148 161 // --- get parameters … … 161 174 modified = [fields objectAtIndex:4]; 162 175 checksum = [fields objectAtIndex:5]; 176 177 /* protocol 1.1 */ 178 if([_connection protocol] >= 1.1) 179 comment = [fields objectAtIndex:6]; 163 180 164 181 if(![path isEqualToString:[_file path]]) … … 179 196 [_checksumTextField setStringValue:checksum]; 180 197 198 /* protocol 1.1 */ 199 if([_connection protocol] >= 1.1) { 200 [_file setComment:comment]; 201 [_commentTextField setStringValue:comment]; 202 } 203 181 204 switch([_file type]) { 182 205 case WCFileTypeDirectory: … … 226 249 } 227 250 251 // --- resize 252 // [_commentTextField setFrameWithControl:_commentTitleTextField atOffset:&last]; 253 228 254 // --- remove checksum 229 255 if([_file type] == WCFileTypeFile) { … … 255 281 256 282 // --- set editable 257 [_fileTextField setEditable:[[_connection account] moveFiles]]; 283 [_fileTextField setEditable:[[_connection account] changeFiles]]; 284 [_commentTextField setEditable: 285 [_connection protocol] >= 1.1 && [[_connection account] changeFiles]]; 258 286 259 287 // --- resize and show window
