Changeset 3570
- Timestamp:
- 01/23/06 19:10:15 (3 years ago)
- Files:
-
- WiredClient/trunk/English.lproj/Files.nib/info.nib (modified) (1 diff)
- WiredClient/trunk/English.lproj/Files.nib/keyedobjects.nib (modified) (previous)
- WiredClient/trunk/English.lproj/Files.nib/objects.nib (modified) (previous)
- WiredClient/trunk/English.lproj/Preferences.nib/classes.nib (modified) (2 diffs)
- WiredClient/trunk/English.lproj/Preferences.nib/keyedobjects.nib (modified) (previous)
- WiredClient/trunk/English.lproj/Preferences.nib/objects.nib (modified) (previous)
- WiredClient/trunk/WCAccountEditor.h (modified) (1 diff)
- WiredClient/trunk/WCAccountEditor.m (modified) (3 diffs)
- WiredClient/trunk/WCAccounts.h (modified) (1 diff)
- WiredClient/trunk/WCAccounts.m (modified) (5 diffs)
- WiredClient/trunk/WCChat.m (modified) (4 diffs)
- WiredClient/trunk/WCConnection.h (modified) (1 diff)
- WiredClient/trunk/WCConnectionController.m (modified) (3 diffs)
- WiredClient/trunk/WCConsole.h (modified) (1 diff)
- WiredClient/trunk/WCConsole.m (modified) (7 diffs)
- WiredClient/trunk/WCFile.h (modified) (1 diff)
- WiredClient/trunk/WCFile.m (modified) (4 diffs)
- WiredClient/trunk/WCFileInfo.h (modified) (1 diff)
- WiredClient/trunk/WCFileInfo.m (modified) (5 diffs)
- WiredClient/trunk/WCFiles.h (modified) (1 diff)
- WiredClient/trunk/WCFiles.m (modified) (57 diffs)
- WiredClient/trunk/WCMessages.h (modified) (1 diff)
- WiredClient/trunk/WCMessages.m (modified) (3 diffs)
- WiredClient/trunk/WCNews.h (modified) (1 diff)
- WiredClient/trunk/WCNews.m (modified) (4 diffs)
- WiredClient/trunk/WCPreferences.h (modified) (2 diffs)
- WiredClient/trunk/WCPreferences.m (modified) (4 diffs)
- WiredClient/trunk/WCPreview.h (modified) (1 diff)
- WiredClient/trunk/WCPreview.m (modified) (13 diffs)
- WiredClient/trunk/WCPrivateChat.h (modified) (1 diff)
- WiredClient/trunk/WCPrivateChat.m (modified) (5 diffs)
- WiredClient/trunk/WCPublicChat.h (modified) (2 diffs)
- WiredClient/trunk/WCPublicChat.m (modified) (10 diffs)
- WiredClient/trunk/WCSearch.h (modified) (1 diff)
- WiredClient/trunk/WCSearch.m (modified) (8 diffs)
- WiredClient/trunk/WCServerConnection.m (modified) (2 diffs)
- WiredClient/trunk/WCServerInfo.h (modified) (1 diff)
- WiredClient/trunk/WCServerInfo.m (modified) (4 diffs)
- WiredClient/trunk/WCSettings.h (modified) (2 diffs)
- WiredClient/trunk/WCTransfer.h (modified) (1 diff)
- WiredClient/trunk/WCTransfer.m (modified) (3 diffs)
- WiredClient/trunk/WCTransfers.h (modified) (2 diffs)
- WiredClient/trunk/WCTransfers.m (modified) (23 diffs)
- WiredClient/trunk/WCUserInfo.h (modified) (1 diff)
- WiredClient/trunk/WCUserInfo.m (modified) (3 diffs)
- WiredClient/trunk/WiredClient.xcodeproj/project.pbxproj (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
WiredClient/trunk/English.lproj/Files.nib/info.nib
r3406 r3570 4 4 <dict> 5 5 <key>IBDocumentLocation</key> 6 <string>12 7 169 398 359 0 0 1280 1002</string>6 <string>124 163 398 359 0 0 1920 1178 </string> 7 7 <key>IBEditorPositions</key> 8 8 <dict> 9 9 <key>161</key> 10 <string> 2304 22 104 99 1280 0 1280 1024</string>10 <string>801 189 104 99 0 0 1920 1178 </string> 11 11 <key>190</key> 12 <string> 727 494 179 49 0 0 1680 1028 </string>12 <string>844 570 190 49 0 0 1920 1178 </string> 13 13 </dict> 14 14 <key>IBFramework Version</key> 15 15 <string>443.0</string> 16 <key>IBOldestOS</key> 17 <integer>3</integer> 16 18 <key>IBOpenObjects</key> 17 19 <array> 18 20 <integer>161</integer> 21 <integer>52</integer> 19 22 <integer>5</integer> 20 <integer>52</integer>21 23 </array> 22 24 <key>IBSystem Version</key> 23 <string>8 F46</string>25 <string>8G32</string> 24 26 </dict> 25 27 </plist> WiredClient/trunk/English.lproj/Preferences.nib/classes.nib
r3565 r3570 100 100 "_showDockAtStartupButton" = NSButton; 101 101 "_showTrackersAtStartupButton" = NSButton; 102 "_showTransfersProgressBarButton" = NSButton;103 102 "_soundsPopUpButton" = NSPopUpButton; 104 103 "_statusTextField" = NSTextField; … … 109 108 "_timestampEveryLineButton" = NSButton; 110 109 "_timestampEveryLineColorWell" = NSColorWell; 110 "_transfersAlternateRowsButton" = NSButton; 111 "_transfersShowProgressBarButton" = NSButton; 111 112 }; 112 113 SUPERCLASS = WIWindowController; WiredClient/trunk/WCAccountEditor.h
r3548 r3570 75 75 76 76 77 - (id)initAccountEditorWithConnection:(WCServerConnection *)connection;78 - (id)initAccountEditorWithConnection:(WCServerConnection *)connection account:(WCAccount *)account;77 + (id)accountEditorWithConnection:(WCServerConnection *)connection; 78 + (id)accountEditorWithConnection:(WCServerConnection *)connection account:(WCAccount *)account; 79 79 80 80 - (IBAction)create:(id)sender; WiredClient/trunk/WCAccountEditor.m
r3550 r3570 33 33 @interface WCAccountEditor(Private) 34 34 35 - (id)_initAccountEditorWithConnection:(WCServerConnection *)connection account:(WCAccount *)account; 36 35 37 - (void)_updateType; 36 38 - (void)_updateGroup; … … 40 42 41 43 @implementation WCAccountEditor(Private) 44 45 - (id)_initAccountEditorWithConnection:(WCServerConnection *)connection account:(WCAccount *)account { 46 self = [super initWithWindowNibName:@"AccountEditor" 47 name:NSLS(@"Account Editor", @"Account editor window title") 48 connection:connection]; 49 50 _account = [account retain]; 51 _groups = [[NSMutableArray alloc] init]; 52 53 [self window]; 54 55 [[self connection] addObserver:self 56 selector:@selector(accountEditorReceivedUser:) 57 name:WCAccountEditorReceivedUser]; 58 59 [[self connection] addObserver:self 60 selector:@selector(accountEditorReceivedGroup:) 61 name:WCAccountEditorReceivedGroup]; 62 63 if(_account) { 64 if([_account type] == WCAccountUser) { 65 [_typePopUpButton selectItem:_userMenuItem]; 66 67 [[self connection] sendCommand:WCReadUserCommand withArgument:[_account name]]; 68 } else { 69 [_typePopUpButton selectItem:_groupMenuItem]; 70 71 [[self connection] sendCommand:WCReadGroupCommand withArgument:[_account name]]; 72 } 73 74 [_okButton setAction:@selector(edit:)]; 75 [_okButton setTitle:NSLS(@"Save", @"Account Editor button title")]; 76 77 [_typePopUpButton setEnabled:NO]; 78 [_nameTextField setEnabled:NO]; 79 } else { 80 [_okButton setAction:@selector(create:)]; 81 [_okButton setTitle:NSLS(@"Add", @"Account Editor button title")]; 82 83 [_typePopUpButton setEnabled:YES]; 84 [_nameTextField setEnabled:YES]; 85 } 86 87 [self _updateType]; 88 [self _updateGroup]; 89 90 [self showWindow:self]; 91 92 [self retain]; 93 94 return self; 95 } 96 97 98 99 #pragma mark - 42 100 43 101 - (void)_updateType { … … 120 178 @implementation WCAccountEditor 121 179 122 - (id)initAccountEditorWithConnection:(WCServerConnection *)connection { 123 return [self initAccountEditorWithConnection:connection account:NULL]; 124 } 125 126 127 128 - (id)initAccountEditorWithConnection:(WCServerConnection *)connection account:(WCAccount *)account { 129 self = [super initWithWindowNibName:@"AccountEditor" 130 name:NSLS(@"Account Editor", @"Account editor window title") 131 connection:connection]; 132 133 _account = [account retain]; 134 _groups = [[NSMutableArray alloc] init]; 135 136 [self window]; 137 138 [[self connection] addObserver:self 139 selector:@selector(accountEditorReceivedUser:) 140 name:WCAccountEditorReceivedUser]; 141 142 [[self connection] addObserver:self 143 selector:@selector(accountEditorReceivedGroup:) 144 name:WCAccountEditorReceivedGroup]; 145 146 if(_account) { 147 if([_account type] == WCAccountUser) { 148 [_typePopUpButton selectItem:_userMenuItem]; 149 150 [[self connection] sendCommand:WCReadUserCommand withArgument:[_account name]]; 151 } else { 152 [_typePopUpButton selectItem:_groupMenuItem]; 153 154 [[self connection] sendCommand:WCReadGroupCommand withArgument:[_account name]]; 155 } 156 157 [_okButton setAction:@selector(edit:)]; 158 [_okButton setTitle:NSLS(@"Save", @"Account Editor button title")]; 159 160 [_typePopUpButton setEnabled:NO]; 161 [_nameTextField setEnabled:NO]; 162 } else { 163 [_okButton setAction:@selector(create:)]; 164 [_okButton setTitle:NSLS(@"Add", @"Account Editor button title")]; 165 166 [_typePopUpButton setEnabled:YES]; 167 [_nameTextField setEnabled:YES]; 168 } 169 170 [self _updateType]; 171 [self _updateGroup]; 172 173 [self showWindow:self]; 174 175 return self; 180 + (id)accountEditorWithConnection:(WCServerConnection *)connection { 181 return [[[self alloc] _initAccountEditorWithConnection:connection account:NULL] autorelease]; 182 } 183 184 185 186 + (id)accountEditorWithConnection:(WCServerConnection *)connection account:(WCAccount *)account { 187 return [[[self alloc] _initAccountEditorWithConnection:connection account:account] autorelease]; 176 188 } 177 189 WiredClient/trunk/WCAccounts.h
r3413 r3570 52 52 53 53 54 - (id)initAccountsWithConnection:(WCServerConnection *)connection;54 + (id)accountsWithConnection:(WCServerConnection *)connection; 55 55 56 56 - (NSArray *)accounts; WiredClient/trunk/WCAccounts.m
r3548 r3570 33 33 @interface WCAccounts(Private) 34 34 35 - (id)_initAccountsWithConnection:(WCServerConnection *)connection; 36 35 37 - (void)_update; 36 38 - (void)_updateStatus; … … 47 49 48 50 @implementation WCAccounts(Private) 51 52 - (id)_initAccountsWithConnection:(WCServerConnection *)connection { 53 self = [super initWithWindowNibName:@"Accounts" 54 name:NSLS(@"Accounts", @"Accounts window title") 55 connection:connection]; 56 57 _allAccounts = [[NSMutableArray alloc] init]; 58 _shownAccounts = [[NSMutableArray alloc] init]; 59 _userImage = [[NSImage imageNamed:@"User"] retain]; 60 _groupImage = [[NSImage imageNamed:@"Group"] retain]; 61 62 [self window]; 63 64 [[self connection] addObserver:self 65 selector:@selector(accountsShouldReload:) 66 name:WCAccountsShouldReload]; 67 68 [[self connection] addObserver:self 69 selector:@selector(accountsReceivedUser:) 70 name:WCAccountsReceivedUser]; 71 72 [[self connection] addObserver:self 73 selector:@selector(accountsCompletedUsers:) 74 name:WCAccountsCompletedUsers]; 75 76 [[self connection] addObserver:self 77 selector:@selector(accountsReceivedGroup:) 78 name:WCAccountsReceivedGroup]; 79 80 [[self connection] addObserver:self 81 selector:@selector(accountsCompletedGroups:) 82 name:WCAccountsCompletedGroups]; 83 84 [self retain]; 85 86 return self; 87 } 88 89 90 91 #pragma mark - 49 92 50 93 - (void)_update { … … 165 208 @implementation WCAccounts 166 209 167 - (id)initAccountsWithConnection:(WCServerConnection *)connection { 168 self = [super initWithWindowNibName:@"Accounts" 169 name:NSLS(@"Accounts", @"Accounts window title") 170 connection:connection]; 171 172 _allAccounts = [[NSMutableArray alloc] init]; 173 _shownAccounts = [[NSMutableArray alloc] init]; 174 _userImage = [[NSImage imageNamed:@"User"] retain]; 175 _groupImage = [[NSImage imageNamed:@"Group"] retain]; 176 177 [self window]; 178 179 [[self connection] addObserver:self 180 selector:@selector(accountsShouldReload:) 181 name:WCAccountsShouldReload]; 182 183 [[self connection] addObserver:self 184 selector:@selector(accountsReceivedUser:) 185 name:WCAccountsReceivedUser]; 186 187 [[self connection] addObserver:self 188 selector:@selector(accountsCompletedUsers:) 189 name:WCAccountsCompletedUsers]; 190 191 [[self connection] addObserver:self 192 selector:@selector(accountsReceivedGroup:) 193 name:WCAccountsReceivedGroup]; 194 195 [[self connection] addObserver:self 196 selector:@selector(accountsCompletedGroups:) 197 name:WCAccountsCompletedGroups]; 198 199 return self; 210 + (id)accountsWithConnection:(WCServerConnection *)connection { 211 return [[[self alloc] _initAccountsWithConnection:connection] autorelease]; 200 212 } 201 213 … … 401 413 402 414 - (IBAction)add:(id)sender { 403 [ [WCAccountEditor alloc] initAccountEditorWithConnection:[self connection]];415 [WCAccountEditor accountEditorWithConnection:[self connection]]; 404 416 } 405 417 … … 413 425 414 426 while((account = [enumerator nextObject])) 415 [ [WCAccountEditor alloc] initAccountEditorWithConnection:[self connection] account:account];427 [WCAccountEditor accountEditorWithConnection:[self connection] account:account]; 416 428 } 417 429 WiredClient/trunk/WCChat.m
r3565 r3570 509 509 _allUsers = [[NSMutableArray alloc] init]; 510 510 _shownUsers = [[NSMutableArray alloc] init]; 511 512 [self window]; 511 513 512 514 [[NSNotificationCenter defaultCenter] … … 567 569 selector:@selector(chatReceivedTopic:) 568 570 name:WCChatReceivedTopic]; 571 572 [self retain]; 569 573 570 574 return self; … … 1432 1436 1433 1437 - (IBAction)getInfo:(id)sender { 1434 [ [WCUserInfo alloc] initWithConnection:[self connection] user:[self selectedUser]];1438 [WCUserInfo userInfoWithConnection:[self connection] user:[self selectedUser]]; 1435 1439 } 1436 1440 … … 1444 1448 account = [[[self connection] accounts] userWithName:[user login]]; 1445 1449 1446 [ [WCAccountEditor alloc] initAccountEditorWithConnection:[self connection] account:account];1450 [WCAccountEditor accountEditorWithConnection:[self connection] account:account]; 1447 1451 } 1448 1452 WiredClient/trunk/WCConnection.h
r3542 r3570 72 72 #define WCLeaveCommand @"LEAVE" 73 73 #define WCListCommand @"LIST" 74 #define WCListRecursiveCommand @"LISTRECURSIVE" 74 75 #define WCMeCommand @"ME" 75 76 #define WCMoveCommand @"MOVE" WiredClient/trunk/WCConnectionController.m
r3545 r3570 43 43 44 44 _name = [name retain]; 45 _connection = [connection retain];45 _connection = connection; 46 46 47 47 if([self respondsToSelector:@selector(connectionDidConnect:)]) { … … 116 116 117 117 [_connection removeObserver:self]; 118 [_connection release];118 _connection = NULL; 119 119 120 120 [super dealloc]; … … 255 255 256 256 - (IBAction)files:(id)sender { 257 [ [WCFiles alloc] initWithConnection:[self connection] path:[WCFile fileWithRootDirectory]];257 [WCFiles filesWithConnection:[self connection] path:[WCFile fileWithRootDirectory]]; 258 258 } 259 259 WiredClient/trunk/WCConsole.h
r3542 r3570 30 30 IBOutlet NSTextView *_consoleTextView; 31 31 IBOutlet NSScrollView *_consoleScrollView; 32 33 BOOL _shared;34 32 } 35 33 36 34 37 - (id)initConsoleWithConnection:(WCServerConnection *)connection;35 + (id)consoleWithConnection:(WCServerConnection *)connection; 38 36 39 37 @end WiredClient/trunk/WCConsole.m
r3542 r3570 31 31 @interface WCConsole(Private) 32 32 33 + (NSColor *)logColor; 34 + (NSColor *)inputColor; 35 + (NSColor *)outputColor; 33 + (NSColor *)_inputColor; 34 + (NSColor *)_outputColor; 36 35 37 - (void)log:(NSString *)string color:(NSColor *)color; 38 - (void)print:(NSAttributedString *)string; 36 - (id)_initConsoleWithConnection:(WCServerConnection *)connection; 37 38 - (void)_log:(NSString *)string color:(NSColor *)color; 39 - (void)_print:(NSAttributedString *)string; 39 40 40 41 @end 41 42 42 43 44 @implementation WCConsole(Private) 43 45 44 @implementation WCConsole 45 46 + (NSColor *)logColor { 47 return [NSColor blackColor]; 48 } 49 50 51 52 + (NSColor *)inputColor { 46 + (NSColor *)_inputColor { 53 47 return [NSColor blueColor]; 54 48 } … … 56 50 57 51 58 + (NSColor *) outputColor {52 + (NSColor *)_outputColor { 59 53 return [NSColor blackColor]; 60 54 } … … 64 58 #pragma mark - 65 59 66 - (id) initConsoleWithConnection:(WCServerConnection *)connection {60 - (id)_initConsoleWithConnection:(WCServerConnection *)connection { 67 61 self = [super initWithWindowNibName:@"Console" 68 62 name:NSLS(@"Console", @"Console window title") … … 78 72 selector:@selector(connectionSentCommand:) 79 73 name:WCConnectionSentCommand]; 74 75 [self retain]; 80 76 81 77 return self; 78 } 79 80 81 82 #pragma mark - 83 84 - (void)_log:(NSString *)string color:(NSColor *)color { 85 static NSArray *separators; 86 static NSFont *font; 87 NSDictionary *attributes; 88 NSAttributedString *attributedString; 89 90 if(!separators) { 91 separators = [[NSArray alloc] initWithObjects: 92 WCFieldSeparator, WCGroupSeparator, WCRecordSeparator, NULL]; 93 94 font = [[NSFont fontWithName:@"Monaco" size:9.0] retain]; 95 } 96 97 string = [string stringByReplacingOccurencesOfStrings:separators withString:@"\t"]; 98 99 attributes = [NSDictionary dictionaryWithObjectsAndKeys: 100 color, NSForegroundColorAttributeName, 101 font, NSFontAttributeName, 102 NULL]; 103 attributedString = [NSAttributedString attributedStringWithString:string attributes:attributes]; 104 105 [self _print:attributedString]; 106 } 107 108 109 110 - (void)_print:(NSAttributedString *)string { 111 float position; 112 113 position = [[_consoleScrollView verticalScroller] floatValue]; 114 115 if([[_consoleTextView textStorage] length] > 0) 116 [[[_consoleTextView textStorage] mutableString] appendString:@"\n"]; 117 118 [[_consoleTextView textStorage] appendAttributedString:string]; 119 120 if(position == 1.0) 121 [_consoleTextView performSelectorOnce:@selector(scrollToBottom) withObject:NULL afterDelay:0.05]; 122 } 123 124 @end 125 126 127 @implementation WCConsole 128 129 + (id)consoleWithConnection:(WCServerConnection *)connection { 130 return [[[self alloc] _initConsoleWithConnection:connection] autorelease]; 82 131 } 83 132 … … 101 150 102 151 - (void)connectionReceivedMessage:(NSNotification *)notification { 103 [self log:[notification object] color:[WCConsoleinputColor]];152 [self _log:[notification object] color:[WCConsole _inputColor]]; 104 153 } 105 154 … … 107 156 108 157 - (void)connectionSentCommand:(NSNotification *)notification { 109 [self log:[notification object] color:[WCConsoleoutputColor]];158 [self _log:[notification object] color:[WCConsole _outputColor]]; 110 159 } 111 160 … … 124 173 } 125 174 126 127 128 #pragma mark -129 130 - (void)log:(NSString *)string color:(NSColor *)color {131 static NSArray *separators;132 static NSFont *font;133 NSDictionary *attributes;134 NSAttributedString *attributedString;135 136 if(!separators) {137 separators = [[NSArray alloc] initWithObjects:138 WCFieldSeparator, WCGroupSeparator, WCRecordSeparator, NULL];139 140 font = [[NSFont fontWithName:@"Monaco" size:9.0] retain];141 }142 143 string = [string stringByReplacingOccurencesOfStrings:separators withString:@"\t"];144 145 attributes = [NSDictionary dictionaryWithObjectsAndKeys:146 color, NSForegroundColorAttributeName,147 font, NSFontAttributeName,148 NULL];149 attributedString = [NSAttributedString attributedStringWithString:string attributes:attributes];150 151 [self print:attributedString];152 }153 154 155 156 - (void)print:(NSAttributedString *)string {157 float position;158 159 position = [[_consoleScrollView verticalScroller] floatValue];160 161 if([[_consoleTextView textStorage] length] > 0)162 [[[_consoleTextView textStorage] mutableString] appendString:@"\n"];163 164 [[_consoleTextView textStorage] appendAttributedString:string];165 166 if(position == 1.0)167 [_consoleTextView performSelectorOnce:@selector(scrollToBottom) withObject:NULL afterDelay:0.05];168 }169 170 175 @end WiredClient/trunk/WCFile.h
r3569 r3570 57 57 58 58 + (NSImage *)iconForFolderType:(WCFileType)type width:(double)width; 59 + (NSImage *)iconForFile:(WCFile *)file width:(double)width;60 59 + (NSString *)kindForFolderType:(WCFileType)type; 61 + (NSString *)kindForFile:(WCFile *)file;62 60 + (WCFileType)folderTypeForString:(NSString *)string; 63 61 WiredClient/trunk/WCFile.m
r3569 r3570 174 174 175 175 176 + (NSImage *)iconForFile:(WCFile *)file width:(double)width {177 NSImage *icon;178 NSString *extension;179 180 if([file isFolder]) {181 icon = [self iconForFolderType:[file type] width:width];182 } else {183 extension = [file extension];184 icon = [[WCCache cache] fileIconForExtension:extension];185 186 if(!icon) {187 icon = [[NSWorkspace sharedWorkspace] iconForFileType:extension];188 [[WCCache cache] setFileIcon:icon forExtension:extension];189 }190 191 [icon setSize:NSMakeSize(width, width)];192 }193 194 return icon;195 }196 197 198 199 176 + (NSString *)kindForFolderType:(WCFileType)type { 200 177 static NSString *folder, *uploads, *dropbox; … … 229 206 230 207 return NULL; 231 }232 233 234 235 + (NSString *)kindForFile:(WCFile *)file {236 NSString *kind;237 238 if([file isFolder]) {239 kind = [self kindForFolderType:[file type]];240 } else {241 LSCopyKindStringForTypeInfo(kLSUnknownType,242 kLSUnknownCreator,243 (CFStringRef) [file extension],244 (CFStringRef *) &kind);245 246 [kind autorelease];247 }248 249 return kind;250 208 } 251 209 … … 454 412 455 413 - (NSString *)kind { 456 if(!_kind) 457 _kind = [[[self class] kindForFile:self] retain]; 458 414 if(!_kind) { 415 if([self isFolder]) { 416 _kind = [[[self class] kindForFolderType:[self type]] retain]; 417 } else { 418 LSCopyKindStringForTypeInfo(kLSUnknownType, 419 kLSUnknownCreator, 420 (CFStringRef) [self extension], 421 (CFStringRef *) &_kind); 422 } 423 } 424 459 425 return _kind; 460 426 } … … 469 435 470 436 - (NSImage *)iconWithWidth:(double)width { 471 return [[self class] iconForFile:self width:width]; 437 NSImage *icon; 438 NSString *extension; 439 440 if([self isFolder]) { 441 icon = [[self class] iconForFolderType:[self type] width:width]; 442 } else { 443 extension = [self extension]; 444 icon = [[WCCache cache] fileIconForExtension:extension]; 445 446 if(!icon) { 447 icon = [[NSWorkspace sharedWorkspace] iconForFileType:extension]; 448 [[WCCache cache] setFileIcon:icon forExtension:extension]; 449 } 450 451 icon = [[icon copy] autorelease]; 452 [icon setSize:NSMakeSize(width, width)]; 453 } 454 455 return icon; 472 456 } 473 457 WiredClient/trunk/WCFileInfo.h
r3441 r3570 53 53 54 54 55 - (id)initWithConnection:(WCServerConnection *)connection file:(WCFile *)file;55 + (id)fileInfoWithConnection:(WCServerConnection *)connection file:(WCFile *)file; 56 56 57 57 @end WiredClient/trunk/WCFileInfo.m
r3569 r3570 34 34 @interface WCFileInfo(Private) 35 35 36 - (id)_initFileInfoWithConnection:(WCServerConnection *)connection file:(WCFile *)file; 37 36 38 - (void)_resizeTextField:(NSTextField *)textField withTextField:(NSTextField *)titleTextField atOffset:(float *)offset; 37 39 … … 40 42 41 43 @implementation WCFileInfo(Private) 44 45 - (id)_initFileInfoWithConnection:(WCServerConnection *)connection file:(WCFile *)file { 46 self = [super initWithWindowNibName:@"FileInfo" connection:connection]; 47 48 _file = [file retain]; 49 50 [self window]; 51 52 [[self connection] addObserver:self 53 selector:@selector(fileInfoReceivedFileInfo:) 54 name:WCFileInfoReceivedFileInfo]; 55 56 [[self connection] sendCommand:WCStatCommand withArgument:[_file path]]; 57 58 [self retain]; 59 60 return self; 61 } 62 63 64 65 #pragma mark - 42 66 43 67 - (void)_resizeTextField:(NSTextField *)textField withTextField:(NSTextField *)titleTextField atOffset:(float *)offset { … … 72 96 @implementation WCFileInfo 73 97 74 - (id)initWithConnection:(WCServerConnection *)connection file:(WCFile *)file { 75 self = [super initWithWindowNibName:@"FileInfo" connection:connection]; 76 77 _file = [file retain]; 78 79 [self window]; 80 81 [[self connection] addObserver:self 82 selector:@selector(fileInfoReceivedFileInfo:) 83 name:WCFileInfoReceivedFileInfo]; 84 85 [[self connection] sendCommand:WCStatCommand withArgument:[_file path]]; 86 87 return self; 98 + (id)fileInfoWithConnection:(WCServerConnection *)connection file:(WCFile *)file { 99 return [[[self alloc] _initFileInfoWithConnection:connection file:file] autorelease]; 88 100 } 89 101 … … 137 149 138 150 // --- compare the existing comment with the one in the text field 139 if(![[_file comment] isEqualToString:[_commentTextField stringValue]]) {151 if(![[_file comment] ? [_file comment] : @"" isEqualToString:[_commentTextField stringValue]]) { 140 152 if([[self connection] protocol] >= 1.1) { 141 153 [[self connection] sendCommand:WCCommentCommand … … 221 233 222 234 // --- set fields 223 [_iconImageView setImage:[ WCFile iconForFile:_file width:32.0]];235 [_iconImageView setImage:[_file iconWithWidth:32.0]]; 224 236 [_fileTextField setStringValue:[_file name]]; 225 237 [_kindTextField setStringValue:[_file kind]]; WiredClient/trunk/WCFiles.h
r3569 r3570 85 85 86 86 87 - (id)initWithConnection:(WCServerConnection *)connection path:(WCFile *)path;88 - (id)initWithConnection:(WCServerConnection *)connection path:(WCFile *)path selectPath:(NSString *)selectPath;87 + (id)filesWithConnection:(WCServerConnection *)connection path:(WCFile *)path; 88 + (id)filesWithConnection:(WCServerConnection *)connection path:(WCFile *)path selectPath:(NSString *)selectPath; 89 89 90 90 - (IBAction)up:(id)sender; WiredClient/trunk/WCFiles.m
r3569 r3570 28 28 29 29 #import "WCAccount.h" 30 #import "WCBrowserCell.h"31 30 #import "WCCache.h" 32 31 #import "WCFile.h" 33 32 #import "WCFileInfo.h" 34 33 #import "WCFiles.h" 34 #import "WCFilesBrowserCell.h" 35 35 #import "WCPreferences.h" 36 36 #import "WCPreview.h" … … 39 39 @interface WCFiles(Private) 40 40 41 - (id)_initFilesWithConnection:(WCServerConnection *)connection path:(WCFile *)path selectPath:(NSString *)selectPath; 42 41 43 - (void)_setCurrentPath:(WCFile *)path; 42 44 - (WCFile *)_currentPath;
