[OGo-Developer] adding search save and create tab to document search in projects

Sebastian Reitenbach developer@opengroupware.org
Mon, 17 Sep 2007 07:02:03 +0200


Hi Helge,

thanks for replying,...
developer@opengroupware.org wrote: 
> On 16.09.2007, at 20:57, Sebastian Reitenbach wrote:
> ...
> > Anybody has an idea why the userdefaults are not written when I  
> > remove a tab?
> ...
> >     if ( [pkey intValue] == [projectId intValue] ) {
> >       projectSettings = [settings objectForKey:pkey];
> 
> Well, most likely this section is never entered? Did you walk through  
> it in the debugger?
it is going into there, I had NSLogs on every second line, like below. I saw 
the tabs disappearing in the WebUI, when I clicked the removeTab button, but 
they are still in the defaults file on the file system.

  for (j = 0; j < maxp; j++) {
    NSString *pkey;

    pkey = [ap objectAtIndex:j];
NSLog(@"savedSearches: pkey: %@, j: %i", pkey, j);
    if ( [pkey intValue] == [projectId intValue] ) {
NSLog(@"pkey == projectId");
      projectSettings = [settings objectForKey:pkey];
NSLog(@"removeTab: title: %@, projectId: %@, my settings before remove: %@", 
title, projectId, projectSettings);
      [projectSettings removeObjectForKey:title];
NSLog(@"removed the tab: %@, now the rest is: %@", title, projectSettings);
      [settings setObject:projectSettings forKey:pkey];
NSLog(@"removeTab: settings after removeObjectForKey:title: %@", settings);
      [ud setObject:settings forKey:@"project_custom_qualifiers"];
NSLog(@"ud: %@", ud);

    }
  [ud synchronize];
  [settings release];

below the output of above sequence. maybe the [ud setObject: forKey] fails 
already, but why?

Sep 17 06:46:17 ogo-webui-1.1 [15200]: savedSearches: pkey: 10890, j: 0
Sep 17 06:46:17 ogo-webui-1.1 [15200]: pkey == projectId
Sep 17 06:46:17 ogo-webui-1.1 [15200]: removeTab: title: pdf, projectId: 
10890, my settings before remove: {
    pdf = {
        maxSearchCount = 100;
        qualifier = "file_type='pdf'";
        showTab = 1;
    };
    txt = {
        maxSearchCount = 100;
        qualifier = "file_type='txt'";
        showTab = 1;
    };
}
Sep 17 06:46:17 ogo-webui-1.1 [15200]: removed the tab: pdf, now the rest 
is: {
    txt = {
        maxSearchCount = 100;
        qualifier = "file_type='txt'";
        showTab = 1;
    };
}
Sep 17 06:46:17 ogo-webui-1.1 [15200]: removeTab: settings after 
removeObjectForKey:title: {
    10890 = {
        txt = {
            maxSearchCount = 100;
            qualifier = "file_type='txt'";
            showTab = 1;
        };
    };
    21660 = {
        txt = {
            maxSearchCount = 100;
            qualifier = "file_type='txt'";
            showTab = 1;
        };
    };
    69640 = {
        txt = {
            maxSearchCount = 100;
            qualifier = "file_type='txt'";
            showTab = 1;
        };
    };
}
Sep 17 06:46:17 ogo-webui-1.1 [15200]: ud: <LSUserDefaults 0x7edd6844>
Sep 17 06:46:17 ogo-webui-1.1 [15200]: savedSearches: pkey: 69640, j: 1
Sep 17 06:46:17 ogo-webui-1.1 [15200]: savedSearches: pkey: 21660, j: 2


I also noted an other problem. Now when I enter a project that has no 
CustomTabs associated, the webui segfaults with signal 11. I tried to add a   
BOOL         showCustomTabs; to the instance variables, and initialize it in 
the -init method. Then surround the CustomTabs in the .html template with 
<#ShowCustomTabsCondition> tags. The line below called in the -init method 
does not return anything:
projectId = [[self project] valueForKey:@"projectId"];
the same line works well in e.g. above -removeTab method, can't I refer to 
self from within the -init method or why is that not working there? anybody 
could give me a hint what my problem here is?



kind regards
Sebastian