Exemple #1
0
HOOKPROTONHNONP(TO_NewDrawer, void)
{

    APTR lv_active;
    char newpath[512];
    char dirname[256];
    BPTR lock;
    
    
    strcpy(dirname, (char *)xget(app.st_newdirname, MUIA_String_Contents));
    
    set(app.wi_newdir, MUIA_Window_Open, FALSE);
    
    if (strlen(dirname) <= 0)
        return;
    
    if (app.ActivePanel == PID_Left)
        lv_active = app.lv_left;
    else if (app.ActivePanel == PID_Right)
        lv_active = app.lv_right;
    else
        return;
        
    strcpy(newpath, (char *) xget(lv_active, MUIA_Dirlist_Directory));
    
    AddPart(newpath, dirname, 500);
    
    if ((lock = CreateDir(newpath)) != NULL)
        UnLock(lock);
    
    DoMethod(lv_active, MUIM_Dirlist_ReRead);

}
STRPTR FindTarget (Object *obj, STRPTR target, struct HTMLviewData *data)
{
  if(target)
  {
    if(!stricmp(target, "_self"))
      target = data->FrameName;
    else if(!stricmp(target, "_top"))
      target = data->Share->Data->FrameName;
    else if(!stricmp(target, "_parent"))
    {
      Object *parent = obj;
      
      if((parent = (Object *)xget(parent, MUIA_Parent)) &&
         (parent = (Object *)xget(parent, MUIA_Parent)))
      {
        target = (STRPTR)xget(parent, MUIA_HTMLview_FrameName);
      }
    }
  }
  else
  {
    target = data->FrameName;
  }
  return(target);
}
Exemple #3
0
/******************************************************************
 This close and disposed the window (note: this must not be called
 within a normal callback hook, because the object is disposed in
 this function)!
 The group is added to the list (currently only at the end)
*******************************************************************/
static void group_window_ok(struct Group_Data **pdata)
{
	struct Group_Data *data = *pdata;
	struct addressbook_entry *new_entry;
	set(data->wnd,MUIA_Window_Open,FALSE);

	if ((new_entry = addressbook_new_group(NULL)))
	{
		struct MUI_NListtree_TreeNode *treenode = NULL;
		char *alias = (char*)xget(data->alias_string,MUIA_String_Contents);
		if (alias && *alias) addressbook_set_alias(new_entry, alias);
		addressbook_set_description(new_entry, (char *)xget(data->description_string,MUIA_String_Contents));

		if (data->group)
		{
			if ((treenode = FindListtreeUserData(address_tree, data->group)))
			{
				DoMethod(address_tree, MUIM_NListtree_Rename, treenode, new_entry, MUIV_NListtree_Rename_Flag_User);
			}
		}

		if (!treenode)
		{
			/* Now add it to the listview (in the active list) */
			DoMethod(address_tree, MUIM_NListtree_Insert, "" /*name*/, new_entry, /*udata */
						   MUIV_NListtree_Insert_ListNode_ActiveFallback,MUIV_NListtree_Insert_PrevNode_Tail,TNF_LIST|TNF_OPEN);
		}

		addressbook_free_entry(new_entry);
	}

	group_window_close(pdata);
}
Exemple #4
0
/// PO_XPKOpenHook
//  Sets a popup listview accordingly to its string gadget
HOOKPROTONH(PO_XPKOpenFunc, BOOL, Object *listview, Object *str)
{
  char *s;
  Object *list;

  ENTER();

  if((s = (char *)xget(str, MUIA_Text_Contents)) != NULL &&
     (list = (Object *)xget(listview, MUIA_Listview_List)) != NULL)
  {
    int i;

    for(i=0;;i++)
    {
      char *x;

      DoMethod(list, MUIM_List_GetEntry, i, &x);
      if(!x)
      {
        set(list, MUIA_List_Active, MUIV_List_Active_Off);
        break;
      }
      else if(!stricmp(x, s))
      {
        set(list, MUIA_List_Active, i);
        break;
      }
    }
  }

  RETURN(TRUE);
  return TRUE;
}
Exemple #5
0
/******************************************************************
 Contents of the email string has been changed
*******************************************************************/
static void person_email_string_contents(struct Person_Data **pdata)
{
	struct Person_Data *data = *pdata;
	LONG active = xget(data->email_list, MUIA_NList_Active);
	if (active >= 0)
	{
		DoMethod(data->email_list,MUIM_NList_ReplaceSingle, xget(data->email_string, MUIA_String_Contents), active, NOWRAP, ALIGN_LEFT);
	}
}
Exemple #6
0
/******************************************************************
 This close and disposed the window (note: this must not be called
 within a normal callback hook, because the object is disposed in
 this function)!
 The person is added to the list (currently only at the end)
*******************************************************************/
static void person_window_ok(struct Person_Data **pdata)
{
	struct Person_Data *data = *pdata;
	struct addressbook_entry *new_entry;
	set(data->wnd,MUIA_Window_Open,FALSE);

	if ((new_entry = addressbook_create_person((char*)xget(data->realname_string,MUIA_String_Contents), NULL)))
	{
		int i;
		char *alias;
		struct MUI_NListtree_TreeNode *treenode = NULL;

		alias = (char*)xget(data->alias_string,MUIA_String_Contents);
		if (alias && *alias) addressbook_set_alias(new_entry, alias);
		addressbook_set_description(new_entry, (char *)xget(data->description_string,MUIA_String_Contents));

		if (new_entry->u.person.phone1) free(new_entry->u.person.phone1);
		new_entry->u.person.phone1 = mystrdup((char *)xget(data->phone1_string,MUIA_String_Contents));
		if (new_entry->u.person.phone2) free(new_entry->u.person.phone2);
		new_entry->u.person.phone2 = mystrdup((char *)xget(data->phone2_string,MUIA_String_Contents));

		if (new_entry->u.person.street) free(new_entry->u.person.street);
		new_entry->u.person.street = mystrdup((char*)xget(data->street_string,MUIA_String_Contents));
		if (new_entry->u.person.city) free(new_entry->u.person.city);
		new_entry->u.person.city = mystrdup((char*)xget(data->city_string,MUIA_String_Contents));
		if (new_entry->u.person.country) free(new_entry->u.person.country);
		new_entry->u.person.country = mystrdup((char*)xget(data->country_string,MUIA_String_Contents));
		if (new_entry->u.person.homepage) free(new_entry->u.person.homepage);
		new_entry->u.person.homepage = mystrdup((char*)xget(data->homepage_string,MUIA_String_Contents));

		for (i=0;i<xget(data->email_list,MUIA_NList_Entries);i++)
		{
			char *email;
			DoMethod(data->email_list, MUIM_NList_GetEntry, i, &email);
			addressbook_person_add_email(new_entry,email);
		}

		if (data->person)
		{
			if ((treenode = FindListtreeUserData(address_tree, data->person)))
			{
				DoMethod(address_tree, MUIM_NListtree_Rename, treenode, new_entry, MUIV_NListtree_Rename_Flag_User);
			}
		}

		if (!treenode)
		{
			/* Now add it to the listview (in the active list) */
			DoMethod(address_tree, MUIM_NListtree_Insert, "" /*name*/, new_entry, /*udata */
							   MUIV_NListtree_Insert_ListNode_ActiveFallback,MUIV_NListtree_Insert_PrevNode_Tail,0);
		}

		addressbook_free_entry(new_entry);
	}

	person_window_close(pdata);
}
Exemple #7
0
VOID CreateSampleText(Object *htmlview)
{
    ULONG ver, rev;
    char text[800];

    ver = xget(htmlview, MUIA_Version);
    rev = xget(htmlview, MUIA_Revision);

    snprintf(text, sizeof(text),GetStr(MSG_Page_SampleText),ver, rev, LIB_VERSION, LIB_REVISION);
    set(htmlview, MUIA_HTMLview_Contents, (ULONG)text);
}
Exemple #8
0
/**************************************************************************
 Add a new rule
**************************************************************************/
static void rules_new(void)
{
#if 0
	struct filter *f;
	DoMethod(filter_listview, MUIM_NList_GetEntry, xget(filter_listview, MUIA_NList_Active),&f);
	if (f)
	{
		struct filter_rule *fr;

		fr = filter_create_and_add_rule(f, xget(rules_page_cycle, MUIA_Cycle_Active));
		DoMethod(rules_page_listview,MUIM_NList_InsertSingle, fr, MUIV_NList_Insert_Bottom);
	}
#endif
}
Exemple #9
0
/// HandleVarHook
//  Pastes an entry from variable listview into string gadget
HOOKPROTONH(HandleVarFunc, void, Object *listview, Object *string)
{
  Object *list;

  ENTER();

  if((list = (Object *)xget(listview, MUIA_NListview_NList)) != NULL)
  {
    char *var = NULL;

    DoMethod(list, MUIM_NList_GetEntry, MUIV_NList_GetEntry_Active, &var);
    if(var != NULL)
    {
      char addstr[3];
      char *str = (char *)xget(string, MUIA_String_Contents);
      LONG pos = xget(string, MUIA_String_BufferPos);

      strlcpy(addstr, var, sizeof(addstr));

      if(IsStrEmpty(str) == FALSE)
      {
        int len = strlen(str)+sizeof(addstr);
        char *buf;

        if((buf = calloc(1, len)) != NULL)
        {
          // append the addstr to the right position

          if(pos > 0)
            strlcpy(buf, str, MIN(len, pos + 1));

          strlcat(buf, addstr, len);

          if(pos >= 0)
            strlcat(buf, str + pos, len);

          set(string, MUIA_String_Contents, buf);

          free(buf);
        }
      }
      else
        set(string, MUIA_String_Contents, addstr);
    }
  }

  LEAVE();
}
Exemple #10
0
///
/// US_AddFunc
//  Adds a new user to the user database
HOOKPROTONHNONP(US_AddFunc, void)
{
  struct US_GUIData *gui;
  int n;

  ENTER();

  gui = &G->US->GUI;
  n = xget(gui->LV_USERS, MUIA_NList_Entries);

  if(n < MAXUSERS)
  {
    struct User user;

    memset(&user, 0, sizeof(struct User));
    user.Limited = TRUE;
    user.IsNew = TRUE;

    DoMethod(gui->LV_USERS, MUIM_NList_InsertSingle, &user, MUIV_NList_Insert_Bottom);
    set(gui->LV_USERS, MUIA_NList_Active, MUIV_NList_Active_Bottom);
    set(gui->WI, MUIA_Window_ActiveObject, gui->ST_USER);

    // check again if we reached the limit
    if(n + 1 == MAXUSERS)
      set(gui->BT_ADD, MUIA_Disabled, TRUE);
  }

  LEAVE();
}
Exemple #11
0
STATIC ULONG SingleString_HandleEvent(struct IClass *cl, Object *obj, struct MUIP_HandleEvent *msg)
{
	if (msg->imsg && msg->imsg->Class == IDCMP_RAWKEY)
	{
		UWORD code;
		if (msg->imsg->Code == CURSORUP)
		{
			set(obj,MUIA_SingleString_Event, MUIV_SingleString_Event_CursorUp);
			return MUI_EventHandlerRC_Eat;
		}

		if (msg->imsg->Code == CURSORDOWN)
		{
			set(obj,MUIA_SingleString_Event, MUIV_SingleString_Event_CursorDown);
			return MUI_EventHandlerRC_Eat;
		}

		code = ConvertKey(msg->imsg);
		if (code == '\b')
		{
			if (xget(obj,MUIA_String_BufferPos) == 0)
			{
				set(obj,MUIA_SingleString_Event, MUIV_SingleString_Event_ContentsToPrevLine);
				return MUI_EventHandlerRC_Eat;
			}
		}
	}
	return 0;
}
Exemple #12
0
void rx_mailforward(UNUSED struct RexxHost *host, struct RexxParams *params, enum RexxAction action, UNUSED struct RexxMsg *rexxmsg)
{
  struct args *args = params->args;
  struct results *results = params->results;

  ENTER();

  switch(action)
  {
    case RXIF_INIT:
    {
      params->args = AllocVecPooled(G->SharedMemPool, sizeof(*args));
      params->results = AllocVecPooled(G->SharedMemPool, sizeof(*results));
    }
    break;

    case RXIF_ACTION:
    {
      static int winNumber = -1;
      struct WriteMailData *wmData;

      results->window = &winNumber;

      // check if there is already an open, quiet write window
      // which is linked as the current active rexx window and
      // if so we close it or otherwise the window will be "lost"
      if(G->ActiveRexxWMData != NULL &&
         G->ActiveRexxWMData->quietMode == TRUE)
      {
        CleanupWriteMailData(G->ActiveRexxWMData);
      }

      if((wmData = NewMessage(NMM_FORWARD, args->quiet ? NEWF_QUIET : 0L)) != NULL)
      {
        G->ActiveRexxWMData = wmData;

        if(wmData->window != NULL)
          winNumber = xget(wmData->window, MUIA_WriteWindow_Num);

        if(args->quiet == FALSE && wmData->window != NULL)
          set(wmData->window, MUIA_Window_Activate, TRUE);
      }
      else
        params->rc = RETURN_ERROR;
    }
    break;

    case RXIF_FREE:
    {
      if(args != NULL)
        FreeVecPooled(G->SharedMemPool, args);

      if(results != NULL)
        FreeVecPooled(G->SharedMemPool, results);
    }
    break;
  }

  LEAVE();
}
Exemple #13
0
STATIC ASM SAVEDS VOID move_objstr(REG(a0,struct Hook *h),REG(a2, Object *list), REG(a1,Object *str))
{
	struct folder *f;

	if ((f = (struct folder*)xget(filter_folder_list, MUIA_FolderTreelist_Active)))
		set(str, MUIA_Text_Contents, f->name);
}
Exemple #14
0
STATIC ULONG transwnd_Wait (struct IClass *cl, Object *obj, Msg msg)
{
	extern void loop(void);
	struct transwnd_Data *data = (struct transwnd_Data *) INST_DATA(cl, obj);
	ULONG start = 0;

	/* Kill the orginal notifies */
	DoMethod(data->abort, MUIM_KillNotify, MUIA_Pressed);
	DoMethod(obj, MUIM_KillNotify, MUIA_Window_CloseRequest);

	/* Set the new notifies */
	DoMethod(data->start, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)App, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
	DoMethod(data->start, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)App, 3, MUIM_WriteLong, (1<<0), (ULONG)&start);
	DoMethod(data->abort, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)App, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
	DoMethod(obj, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, (ULONG)App, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);

	loop();

	/* Kill all new notifies */
	DoMethod(obj, MUIM_KillNotify, MUIA_Window_CloseRequest);
	DoMethod(data->abort, MUIM_KillNotify, MUIA_Pressed);
	DoMethod(data->start, MUIM_KillNotify, MUIA_Pressed);
	DoMethod(data->start, MUIM_KillNotify, MUIA_Pressed);

	/* Restore the original notifies */
	DoMethod(obj, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, (ULONG)obj, 3, MUIM_Set, MUIA_transwnd_Aborted, TRUE);
	DoMethod(data->abort, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)obj, 3, MUIM_Set, MUIA_transwnd_Aborted, TRUE);

	if (start && xget(data->ignore_check,MUIA_Selected))
		start |= (1<<1);

	data->start_pressed = 0;

	return start;
}
Exemple #15
0
ULONG openWindow(Object *app, Object *win)
{
    ULONG v;

    if (win)
    {
        set(win,MUIA_Window_Open,TRUE);
        v = xget(win, MUIA_Window_Open);
        if (!v)
          v = xget(app, MUIA_Application_Iconified);
    }
    else v = FALSE;

    if (!v) DisplayBeep(0);

    return v;
}
Exemple #16
0
/******************************************************************
 The save button has been clicked
*******************************************************************/
static void save_button_pressed(struct Read_Data **pdata)
{
	struct mail *mail;
	struct Read_Data *data = *pdata;
	if (!data->attachments_last_selected) return;
	if (!(mail = (struct mail*)xget(data->attachments_last_selected,MUIA_UserData))) return;
	save_contents(data,mail);
}
Exemple #17
0
/**
 * Remove the rule from the GUI.
 *
 * @param objs the object representing the rule.
 */
