plugin menuCommandFor issue
Re: plugin menuCommandFor issue
I overlooked the mistake as I am used to programming directly with the inner relationships that as you found out by looking at the NSManagedObject is called "linksSet" but the add function takes only a "links" array that goes through validation before being added. So change @"linksSet" to @"links".
Re: plugin menuCommandFor issue
hi,
only the first dictionary of the array is reccorded .
is it a bug ?
only the first dictionary of the array is reccorded .
is it a bug ?
Re: plugin menuCommandFor issue
Can you please send me your code, you might be replacing one NSArray with another? The following works:
Code: Select all
NSMutableArray *arrayURL =[NSMutableArray array];
[secondItem setObject:arrayURL forKey:@"links"];
NSMutableDictionary * anotherURL =[NSMutableDictionary dictionaryWithCapacity:3];
[anotherURL setObject:@"http://www.tests/" forKey:@"url"];
[anotherURL setObject:@"urlName" forKey:@"name"];
[anotherURL setObject:@"urlType" forKey:@"type"];
[arrayURL addObject:anotherURL];
NSMutableDictionary *anotherURL2 =[NSMutableDictionary dictionaryWithCapacity:3];
[anotherURL2 setObject:@"http://www.tests2.com/" forKey:@"url"];
[anotherURL2 setObject:@"two" forKey:@"name"];
[anotherURL2 setObject:@"two" forKey:@"type"];
[arrayURL addObject:anotherURL2];
Re: plugin menuCommandFor issue
i try exactly the following code
only the first item is reccorded
Code: Select all
NSMutableArray *arrayURL =[NSMutableArray array];
NSMutableDictionary * anotherURL =[NSMutableDictionary dictionaryWithCapacity:3];
[anotherURL setObject:@"http://www.tests/" forKey:@"url"];
[anotherURL setObject:@"urlName" forKey:@"name"];
[anotherURL setObject:@"urlType" forKey:@"type"];
[arrayURL addObject:anotherURL];
NSMutableDictionary *anotherURL2 =[NSMutableDictionary dictionaryWithCapacity:3];
[anotherURL2 setObject:@"http://www.tests2.com/" forKey:@"url"];
[anotherURL2 setObject:@"two" forKey:@"name"];
[anotherURL2 setObject:@"two" forKey:@"type"];
[arrayURL addObject:anotherURL2];
[returnData setObject:arrayURL forKey:@"links"];
Re: plugin menuCommandFor issue
Strange. I have uploaded another beta just for precautions that we have the latest version and try this entire function as a test that works for me:
Code: Select all
- (NSArray *)menuCommandFor:(NSArray *)selectedObjects {
NSMutableDictionary *firstItem = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"A Book", @"title", @"An Author", @"author", nil];
NSMutableDictionary *secondItem = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"Another Book", @"title", @"Another Autor", @"author", @"n Editor", @"editor", @"http://www.bruji.com/dvdpedia/images/mainScreenshot.png", @"imageLocation", nil];
NSMutableArray *arrayURL =[NSMutableArray array];
NSMutableDictionary * anotherURL =[NSMutableDictionary dictionaryWithCapacity:3];
[anotherURL setObject:@"http://www.tests/" forKey:@"url"];
[anotherURL setObject:@"urlName" forKey:@"name"];
[anotherURL setObject:@"urlType" forKey:@"type"];
[arrayURL addObject:anotherURL];
NSMutableDictionary *anotherURL2 =[NSMutableDictionary dictionaryWithCapacity:3];
[anotherURL2 setObject:@"http://www.tests2.com/" forKey:@"url"];
[anotherURL2 setObject:@"two" forKey:@"name"];
[anotherURL2 setObject:@"two" forKey:@"type"];
[arrayURL addObject:anotherURL2];
[firstItem setObject:arrayURL forKey:@"links"];
return [NSArray arrayWithObjects:firstItem, secondItem, nil];
}
Re: plugin menuCommandFor issue
i will test your code this evening.
the only difference i see with my test is that i tested it with the (NSDictionary *)resultNumber method called by th searchfor method. I imagine i use the same code for both.
the only difference i see with my test is that i tested it with the (NSDictionary *)resultNumber method called by th searchfor method. I imagine i use the same code for both.
Re: plugin menuCommandFor issue
Thank you for clearing that up, I have fixed the bug an "if" instead of a "while" for enumerating, here is the latest beta.
Re: plugin menuCommandFor issue
Hi,
Thks Conor, the last beta is perfect.
Is there programmatically a way to add en entry to the wishlist if the user didn't select it before ?
Thks Conor, the last beta is perfect.
Is there programmatically a way to add en entry to the wishlist if the user didn't select it before ?
Re: plugin menuCommandFor issue
No way to add it to another collection but the selected collection, I'll look at expanding the plug-in interface to include that possibility for you.
Re: plugin menuCommandFor issue
Hi Conor,
i test to add 1500 books with covers using the plugin method MenuCommandFor. Covers are localy on my HDD.
Bookpedia is going out of memory and crash. It seems that memory allocated to copy covers is not released during your adding process.
i test to add 1500 books with covers using the plugin method MenuCommandFor. Covers are localy on my HDD.
Bookpedia is going out of memory and crash. It seems that memory allocated to copy covers is not released during your adding process.
Last edited by bobino on Wed Jul 29, 2009 9:29 am, edited 1 time in total.
Re: plugin menuCommandFor issue
I have added an auto release pool around the code to free memory on the go, let me know if you still have problems with large numbers.
Re: plugin menuCommandFor issue
hi,
when i add a book through the plugin with values for fields "borrowedBy", "borrowedOn" and "dueDate", the book doesn't appear in the borrowed list. What do i need to do for that ?
thks
when i add a book through the plugin with values for fields "borrowedBy", "borrowedOn" and "dueDate", the book doesn't appear in the borrowed list. What do i need to do for that ?
thks
Re: plugin menuCommandFor issue
I have updated the beta to add a book into the borrowed collection when a "borrowedBy" value is set.
Re: plugin menuCommandFor issue
i Conor, any news about that point ? this will be very very usefull ....Conor wrote:No way to add it to another collection but the selected collection, I'll look at expanding the plug-in interface to include that possibility for you.
thks
Re: plugin menuCommandFor issue
I have added the following methods in the beta. Use the following code to get the collections and then select the correct one before adding your entries:
You can then get relevant collections with the following methods (already encased in an interface declaration so you can add them to the MyControllerForPlugins.h header file):
You will also need to add the getCollections method to the existing Controller interface declaration:
Code: Select all
MyCollectionTableView *collections = [[NSApp delegate] getCollections];
Code: Select all
// Application Controller
@interface MyCollectionTableView : NSObject
- (MOCollection *)selectedCollection;
- (MOCollection *)borrowedCollection;
- (MOCollection *)wishlistCollection;
- (MOCollection *)libraryCollection;
- (NSArray *)allCollections;
// To select a collection use:
- (void)selectCollection:(MOCollection *)aCollection;
@end
Code: Select all
// Application Controller
@interface MyControllerForPlugins : NSObject
- (MyCollectionTableView *)getCollections;