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

Sebastian Reitenbach developer@opengroupware.org
Tue, 02 Oct 2007 13:40:45 +0200


Hi,

developer@opengroupware.org wrote: 
> On 02.10.2007, at 12:08, Sebastian Reitenbach wrote:
> > I don't get the saved custom tabs to initiate a search on the saved
> > qualifier when clicking on a custom tab.
> 
> W/o looking at the code I would guess that the WETabItem has an  
> action binding assigned which then triggers a method in the  
> associated component. Which then loads the qualifier and performs the  
> search.
> 

I you mean this in LSWPersons.wod file:
SearchTab: SkySimpleTabItem {
  key    = "personSearch";
  action = tabClicked;
  label  = labels.searchPersonTabLabel;
}
CustomTab: SkySimpleTabItem {
  key    = itemIndex;
  label  = customTabLabel;
  action = customTabClicked;
}

and this in the LSWPersons.m I read:

- (WOComponent *)tabClicked {
  /*
    If a tab gets clicked, we reset the fetch specification so that no
    objects get displayed.
  */
  EOFetchSpecification *fspec;

  self->opFlags.hasSearched = 0;

  fspec = [self fetchSpecification];
  [fspec setQualifier:nil];
  [self->dataSource setFetchSpecification:fspec];

  if ([self->tabKey isEqualToString:@"advancedSearch"])
    [self setMaxSearchCount:maxSearchCountDef];

  [self setSearchTitle:nil];
  [self debugWithFormat:@"tab was clicked .."];
  return nil;
}

- (id)customTabClicked {
  NSString *title;
  id result;

  result = [self tabClicked];
  title  = [[self savedSearches] objectAtIndex:[self itemIndex]];
  if (result == nil) [self setSearchTitle:title];
  return result;
}

where I think the customTabClicked is called when on clicking the tab, and 
that is calling tabClicked. I have no idea what is going on there with the 
EOFetchSpecification in tabClicked. I don't know how this 
EOFetchSpecification and this self->dataSource is working.

I also see these in LSWPersons:

- (id<WOActionResults>)showPersonSearchAction {
  OGoContentPage *page;

  [self setTabKey:@"personSearch"];
  if ((page = (id)[self tabClicked]) == nil)
    page = self;
  return page;
}


- (id<WOActionResults>)showAdvancedSearchAction {
  OGoContentPage *page;

  [self setTabKey:@"advancedSearch"];
  if ((page = (id)[self tabClicked]) == nil)
    page = self;
  return page;
}

but I also have no idea what the purpose of these methods is and whether I 
need them at all.

any further explanation is highly appreciated. 

kind regards
Sebastian