static void filter_remove_rule_gui(Object **objs)
{
	struct filter_rule *fr;
	Object *parent;

	/* The pointer to the real filter rule is stored in MUIA_UserData */
	if ((fr = (struct filter_rule*)xget(objs[0],MUIA_UserData)))
		filter_remove_rule(fr);

	/* Get the parent of the objects and remove the objects */
	parent = (Object*)xget(objs[0],MUIA_Parent);
	DoMethod(parent, MUIM_Group_InitChange);
	DoMethod(parent, OM_REMMEMBER, (ULONG)objs[1]);
	DoMethod(parent, OM_REMMEMBER, (ULONG)objs[0]);
	DoMethod(parent, MUIM_Group_ExitChange);
	MUI_DisposeObject(objs[1]);
	MUI_DisposeObject(objs[0]);
}
Exemple #18
0
/**
 * A new name has been entered.
 */
static void filter_name(void)
{
	struct filter *f;
	DoMethod(filter_list, MUIM_NList_GetEntry, MUIV_NList_GetEntry_Active, (ULONG)&f);
	if (f)
	{
		if (f->name) free(f->name);
		f->name = mystrdup((char*)xget(filter_name_string, MUIA_UTF8String_Contents));
		DoMethod(filter_list,MUIM_NList_Redraw,MUIV_NList_Redraw_Active);
	}
}
Exemple #19
0
STATIC STRPTR GetString( Object * obj, STRPTR def )
{
	STRPTR str;
	
	str = (STRPTR) xget( obj, MUIA_String_Contents );
	
	if(!(str && *str))
		str = def;
	
	return( str );
}
Exemple #20
0
/******************************************************************
 Opens a addressbook
*******************************************************************/
void addressbook_open(void)
{
#if 0
	if (!address_wnd) addressbook_init();
	if (address_wnd)
	{
		if (!xget(address_wnd, MUIA_Window_Open)) addressbook_refresh();
		set(address_wnd, MUIA_Window_Open, TRUE);
	}
#endif
}
Exemple #21
0
STATIC ULONG transwnd_GetMailFlags (struct IClass *cl, Object *obj, struct MUIP_transwnd_GetMailFlags *msg)
{
	struct transwnd_Data *data = (struct transwnd_Data *) INST_DATA(cl, obj);
	int i;
	for (i=0;i<xget(data->mail_list, MUIA_NList_Entries);i++)
	{
		struct mail_entry *entry;
		DoMethod(data->mail_list, MUIM_NList_GetEntry, i, (ULONG)&entry);
		if (entry->no == msg->Num) return (ULONG)entry->flags;
	}
	return (ULONG)-1;
}
Exemple #22
0
///
/// US_GetUSEntryFunc
//  Fills form with data from selected list entry
HOOKPROTONHNONP(US_GetUSEntryFunc, void)
{
  struct US_GUIData *gui;
  int act;

  ENTER();

  gui = &G->US->GUI;
  act = xget(gui->LV_USERS, MUIA_NList_Active);

  if(act != MUIV_NList_Active_Off)
  {
    struct User *user;
    BOOL notallowed;
    BOOL iscurrent;
    BOOL limited;

    DoMethod(gui->LV_USERS, MUIM_NList_GetEntry, act, &user);

    limited = !G->US->Supervisor;
    iscurrent = (user->ID == G->Users.CurrentID);
    notallowed = limited && !iscurrent;

    nnset(gui->ST_USER,    MUIA_String_Contents, user->Name);
    nnset(gui->ST_MAILDIR, MUIA_String_Contents, user->MailDir);
    nnset(gui->ST_PASSWD,  MUIA_String_Contents, user->Password);
    nnset(gui->CH_USEADDR, MUIA_Selected, user->UseAddr);
    nnset(gui->CH_USEDICT, MUIA_Selected, user->UseDict);
    nnset(gui->CH_ROOT,    MUIA_Selected, !user->Limited);
    nnset(gui->CH_CLONE,   MUIA_Selected, user->Clone);
    set(gui->ST_USER,    MUIA_Disabled, notallowed);
    set(gui->CH_USEDICT, MUIA_Disabled, notallowed || act == 0);
    set(gui->CH_USEADDR, MUIA_Disabled, notallowed || act == 0);
    set(gui->CH_CLONE,   MUIA_Disabled, !user->IsNew || act == 0);
    set(gui->PO_MAILDIR, MUIA_Disabled, limited);
    set(gui->CH_ROOT,    MUIA_Disabled, limited);
    set(gui->ST_PASSWD,  MUIA_Disabled, notallowed);
    set(gui->BT_DEL,     MUIA_Disabled, act == 0 || iscurrent);
   }
   else
     DoMethod(G->App, MUIM_MultiSet, MUIA_Disabled, TRUE, gui->ST_USER,
                                                          gui->ST_PASSWD,
                                                          gui->PO_MAILDIR,
                                                          gui->CH_USEDICT,
                                                          gui->CH_USEADDR,
                                                          gui->CH_ROOT,
                                                          gui->CH_CLONE,
                                                          gui->BT_DEL,
                                                          NULL);

  LEAVE();
}
Exemple #23
0
STATIC VOID MultiString_Event(void **msg)
{
/*	struct IClass *cl = (struct IClass*)msg[0];*/
	Object *obj = (Object*)msg[1];
	struct object_node *obj_node = (struct object_node*)msg[2];
	Object *window = (Object*)xget(obj,MUIA_WindowObject);
	int event = (int)msg[3];

	if (event == MUIV_SingleString_Event_CursorUp && node_prev(&obj_node->node))
	{
		set(window, MUIA_Window_ActiveObject, ((struct object_node*)node_prev(&obj_node->node))->obj);
		return;
	}

	if (event == MUIV_SingleString_Event_CursorDown && node_next(&obj_node->node))
	{
		set(window, MUIA_Window_ActiveObject, ((struct object_node*)node_next(&obj_node->node))->obj);
		return;
	}

	if (event == MUIV_SingleString_Event_ContentsToPrevLine && node_prev(&obj_node->node))
	{
		struct object_node *prev_node = (struct object_node*)node_prev(&obj_node->node);
		char *contents = (char*)xget(obj_node->obj, MUIA_UTF8String_Contents);
		int new_cursor_pos = strlen((char*)xget(prev_node->obj, MUIA_String_Contents)); /* is Okay */

		DoMethod(prev_node->obj, MUIM_UTF8String_Insert, (ULONG)contents, MUIV_BetterString_Insert_EndOfString);
		set(prev_node-> obj,MUIA_String_BufferPos, new_cursor_pos);
		set(window, MUIA_Window_ActiveObject, prev_node->obj);

		node_remove(&obj_node->node);
		DoMethod(obj, MUIM_Group_InitChange);
		DoMethod(obj, OM_REMMEMBER, (ULONG)obj_node->obj);
		MUI_DisposeObject(obj_node->obj);
		free(obj_node);
		DoMethod(obj, MUIM_Group_ExitChange);
		return;
	}
}
Exemple #24
0
static Object *findWinObjByAttr(Object *app, ULONG attr, IPTR val)
{
    struct List *winlist;
    Object      *obj;
    Object      *state;

    /* return the window object which supports OM_GET on attr, and
       whose value of attr == val */

    winlist = (struct List *)xget(app,MUIA_Application_WindowList);
    state = (Object *)winlist->lh_Head;

    while((obj = NextObject(&state)) != NULL)
    {
        IPTR value;

        if((value = xget(obj,attr)) != 0 && (value == val))
          break;
    }

    return obj;
}
Exemple #25
0
/**************************************************************************
 Create a new rule
**************************************************************************/
static void filter_new(void)
{
#if 0
	struct filter *f = filter_create();
	if (f)
	{
		DoMethod(filter_listview, MUIM_NList_InsertSingle, f, MUIV_NList_Insert_Bottom);
		filter_dispose(f);
		set(filter_listview, MUIA_NList_Active, xget(filter_listview, MUIA_NList_Entries)-1);
		filter_edit();
	}
#endif
}
Exemple #26
0
int xselect (int events, int nin, int *in_set, int nout, int *out_set)
{
	int i, n;
	struct sockbase *sb;

	for (n = 0, i = 0; i < nin && n < nout; i++) {
		if (! (sb = xget (in_set[i]) ) )
			continue;
		if (check_pollevents (sb, events) > 0)
			out_set[n++] = in_set[i];
		xput (sb->fd);
	}
	return n;
}
Exemple #27
0
///
/// US_DelFunc
//  Removes a user from the user database
HOOKPROTONHNONP(US_DelFunc, void)
{
  Object *lv;
  int userIndex;
  int m;
  struct User *user;

  ENTER();

  lv = G->US->GUI.LV_USERS;
  userIndex = xget(lv, MUIA_NList_Active);
  DoMethod(lv, MUIM_NList_GetEntry, userIndex, &user);

  if(user->MailDir[0] != '\0')
  {
    m = MUI_Request(G->App, G->US->GUI.WI, MUIF_NONE,
                    tr(MSG_MA_ConfirmReq), tr(MSG_US_RemoveReqGads), tr(MSG_US_RemoveReq));

    if(m == 1)
      DeleteMailDir(user->MailDir, TRUE);
  }
  else
  {
    // just remove the user, as this doesn't have an own mail directory
    m = 2;
  }

  if(m != 0)
  {
    DoMethod(lv, MUIM_NList_Remove, userIndex);
    // reactivate the Add/Del buttons
    set(G->US->GUI.BT_ADD, MUIA_Disabled, FALSE);
    set(G->US->GUI.BT_DEL, MUIA_Disabled, xget(lv, MUIA_NList_Entries) == 0);
  }

  LEAVE();
}
Exemple #28
0
static void closeAllWindows(Object *app)
{
  BOOL loop;

  ENTER();

  do
  {
    struct List *list;
    Object *mstate;
    Object *win;

    loop = FALSE;

    list = (struct List *)xget(app, MUIA_Application_WindowList);
    mstate = (Object *)list->lh_Head;

    while((win = NextObject(&mstate)) != NULL)
    {
      ULONG ok = FALSE;

      ok = xget(win, MUIA_App_IsSubWin);
      if(ok)
      {
        set(win, MUIA_Window_Open, FALSE);
        DoMethod(app, OM_REMMEMBER, (IPTR)win);
        MUI_DisposeObject(win);
        loop = TRUE;
        break;
      }
    }
  }
  while(loop == TRUE);

  LEAVE();
}
Exemple #29
0
static void error_select(void)
{
	int num = xget(error_numeric, MUIA_Numeric_Value);
	struct error_node *node = (struct error_node *)list_find(&error_list,num-1);

	set(text_list, MUIA_NList_Quiet, TRUE);
	DoMethod(text_list, MUIM_NList_Clear);

	if (node)
	{
		DoMethod(text_list, MUIM_NList_InsertSingleWrap, (ULONG)node->text, MUIV_NList_Insert_Bottom, WRAPCOL0, ALIGN_LEFT);
	}

	set(text_list, MUIA_NList_Quiet, FALSE);
}
Exemple #30
0
STATIC VOID MultiString_Acknowledge(void **msg)
{
	struct IClass *cl = (struct IClass*)msg[0];
	Object *obj = (Object*)msg[1];
	Object *new_obj;
	struct object_node *obj_node = (struct object_node*)msg[2];
	struct MUIP_MultiString_AddStringField asf_msg;

	asf_msg.MethodID = MUIM_MultiString_AddStringField;
	asf_msg.contents = "";

	if ((new_obj = MultiString_AddStringField(cl,obj,&asf_msg,obj_node)))
	{
		set((Object*)xget(obj,MUIA_WindowObject), MUIA_Window_ActiveObject, new_obj);
	}
}