Ejemplo n.º 1
0
void
XFE_LdapSearchView::handleClose()
{
  /* hide the frame for now*/
  getToplevel()->notifyInterested(XFE_LdapSearchView::CloseLdap);
  //XtDestroyWidget(obj->getToplevel()->getBaseWidget());
}
Ejemplo n.º 2
0
void XFE_AddrBookView::abVCard()
{
	// Need to check if the user has created a card 
	XFE_GlobalPrefs    *prefs = &fe_globalPrefs;

	PersonEntry  person;
	ABook       *addr_book = fe_GetABook(0);
	DIR_Server  *dir;
	ABID         entry_id;

	person.Initialize();
	person.pGivenName = ((prefs->real_name) && 
						 (XP_STRLEN(prefs->real_name) > 0)) ?
		                 XP_STRDUP(prefs->real_name) : 0;
	person.pEmailAddress = ((prefs->email_address) && 
							(XP_STRLEN(prefs->email_address) > 0)) ?
		                    XP_STRDUP(prefs->email_address) : 0;
  
	DIR_GetPersonalAddressBook(m_directories, &dir);

	if (dir) {
		AB_GetEntryIDForPerson(dir, addr_book, &entry_id, &person);
		fe_showABCardPropertyDlg(getToplevel()->getBaseWidget(), 
								 m_contextData,
								 entry_id,
								 (MSG_MESSAGEIDNONE != entry_id)?FALSE:TRUE);
	}
	person.CleanUp();

}
Ejemplo n.º 3
0
// Override
void
XFE_LdapSearchView::changeScope ()
{
  // Should do nothing because the scope should always be LdapDirectory 
  m_dir = getDirServer();
  getToplevel()->notifyInterested( XFE_MNSearchView::scopeChanged, m_dir);
}
Ejemplo n.º 4
0
void XFE_ABDirListView::doubleClickBody(const OutlineButtonFuncData *data)
{
#if defined(USE_ABCOM)
	int count = 0;
	const int *indices = 0;
	m_outliner->getSelection(&indices, &count);

	int error = 
		AB_CommandAB2(m_pane, 
					  AB_PropertiesCmd,
					  (MSG_ViewIndex *) indices,
					  (int32) count);
#else
	/* get dir
	 */
	DIR_Server *dir = 
		(DIR_Server *) XP_ListGetObjectNum(m_directories, 
										   data->row+1);

	fe_showABDirPropertyDlg(getToplevel()->getBaseWidget(),
							m_contextData,
							dir,
							&(XFE_ABDirListView::propertyCallback),
							this);
#endif /* USE_ABCOM */
}
Ejemplo n.º 5
0
void
XFE_MNBanner::setShowFolder(XP_Bool show)
{
  unsigned char arrowDir;

  if (!m_arrowButton )
  {
		m_arrowButton =   XtVaCreateManagedWidget("arrowb",
                                     xmArrowButtonWidgetClass,
                                     m_form,
                                     XmNleftAttachment, XmATTACH_FORM,
                                     XmNtopAttachment, XmATTACH_FORM,
                                     XmNbottomAttachment, XmATTACH_FORM,
                                     XmNrightAttachment, XmATTACH_NONE,
                                     XmNarrowDirection, (show? XmARROW_DOWN : XmARROW_RIGHT),
                                     XmNshadowThickness, 0,
                                     NULL);
		XtAddCallback(m_arrowButton, XmNactivateCallback, showFolderBtnCB, this );

		getToplevel()->registerInterest(XFE_ThreePaneView::ShowFolder, this,
			(XFE_FunctionNotification)showFolder_cb);

  }
  else 
  {
     XtVaGetValues(m_arrowButton, XmNarrowDirection, &arrowDir, NULL);

     if ( (arrowDir == XmARROW_DOWN)  && !show)
	XtVaSetValues(m_arrowButton, XmNarrowDirection, XmARROW_RIGHT, NULL);
     else if ( (arrowDir == XmARROW_RIGHT) && show)
	XtVaSetValues(m_arrowButton, XmNarrowDirection, XmARROW_DOWN, NULL);
   }
}
Ejemplo n.º 6
0
// This shows a question dialog box response can be (YES/NO/CANCEL)
gint
showAskingBox(const std::string& message,
	      GtkMessageType type,
              const GtkButtonsType buttonsType,
              GtkWidget* transient_widget)
{
  GtkWidget *dialog;
  GtkWindow *transient_parent(NULL);

  // Make transient if necessary
  if (transient_widget)
  {
    GtkWidget *toplevel = getToplevel(transient_widget);
    if (toplevel && GTK_IS_WINDOW (toplevel) && GTK_WIDGET_MAPPED (toplevel))
        transient_parent=GTK_WINDOW(toplevel);
  }

  dialog = gtk_message_dialog_new (transient_parent,
				   GTK_DIALOG_MODAL,
				   type,
				   buttonsType,
				   "%s", message.c_str());
  //gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_OK);
  gtk_window_set_position(GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);

  // Suspend AReVi Scheduler
  gint result=runModalBox(dialog);
  gtk_widget_destroy (dialog);

  return result;
}
Ejemplo n.º 7
0
//----------------------------- Messages -------------------------------------
// This shows a simple dialog box with a label and an 'OK' button.
void
showMessageBox(const std::string &message,
                GtkMessageType type/*=GTK_MESSAGE_ERROR*/,
                GtkWidget *transient_widget/*=NULL*/)
{
  GtkWidget* dialog;
  GtkWindow* transientParent = NULL;

  // Make transient if necessary
  if(transient_widget) {
    GtkWidget* toplevel = getToplevel(transient_widget);
    if(toplevel                   && 
       GTK_IS_WINDOW(toplevel)    && 
       GTK_WIDGET_MAPPED(toplevel))
      transientParent = GTK_WINDOW(toplevel);
  }

  dialog = gtk_message_dialog_new(transientParent,
				  GTK_DIALOG_MODAL,
				  type,
				  GTK_BUTTONS_OK,
				  "%s", message.c_str());

  gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
  gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);

  runModalBox(dialog);
  gtk_widget_destroy(dialog);
}
Ejemplo n.º 8
0
//------------------------- Color Selection -----------------------------------
// Open Dlg for color selection return true, if color changed
bool
showColorBox(const std::string &title,
             GdkColor &colorInOut,
             GtkWidget *transient_widget/*=NULL*/)
{
  GtkWidget *dialog;
  GtkColorSelection *colorsel;
  gint response;

  dialog = gtk_color_selection_dialog_new (title.c_str());

  // Make transient if necessary
  if (transient_widget)
  {
    GtkWidget *toplevel = getToplevel(transient_widget);
    if (toplevel && GTK_IS_WINDOW (toplevel) && GTK_WIDGET_MAPPED (toplevel))
        gtk_window_set_transient_for (GTK_WINDOW (dialog),
                                      GTK_WINDOW (toplevel));
  }

  colorsel = GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG (dialog)->colorsel);

  gtk_color_selection_set_previous_color (colorsel, &colorInOut);
  gtk_color_selection_set_current_color (colorsel, &colorInOut);
  gtk_color_selection_set_has_palette (colorsel, TRUE);

  response = runModalBox(dialog);

  if (response == GTK_RESPONSE_OK)
  {
    gtk_color_selection_get_current_color (colorsel,&colorInOut);
  }
  gtk_widget_destroy (dialog);
  return (response == GTK_RESPONSE_OK);
}
Ejemplo n.º 9
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 */
}
Ejemplo n.º 10
0
// update UI in response to selection change
void XFE_ComposeAttachFolderView::updateSelectionUI()
{
    // take Motif 'active' status away from Subject/text area so
    // that xfeCmdDelete gets routed appropriately.
    if (getBaseWidget())
        _XmSetDestination(XtDisplay(getBaseWidget()),NULL);

    // update Delete menu entry
    getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating);
}
Ejemplo n.º 11
0
void XFE_ABDirListView::Buttonfunc(const OutlineButtonFuncData *data)
{
  int row = data->row, 
      clicks = data->clicks;

  // focus
  notifyInterested(XFE_MNListView::changeFocus, this);

  if (row < 0) {
	  clickHeader(data);
	  return;
  } 
  else {
	  /* content row 
	   */
	  if (clicks == 2) {
		  m_outliner->selectItemExclusive(data->row);
		  doubleClickBody(data);
	  }/* clicks == 2 */
	  else if (clicks == 1) {
		  if (data->ctrl) {
				  m_outliner->toggleSelected(data->row);
		  }
		  else if (data->shift) {
			  // select the range.
			  const int *selected;
			  int count;
  
			  m_outliner->getSelection(&selected, &count);
			  
			  if (count == 0) { /* there wasn't anything selected yet. */
				  m_outliner->selectItemExclusive(data->row);
			  }/* if count == 0 */
			  else if (count == 1) {
				  /* there was only one, so we select the range from
					 that item to the new one. */
				  m_outliner->selectRangeByIndices(selected[0], data->row);
			  }/* count == 1 */
			  else {
				  /* we had a range of items selected, 
				   * so let's do something really
				   * nice with them. */
				  m_outliner->trimOrExpandSelection(data->row);
			  }/* else */
		  }/* if */
		  else {
			  m_outliner->selectItemExclusive(data->row);
			  selectLine(data->row);
		  }/* else */

		  getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating);
	  }/* clicks == 1 */
  }/* else */

}
Ejemplo n.º 12
0
static GdkVisual* getVisual(Widget* widget)
{
    GtkWidget* container = widget ? GTK_WIDGET(widget->root()->hostWindow()->platformPageClient()) : 0;
    if (!container) {
        GdkScreen* screen = gdk_screen_get_default();
        return screen ? gdk_screen_get_system_visual(screen) : 0;
    }

    if (!gtk_widget_get_realized(container))
        container = getToplevel(container);
    return container ? gdk_window_get_visual(gtk_widget_get_window(container)) : 0;
}
Ejemplo n.º 13
0
void
XFE_LdapSearchView::buildResultTable()
{
  int num_columns =  5;
  int visible_num_columns =  4;
  static int column_widths[] = {10, 20, 20, 10, 10};
  m_outliner = new XFE_Outliner("addressList",
                                this,
                                getToplevel(),
                                m_result.container,
                                False, // constantSize
                                True,  // hasHeadings
                                num_columns,
                                visible_num_columns,
                                column_widths,
								OUTLINER_GEOMETRY_PREF);

  Pixel bg;
  XtVaGetValues(m_outliner->getBaseWidget(), XmNbackground, &bg, 0);
  if (!m_personIcon.pixmap)
      fe_NewMakeIcon(getToplevel()->getBaseWidget(),
		     BlackPixelOfScreen(XtScreen(m_outliner->getBaseWidget())),
		     bg,
		     &m_personIcon,
		     NULL, 
		     MN_Person.width, 
		     MN_Person.height,
		     MN_Person.mono_bits, 
		     MN_Person.color_bits, 
		     MN_Person.mask_bits, 
		     FALSE);
  m_outliner->setMultiSelectAllowed(True);

#if !defined(USE_MOTIF_DND)
  m_outliner->setDragType(FE_DND_LDAP_ENTRY, &m_personIcon, this);
#endif /* USE_MOTIF_DND */

  m_outliner->setHideColumnsAllowed(True);

}
Ejemplo n.º 14
0
void 
XFE_ABDirGenTabView::getDlgValues()
{
	XFE_ABDirPropertyDlg *dlg = (XFE_ABDirPropertyDlg *)getToplevel();
	DIR_Server *dir = dlg->getDir();

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

	tmp = fe_GetTextField(m_textFs[ABDIR_DESCRIPTION]);
	if (tmp && strlen(tmp))
		dir->description = tmp;
	else
		dir->description = NULL;

	tmp = fe_GetTextField(m_textFs[ABDIR_LDAPSERVER]);
	if (tmp && strlen(tmp))
		dir->serverName = tmp;
	else
		dir->serverName = NULL;

	tmp = fe_GetTextField(m_textFs[ABDIR_SEARCHROOT]);
	if (tmp && strlen(tmp))
		dir->searchBase = tmp;
	else
		dir->searchBase = NULL;


	tmp = fe_GetTextField(m_textFs[ABDIR_PORTNUMBER]);
	if (tmp && strlen(tmp))
		sscanf(tmp, "%d", &(dir->port));
	else
		dir->port = 0;


	tmp = fe_GetTextField(m_textFs[ABDIR_MAXHITS]);
	if (tmp && strlen(tmp))
		sscanf(tmp, "%d", &(dir->maxHits));
	else
		dir->maxHits = 0;

	dir->isSecure = XmToggleButtonGetState(m_toggles[ABDIR_SECUR]);
	dir->enableAuth = XmToggleButtonGetState(m_toggles[ABDIR_USEPASSWD]);
	dir->savePassword = XmToggleButtonGetState(m_toggles[ABDIR_SAVEPASSWD]);
}
Ejemplo n.º 15
0
ANetNodeInstance * NetworkSetup::findNext( ANetNodeInstance * NNI ) {
    ANetNodeInstance * NNNI;

    if( ! NNI )
      getToplevel();

    for( QListIterator<ANetNodeInstance> it(*this);
         it.current();
         ++it ) {
      NNNI = it.current();
      if( NNNI == NNI ) {
        ++it;
        return it.current();
      }
    }
    return 0; // no more next
}
Ejemplo n.º 16
0
QPixmap NetworkSetup::devicePixmap( void ) {
    QPixmap pm = NSResources->getPixmap(
            getToplevel()->nextNode()->pixmapName()+"-large");

    QPixmap Mini = NSResources->getPixmap(
            device()->netNode()->pixmapName() );

    if( pm.isNull() || Mini.isNull() )
	return Resource::loadPixmap("Unknown");

    QPainter painter( &pm );
    painter.drawPixmap( pm.width()-Mini.width(),
                        pm.height()-Mini.height(),
                        Mini );
    pm.setMask( pm.createHeuristicMask( TRUE ) );
    return pm;
}
Ejemplo n.º 17
0
FloatRect screenRect(Widget* widget)
{
    GtkWidget* container = widget ? GTK_WIDGET(widget->root()->hostWindow()->platformPageClient()) : 0;
    if (container)
        container = getToplevel(container);

    GdkScreen* screen = container ? getScreen(container) : gdk_screen_get_default();
    if (!screen)
        return FloatRect();

    gint monitor = container ? gdk_screen_get_monitor_at_window(screen, gtk_widget_get_window(container)) : 0;

    GdkRectangle geometry;
    gdk_screen_get_monitor_geometry(screen, monitor, &geometry);

    return FloatRect(geometry.x, geometry.y, geometry.width, geometry.height);
}
Ejemplo n.º 18
0
void
XFE_ABDirListView::propertiesCB()
{
  int count = 0;
  const int *indices = 0;
  m_outliner->getSelection(&indices, &count);
  if (count > 0 && indices) {
	  DIR_Server *dir = 
		  (DIR_Server *) XP_ListGetObjectNum(m_directories, 
											 indices[0]+1);
	  fe_showABDirPropertyDlg(getToplevel()->getBaseWidget(),
							  m_contextData,
							  dir,
							  &(XFE_ABDirListView::propertyCallback),
							  this);
  }/* if */
}
Ejemplo n.º 19
0
void XFE_ABDirListView::propertyCB(DIR_Server *dir)
{	
	int which = XP_ListGetNumFromObject(m_directories, dir);
#if defined(DEBUG_tao)
	printf("\nXFE_ABDirListView::propertyCB=%d\n", which);
#endif
	if (!which) {
		/* new
		 */
		const int *selected;
		int count;		
		m_outliner->getSelection(&selected, &count);
		int pos = 0;
		if (m_nDirs > 0 && count && selected) {
			// Insert dir at position
			pos = selected[0];
			DIR_Server *prev_dir;
			prev_dir = (DIR_Server*)XP_ListGetObjectNum(m_directories,
														pos+1);
			XP_ListInsertObjectAfter(m_directories, prev_dir, dir);
			pos = pos+1;
		}
		else {
			XP_ListAddObjectToEnd(m_directories, dir);
			pos = m_nDirs+1;
		}
			
		// Repaint 
		m_nDirs = XP_ListCount(m_directories);
		m_outliner->change(0, m_nDirs, m_nDirs);
		// Set selection
		m_outliner->selectItemExclusive(pos);
		notifyInterested(XFE_ABDirListView::dirSelect, (void *) dir);
	}/* if */
	else
		m_outliner->invalidateLine(which);
		
	DIR_SaveServerPreferences(m_directories);
	if (m_deleted_directories) {
		DIR_CleanUpServerPreferences(m_deleted_directories);
		m_deleted_directories = NULL;
	}/* if */

	getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating);
}
Ejemplo n.º 20
0
void 
XFE_LdapSearchView::doubleClick(const OutlineButtonFuncData *data)
{
   MSG_ViewIndex index;
   MSG_ResultElement *elem = NULL;
   // Do nothing
   if (data->clicks == 2 )
   {
	m_outliner->selectItemExclusive(data->row);
	toggleActionButtonState(True);
	index = (MSG_ViewIndex)(data->row);
        MSG_GetResultElement(getPane(), index, &elem );

	// Always create a new frame for each result
	m_browserFrame = new XFE_BrowserFrame(
			XtParent(getToplevel()->getBaseWidget()), 
			   ViewGlue_getFrame(m_contextData), NULL);
        m_searchpane = ((XFE_MsgView*)(m_browserFrame->getView()))->getPane();
        MSG_OpenResultElement(elem, m_browserFrame->getContext());
	m_browserFrame->show();
   }
}
Ejemplo n.º 21
0
// Override
void
XFE_LdapSearchView::buildHeaderOption()
{
  Cardinal ac;
  Arg av[20];
  Widget popupW;
  Dimension width, height;

  ac = 0;
  m_rules.searchLabel = XmCreateLabelGadget(m_header,
                                "ldapSearchFolderLabel", av, ac);
  m_rules.scopeOptW = fe_make_option_menu(getToplevel()->getBaseWidget(),
                        m_header, "ldapSearchScopeOpt", &popupW);

  // Add folders...
  addDefaultFolders();
  fe_get_option_size ( m_rules.scopeOptW, &width, &height);

  ac = 0;
  m_rules.whereLabel = XmCreateLabelGadget(m_header, "where", av, ac);
  XtVaSetValues(m_rules.searchLabel, XmNheight, height, 0 );
  XtVaSetValues(m_rules.whereLabel, XmNheight, height, 0 );
}
Ejemplo n.º 22
0
void Widget::grabFocus()
{
  Toplevel *tl = getToplevel();
  if (tl)
    tl->setFocussed(this);
}
Ejemplo n.º 23
0
void
XFE_MNBanner::showFolderBtn()
{
  getToplevel()->notifyInterested(XFE_MNBanner::twoPaneView);
}
Ejemplo n.º 24
0
XFE_FolderDropdown::XFE_FolderDropdown(XFE_Component *toplevel_component,
									   Widget parent,
									   XP_Bool allowServerSelection,
									   XP_Bool showNewsgroups,
									   XP_Bool boldWithNew)
	: XFE_Component(toplevel_component)
{
	m_popupServer = True;

	Widget combo;
	Colormap cmap;
	Cardinal depth;
	Visual *v;

	XtVaGetValues(getToplevel()->getBaseWidget(),
				  XmNvisual, &v,
				  XmNcolormap, &cmap,
				  XmNdepth, &depth,
				  NULL);

	m_allowServerSelection = allowServerSelection;
	m_showNewsgroups = showNewsgroups;
	m_boldWithNew = boldWithNew;
	m_foldersHaveChanged = FALSE;

	combo = XtVaCreateWidget("folderDropdown",
							 dtComboBoxWidgetClass,
							 parent,
							 XmNshadowThickness, 1,
							 XmNmarginWidth, 0,
							 XmNmarginHeight, 0,
							 XmNarrowType, XmMOTIF,
							 XmNtype, XmDROP_DOWN_LIST_BOX,
							 XmNcolumns, 30,
							 XmNvisibleItemCount, 20,
							 XmNvisual, v,
							 XmNcolormap, cmap,
							 XmNdepth, depth,
							 NULL);

	m_lastSelectedPosition = 0;
	m_numNewsHosts = 0;
	m_numinfos = 0;
	m_infos = 0;

	XFE_MozillaApp::theApp()->registerInterest(XFE_MNView::foldersHaveChanged,
											   this,
											   (XFE_FunctionNotification)rebuildFolderDropdown_cb);
	XFE_MozillaApp::theApp()->registerInterest(XFE_MNView::newsgroupsHaveChanged,
											   this,
											   (XFE_FunctionNotification)rebuildFolderDropdown_cb);
	if (m_boldWithNew)
		XFE_MozillaApp::theApp()->registerInterest(XFE_MNView::folderChromeNeedsUpdating,
												   this,
												   (XFE_FunctionNotification)boldFolderInfo_cb);

	XtAddCallback(combo, XmNselectionCallback, folderSelect_cb, this);
	XtAddCallback(combo, XmNmenuPostCallback, folderMenuPost_cb, this);

	setBaseWidget(combo);
	installDestroyHandler();

	resyncDropdown();
}
Ejemplo n.º 25
0
XFE_ABDirListView::XFE_ABDirListView(XFE_Component *toplevel_component,
									 Widget         parent, 
									 XFE_View      *parent_view, 
									 MWContext     *context,
									 XP_List       *directories):
	XFE_MNListView(toplevel_component, 
				   parent_view,
				   context, 
				   (MSG_Pane *)NULL),
