/* Copyright (C) 2002-2003, Jeffrey D. Argast. The authors make NO WARRANTY or representation, either express or implied, with respect to this software, its quality, accuracy, merchantability, or fitness for a particular purpose. This software is provided "AS IS", and you, its user, assume the entire risk as to its quality and accuracy. Permission is hereby granted to use, copy, modify, and distribute this software or portions thereof for any purpose, without fee, subject to these conditions: (1) If any part of the source code is distributed, then this statement must be included, with this copyright and no-warranty notice unaltered. (2) Permission for use of this software is granted only if the user accepts full responsibility for any undesirable consequences; the authors accept NO LIABILITY for damages of any kind. */ #import "PendingChangesController.h" #import "OutlineItem.h" #import "AppDefaults.h" #import "MessageDefs.h" #import "PerforceChanges.h" @implementation PendingChangesController - (void) comeForward { fForward = YES; [fPendingChangesView reloadData]; } - (void) stepBack { fForward = NO; } - (void) dealloc { NSNotificationCenter* nCenter = [NSNotificationCenter defaultCenter]; [nCenter removeObserver:self]; [fChildren release]; [super dealloc]; } - (void) buildChildren { NSMutableArray* childArray = [[NSMutableArray alloc] initWithCapacity:2]; NSMutableString* nsString = [NSMutableString stringWithString:@"Pending Changelists (client '"]; AppDefaults* appDefaults = [AppDefaults defaultAppDefaults]; [nsString appendString:[appDefaults getPerforceClient]]; [nsString appendString:@"')"]; [childArray addObject:[[[PerforceChanges alloc] initWithName:nsString clientChanges:YES] autorelease]]; [childArray addObject:[[[PerforceChanges alloc] initWithName:@"Pending Changelists (other clients)" clientChanges:NO] autorelease]]; fChildren = childArray; } - (void) awakeFromNib { NSTableColumn *tableColumn = nil; NSBrowserCell *browserCell = nil; tableColumn = [fPendingChangesView tableColumnWithIdentifier:@"1"]; browserCell = [[[NSBrowserCell alloc] init] autorelease]; [browserCell setEditable:NO]; [browserCell setLeaf:YES]; [tableColumn setDataCell:browserCell]; { NSNotificationCenter* nCenter = [NSNotificationCenter defaultCenter]; [nCenter addObserver:self selector:@selector(handleDefaultsChanged:) name:kDefaultsUserChanged object:nil]; [nCenter addObserver:self selector:@selector(handleDefaultsChanged:) name:kDefaultsClientChanged object:nil]; [nCenter addObserver:self selector:@selector(handleDefaultsChanged:) name:kDefaultsPortChanged object:nil]; [nCenter addObserver:self selector:@selector(handleDefaultsChanged:) name:kGlobalSyncComplete object:nil]; [nCenter addObserver:self selector:@selector(handleDefaultsChanged:) name:kDefaultsConfigurationsChanged object:nil]; [nCenter addObserver:self selector:@selector(handleDefaultsChanged:) name:kRefreshAllViews object:nil]; [nCenter addObserver:self selector:@selector(handleChangeChanged:) name:kChangeChanged object:nil]; [nCenter addObserver:self selector:@selector(handleChildChanged:) name:kPendingChangesChildChanged object:nil]; } } - (void) handleChangeChanged: (NSNotification*) notification { [self refreshClientData]; } - (void) handleChildChanged: (NSNotification*) notification { [fPendingChangesView reloadData]; } - (void) handleDefaultsChanged: (NSNotification*) notification { [self refreshData]; } /* ** The outline view datasource protocol */ // outlineView:child:ofItem: - (id) outlineView: (NSOutlineView *) outlineView child: (int) index ofItem: (id) item { if ( item ) { return [item getChildAtIndex: index]; } if ( !fForward ) { /* skip entirely. It works ok this way and has the advantage of not hitting the server when the panel is not forward if ( fChildren ) { return [fChildren objectAtIndex: index]; } */ return nil; } if ( !fChildren ) { [self buildChildren]; } return [fChildren objectAtIndex: index]; } // outlineView:isItemExpandable: - (BOOL) outlineView: (NSOutlineView *) outlineView isItemExpandable: (id) item { if ( item ) { return [item hasChildren]; } return YES; } // outlineView:numberOfChildrenOfItem: - (int) outlineView: (NSOutlineView*) outlineView numberOfChildrenOfItem: (id) item { if ( item ) { return [item getNumberOfChildren]; } if ( !fForward ) { /* skip entirely. It works ok this way and has the advantage of not hitting the server when the panel is not forward if ( fChildren ) { return [fChildren count]; } */ return 0; } if ( !fChildren ) { [self buildChildren]; } return [fChildren count]; } // outlineView:objectValueForTableColumn:byItem: - (id) outlineView: (NSOutlineView *) outlineView objectValueForTableColumn: (NSTableColumn *) tableColumn byItem: (id) item { return [item getCellText]; } /* ** outline view delegate methods */ - (void) outlineView: (NSOutlineView *) olv willDisplayCell: (NSCell *) cell forTableColumn: (NSTableColumn *) tableColumn item: (id) item { if ( [[tableColumn identifier] isEqualToString:@"1"] ) { [(NSBrowserCell*)cell setImage:[item getCellImage]]; } } // // getSelectedItem // - (id) getSelectedItem { int rowIdx; id item = nil; rowIdx = [fPendingChangesView selectedRow]; if ( rowIdx >= 0 ) { item = [fPendingChangesView itemAtRow:rowIdx]; } return item; } // // // - (void) refreshData { if ( fChildren ) { [fChildren release]; fChildren = nil; [fPendingChangesView reloadData]; } } - (void) refreshClientData { if ( fChildren && ( [fChildren count] > 0 ) ) { PerforceChanges* clientChanges = [fChildren objectAtIndex:0]; [clientChanges refreshClientData]; [fPendingChangesView reloadData]; } } @end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#10 | 4225 | Jeff Argast |
Added resolve support, reveal in finder, drag and drop edit, show local files, and showing added files. |
||
#9 | 3134 | Jeff Argast |
Added copy/paste support in the depot view Added expand path to depot view Added bookmarks |
||
#8 | 3130 | Jeff Argast |
Added double click support to the depot view and pending changelist view. Added View File In Editor item on the pending changeist context menu. |
||
#7 | 3126 | Jeff Argast |
Added drag and drop reordering/reopening of files in the pending change list view |
||
#6 | 3114 | Jeff Argast |
Fixed retaining the correct selection after a perforce action completed executing and updated the outline view. |
||
#5 | 3113 | Jeff Argast |
Reduced the times the depot view completely collapses. Now it won't collapse on refresh views or submit, but still collapses when the defaults change. |
||
#4 | 3111 | Jeff Argast |
Made multiple selection smarter by operating on the entire selection as an atomic operation with the server. Also partially fixed the read only window to not wrap at the window boundary. I did the same for the editable window, but now the problem appears to be that p4 change -o is breaking its output at some character location before the string gets into the editor (at least I think that is the problem). |
||
#3 | 2803 | Jeff Argast |
Added submit default changelist to the changelist menu Made the out window selectable Changed the tabs in a few places |
||
#2 | 2737 | Jeff Argast | Added several 0.15 revision functionality | ||
#1 | 2732 | Jeff Argast | Initial submission of P4Cocoa |