Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Copy and paste, and some bug fixes.

  • Loading branch information...
commit aed0d315fdd1a70afb12720b1a44ea0460cb005c 1 parent 24a9a51
@snej snej authored
View
4 TouchDB Viewer.xcodeproj/project.pbxproj
@@ -351,6 +351,7 @@
27A8A791152A008200363704 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CODE_SIGN_IDENTITY = "Developer ID Application: CouchOne";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -361,6 +362,7 @@
INFOPLIST_FILE = "TouchDB Viewer/TouchDB Viewer-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "@executable_path/../Frameworks/";
PRODUCT_NAME = "$(TARGET_NAME)";
+ PROVISIONING_PROFILE = "";
WRAPPER_EXTENSION = app;
};
name = Debug;
@@ -368,6 +370,7 @@
27A8A792152A008200363704 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ CODE_SIGN_IDENTITY = "Developer ID Application: CouchOne";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -378,6 +381,7 @@
INFOPLIST_FILE = "TouchDB Viewer/TouchDB Viewer-Info.plist";
LD_RUNPATH_SEARCH_PATHS = "@executable_path/../Frameworks/";
PRODUCT_NAME = "$(TARGET_NAME)";
+ PROVISIONING_PROFILE = "";
WRAPPER_EXTENSION = app;
};
name = Release;
View
2  TouchDB Viewer/AppDelegate.m
@@ -16,7 +16,7 @@ @implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
- gRESTLogLevel = kRESTLogRequestHeaders;
+ //gRESTLogLevel = kRESTLogRequestHeaders;
}
@end
View
13 TouchDB Viewer/DBWindowController.m
@@ -247,4 +247,17 @@ - (void) keyDown: (NSEvent*)ev {
}
+- (IBAction) copy:(id)sender {
+ id focus = self.window.firstResponder;
+ if ([focus isKindOfClass: [NSTableView class]]) {
+ focus = [focus delegate];
+ if ([focus respondsToSelector: @selector(copy:)]) {
+ [focus copy: sender];
+ return;
+ }
+ }
+ NSBeep();
+}
+
+
@end
View
30 TouchDB Viewer/DBWindowController.xib
@@ -901,17 +901,17 @@
<object class="IBOutletConnection" key="connection">
<string key="label">dataSource</string>
<reference key="source" ref="417721070"/>
- <reference key="destination" ref="1001"/>
+ <reference key="destination" ref="572162625"/>
</object>
- <int key="connectionID">62</int>
+ <int key="connectionID">624</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="417721070"/>
- <reference key="destination" ref="1001"/>
+ <reference key="destination" ref="572162625"/>
</object>
- <int key="connectionID">61</int>
+ <int key="connectionID">625</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
@@ -2067,7 +2067,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
- <int key="maxID">623</int>
+ <int key="maxID">625</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -2076,9 +2076,7 @@
<string key="superclassName">NSWindowController</string>
<dictionary class="NSMutableDictionary" key="actions">
<string key="deleteDocument:">id</string>
- <string key="hideDocRevisionTree:">id</string>
<string key="newDocument:">id</string>
- <string key="pathClicked:">id</string>
<string key="showDocRevisionTree:">id</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName">
@@ -2086,18 +2084,10 @@
<string key="name">deleteDocument:</string>
<string key="candidateClassName">id</string>
</object>
- <object class="IBActionInfo" key="hideDocRevisionTree:">
- <string key="name">hideDocRevisionTree:</string>
- <string key="candidateClassName">id</string>
- </object>
<object class="IBActionInfo" key="newDocument:">
<string key="name">newDocument:</string>
<string key="candidateClassName">id</string>
</object>
- <object class="IBActionInfo" key="pathClicked:">
- <string key="name">pathClicked:</string>
- <string key="candidateClassName">id</string>
- </object>
<object class="IBActionInfo" key="showDocRevisionTree:">
<string key="name">showDocRevisionTree:</string>
<string key="candidateClassName">id</string>
@@ -2144,6 +2134,7 @@
<string key="addColumnForSelectedProperty:">id</string>
<string key="addProperty:">id</string>
<string key="cancelOperation:">id</string>
+ <string key="copy:">id</string>
<string key="removeProperty:">id</string>
<string key="revertDocumentToSaved:">id</string>
<string key="saveDocument:">id</string>
@@ -2161,6 +2152,10 @@
<string key="name">cancelOperation:</string>
<string key="candidateClassName">id</string>
</object>
+ <object class="IBActionInfo" key="copy:">
+ <string key="name">copy:</string>
+ <string key="candidateClassName">id</string>
+ </object>
<object class="IBActionInfo" key="removeProperty:">
<string key="name">removeProperty:</string>
<string key="candidateClassName">id</string>
@@ -2199,10 +2194,15 @@
<string key="className">QueryResultController</string>
<string key="superclassName">NSObject</string>
<dictionary class="NSMutableDictionary" key="actions">
+ <string key="copy:">id</string>
<string key="deleteDocument:">id</string>
<string key="newDocument:">id</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName">
+ <object class="IBActionInfo" key="copy:">
+ <string key="name">copy:</string>
+ <string key="candidateClassName">id</string>
+ </object>
<object class="IBActionInfo" key="deleteDocument:">
<string key="name">deleteDocument:</string>
<string key="candidateClassName">id</string>
View
1  TouchDB Viewer/DocEditor.h
@@ -34,5 +34,6 @@
- (BOOL) saveDocument;
- (IBAction) cancelOperation: (id)sender;
+- (IBAction) copy:(id)sender;
@end
View
16 TouchDB Viewer/DocEditor.m
@@ -8,6 +8,7 @@
#import "DocEditor.h"
#import "DBWindowController.h"
+#import "JSONFormatter.h"
@implementation DocEditor
@@ -203,6 +204,21 @@ - (IBAction) cancelOperation: (id)sender {
}
+- (IBAction) copy:(id)sender {
+ NSString* prop = self.selectedProperty;
+ if (!prop) {
+ NSBeep();
+ return;
+ }
+ id value = _properties[prop];
+ NSString* json = [JSONFormatter stringForObjectValue: value];
+
+ NSPasteboard* pb = [NSPasteboard generalPasteboard];
+ [pb clearContents];
+ [pb setString: json forType: NSStringPboardType];
+}
+
+
- (BOOL) validateUserInterfaceItem: (id <NSValidatedUserInterfaceItem>)item {
NSLog(@"validate %@", item);//TEMP
NSString* property = self.selectedOrClickedProperty;
View
2  TouchDB Viewer/JSONFormatter.h
@@ -10,4 +10,6 @@
@interface JSONFormatter : NSFormatter
++ (NSString*) stringForObjectValue: (id)obj;
+
@end
View
7 TouchDB Viewer/JSONFormatter.m
@@ -11,7 +11,7 @@
@implementation JSONFormatter
-- (NSString *)stringForObjectValue: (id)obj {
++ (NSString*) stringForObjectValue: (id)obj {
if (obj == nil)
return @"";
NSArray* wrapped = @[obj]; // in case obj is a fragment
@@ -21,6 +21,11 @@ - (NSString *)stringForObjectValue: (id)obj {
}
+- (NSString *)stringForObjectValue: (id)obj {
+ return [[self class] stringForObjectValue: obj];
+}
+
+
- (BOOL)getObjectValue:(out id *)obj
forString:(NSString *)string
errorDescription:(out NSString **)errorMessage
View
1  TouchDB Viewer/QueryResultController.h
@@ -18,5 +18,6 @@
- (IBAction) newDocument: (id)sender;
- (IBAction) deleteDocument: (id)sender;
+- (IBAction) copy:(id)sender;
@end
View
17 TouchDB Viewer/QueryResultController.m
@@ -272,6 +272,23 @@ - (IBAction) deleteDocument: (id)sender {
}
+- (IBAction) copy:(id)sender {
+ NSArray* docs = self.selectedDocuments;
+ if (!docs.count) {
+ NSBeep();
+ return;
+ }
+ NSMutableArray* docIDs = [NSMutableArray array];
+ for (CouchDocument* doc in docs)
+ [docIDs addObject: doc.documentID];
+ NSString* result = [docIDs componentsJoinedByString: @"\n"];
+
+ NSPasteboard* pb = [NSPasteboard generalPasteboard];
+ [pb clearContents];
+ [pb setString: result forType: NSStringPboardType];
+}
+
+
@end
View
32 TouchDB Viewer/RevTreeController.m
@@ -68,6 +68,18 @@ - (void) setDocument:(CouchDocument *)document {
}
+- (NSArray*) selectedRevisions {
+ NSIndexSet* selIndexes = [_docsOutline selectedRowIndexes];
+ NSUInteger count = selIndexes.count;
+ NSMutableArray* sel = [NSMutableArray arrayWithCapacity: count];
+ [selIndexes enumerateIndexesUsingBlock: ^(NSUInteger idx, BOOL *stop) {
+ CouchRevision* item = [self revisionForItem: [_docsOutline itemAtRow: idx]];
+ [sel addObject: item];
+ }];
+ return sel;
+}
+
+
#pragma mark - DOCUMENT-LIST VIEW:
@@ -174,4 +186,24 @@ - (void)outlineViewSelectionDidChange:(NSNotification *)notification {
}
+#pragma mark - ACTIONS:
+
+
+- (IBAction) copy:(id)sender {
+ NSArray* sel = self.selectedRevisions;
+ if (!sel.count) {
+ NSBeep();
+ return;
+ }
+ NSMutableArray* revIDs = [NSMutableArray array];
+ for (CouchRevision* rev in sel)
+ [revIDs addObject: rev.revisionID];
+ NSString* result = [revIDs componentsJoinedByString: @"\n"];
+
+ NSPasteboard* pb = [NSPasteboard generalPasteboard];
+ [pb clearContents];
+ [pb setString: result forType: NSStringPboardType];
+}
+
+
@end
Please sign in to comment.
Something went wrong with that request. Please try again.