#if !defined(USE_ABCOM)
	m_directories(directories)
#else
	m_containerLine(NULL),
	m_activeContainer(NULL)
#endif /* USE_ABCOM */
{
	/* initialize 
	 */
	m_dir = 0;
	m_dirLine = 0;
	m_ancestorInfo = 0;
	m_deleted_directories = NULL;

	/* For outliner
	 */
	int num_columns = OUTLINER_COLUMN_LAST;
	static int column_widths[] = {23};
	m_outliner = new XFE_Outliner("dirList",
								  this,
								  toplevel_component,
								  parent,
								  False, // constantSize
								  True,  // hasHeadings
								  num_columns,
								  num_columns,// num_visible 
								  column_widths,
								  AB_DIR_OUTLINER_GEOMETRY_PREF);
	m_outliner->setHideColumnsAllowed(False);
	m_outliner->setPipeColumn(OUTLINER_COLUMN_NAME);

	/* BEGIN_3P: XmLGrid
	 */
	XtVaSetValues(m_outliner->getBaseWidget(),
				  XtVaTypedArg, XmNblankBackground, XmRString, "white", 6,
				  // XmNselectionPolicy, XmSELECT_MULTIPLE_ROW,
				  XmNvisibleRows, 15,
				  NULL);
	XtVaSetValues(m_outliner->getBaseWidget(),
				  XmNcellDefaults, True,
				  XtVaTypedArg, XmNcellBackground, XmRString, "white", 6,
				  NULL);
	/* END_3P: XmLGrid
	 */

#if defined(USE_ABCOM)
	// todo: check return val
	int error = AB_CreateContainerPane(&m_pane,
									   context,
									   fe_getMNMaster());


	error = 
		AB_SetShowPropertySheetForDirFunc(m_pane, 
		   &XFE_ABDirListView::ShowPropertySheetForDirFunc);

	error = AB_InitializeContainerPane(m_pane);
	m_nDirs = MSG_GetNumLines(m_pane);
#if defined(DEBUG_tao)
	printf("\n MSG_GetNumLines, m_nDirs=%d\n", m_nDirs);
#endif

#else
	/* XFE_Outliner constructor does not allocate any content row
	 * XFE_Outliner::change(int first, int length, int newnumrows)
	 */
	if (directories) {
		m_nDirs = XP_ListCount(directories);
	}/* if */
#endif /* USE_ABCOM */

	m_outliner->change(0, m_nDirs, m_nDirs);
	m_outliner->show();
	if (m_nDirs)
		m_outliner->selectItemExclusive(0);
	setBaseWidget(m_outliner->getBaseWidget());
    XtVaSetValues(getBaseWidget(),
                  XmNpaneMinimum, 1,
                  XmNpaneMaximum, 10000,
                  NULL);
	/* initialize the icons if they haven't already been
	 */
	Pixel bg_pixel;
	XtVaGetValues(m_outliner->getBaseWidget(), XmNbackground, &bg_pixel, 0);

	if (!m_openParentIcon.pixmap)
		fe_NewMakeIcon(getToplevel()->getBaseWidget(),
					   /* umm. fix me
						*/
					   BlackPixelOfScreen(XtScreen(m_outliner->getBaseWidget())),
					   bg_pixel,
					   &m_openParentIcon,
					   NULL, 
					   oparent.width, 
					   oparent.height,
					   oparent.mono_bits, 
					   oparent.color_bits, 
					   oparent.mask_bits, 
					   FALSE);
  
	if (!m_closedParentIcon.pixmap)
		fe_NewMakeIcon(getToplevel()->getBaseWidget(),
					   /* umm. fix me
						*/
					   BlackPixelOfScreen(XtScreen(m_outliner->getBaseWidget())),
					   bg_pixel,
					   &m_closedParentIcon,
					   NULL, 
					   cparent.width, 
					   cparent.height,
					   cparent.mono_bits, 
					   cparent.color_bits, 
					   cparent.mask_bits, 
					   FALSE);
  

	if (!m_pabIcon.pixmap)
		fe_NewMakeIcon(getToplevel()->getBaseWidget(),
					   /* umm. fix me
						*/
					   BlackPixelOfScreen(XtScreen(m_outliner->getBaseWidget())),
					   bg_pixel,
					   &m_pabIcon,
					   NULL, 
					   MNC_AddressSmall.width, 
					   MNC_AddressSmall.height,
					   MNC_AddressSmall.mono_bits, 
					   MNC_AddressSmall.color_bits, 
					   MNC_AddressSmall.mask_bits, 
					   FALSE);
  

	if (!m_ldapDirIcon.pixmap)
		fe_NewMakeIcon(getToplevel()->getBaseWidget(),
					   /* umm. fix me
						*/
					   BlackPixelOfScreen(XtScreen(m_outliner->getBaseWidget())),
					   bg_pixel,
					   &m_ldapDirIcon,
					   NULL, 
					   MN_FolderServer.width, 
					   MN_FolderServer.height,
					   MN_FolderServer.mono_bits, 
					   MN_FolderServer.color_bits, 
					   MN_FolderServer.mask_bits, 
					   FALSE);
  

	if (!m_mListIcon.pixmap)
		fe_NewMakeIcon(getToplevel()->getBaseWidget(),
					   /* umm. fix me
						*/
					   BlackPixelOfScreen(XtScreen(m_outliner->getBaseWidget())),
					   bg_pixel,
					   &m_mListIcon,
					   NULL, 
					   MN_People.width, 
					   MN_People.height,
					   MN_People.mono_bits, 
					   MN_People.color_bits, 
					   MN_People.mask_bits, 
					   FALSE);
  

}

