コード例 #1
0
void
XFE_ABDirGenTabView::setDlgValues()
{
	XFE_ABDirPropertyDlg *dlg = (XFE_ABDirPropertyDlg *)getToplevel();
	DIR_Server *dir = dlg->getDir();

	if (dir) {
		/* set
		 */
		fe_SetTextField(m_textFs[ABDIR_DESCRIPTION], 
						dir->description?dir->description:"");
		fe_SetTextField(m_textFs[ABDIR_LDAPSERVER], 
						dir->serverName?dir->serverName:"");
		fe_SetTextField(m_textFs[ABDIR_SEARCHROOT], 
						dir->searchBase?dir->searchBase:"");
		char tmp[16];
		XP_SAFE_SPRINTF(tmp, sizeof(tmp),
						"%d",
						dir->port);
		fe_SetTextField(m_textFs[ABDIR_PORTNUMBER], 
						tmp);
		
		XP_SAFE_SPRINTF(tmp, sizeof(tmp),
						"%d",
						dir->maxHits);
		fe_SetTextField(m_textFs[ABDIR_MAXHITS], 
						tmp);

		XmToggleButtonSetState(m_toggles[ABDIR_SECUR], dir->isSecure, 
							   FALSE);
		XmToggleButtonSetState(m_toggles[ABDIR_SAVEPASSWD], dir->savePassword,
							   FALSE);		
		XmToggleButtonSetState(m_toggles[ABDIR_USEPASSWD], dir->enableAuth, 
							   TRUE);		
		XtSetSensitive(m_toggles[ABDIR_SAVEPASSWD], dir->enableAuth);

	}/* if */
	else {
		/* clear
		 */
		fe_SetTextField(m_textFs[ABDIR_DESCRIPTION], 
						"");
		fe_SetTextField(m_textFs[ABDIR_LDAPSERVER], 
						"");
		fe_SetTextField(m_textFs[ABDIR_SEARCHROOT], 
						"");
		fe_SetTextField(m_textFs[ABDIR_PORTNUMBER], 
						"");
		fe_SetTextField(m_textFs[ABDIR_MAXHITS], 
						"");

		XmToggleButtonSetState(m_toggles[ABDIR_SECUR], False, FALSE);
		XmToggleButtonSetState(m_toggles[ABDIR_SAVEPASSWD], False, FALSE);	
		XmToggleButtonSetState(m_toggles[ABDIR_USEPASSWD], False, TRUE);
		XtSetSensitive(m_toggles[ABDIR_SAVEPASSWD], False);
	}/* else */
}
コード例 #2
0
void XFE_AddrBookView::abCall()
{
  int count = 0;
  const int *indices = 0;
  m_outliner->getSelection(&indices, &count);
  if (count > 0 && indices) {
#if defined(USE_ABCOM)
#else
	  /* Take the first one 
	   */
	  ABID type;
	  ABID entry;
	  
	  entry = AB_GetEntryIDAt((AddressPane *) m_abPane, (uint32) indices[0]);
    
	  if (entry == MSG_VIEWINDEXNONE) 
		  return;

	  AB_GetType(m_dir, m_AddrBook, entry, &type);
    
	  /* Select
	   */
	  if (type != ABTypePerson)
		  return;
		  
	  char a_line[AB_MAX_STRLEN];
	  a_line[0] = '\0';
	  
	  char cmdstr[AB_MAX_STRLEN];
	  cmdstr[0] = '\0';
	  char *email= NULL;

	  if ((AB_GetEmailAddress(m_dir, m_AddrBook, entry, a_line) != MSG_VIEWINDEXNONE)&&
		  XP_STRLEN(a_line))
		  email = XP_STRDUP(a_line);
	  else {
		  /* Can not call w/o email
		   */
		  // Prompt the user to enter the email address
		  char tmp[128];
		  XP_SAFE_SPRINTF(tmp, sizeof(tmp),
						  "%s",
						  XP_GetString(MK_MSG_CALL_NEEDS_EMAILADDRESS));
		  fe_Message(m_contextData, tmp);
		  return;
	  }/* else */

	  char *coolAddr = NULL;
	  if (AB_GetCoolAddress(m_dir, m_AddrBook, entry, a_line) != MSG_VIEWINDEXNONE)
		  coolAddr = XP_STRDUP(a_line);

	  short use;
	  if (AB_GetUseServer(m_dir, m_AddrBook, entry, &use) == MSG_VIEWINDEXNONE)
		  /* Can't determine which mode; use default
		   */
		  use = kDefaultDLS;

	  if (email && XP_STRLEN(email))
		  fe_showConference(getBaseWidget(), email, use, coolAddr);
	  else {
		  /* prompt user to enter email address for this person
		   */
			  char tmp[128];
			  XP_SAFE_SPRINTF(tmp, sizeof(tmp),
							  "%s",
							  XP_GetString(MK_MSG_CALL_NEEDS_EMAILADDRESS));
			  fe_Message(m_contextData, tmp);

	  }/* else */
	  if (email)
		  XP_FREE((char *) email);
	  if (coolAddr)
		  XP_FREE((char *) coolAddr);
#endif /* USE_ABCOM */
  }/* if */
}
コード例 #3
0
char*
XFE_AddrBookView::getColumnText(int column)
{
  static char a_line[AB_MAX_STRLEN];
  a_line[0] = '\0';
#if defined(USE_ABCOM)
  AB_AttributeValue *value = 0;
  AB_AttribID attrib = AB_attribEntryType;
  XP_Bool isPhone = False;
  switch (column) {
  case OUTLINER_COLUMN_TYPE:
	  break;

  case OUTLINER_COLUMN_NAME:
	  attrib = AB_attribFullName; // shall be AB_attribDisplayName;
	  break;

  case OUTLINER_COLUMN_NICKNAME:
	  attrib = AB_attribNickName;
	  break;
	  
  case OUTLINER_COLUMN_EMAIL:
	  attrib = AB_attribEmailAddress;
	  break;
	  
  case OUTLINER_COLUMN_PHONE:
	  isPhone = True;
	  attrib = AB_attribWorkPhone;
	  break;

  case OUTLINER_COLUMN_COMPANY:
	  attrib = AB_attribCompanyName;
	  break;
	  
  case OUTLINER_COLUMN_LOCALITY:
 	  attrib = AB_attribLocality;
	  break;
	  
  }/* switch () */
  if (attrib != AB_attribEntryType) {
	  int error = AB_GetEntryAttribute(m_containerInfo, m_entryID, 
									   attrib, &value);

	  if (isPhone && 
		  EMPTY_STRVAL(value)) {
		  error = AB_GetEntryAttribute(m_containerInfo, m_entryID, 
									   AB_attribHomePhone, &value);
	  }/* if */
	  XP_SAFE_SPRINTF(a_line, sizeof(a_line),
					  "%s",
					  EMPTY_STRVAL(value)?"":value->u.string);

	  AB_FreeEntryAttributeValue(value);
  }/* if */
#else
  switch (column) {
  case OUTLINER_COLUMN_TYPE:
    break;

  case OUTLINER_COLUMN_NAME:
    AB_GetFullName(m_dir, m_AddrBook, m_entryID, a_line);
    break;

  case OUTLINER_COLUMN_NICKNAME:
    AB_GetNickname(m_dir, m_AddrBook, m_entryID, a_line);
    break;

  case OUTLINER_COLUMN_EMAIL:
    AB_GetEmailAddress(m_dir, m_AddrBook, m_entryID, a_line);
    break;

  case OUTLINER_COLUMN_PHONE:
    AB_GetWorkPhone(m_dir, m_AddrBook, m_entryID, a_line);
	if (!a_line || !XP_STRLEN(a_line)) {
		a_line[0] = '\0';
		AB_GetHomePhone(m_dir, m_AddrBook, m_entryID, a_line);
	}/* if */
    break;

  case OUTLINER_COLUMN_COMPANY:
    AB_GetCompanyName(m_dir, m_AddrBook, m_entryID, a_line);
    break;

  case OUTLINER_COLUMN_LOCALITY:
    AB_GetLocality(m_dir, m_AddrBook, m_entryID, a_line);
    break;

  }/* switch () */
#endif /* !USE_ABCOM */
  return a_line;
}
コード例 #4
0
// tooltips and doc string
char *XFE_AddrBookView::getDocString(CommandType cmd)
{
	uint32 count = 0;
	const int *indices = 0;
	m_outliner->getSelection(&indices, (int *) &count);

	if (count > 0) {
		char *names = 0;
		char a_line[512];
		a_line[0] = '\0';
		int len = 0;
		for (int i=0; i < count && len < 512; i++) {
			/* Take the first one 
			 */
#if defined(USE_ABCOM)
			AB_AttributeValue *value = NULL;
			int error = 
				AB_GetEntryAttributeForPane(m_pane,
											(MSG_ViewIndex) indices[i],
											AB_attribFullName,
											&value);
			XP_ASSERT(value && value->attrib == AB_attribFullName);

			XP_SAFE_SPRINTF(a_line, sizeof(a_line),
							"%s",
							value->u.string?value->u.string:"");
			AB_FreeEntryAttributeValue(value);
#else
			ABID entry;		
			entry = AB_GetEntryIDAt((AddressPane *) m_abPane, 
									(uint32) indices[i]);
			AB_GetFullName(m_dir, m_AddrBook, entry, a_line);
#endif /* USE_ABCOM */
			if (a_line) {
				len += XP_STRLEN(a_line);
				if (i)
					len += 2;

				names = names?
					((char *) XP_REALLOC(names, (len+1)*sizeof(char))):
					((char *) XP_CALLOC(1+len, sizeof(char)));

				if (i)
					names = XP_STRCAT(names, ", ");
				names = XP_STRCAT(names, a_line);			
			}/* if */
		}/* for i */

		char *cstr = 0;
		if (cmd == xfeCmdComposeMessage ||
			cmd == xfeCmdComposeMessageHTML ||
			cmd == xfeCmdComposeMessagePlain) {
			cstr = XP_STRDUP(XP_GetString(XFE_SEND_MSG_TO));	
		} else if (cmd == xfeCmdABCall) {
			cstr = XP_STRDUP(XP_GetString(XFE_PLACE_CONFERENCE_CALL_TO));
		}
		len += XP_STRLEN(cstr);
		cstr = (char *) XP_REALLOC(cstr, (1+len)*sizeof(char));
		cstr = (char *) XP_STRCAT(cstr, names);
		return cstr;
	}/* if */
	return NULL;
}
コード例 #5
0
void XFE_ABNameGenTabView::getDlgValues()
{
#if defined(DEBUG_tao_)
	printf("\n XFE_ABNameGenTabView::getDlgValues \n");
#endif
  XFE_ABNameFolderDlg *dlg = (XFE_ABNameFolderDlg *)getToplevel();
#if defined(USE_ABCOM)
  XFE_PropertySheetView *folderView = (XFE_PropertySheetView *) getParent();
  MSG_Pane *pane = folderView->getPane();

  uint16 numItems = AB_LAST+1;
  AB_AttributeValue *values = 
	  (AB_AttributeValue *) XP_CALLOC(numItems, 
									  sizeof(AB_AttributeValue));
  char *tmp = NULL;

  //
  tmp = fe_GetTextField(m_textFs[AB_FIRST_NAME]);
  values[AB_FIRST_NAME].attrib = AB_attribGivenName;
  if (tmp && strlen(tmp))
	  values[AB_FIRST_NAME].u.string = tmp;
  else
	  values[AB_FIRST_NAME].u.string = XP_STRDUP("");

  //
  tmp = fe_GetTextField(m_textFs[AB_LAST_NAME]);
  values[AB_LAST_NAME].attrib = AB_attribFamilyName;
  if (tmp && strlen(tmp))
	  values[AB_LAST_NAME].u.string = tmp;
  else
	  values[AB_LAST_NAME].u.string = XP_STRDUP("");

  // AB_attribInfo
  tmp = fe_GetTextField(m_notesTxt);
  values[AB_DISPLAY_NAME].attrib = AB_attribInfo;
  if (tmp && strlen(tmp))
	  values[AB_DISPLAY_NAME].u.string = tmp;
  else
	  values[AB_DISPLAY_NAME].u.string = XP_STRDUP("");

  //
  tmp = fe_GetTextField(m_textFs[AB_EMAIL]);
  values[AB_EMAIL].attrib = AB_attribEmailAddress;
  if (tmp && strlen(tmp))
	  values[AB_EMAIL].u.string = tmp;
  else
	  values[AB_EMAIL].u.string = XP_STRDUP("");

  //
  tmp = fe_GetTextField(m_textFs[AB_NICKNAME]);
  values[AB_NICKNAME].attrib = AB_attribNickName;
  if (tmp && strlen(tmp))
	  values[AB_NICKNAME].u.string = tmp;
  else
	  values[AB_NICKNAME].u.string = XP_STRDUP("");

  //
  tmp = fe_GetTextField(m_textFs[AB_TITLE]);
  values[AB_TITLE].attrib = AB_attribTitle;
  if (tmp && strlen(tmp))
	  values[AB_TITLE].u.string = tmp;
  else
	  values[AB_TITLE].u.string = XP_STRDUP("");

  //
  tmp = fe_GetTextField(m_textFs[AB_COMPANY_NAME]);
  values[AB_COMPANY_NAME].attrib = AB_attribCompanyName;
  if (tmp && strlen(tmp))
	  values[AB_COMPANY_NAME].u.string = tmp;
  else
	  values[AB_COMPANY_NAME].u.string = XP_STRDUP("");

  //
  values[AB_LAST].u.boolValue = XmToggleButtonGetState(m_prefHTMLTog);
  values[AB_LAST].attrib = AB_attribHTMLMail;

  //set values 
  int error = AB_SetPersonEntryAttributes(pane, 
										  values, 
										  numItems);
  AB_FreeEntryAttributeValues(values, numItems);

#else
  PersonEntry& entry = dlg->getPersonEntry();

  /* setting up the defaults 
   */
  char *tmp;

  tmp = fe_GetTextField(m_textFs[AB_NICKNAME]);
  if (tmp && strlen(tmp))
	  entry.pNickName = tmp;
  else
	  entry.pNickName = XP_STRDUP("");

  tmp = fe_GetTextField(m_textFs[AB_FIRST_NAME]);
  if (tmp && strlen(tmp))
	  entry.pGivenName = tmp;
  else
	  entry.pGivenName = XP_STRDUP("");

  tmp = fe_GetTextField(m_textFs[AB_LAST_NAME]);
  if (tmp && strlen(tmp))
	  entry.pFamilyName = tmp;
  else
	  entry.pFamilyName = XP_STRDUP("");

  tmp = fe_GetTextField(m_textFs[AB_COMPANY_NAME]);
  if (tmp && strlen(tmp))
	  entry.pCompanyName = tmp;
  else
	  entry.pCompanyName = XP_STRDUP("");

  tmp = fe_GetTextField(m_textFs[AB_TITLE]);
  if (tmp && strlen(tmp))
	  entry.pTitle = tmp;
  else
	  entry.pTitle = XP_STRDUP("");

  tmp = fe_GetTextField(m_textFs[AB_EMAIL]);
  if (tmp && strlen(tmp))
	  entry.pEmailAddress = 
		  fe_GetTextField(m_textFs[AB_EMAIL]);
  else
	  entry.pEmailAddress = XP_STRDUP("");

  tmp = fe_GetTextField(m_notesTxt);
  if (tmp && strlen(tmp))
	  entry.pInfo = tmp;
  else
	  entry.pInfo = XP_STRDUP("");

  entry.HTMLmail = XmToggleButtonGetState(m_prefHTMLTog);
#endif /* USE_ABCOM */

  // set title
  if (tmp = dlg->getFullname()) {
	  char tmp2[AB_MAX_STRLEN];
	  XP_SAFE_SPRINTF(tmp2, sizeof(tmp2),
					  XP_GetString(XFE_AB_NAME_CARD_FOR),
					  tmp);
	  dlg->setCardName(tmp2);
	  XP_FREE((char *) tmp);
  }/* if */
  else 
	  dlg->setCardName(XP_GetString(XFE_AB_NAME_NEW_CARD));
}