void XFE_FolderDropdown::buildList(MSG_FolderInfo *info, int *position) { int num_children = MSG_GetFolderChildren(fe_getMNMaster(), info, NULL, 0); #ifdef DEBUG_dora // For debugging P0 bug on XP only. MSG_FolderLine line; printf("buildList %x\n", info); printf("num_children %d\n", num_children); if ( info ) { MSG_GetFolderLineById(fe_getMNMaster(), info, &line); if ( line.name) printf("folder name=%s\n", line.name); else printf("no folder name...\n"); } #endif if (num_children == 0) { return; } else { MSG_FolderInfo **tmp; int i; tmp = new MSG_FolderInfo* [num_children]; /* first we handle local mail stuff. */ MSG_GetFolderChildren(fe_getMNMaster(), info, tmp, num_children); for (i = 0; i < num_children; i ++) { if (*position >= m_numinfos) return; m_infos[*position] = tmp[i]; *position += 1; XP_ASSERT(tmp[i]); buildList(tmp[i], position); } delete [] tmp; } }
void XFE_FolderDropdown::syncFolderList() { MSG_Master *master = fe_getMNMaster(); int num_infos; if (m_infos) delete [] m_infos; /* this should be the number of MSG_FolderInfo's for mail, including servers. */ num_infos = MSG_GetFoldersWithFlag(master, MSG_FOLDER_FLAG_MAIL, NULL, 0); if (m_showNewsgroups) { num_infos += MSG_GetFoldersWithFlag(master, MSG_FOLDER_FLAG_NEWSGROUP, NULL, 0); m_numNewsHosts = MSG_GetFoldersWithFlag(master, MSG_FOLDER_FLAG_NEWS_HOST, NULL, 0); num_infos += m_numNewsHosts; } m_numinfos = num_infos; m_infos = new MSG_FolderInfo* [num_infos]; int pos = 0; /* build the default mail tree */ buildList(NULL, &pos); /* now we build each newshost */ if (m_numNewsHosts > 0) { MSG_FolderInfo **news_hosts; int i; news_hosts = new MSG_FolderInfo* [m_numNewsHosts]; MSG_GetFoldersWithFlag(master, MSG_FOLDER_FLAG_NEWS_HOST, news_hosts, m_numNewsHosts); for (i = 0; i < m_numNewsHosts; i++) buildList(news_hosts[i], &pos); delete [] news_hosts; } DD(printf("\nold m_numinfos = %d new numinfos %d\n", m_numinfos, pos);)
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; }