HistoryView: Add copy behaviour in commit list

This copies text like:

	2e7cd5268d (Remember selected view (history or commit))

to the pasteboard on command-c
This commit is contained in:
Pieter de Bie
2008-09-26 18:41:20 +02:00
parent 0a80eb16cb
commit de9f4ddf91
5 changed files with 33 additions and 3 deletions
+1
View File
@@ -13,6 +13,7 @@
@interface PBCommitList : NSTableView {
IBOutlet WebView* webView;
IBOutlet PBWebGitController* webController;
IBOutlet PBGitHistoryController *controller;
}
@end
+5
View File
@@ -28,4 +28,9 @@
[super keyDown: event];
}
- (void) copy:(id)sender
{
[controller copyCommitInfo];
};
@end
+2
View File
@@ -40,5 +40,7 @@
- (IBAction) openSelectedFile: sender;
- (void) updateQuicklookForce: (BOOL) force;
- (void) copyCommitInfo;
- (BOOL) hasNonlinearPath;
@end
+13 -1
View File
@@ -102,13 +102,25 @@
- (void)keyDown:(NSEvent*)event
{
NSLog(@"Key down!");
if ([[event charactersIgnoringModifiers] isEqualToString: @"f"] && [event modifierFlags] & NSAlternateKeyMask && [event modifierFlags] & NSCommandKeyMask)
[superController focusOnSearchField];
else
[super keyDown: event];
}
- (void) copyCommitInfo
{
PBGitCommit *commit = [[commitController selectedObjects] objectAtIndex:0];
if (!commit)
return;
NSString *info = [NSString stringWithFormat:@"%@ (%@)", [commit sha], [commit subject]];
NSPasteboard *a =[NSPasteboard generalPasteboard];
[a declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:self];
[a setString:info forType: NSStringPboardType];
}
- (IBAction) toggleQuickView: sender
{
id panel = [QLPreviewPanel sharedPreviewPanel];
+12 -2
View File
@@ -8,7 +8,7 @@
<string key="IBDocument.HIToolboxVersion">352.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="32"/>
<integer value="3"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1320,6 +1320,14 @@
</object>
<int key="connectionID">110</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">controller</string>
<reference key="source" ref="254268962"/>
<reference key="destination" ref="1001"/>
</object>
<int key="connectionID">111</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -1852,7 +1860,7 @@
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">110</int>
<int key="maxID">111</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1864,11 +1872,13 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>controller</string>
<string>webController</string>
<string>webView</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>PBGitHistoryController</string>
<string>PBWebGitController</string>
<string>WebView</string>
</object>