Ejemplo n.º 1
0
static void
fe_property_change_action (Widget widget, XEvent *event,
			   String *av, Cardinal *ac)
{
  MWContext *context = fe_WidgetToMWContext (widget);
  if (! context) return;
  fe_server_handle_property_change (XtDisplay (CONTEXT_WIDGET (context)),
				    XtWindow (CONTEXT_WIDGET (context)),
				    event);
}
Ejemplo n.º 2
0
void XFE_ComposeAttachFolderView::openAttachment(int pos)
{
    if (pos<0 || pos>=_attachPanel->numItems())
        return;

    // Disable preview of previously attached item. Need to resolve
    // inconsistency when attaching URL pointing to cgi. Preview
    // will reload the URL, and the return data may differ from the
    // data previously loaded by the mail back-end. i.e. it will
    // not be a useful preview.
#if 0
    // ensure clicked item is selected
    if (pos!=_attachPanel->currentSelectionPos() && _attachPanel->items())
        _attachPanel->selectItem(_attachPanel->items()[pos]);

    XFE_AttachPanelItem *item=_attachPanel->currentSelection();
    
    if (!item || !item->data())
        return;
    
    URL_Struct *url = NET_CreateURLStruct (item->data(),NET_DONT_RELOAD);
    if (!MSG_RequiresBrowserWindow(url->address))
        fe_GetURL(_context,url,FALSE);
    else
        fe_MakeWindow(XtParent(CONTEXT_WIDGET (_context)), _context, url, NULL,
                      MWContextBrowser, FALSE);

    fe_UserActivity(_context);
#endif
}
Ejemplo n.º 3
0
void XFE_ReadAttachPanel::openCb()
{
    if (!currentSelection())
        return;

    const char *selData=currentSelection()->data();
    if (!selData || strlen(selData)==0)
        return;

    URL_Struct *url = NET_CreateURLStruct (selData,NET_DONT_RELOAD);
    if (!MSG_RequiresBrowserWindow(url->address))
	fe_GetURL(_context,url,FALSE);
    else
        fe_MakeWindow(XtParent(CONTEXT_WIDGET (_context)), _context, url, NULL,
                      MWContextBrowser, FALSE);

    fe_UserActivity(_context);
}
Ejemplo n.º 4
0
void
fe_InitRemoteServerWindow (MWContext *context)
{
  Widget widget = CONTEXT_WIDGET (context);
  Display *dpy = XtDisplay (widget);
  Window window = XtWindow (widget);
  XWindowAttributes attrs;
  unsigned char *data = (unsigned char *) fe_version;

  XtOverrideTranslations (widget, fe_prop_translations);

  XChangeProperty (dpy, window, XA_MOZILLA_VERSION, XA_STRING,
		   8, PropModeReplace, data, strlen (data));

  XGetWindowAttributes (dpy, window, &attrs);
  if (! (attrs.your_event_mask & PropertyChangeMask))
    XSelectInput (dpy, window, attrs.your_event_mask | PropertyChangeMask);
}
Ejemplo n.º 5
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.º 6
0
static char *
fe_server_handle_command (Display *dpy, Window window, XEvent *event,
			  char *command)
{
	char *name = 0;
	char **av = 0;
	int ac = 0;
	int avsize = 0;
	Boolean raise_p = True;
	int i;
	char *buf;
	char *buf2;
	int32 buf2_size;
	char *head, *tail;
	XtActionProc action = 0;
	Widget widget = XtWindowToWidget (dpy, window);
	MWContext *context = fe_WidgetToMWContext (widget);
	XP_Bool mail_or_news_required = FALSE;
	MWContextType required_type = (MWContextType) (~0);
	XP_Bool make_context_if_necessary = FALSE;
    MWContext *target_context = context;

	XP_ASSERT(context);

	buf = fe_StringTrim (strdup (command));
	buf2_size = strlen (buf) + 200;
	buf2 = (char *) malloc (buf2_size);

	head = buf;
	tail = buf;

	if (! widget)
		{
			PR_snprintf (buf2, buf2_size,
						 XP_GetString(XFE_REMOTE_S_509_INTERNAL_ERROR),
						 (unsigned int) window);
			free (buf);
			return buf2;
		}

	/* extract the name (everything before the first '(', trimmed.) */
	while (1)
		if (*tail == '(' || isspace (*tail) || !*tail)
			{
				*tail = 0;
				tail++;
				name = fe_StringTrim (head);
				break;
			}
		else
			tail++;

	if (!name || !*name)
		{
			PR_snprintf (buf2, buf2_size,
						 XP_GetString(XFE_REMOTE_S_500_UNPARSABLE_COMMAND), 
						 command);
			free (buf);
			return buf2;
		}

	/* look for it in the old remote actions. */
	for (i = 0; i < fe_CommandActionsSize; i++)
		if (!XP_STRCASECMP(name, fe_CommandActions [i].string))
			{
				name = fe_CommandActions [i].string;
				action = fe_CommandActions [i].proc;
				break;
			}

	if (!av)
		{
			avsize = 20;
			av = (char **) calloc (avsize, sizeof (char *));

			/* if it's not an old action, we need to know the name of the
			   command, so we stick it on the front.  This will be dealt
			   with in xfeDoRemoteCommand. */
			if (!action)
				av[ ac++ ] = name;

			while (*tail == '(' || isspace (*tail))
				tail++;

			head = tail;
			while (1)
				{
					if (*tail == ')' || *tail == ',' || *tail == 0)
						{
							char delim = *tail;
							if (ac >= (avsize - 2))
								{
									avsize += 20;
									av = (char **) realloc (av, avsize * sizeof (char *));
								}
							*tail = 0;

							av [ac++] = fe_StringTrim (head);

							if (delim != ',' && !*av[ac-1])
								ac--;
							else if (!strcasecomp (av [ac-1], "noraise"))
								{
									raise_p = False;
									ac--;
								}
							else if (!strcasecomp (av [ac-1], "raise"))
								{
									raise_p = True;
									ac--;
								}

							head = tail+1;
							if (delim != ',')
								break;
						}
					tail++;
				}

			av [ac++] = "<remote>";
		}

	/* If this is GetURL or something like it, make sure the context we pick
	   matches the URL.
	   */
	if (strstr(name, "URL"))
		{
			const char *url = av[0];
			mail_or_news_required = FALSE;
			required_type = (MWContextType) (~0);
#ifdef MOZ_MAIL_NEWS
			if (MSG_RequiresMailWindow (url))
				required_type = MWContextMail;
			else if (MSG_RequiresNewsWindow (url))
				required_type = MWContextNews;
			else if (MSG_RequiresBrowserWindow (url))
#endif
				required_type = MWContextBrowser;
			/* Nothing to do for MSG_RequiresComposeWindow compose. */

			if (required_type != (MWContextType) (~0))
				{
					make_context_if_necessary = TRUE;
				}
		}
    else if (!strcasecomp(name, "openfile"))
      {
        required_type = MWContextBrowser;
        make_context_if_necessary = TRUE;
      }

	if (raise_p)
		XMapRaised (dpy, window);

    if (required_type != (MWContextType) (~0))
      target_context = XP_FindContextOfType(context, required_type);
			
    if (make_context_if_necessary && !target_context)
      target_context = FE_MakeNewWindow(context, NULL, NULL, NULL);

    if (target_context) 
      {
        Cardinal ac2 = ac; /* why is this passed as a pointer??? */
        if (name && action)
          {
            (*action) (CONTEXT_WIDGET(target_context), event, av, &ac2);
          }
        else
          /* now we call our new xfe2 interface to the command mechanism */
          {
            xfeDoRemoteCommand (CONTEXT_WIDGET(target_context),
                                event, av, &ac2);
          }
      }

	PR_snprintf (buf2, buf2_size,
				 XP_GetString(XFE_REMOTE_S_200_EXECUTED_COMMAND),
				 name);
	for (i = 0; i < ac-1; i++)
		{
			strcat (buf2, av [i]);
			if (i < ac-2)
				strcat (buf2, ", ");
		}
	strcat (buf2, ")");

	free (av);

	free (buf);
	return buf2;
}