XFE_ABDirListView::~XFE_ABDirListView()
{
}

#if defined(USE_ABCOM)
int
XFE_ABDirListView::ShowPropertySheetForDirFunc(DIR_Server *server, 
											   MWContext  *context, 
											   MSG_Pane   *pane,
											   XP_Bool     newDirectory)
{
#if defined(DEBUG_tao)
	printf("\n XFE_ABDirListView::ShowPropertySheetForDirFunc, newDirectory=%d\n",
		   newDirectory);
#endif
	XFE_ABDirPropertyDlg* Dlg = 
		new XFE_ABDirPropertyDlg(CONTEXT_WIDGET(context),
								 "abDirProperties", 
								 True, 
								 context);
	Dlg->setDlgValues(server);
	Dlg->setPane(pane);
	Dlg->show();
	return 1;
}
Ejemplo n.º 26
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));
}
Ejemplo n.º 27
0
void XFE_ABNameGenTabView::setDlgValues()
{
  /* Get mode, entryid, and ab_view
   */
  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+2;
  AB_AttribID * attribs = (AB_AttribID *) XP_CALLOC(numItems, 
													sizeof(AB_AttribID));
  attribs[AB_FIRST_NAME] = AB_attribGivenName;
  attribs[AB_LAST_NAME] = AB_attribFamilyName;
  attribs[AB_DISPLAY_NAME] = AB_attribDisplayName;
  attribs[AB_EMAIL] = AB_attribEmailAddress;
  attribs[AB_NICKNAME] = AB_attribNickName;
  attribs[AB_TITLE] = AB_attribTitle;
  attribs[AB_COMPANY_NAME] = AB_attribCompanyName;
  attribs[AB_LAST] = AB_attribInfo;
  attribs[AB_LAST+1] = AB_attribHTMLMail;

  AB_AttributeValue *values = NULL;
  int error = AB_GetPersonEntryAttributes(pane, 
										  attribs,
										  &values, 
										  &numItems);
  char *tmp = NULL;
  for (int i=0; i < numItems; i++) {
	  switch (values[i].attrib) {
	  case AB_attribGivenName:
		  tmp = values[i].u.string;
		  fe_SetTextField(m_textFs[AB_FIRST_NAME], 
						  tmp?tmp:"");
		  break;

	  case AB_attribFamilyName:
		  tmp = values[i].u.string;
		  fe_SetTextField(m_textFs[AB_LAST_NAME], 
					  tmp?tmp:"");
		  break;
		  
	  case AB_attribDisplayName:
		  tmp = values[i].u.string;
		  fe_SetTextField(m_textFs[AB_DISPLAY_NAME], 
						  tmp?tmp:"");
		  break;
		  
	  case AB_attribEmailAddress:
		  tmp = values[i].u.string;
		  fe_SetTextField(m_textFs[AB_EMAIL], 
						  tmp?tmp:"");
		  break;
		  
	  case AB_attribNickName:
		  tmp = values[i].u.string;
		  fe_SetTextField(m_textFs[AB_NICKNAME], 
						  tmp?tmp:"");
		  break;

	  case AB_attribTitle:
		  tmp = values[i].u.string;
		  fe_SetTextField(m_textFs[AB_TITLE], 
						  tmp?tmp:"");
		  break;
		  
	  case AB_attribCompanyName:
		  tmp = values[i].u.string;
		  fe_SetTextField(m_textFs[AB_COMPANY_NAME], 
						  tmp?tmp:"");
		  break;
		  
	  case AB_attribInfo:
		  // AB_attribInfo
		  tmp = values[i].u.string;
		  fe_SetTextField(m_notesTxt, 
						  tmp?tmp:"");
		  break;
		  
	  case AB_attribHTMLMail:
		  XmToggleButtonSetState(m_prefHTMLTog, 
								 values[i].u.boolValue, FALSE);
		  break;
		  
	  }/* switch */
  }/* for i */

  XP_FREEIF(attribs);
  AB_FreeEntryAttributeValues(values, numItems);

#else
  PersonEntry& entry = dlg->getPersonEntry();
  fe_SetTextField(m_textFs[AB_FIRST_NAME], 
		entry.pGivenName?entry.pGivenName:"");
  fe_SetTextField(m_textFs[AB_LAST_NAME], 
		entry.pFamilyName?entry.pFamilyName:"");
  fe_SetTextField(m_textFs[AB_COMPANY_NAME], 
		entry.pCompanyName?entry.pCompanyName:"");
  fe_SetTextField(m_textFs[AB_TITLE], entry.pTitle?entry.pTitle:"");
  fe_SetTextField(m_textFs[AB_EMAIL], 
		entry.pEmailAddress?entry.pEmailAddress:"");
  fe_SetTextField(m_textFs[AB_NICKNAME], entry.pNickName?entry.pNickName:"");
  fe_SetTextField(m_notesTxt, entry.pInfo?entry.pInfo:""); 
  XmToggleButtonSetState(m_prefHTMLTog, entry.HTMLmail, FALSE);
#endif /* USE_ABCOM */
}
Ejemplo n.º 28
0
QString NetworkSetup::setState( Action_t A, bool Force ) {

    QString msg;
    Action_t Actions[10];
    int NoOfActions = 0;

    // get current state
    state( Force );

    switch( A ) {
      case Disable :
        /*
        if( CurrentState < Disabled ) {
          // disabled
          CurrentState = Disabled;
          return QString();
        }
        */

        if( CurrentState == IsUp ) {
          Actions[NoOfActions++] = Down;
          Actions[NoOfActions++] = Deactivate;
        } else if( CurrentState == Available ) {
          Actions[NoOfActions++] = Deactivate;
        }
        Actions[NoOfActions++] = Disable;
        break;
      case Enable :
        // always possible -> detected state is new state
        Actions[NoOfActions++] = Enable;
        break;
      case Activate :
        if( ! Force ) {
          if( CurrentState >= Available ) {
            // already available
            return QString();
          }

          if( CurrentState != Off ) {
            return qApp->translate( "System",
                                    "State should be off" );
          }
        }

        Actions[NoOfActions++] = Activate;
        break;
      case Deactivate :
        if( ! Force ) {
          if( CurrentState < Off ) {
            // already inactive
            return QString();
          }
        }

        if( CurrentState == IsUp ) {
          Actions[NoOfActions++] = Down;
        }
        Actions[NoOfActions++] = Deactivate;
        break;
      case Up :
        if( ! Force ) {
          if( CurrentState == IsUp ) {
            return QString();
          }
          if( CurrentState < Off ) {
            return qApp->translate( "System",
                                    "State should at least be off" );
          }
        }
        if( CurrentState == Off ) {
          Actions[NoOfActions++] = Activate;
        }
        Actions[NoOfActions++] = Up;
        break;
      case Down :
        if( ! Force ) {
          if( CurrentState < Available ) {
            // OK
            return QString();
          }
        }
        Actions[NoOfActions++] = Down;
        break;
    }

    // send actions to all nodes
    Log(( "Action %s requires %d steps\n",
          ActionName[A], NoOfActions ));

    for( int i = 0 ; i < NoOfActions; i ++ ) {
      // setState recurses through the tree depth first
      msg = getToplevel()->runtime()->setState( this, Actions[i], Force );
      if( ! msg.isEmpty() ) {
        return msg;
      }
    }
    return QString();
}
Ejemplo n.º 29
0
const QStringList & NetworkSetup::triggers() {
    return getToplevel()->runtime()->triggers();
}
Ejemplo n.º 30
0
const QString & NetworkSetup::description( void ) {
    ANetNodeInstance * NNI = getToplevel();
    return (NNI) ? NNI->runtime()->description() : Name;
}