⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pickaliaswinc.c

📁 linux下的E_MAIL客户端源码
💻 C
📖 第 1 页 / 共 2 页
字号:
      fieldList.add(val);      VItemC	*item;      if ( i+itemOffset < itemList.size() ) {	 item = itemList[i+itemOffset];	 item->Name(key);	 item->Label(key);      }      else {	 item = new VItemC(key);	 item->AddOpenCallback((CallbackFn *)PickAlias, this);	 itemList.add(item);      }      item->FieldList(fieldList);   } // End for each alias} // End ProcessDict/*--------------------------------------------------------------- *  Callback routine to handle find next */voidPickAliasWinC::DoFindNext(Widget, PickAliasWinC *This, XtPointer){   This->ClearMessage();   char	*cs = XmTextFieldGetString(This->findTF);   StringC	pat(cs);   pat.Trim();   if ( pat.size() == 0 ) {      set_invalid(This->findTF, True, True);      This->PopupMessage("Please enter a search string");      return;   }      Boolean	found = False;   u_int	count = This->aliasBox->VisItems().size();   if ( count > 0 ) {      if ( This->findIndex > count-1 ) This->findIndex = 0;//// Look from the start index to the end of the list//      int	i;      for (i=This->findIndex; !found && i<count; i++) {	 VItemC		*item = This->aliasBox->VisItems()[i];	 StringListC&	fieldList = item->FieldList();	 StringC		*field1 = fieldList[0];	 StringC		*field2 = fieldList[1];	 if ( field1->Contains(pat, IGNORE_CASE) ||	      field2->Contains(pat, IGNORE_CASE) ) {	    This->aliasBox->SelectItemOnly(*item);	    This->fieldView->ScrollToItem(*item);	    This->findIndex = (i + 1) % count;	    found = True;	 }      }//// Look from the beginning of the list to the start index//      for (i=0; !found && i<This->findIndex; i++) {	 VItemC		*item = This->aliasBox->VisItems()[i];	 StringListC&	fieldList = item->FieldList();	 StringC		*field1 = fieldList[0];	 StringC		*field2 = fieldList[1];	 if ( field1->Contains(pat, IGNORE_CASE) ||	      field2->Contains(pat, IGNORE_CASE) ) {	    This->aliasBox->SelectItemOnly(*item);	    This->fieldView->ScrollToItem(*item);	    This->findIndex = (i + 1) % count;	    found = True;	 }      }   } // End if there are items in the list   if ( !found ) {      XBell(halApp->display, ishApp->appPrefs->bellVolume);      This->Message("No match");   }} // End DoFindNext/*--------------------------------------------------------------- *  Callback routine to handle find previous */voidPickAliasWinC::DoFindPrev(Widget, PickAliasWinC *This, XtPointer){   This->ClearMessage();   char	*cs = XmTextFieldGetString(This->findTF);   StringC	pat(cs);   pat.Trim();   if ( pat.size() == 0 ) {      set_invalid(This->findTF, True, True);      This->PopupMessage("Please enter a search string");      return;   }      Boolean	found = False;   u_int	count = This->aliasBox->VisItems().size();   if ( count > 0 ) {      if ( This->findIndex > count-1 ) This->findIndex = 0;//// Look from the start index to the beginning of the list//      int	i;      for (i=This->findIndex; !found && i>=0; i--) {	 VItemC		*item = This->aliasBox->VisItems()[i];	 StringListC&	fieldList = item->FieldList();	 StringC		*field1 = fieldList[0];	 StringC		*field2 = fieldList[1];	 if ( field1->Contains(pat, IGNORE_CASE) ||	      field2->Contains(pat, IGNORE_CASE) ) {	    This->aliasBox->SelectItemOnly(*item);	    This->fieldView->ScrollToItem(*item);	    This->findIndex = i - 1;	    if ( This->findIndex < 0 ) This->findIndex = count - 1;	    found = True;	 }      }//// Look from the end of the list to the start index//      for (i=count-1; !found && i>This->findIndex; i--) {	 VItemC		*item = This->aliasBox->VisItems()[i];	 StringListC&	fieldList = item->FieldList();	 StringC		*field1 = fieldList[0];	 StringC		*field2 = fieldList[1];	 if ( field1->Contains(pat, IGNORE_CASE) ||	      field2->Contains(pat, IGNORE_CASE) ) {	    This->aliasBox->SelectItemOnly(*item);	    This->fieldView->ScrollToItem(*item);	    This->findIndex = i - 1;	    if ( This->findIndex < 0 ) This->findIndex = count - 1;	    found = True;	 }      }   } // End if there are items in the list   if ( !found ) {      XBell(halApp->display, ishApp->appPrefs->bellVolume);      This->Message("No match");   }} // End DoFindNext/*--------------------------------------------------------------- *  Callback routine to handle find all */voidPickAliasWinC::DoFindAll(Widget, PickAliasWinC *This, XtPointer){   This->ClearMessage();   char	*cs = XmTextFieldGetString(This->findTF);   StringC	pat(cs);   pat.Trim();   if ( pat.size() == 0 ) {      set_invalid(This->findTF, True, True);      This->PopupMessage("Please enter a search string");      return;   }   //// Look through the list, selecting all matches//   VItemC	*first = NULL;   u_int	count = This->aliasBox->VisItems().size();   for (int i=0; i<count; i++) {      VItemC		*item = This->aliasBox->VisItems()[i];      StringListC&	fieldList = item->FieldList();      StringC		*field1 = fieldList[0];      StringC		*field2 = fieldList[1];      if ( field1->Contains(pat, IGNORE_CASE) ||	   field2->Contains(pat, IGNORE_CASE) ) {	 This->aliasBox->SelectItem(*item);	 if ( !first ) first = item;      }   }   if ( first ) This->fieldView->ScrollToItem(*first);   This->aliasBox->Refresh();   if ( !first ) {      XBell(halApp->display, ishApp->appPrefs->bellVolume);      This->Message("No match");   }} // End DoFindAll/*--------------------------------------------------------------- *  Callback routine to handle selection of items */voidPickAliasWinC::ChangeSelection(VBoxC *vb, PickAliasWinC *This){   unsigned	scount = vb->SelItems().size();//// Update buttons sensitivities based on number of selected items//   XtSetSensitive(This->okPB,    scount>0);   XtSetSensitive(This->applyPB, scount>0);} // End ChangeSelection/*--------------------------------------------------------------- *  Callback to handle double-click on entry item */voidPickAliasWinC::PickAlias(VItemC *item, PickAliasWinC *This){   This->aliasBox->SelectItemOnly(*item, True);   DoOk(NULL, This, NULL);}/*--------------------------------------------------------------- *  Callback routine to handle initial display. */voidPickAliasWinC::DoPopup(Widget, PickAliasWinC *This, XtPointer){   This->aliasBox->ViewType(This->viewType);}/*--------------------------------------------------------------- *  Callback to handle ok */voidPickAliasWinC::DoOk(Widget, PickAliasWinC *This, XtPointer){   This->DoApply(NULL, This, NULL);   This->Hide();}/*--------------------------------------------------------------- *  Callback to handle apply */voidPickAliasWinC::DoApply(Widget, PickAliasWinC *This, XtPointer){//// Build list of aliases//   This->aliasList.removeAll();   StringC	name;   Boolean	expand = XmToggleButtonGetState(This->expandTB);   VItemListC&	list = This->aliasBox->SelItems();   u_int	count = list.size();   for (int i=0; i<count; i++) {      VItemC	*item = list[i];      if ( expand ) {	 name = ishApp->aliasPrefs->ExpandAddress(item->Name(), 1);	 This->aliasList.add(name);      }      else	 This->aliasList.add(item->Name());   }//// Tell user they're ready//   This->applyCall(This);} // End DoApply/*------------------------------------------------------------------------ * Method to compare two aliases */intPickAliasWinC::AliasCompare(const void *a, const void *b){   VItemC	*via = *(VItemC **)a;   VItemC	*vib = *(VItemC **)b;   return via->Name().compare(vib->Name());} // End AliasCompare

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -