home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / src / ABDirListView.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  32.1 KB  |  1,317 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. /* 
  19.    ABDirListView.h -- class definition for ABDirListView
  20.    Created: Tao Cheng <tao@netscape.com>, 14-oct-97
  21.  */
  22.  
  23. #include "ABDirPropertyDlg.h"
  24. #include "ABDirListView.h"
  25.  
  26. #if defined(USE_MOTIF_DND)
  27.  
  28. #include "OutlinerDrop.h"
  29.  
  30. #endif /* USE_MOTIF_DND */
  31.  
  32. #include "xpgetstr.h"
  33.  
  34. const char *XFE_ABDirListView::dirCollapse = 
  35.                               "XFE_ABDirListView::dirCollapse";
  36. const char *XFE_ABDirListView::dirSelect = 
  37.                               "XFE_ABDirListView::dirSelect";
  38.  
  39. // icons
  40. fe_icon XFE_ABDirListView::m_openParentIcon = { 0 };
  41. fe_icon XFE_ABDirListView::m_closedParentIcon = { 0 };
  42. fe_icon XFE_ABDirListView::m_pabIcon = { 0 };
  43. fe_icon XFE_ABDirListView::m_ldapDirIcon = { 0 };
  44. fe_icon XFE_ABDirListView::m_mListIcon = { 0 };
  45.  
  46. extern int XFE_AB_HEADER_NAME;
  47. extern int XFE_AB2PANE_DIR_HEADER;
  48.  
  49. #if defined(DEBUG_tao)
  50. #define D(x) printf x
  51. #else
  52. #define D(x)
  53. #endif
  54.  
  55.  
  56. #define AB_DIR_OUTLINER_GEOMETRY_PREF "ab_dir.outliner_geometry"
  57.  
  58. XFE_ABDirListView::XFE_ABDirListView(XFE_Component *toplevel_component,
  59.                                      Widget         parent, 
  60.                                      XFE_View      *parent_view, 
  61.                                      MWContext     *context,
  62.                                      XP_List       *directories):
  63.     XFE_MNListView(toplevel_component, 
  64.                    parent_view,
  65.                    context, 
  66.                    (MSG_Pane *)NULL),
  67. #if !defined(USE_ABCOM)
  68.     m_directories(directories)
  69. #else
  70.     m_containerLine(NULL),
  71.     m_activeContainer(NULL)
  72. #endif /* USE_ABCOM */
  73. {
  74.     /* initialize 
  75.      */
  76.     m_dir = 0;
  77.     m_dirLine = 0;
  78.     m_ancestorInfo = 0;
  79.     m_deleted_directories = NULL;
  80.  
  81.     /* For outliner
  82.      */
  83.     int num_columns = OUTLINER_COLUMN_LAST;
  84.     static int column_widths[] = {23};
  85.     m_outliner = new XFE_Outliner("dirList",
  86.                                   this,
  87.                                   toplevel_component,
  88.                                   parent,
  89.                                   False, // constantSize
  90.                                   True,  // hasHeadings
  91.                                   num_columns,
  92.                                   num_columns,// num_visible 
  93.                                   column_widths,
  94.                                   AB_DIR_OUTLINER_GEOMETRY_PREF);
  95.     m_outliner->setHideColumnsAllowed(False);
  96.     m_outliner->setPipeColumn(OUTLINER_COLUMN_NAME);
  97.  
  98.     /* BEGIN_3P: XmLGrid
  99.      */
  100.     XtVaSetValues(m_outliner->getBaseWidget(),
  101.                   XtVaTypedArg, XmNblankBackground, XmRString, "white", 6,
  102.                   // XmNselectionPolicy, XmSELECT_MULTIPLE_ROW,
  103.                   XmNvisibleRows, 15,
  104.                   NULL);
  105.     XtVaSetValues(m_outliner->getBaseWidget(),
  106.                   XmNcellDefaults, True,
  107.                   XtVaTypedArg, XmNcellBackground, XmRString, "white", 6,
  108.                   NULL);
  109.     /* END_3P: XmLGrid
  110.      */
  111.  
  112. #if defined(USE_ABCOM)
  113.     // todo: check return val
  114.     int error = AB_CreateContainerPane(&m_pane,
  115.                                        context,
  116.                                        fe_getMNMaster());
  117.  
  118.  
  119.     error = 
  120.         AB_SetShowPropertySheetForDirFunc(m_pane, 
  121.            &XFE_ABDirListView::ShowPropertySheetForDirFunc);
  122.  
  123.     error = AB_InitializeContainerPane(m_pane);
  124.     m_nDirs = MSG_GetNumLines(m_pane);
  125. #if defined(DEBUG_tao)
  126.     printf("\n MSG_GetNumLines, m_nDirs=%d\n", m_nDirs);
  127. #endif
  128.  
  129. #else
  130.     /* XFE_Outliner constructor does not allocate any content row
  131.      * XFE_Outliner::change(int first, int length, int newnumrows)
  132.      */
  133.     if (directories) {
  134.         m_nDirs = XP_ListCount(directories);
  135.     }/* if */
  136. #endif /* USE_ABCOM */
  137.  
  138.     m_outliner->change(0, m_nDirs, m_nDirs);
  139.     m_outliner->show();
  140.     if (m_nDirs)
  141.         m_outliner->selectItemExclusive(0);
  142.     setBaseWidget(m_outliner->getBaseWidget());
  143.     XtVaSetValues(getBaseWidget(),
  144.                   XmNpaneMinimum, 1,
  145.                   XmNpaneMaximum, 10000,
  146.                   NULL);
  147.     /* initialize the icons if they haven't already been
  148.      */
  149.     Pixel bg_pixel;
  150.     XtVaGetValues(m_outliner->getBaseWidget(), XmNbackground, &bg_pixel, 0);
  151.  
  152.     if (!m_openParentIcon.pixmap)
  153.         fe_NewMakeIcon(getToplevel()->getBaseWidget(),
  154.                        /* umm. fix me
  155.                         */
  156.                        BlackPixelOfScreen(XtScreen(m_outliner->getBaseWidget())),
  157.                        bg_pixel,
  158.                        &m_openParentIcon,
  159.                        NULL, 
  160.                        oparent.width, 
  161.                        oparent.height,
  162.                        oparent.mono_bits, 
  163.                        oparent.color_bits, 
  164.                        oparent.mask_bits, 
  165.                        FALSE);
  166.   
  167.     if (!m_closedParentIcon.pixmap)
  168.         fe_NewMakeIcon(getToplevel()->getBaseWidget(),
  169.                        /* umm. fix me
  170.                         */
  171.                        BlackPixelOfScreen(XtScreen(m_outliner->getBaseWidget())),
  172.                        bg_pixel,
  173.                        &m_closedParentIcon,
  174.                        NULL, 
  175.                        cparent.width, 
  176.                        cparent.height,
  177.                        cparent.mono_bits, 
  178.                        cparent.color_bits, 
  179.                        cparent.mask_bits, 
  180.                        FALSE);
  181.   
  182.  
  183.     if (!m_pabIcon.pixmap)
  184.         fe_NewMakeIcon(getToplevel()->getBaseWidget(),
  185.                        /* umm. fix me
  186.                         */
  187.                        BlackPixelOfScreen(XtScreen(m_outliner->getBaseWidget())),
  188.                        bg_pixel,
  189.                        &m_pabIcon,
  190.                        NULL, 
  191.                        MNC_AddressSmall.width, 
  192.                        MNC_AddressSmall.height,
  193.                        MNC_AddressSmall.mono_bits, 
  194.                        MNC_AddressSmall.color_bits, 
  195.                        MNC_AddressSmall.mask_bits, 
  196.                        FALSE);
  197.   
  198.  
  199.     if (!m_ldapDirIcon.pixmap)
  200.         fe_NewMakeIcon(getToplevel()->getBaseWidget(),
  201.                        /* umm. fix me
  202.                         */
  203.                        BlackPixelOfScreen(XtScreen(m_outliner->getBaseWidget())),
  204.                        bg_pixel,
  205.                        &m_ldapDirIcon,
  206.                        NULL, 
  207.                        MN_FolderServer.width, 
  208.                        MN_FolderServer.height,
  209.                        MN_FolderServer.mono_bits, 
  210.                        MN_FolderServer.color_bits, 
  211.                        MN_FolderServer.mask_bits, 
  212.                        FALSE);
  213.   
  214.  
  215.     if (!m_mListIcon.pixmap)
  216.         fe_NewMakeIcon(getToplevel()->getBaseWidget(),
  217.                        /* umm. fix me
  218.                         */
  219.                        BlackPixelOfScreen(XtScreen(m_outliner->getBaseWidget())),
  220.                        bg_pixel,
  221.                        &m_mListIcon,
  222.                        NULL, 
  223.                        MN_People.width, 
  224.                        MN_People.height,
  225.                        MN_People.mono_bits, 
  226.                        MN_People.color_bits, 
  227.                        MN_People.mask_bits, 
  228.                        FALSE);
  229.   
  230.  
  231. }
  232.  
  233. XFE_ABDirListView::~XFE_ABDirListView()
  234. {
  235. }
  236.  
  237. #if defined(USE_ABCOM)
  238. int
  239. XFE_ABDirListView::ShowPropertySheetForDirFunc(DIR_Server *server, 
  240.                                                MWContext  *context, 
  241.                                                MSG_Pane   *pane,
  242.                                                XP_Bool     newDirectory)
  243. {
  244. #if defined(DEBUG_tao)
  245.     printf("\n XFE_ABDirListView::ShowPropertySheetForDirFunc, newDirectory=%d\n",
  246.            newDirectory);
  247. #endif
  248.     XFE_ABDirPropertyDlg* Dlg = 
  249.         new XFE_ABDirPropertyDlg(CONTEXT_WIDGET(context),
  250.                                  "abDirProperties", 
  251.                                  True, 
  252.                                  context);
  253.     Dlg->setDlgValues(server);
  254.     Dlg->setPane(pane);
  255.     Dlg->show();
  256.     return 1;
  257. }
  258. #endif /* USE_ABCOM */
  259.  
  260. void 
  261. XFE_ABDirListView::paneChanged(XP_Bool asynchronous,
  262.                                MSG_PANE_CHANGED_NOTIFY_CODE notify_code,
  263.                                int32 value)
  264. {
  265. #if defined(DEBUG_tao)
  266.     printf("\nXFE_ABDirListView::paneChanged, asynchronous=%d, notify_code=%d, value=0x%x", asynchronous, notify_code, value);
  267. #endif
  268. }
  269.  
  270. Boolean 
  271. XFE_ABDirListView::isCommandEnabled(CommandType command, 
  272.                                     void * /* calldata */,
  273.                                     XFE_CommandInfo* /* i */)
  274. {
  275.     AB_CommandType abCmd = (AB_CommandType)~0;
  276.     if (command == xfeCmdABNewPAB)
  277.         abCmd = AB_NewAddressBook;
  278.     else if (command == xfeCmdABNewLDAPDirectory)
  279.         abCmd = AB_NewLDAPDirectory;
  280.     else if (command == xfeCmdABDelete)
  281.         abCmd = AB_DeleteCmd;
  282.     else if (command == xfeCmdABProperties)
  283.         abCmd = AB_PropertiesCmd;
  284.     else
  285.         return FALSE;
  286.  
  287.     int count = 0;
  288.     const int *indices = 0;
  289.     m_outliner->getSelection(&indices, &count);
  290.  
  291.     XP_Bool selectable_p = False;
  292. #if defined(USE_ABCOM)
  293.     int error = 
  294.         AB_CommandStatusAB2(m_pane, 
  295.                             abCmd,
  296.                             (MSG_ViewIndex *) indices,
  297.                             (int32) count,
  298.                             &selectable_p,
  299.                             NULL,
  300.                             NULL,
  301.                             NULL);
  302. #endif /* USE_ABCOM */
  303.     return selectable_p;
  304. }
  305.  
  306. Boolean 
  307. XFE_ABDirListView::isCommandSelected(CommandType /* command */, 
  308.                                      void * /* calldata */,
  309.                                      XFE_CommandInfo* /* i */)
  310. {
  311.     return FALSE;
  312. }
  313.  
  314. Boolean 
  315. XFE_ABDirListView::handlesCommand(CommandType command, 
  316.                                   void * /* calldata */,
  317.                                   XFE_CommandInfo* /* i */)
  318. {
  319.     if (command == xfeCmdABNewPAB ||
  320.         command == xfeCmdABNewLDAPDirectory ||
  321.         command == xfeCmdABDelete ||
  322.         command == xfeCmdABProperties)
  323.         return True;
  324.     else
  325.         return FALSE;
  326. }
  327.  
  328. void 
  329. XFE_ABDirListView::doCommand(CommandType command, 
  330.                              void * /* calldata */,
  331.                              XFE_CommandInfo* /* i */)
  332. {
  333.     AB_CommandType abCmd = (AB_CommandType)~0;
  334.     if (command == xfeCmdABNewPAB)
  335.         abCmd = AB_NewAddressBook;
  336.     else if (command == xfeCmdABNewLDAPDirectory)
  337.         abCmd = AB_NewLDAPDirectory;
  338.     else if (command == xfeCmdABDelete)
  339.         abCmd = AB_DeleteCmd;
  340.     else if (command == xfeCmdABProperties)
  341.         abCmd = AB_PropertiesCmd;
  342.     else
  343.         return;
  344.  
  345.     int count = 0;
  346.     const int *indices = 0;
  347.     m_outliner->getSelection(&indices, &count);
  348.  
  349. #if defined(USE_ABCOM)    
  350.     int error = 
  351.         AB_CommandAB2(m_pane, 
  352.                       abCmd,
  353.                       (MSG_ViewIndex *) indices,
  354.                       (int32) count);
  355. #endif /* USE_ABCOM */
  356.     return;
  357. }
  358.  
  359. void 
  360. XFE_ABDirListView::setDirServers(XP_List *dirs)
  361. {
  362.     m_directories = dirs;
  363.     if (m_directories) {
  364.         m_nDirs = XP_ListCount(m_directories);        
  365.     }/* if */
  366.     else {
  367.         m_nDirs = 0;
  368.         m_dir = 0;
  369.         m_dirLine = 0;
  370.     }/* else */
  371.  
  372.     /* update UI
  373.      */
  374.     m_outliner->change(0, m_nDirs, m_nDirs);
  375. }
  376.  
  377. // The Outlinable interface
  378. void* XFE_ABDirListView::ConvFromIndex(int /* index */)
  379. {
  380.     return 0;
  381. }
  382.  
  383. int XFE_ABDirListView::ConvToIndex(void */* item */)
  384. {
  385.     return -1;
  386. }
  387.  
  388. //
  389. char *XFE_ABDirListView::getColumnName(int /* column */)
  390. {
  391.     return XP_GetString(XFE_AB_HEADER_NAME);
  392. }
  393.  
  394. char *XFE_ABDirListView::getColumnHeaderText(int column)
  395. {
  396.   char *tmp = 0;
  397.   switch (column) {
  398.   case OUTLINER_COLUMN_NAME:
  399.     tmp = XP_GetString(XFE_AB2PANE_DIR_HEADER);
  400.     break;
  401.   }/* switch () */
  402.  
  403.   return tmp;
  404. }
  405.  
  406.  
  407. fe_icon *XFE_ABDirListView::getColumnHeaderIcon(int /* column */)
  408. {
  409.     fe_icon *myIcon = 0;
  410.  
  411. #if 0
  412.     switch (column) {
  413.     case OUTLINER_COLUMN_FLPPY:
  414.         myIcon = &m_openParentIcon;
  415.         break;
  416.  
  417.     case OUTLINER_COLUMN_TYPE:
  418.         myIcon = &m_pabIcon;
  419.         break;
  420.   case OUTLINER_COLUMN_NAME:
  421.         myIcon = &m_pabIcon;
  422.         break;
  423.         
  424.     }/* switch () */
  425. #endif
  426.     return myIcon;
  427. }
  428.  
  429. EOutlinerTextStyle 
  430. XFE_ABDirListView::getColumnHeaderStyle(int /* column */)
  431. {
  432.     return OUTLINER_Default;
  433. }
  434.  
  435.  
  436. EOutlinerTextStyle 
  437. XFE_ABDirListView::getColumnStyle(int /* column */)
  438. {
  439.     return OUTLINER_Default;
  440. }
  441.  
  442. //
  443. fe_icon*
  444. XFE_ABDirListView::treeInfoToIcon(int /* depth */, int /* flags */, 
  445.                                   XP_Bool /* expanded */)
  446. {
  447. #if 0
  448.     if (depth < 1) {
  449.         if (flags & MSG_FOLDER_FLAG_NEWS_HOST)
  450.             return secure ? &newsServerSecureIcon : &newsServerIcon;
  451.         else if (flags & MSG_FOLDER_FLAG_IMAPBOX)
  452.             return &mailServerIcon;
  453.         else
  454.             return &mailLocalIcon;
  455.     }/* if */
  456.  
  457.     if (flags & MSG_FOLDER_FLAG_NEWSGROUP)
  458.         return &newsgroupIcon;
  459.     else if (flags & MSG_FOLDER_FLAG_INBOX)
  460.         return expanded ? &inboxOpenIcon : &inboxIcon;
  461.     else if (flags & MSG_FOLDER_FLAG_DRAFTS)
  462.         return expanded ? &draftsOpenIcon : &draftsIcon;
  463.     else if (flags & MSG_FOLDER_FLAG_TRASH)
  464.         return &trashIcon;
  465.     else if (flags & MSG_FOLDER_FLAG_QUEUE)
  466.         return expanded ? &outboxOpenIcon : &outboxIcon;
  467.     else if (flags & MSG_FOLDER_FLAG_IMAPBOX)
  468.         return expanded ? &folderServerOpenIcon : &folderServerIcon;
  469.     else
  470.         return expanded ? &folderOpenIcon : &folderIcon;
  471. #else
  472.     return NULL;
  473. #endif
  474. }
  475.  
  476. void 
  477. XFE_ABDirListView::getTreeInfo(XP_Bool *expandable, 
  478.                                XP_Bool *is_expanded, 
  479.                                int *depth, 
  480.                                OutlinerAncestorInfo **ancestor)
  481. {
  482.     XP_Bool is_line_expandable = False;
  483.     XP_Bool is_line_expanded = False;
  484.     
  485. #if defined(USE_ABCOM)
  486.     AB_ContainerAttribValue *value = NULL;
  487.     int error = AB_GetContainerAttribute(m_containerLine,
  488.                                          attribNumChildren,
  489.                                          &value);
  490.     XP_ASSERT(value && value->attrib == attribNumChildren);
  491.  
  492.     /* is_line_expandable 
  493.      */
  494.     if (value->u.number)
  495.         is_line_expandable = value->u.number?True:False;
  496.     AB_FreeContainerAttribValue(value);
  497.  
  498.     /* depth
  499.      */
  500.     if (depth) {
  501.         error = AB_GetContainerAttribute(m_containerLine,
  502.                                          attribDepth,
  503.                                          &value);
  504.     
  505.         XP_ASSERT(value && value->attrib == attribDepth);
  506.         *depth = value->u.number;
  507.         AB_FreeContainerAttribValue(value);
  508.     }/* if */
  509.  
  510.     /* is_line_expanded ?
  511.      */
  512.     if (is_line_expandable) {
  513.         int32 delta = MSG_ExpansionDelta(m_pane, value->u.number);
  514.         if (delta < 0)
  515.             is_line_expanded = True;
  516.     }/* if */
  517.  
  518. #else
  519.     is_line_expandable = 
  520.         (m_dirLine->dirType == PABDirectory)?
  521.         True:False;
  522.     if (is_line_expandable) {
  523.         is_line_expanded = True; // hardwired
  524.     }
  525.     else {
  526.         is_line_expanded = False;
  527.     }
  528.  
  529.     if (depth)
  530.         *depth = (m_dirLine->dirType == PABDirectory)?0:0;
  531. #endif
  532.     if (ancestor)
  533.         *ancestor = m_ancestorInfo;
  534.  
  535.     if (expandable)
  536.         *expandable =  is_line_expandable;
  537.  
  538.     if (is_expanded)
  539.         *is_expanded = is_line_expanded;
  540. }
  541.  
  542. char*
  543. XFE_ABDirListView::getColumnText(int column)
  544. {
  545.   char *tmp = 0;
  546.   switch (column) {
  547.   case OUTLINER_COLUMN_NAME:
  548. #if defined(USE_ABCOM)
  549.       if (m_containerLine) {
  550.           AB_ContainerAttribValue *value = NULL;
  551.           int error = AB_GetContainerAttribute(m_containerLine,
  552.                                                attribName,
  553.                                                &value);
  554.           XP_ASSERT(value && value->attrib == attribName);
  555.           if (value->u.string)
  556.               tmp = XP_STRDUP(value->u.string); //todo need to free it
  557.           AB_FreeContainerAttribValue(value);
  558.       }/* if */
  559. #else
  560.       if (m_dirLine &&
  561.           m_dirLine->description) {
  562.           tmp = XP_STRDUP(m_dirLine->description);
  563.       }/* if */
  564. #endif /* USE_ABCOM */
  565.       break;
  566.   }/* switch () */
  567.  
  568.   return tmp;
  569.  
  570. }
  571.  
  572. fe_icon*
  573. XFE_ABDirListView::getColumnIcon(int column)
  574. {
  575.     fe_icon *myIcon = NULL;
  576. #if defined(USE_ABCOM)    
  577.     if (!m_containerLine)
  578.         return myIcon;
  579.  
  580.     switch (column) {
  581.     case OUTLINER_COLUMN_NAME:
  582.         AB_ContainerAttribValue *value = NULL;
  583.         int error = AB_GetContainerAttribute(m_containerLine,
  584.                                              attribContainerType,
  585.                                              &value);
  586.         XP_ASSERT(value && value->attrib == attribContainerType);
  587.         AB_ContainerType dirType = value->u.containerType; // attribContainerType
  588.         AB_FreeContainerAttribValue(value);
  589.  
  590.         if (dirType == AB_PABContainer)
  591.             myIcon = &m_pabIcon;
  592.         else if (dirType == AB_LDAPContainer)
  593.             myIcon = &m_ldapDirIcon;
  594.         else if (dirType == AB_MListContainer)
  595.             myIcon = &m_mListIcon;
  596.         break;
  597.     }/* switch */
  598. #else
  599.     if (!m_dirLine)
  600.         return myIcon;
  601.  
  602.     switch (column) {
  603.     case OUTLINER_COLUMN_NAME:
  604.         if (m_dirLine->dirType == PABDirectory)
  605.             myIcon = &m_pabIcon;
  606.         else if (m_dirLine->dirType == LDAPDirectory)
  607.             myIcon = &m_ldapDirIcon;
  608.         else
  609.             myIcon = &m_mListIcon;
  610.         break;
  611.     }/* switch */
  612. #endif /* USE_ABCOM */
  613.     return myIcon;    
  614. }
  615.  
  616. //
  617. void XFE_ABDirListView::clickHeader(const OutlineButtonFuncData *data)
  618. {
  619.  
  620.   int column = data->column; 
  621.   switch (column) {
  622.   case OUTLINER_COLUMN_NAME:  
  623.   default:
  624.       break;
  625.   }/* switch() */
  626. }
  627.  
  628. void
  629. XFE_ABDirListView::propertiesCB()
  630. {
  631.   int count = 0;
  632.   const int *indices = 0;
  633.   m_outliner->getSelection(&indices, &count);
  634.   if (count > 0 && indices) {
  635.       DIR_Server *dir = 
  636.           (DIR_Server *) XP_ListGetObjectNum(m_directories, 
  637.                                              indices[0]+1);
  638.       fe_showABDirPropertyDlg(getToplevel()->getBaseWidget(),
  639.                               m_contextData,
  640.                               dir,
  641.                               &(XFE_ABDirListView::propertyCallback),
  642.                               this);
  643.   }/* if */
  644. }
  645.  
  646. void XFE_ABDirListView::propertyCallback(DIR_Server *dir, void *callData)
  647. {
  648.     XFE_ABDirListView *obj = (XFE_ABDirListView *) callData;
  649.     obj->propertyCB(dir);
  650. }
  651.  
  652. void XFE_ABDirListView::propertyCB(DIR_Server *dir)
  653. {    
  654.     int which = XP_ListGetNumFromObject(m_directories, dir);
  655. #if defined(DEBUG_tao)
  656.     printf("\nXFE_ABDirListView::propertyCB=%d\n", which);
  657. #endif
  658.     if (!which) {
  659.         /* new
  660.          */
  661.         const int *selected;
  662.         int count;        
  663.         m_outliner->getSelection(&selected, &count);
  664.         int pos = 0;
  665.         if (m_nDirs > 0 && count && selected) {
  666.             // Insert dir at position
  667.             pos = selected[0];
  668.             DIR_Server *prev_dir;
  669.             prev_dir = (DIR_Server*)XP_ListGetObjectNum(m_directories,
  670.                                                         pos+1);
  671.             XP_ListInsertObjectAfter(m_directories, prev_dir, dir);
  672.             pos = pos+1;
  673.         }
  674.         else {
  675.             XP_ListAddObjectToEnd(m_directories, dir);
  676.             pos = m_nDirs+1;
  677.         }
  678.             
  679.         // Repaint 
  680.         m_nDirs = XP_ListCount(m_directories);
  681.         m_outliner->change(0, m_nDirs, m_nDirs);
  682.         // Set selection
  683.         m_outliner->selectItemExclusive(pos);
  684.         notifyInterested(XFE_ABDirListView::dirSelect, (void *) dir);
  685.     }/* if */
  686.     else
  687.         m_outliner->invalidateLine(which);
  688.         
  689.     DIR_SaveServerPreferences(m_directories);
  690.     if (m_deleted_directories) {
  691.         DIR_CleanUpServerPreferences(m_deleted_directories);
  692.         m_deleted_directories = NULL;
  693.     }/* if */
  694.  
  695.     getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating);
  696. }
  697.  
  698. void XFE_ABDirListView::doubleClickBody(const OutlineButtonFuncData *data)
  699. {
  700. #if defined(USE_ABCOM)
  701.     int count = 0;
  702.     const int *indices = 0;
  703.     m_outliner->getSelection(&indices, &count);
  704.  
  705.     int error = 
  706.         AB_CommandAB2(m_pane, 
  707.                       AB_PropertiesCmd,
  708.                       (MSG_ViewIndex *) indices,
  709.                       (int32) count);
  710. #else
  711.     /* get dir
  712.      */
  713.     DIR_Server *dir = 
  714.         (DIR_Server *) XP_ListGetObjectNum(m_directories, 
  715.                                            data->row+1);
  716.  
  717.     fe_showABDirPropertyDlg(getToplevel()->getBaseWidget(),
  718.                             m_contextData,
  719.                             dir,
  720.                             &(XFE_ABDirListView::propertyCallback),
  721.                             this);
  722. #endif /* USE_ABCOM */
  723. }
  724.  
  725.  
  726. void XFE_ABDirListView::Buttonfunc(const OutlineButtonFuncData *data)
  727. {
  728.   int row = data->row, 
  729.       clicks = data->clicks;
  730.  
  731.   // focus
  732.   notifyInterested(XFE_MNListView::changeFocus, this);
  733.  
  734.   if (row < 0) {
  735.       clickHeader(data);
  736.       return;
  737.   } 
  738.   else {
  739.       /* content row 
  740.        */
  741.       if (clicks == 2) {
  742.           m_outliner->selectItemExclusive(data->row);
  743.           doubleClickBody(data);
  744.       }/* clicks == 2 */
  745.       else if (clicks == 1) {
  746.           if (data->ctrl) {
  747.                   m_outliner->toggleSelected(data->row);
  748.           }
  749.           else if (data->shift) {
  750.               // select the range.
  751.               const int *selected;
  752.               int count;
  753.   
  754.               m_outliner->getSelection(&selected, &count);
  755.               
  756.               if (count == 0) { /* there wasn't anything selected yet. */
  757.                   m_outliner->selectItemExclusive(data->row);
  758.               }/* if count == 0 */
  759.               else if (count == 1) {
  760.                   /* there was only one, so we select the range from
  761.                      that item to the new one. */
  762.                   m_outliner->selectRangeByIndices(selected[0], data->row);
  763.               }/* count == 1 */
  764.               else {
  765.                   /* we had a range of items selected, 
  766.                    * so let's do something really
  767.                    * nice with them. */
  768.                   m_outliner->trimOrExpandSelection(data->row);
  769.               }/* else */
  770.           }/* if */
  771.           else {
  772.               m_outliner->selectItemExclusive(data->row);
  773.               selectLine(data->row);
  774.           }/* else */
  775.  
  776.           getToplevel()->notifyInterested(XFE_View::chromeNeedsUpdating);
  777.       }/* clicks == 1 */
  778.   }/* else */
  779.  
  780. }
  781.  
  782. void XFE_ABDirListView::Flippyfunc(const OutlineFlippyFuncData */* data */)
  783. {
  784. }
  785.     
  786. //
  787. void XFE_ABDirListView::releaseLineData()
  788. {
  789.     delete [] m_ancestorInfo;
  790.     m_ancestorInfo = NULL;    
  791. }
  792.  
  793. void *XFE_ABDirListView::acquireLineData(int line)
  794. {
  795. #if defined(USE_ABCOM)
  796.     if (line < 0 ||
  797.         !m_outliner ||
  798.         line >= m_outliner->getTotalLines())
  799.         return 0;
  800.     
  801.     AB_ContainerAttribValue *value = NULL;
  802.     int error = AB_GetContainerAttributeForPane(m_pane,
  803.                                          line,
  804.                                          attribContainerInfo,
  805.                                          &value);
  806.     XP_ASSERT(value && value->attrib == attribContainerInfo && value->u.container);
  807.     m_containerLine = value->u.container;
  808.     AB_FreeContainerAttribValue(value);
  809.  
  810.     /* ancestor
  811.      */
  812.     /* depth
  813.      */
  814.     error = AB_GetContainerAttribute(m_containerLine,
  815.                                      attribDepth,
  816.                                      &value);
  817.     
  818.     XP_ASSERT(value && value->attrib == attribDepth);
  819.     int32 depth = value->u.number;
  820. #if defined(DEBUG_tao_)
  821.     printf("\nXFE_ABDirListView::acquireLineData, depth=%d\n", depth);
  822. #endif
  823.     AB_FreeContainerAttribValue(value);
  824.     if (depth) 
  825.         m_ancestorInfo = new OutlinerAncestorInfo[depth];
  826.     else
  827.         m_ancestorInfo = new OutlinerAncestorInfo[1];
  828.       
  829.     // ripped straight from the winfe
  830.     int i = depth - 1;
  831.     int idx = line + 1;
  832.     int total_lines = m_outliner->getTotalLines();
  833.     while (i >  0) {
  834.         if ( idx < total_lines ) {
  835.             /* depth
  836.              */
  837.             error = AB_GetContainerAttribute(m_containerLine,
  838.                                              attribDepth,
  839.                                              &value);
  840.             
  841.             XP_ASSERT(value && value->attrib == attribDepth);
  842.             int32 level = value->u.number;
  843.             AB_FreeContainerAttribValue(value);
  844.  
  845.             if ( (level - 1) == i ) {
  846.                 m_ancestorInfo[i].has_prev = TRUE;
  847.                 m_ancestorInfo[i].has_next = TRUE;
  848.                 i--;
  849.                 idx++;
  850.             }/* if */ 
  851.             else if ( (level - 1) < i ) {
  852.                 m_ancestorInfo[i].has_prev = FALSE;
  853.                 m_ancestorInfo[i].has_next = FALSE;
  854.                 i--;
  855.             }/* else if */
  856.             else {
  857.                 idx++;
  858.             }/* else */
  859.         }/* if */ 
  860.         else {
  861.             m_ancestorInfo[i].has_prev = FALSE;
  862.             m_ancestorInfo[i].has_next = FALSE;
  863.             i--;
  864.         }/* else */
  865.     }/* while */
  866.  
  867.     m_ancestorInfo[0].has_prev = FALSE;
  868.     m_ancestorInfo[0].has_next = FALSE;
  869.     return m_containerLine;
  870. #else
  871.     if (line < 0 ||
  872.         line >= m_nDirs ||
  873.         m_directories == 0) {
  874.         m_dirLine = 0;
  875.         return 0;
  876.     }/* if */
  877.     else {
  878.         m_dirLine = (DIR_Server *) XP_ListGetObjectNum(m_directories, 
  879.                                                        line+1);
  880.     }/* else */
  881.  
  882.     /* ancestor
  883.      */
  884.     m_ancestorInfo = NULL;
  885.  
  886.     int level = (m_dirLine->dirType == PABDirectory)?1:0;
  887.  
  888.     if (level > 0) {
  889.         m_ancestorInfo = new OutlinerAncestorInfo[level];
  890.     }
  891.     else {
  892.         m_ancestorInfo = new OutlinerAncestorInfo[ 1 ];
  893.     }
  894.       
  895.     // ripped straight from the winfe
  896.     int i = level - 1;
  897.     int idx = line + 1;
  898.     int total_lines = m_outliner->getTotalLines();
  899.     while ( i >  0 ) {
  900.         if ( idx < total_lines ) {
  901.             int level = (m_dirLine->dirType == PABDirectory)?1:2;
  902.             //MSG_GetFolderLevelByIndex(m_pane, idx);
  903.             if ( (level - 1) == i ) {
  904.                 m_ancestorInfo[i].has_prev = TRUE;
  905.                 m_ancestorInfo[i].has_next = TRUE;
  906.                 i--;
  907.                 idx++;
  908.             } else if ( (level - 1) < i ) {
  909.                 m_ancestorInfo[i].has_prev = FALSE;
  910.                 m_ancestorInfo[i].has_next = FALSE;
  911.                 i--;
  912.             } else {
  913.                 idx++;
  914.             }
  915.         } else {
  916.             m_ancestorInfo[i].has_prev = FALSE;
  917.             m_ancestorInfo[i].has_next = FALSE;
  918.             i--;
  919.         }
  920.     }
  921.     
  922.     m_ancestorInfo[0].has_prev = FALSE;
  923.     m_ancestorInfo[0].has_next = FALSE;
  924.  
  925.     return m_dirLine;
  926. #endif /* !USE_ABCOM */
  927. }
  928.  
  929. #define COLLAPSE_IS_HIDE 1
  930. //
  931. void XFE_ABDirListView::expandCollapse(XP_Bool expand)
  932. {
  933.     if (expand)
  934.         show();
  935.     else
  936.         hide();
  937. }
  938.  
  939. #if defined(USE_ABCOM)
  940. //
  941. void XFE_ABDirListView::selectContainer(AB_ContainerInfo *containerInfo)
  942. {
  943.     if (containerInfo == m_activeContainer)
  944.         return;
  945.  
  946.     MSG_ViewIndex index = AB_GetIndexForContainer(m_pane, containerInfo);
  947.     if (index != MSG_VIEWINDEXNONE) {
  948.         m_outliner->scroll2Item((int) index);
  949.  
  950.         selectLine((int) index);
  951.     }/* if */
  952. }
  953. #endif /* USE_ABCOM */
  954.  
  955. void XFE_ABDirListView::selectLine(int line)
  956. {
  957. #if defined(USE_ABCOM)
  958.     AB_ContainerAttribValue *value = NULL;
  959.     int error = AB_GetContainerAttributeForPane(m_pane,
  960.                                                 line,
  961.                                                 attribContainerInfo,
  962.                                                 &value);
  963.     XP_ASSERT(value && value->attrib == attribContainerInfo && value->u.container);
  964.  
  965.     // set active one
  966.     m_activeContainer = value->u.container;
  967.  
  968.     notifyInterested(XFE_ABDirListView::dirSelect, 
  969.                      (void *) value->u.container);
  970.     AB_FreeContainerAttribValue(value);
  971. #else
  972.     DIR_Server *dir = 
  973.         (DIR_Server *) XP_ListGetObjectNum(m_directories, 
  974.                                            line+1);
  975.     selectDir(dir);
  976. #endif /* USE_ABCOM */
  977. }
  978.  
  979. void XFE_ABDirListView::selectDir(DIR_Server* dir)
  980. {
  981.     notifyInterested(XFE_ABDirListView::dirSelect, (void *) dir);
  982. }
  983.  
  984. #if defined(USE_MOTIF_DND)
  985.  
  986. fe_icon_data*
  987. XFE_ABDirListView::GetDragIconData(int row, int column)
  988. {
  989.     D(("XFE_ABDirListView::GetDragIconData()\n"));
  990.     /* TODO: get line data
  991.      * determine entry type
  992.      * return MNC_AddressSmall, or MN_FolderServer
  993.      */
  994.     fe_icon_data *icon_data = 0;
  995.     if (row < 0) {
  996. #if defined(DEBUG_tao)
  997.         printf("\n XFE_ABDirListView::GetDragIconData (row,col)=(%d,%d)\n",
  998.                row, column);
  999. #endif
  1000.     }/* if */
  1001.     else {
  1002.         DIR_Server *dirLine = (DIR_Server *) XP_ListGetObjectNum(m_directories, 
  1003.                                                                  row+1);
  1004.         if (!dirLine)
  1005.             return icon_data;
  1006.  
  1007.         if (dirLine->dirType == PABDirectory)
  1008.             icon_data = &MNC_AddressSmall; /* shall call make/initialize icons */
  1009.         else
  1010.             icon_data = &MN_FolderServer;
  1011.     }/* else */
  1012.     return icon_data;
  1013. }
  1014.  
  1015. void
  1016. XFE_ABDirListView::GetDragTargets(int    row, int column,
  1017.                                   Atom **targets,
  1018.                                   int   *num_targets)
  1019. {
  1020.     D(("XFE_ABDirListView::GetDragTargets(row=%d, col=%d)\n", row, column));
  1021.     
  1022.     XP_ASSERT(row > -1);
  1023.     if (row == -1) {
  1024.         *targets = NULL;
  1025.         *num_targets = 0;
  1026.     }/* if */
  1027.     else {
  1028.         if (!m_outliner->isSelected(row))
  1029.             m_outliner->selectItemExclusive(row);
  1030.         
  1031.         *num_targets = 2;
  1032.         
  1033.         *targets = new Atom[ *num_targets ];
  1034.  
  1035.         (*targets)[0] = XFE_OutlinerDrop::_XA_NETSCAPE_DIRSERV;
  1036.         (*targets)[1] = XFE_OutlinerDrop::_XA_NETSCAPE_PAB;
  1037.  
  1038.     }/* else */
  1039. }
  1040.  
  1041. void 
  1042. XFE_ABDirListView::getDropTargets(void */*this_ptr*/,
  1043.                                   Atom **targets,
  1044.                                   int *num_targets)
  1045. {
  1046.     D(("XFE_ABDirListView::getDropTargets()\n"));
  1047.     *num_targets = 2;
  1048.     *targets = new Atom[ *num_targets ];
  1049.  
  1050.     (*targets)[0] = XFE_OutlinerDrop::_XA_NETSCAPE_DIRSERV;
  1051.     (*targets)[1] = XFE_OutlinerDrop::_XA_NETSCAPE_PAB;
  1052. }
  1053.  
  1054. char *
  1055. XFE_ABDirListView::DragConvert(Atom atom)
  1056. {
  1057.     /* pack data
  1058.      */
  1059.     if (atom == XFE_OutlinerDrop::_XA_NETSCAPE_DIRSERV)    {
  1060. #if defined(DEBUG_tao)
  1061.         printf("\nXFE_ABDirListView::DragConvert:_XA_NETSCAPE_DIRSERV\n");
  1062. #endif        
  1063.         
  1064.         uint32 count = 0;
  1065.         const int *indices = 0;
  1066.  
  1067.         m_outliner->getSelection(&indices, (int *) &count);
  1068.  
  1069.         char tmp[32];
  1070.         sprintf(tmp, "%d", count);
  1071.  
  1072.         int len = XP_STRLEN(tmp);
  1073.         char *buf = (char *) XtCalloc(len, sizeof(char));
  1074.         buf = XP_STRCAT(buf, tmp);        
  1075.         for (int i=0; i < count; i++) {
  1076.             sprintf(tmp, "%d", indices[i]);
  1077.             len += XP_STRLEN(tmp)+1;
  1078.             buf = XtRealloc(buf, len);
  1079.             buf = XP_STRCAT(buf, " ");        
  1080.             buf = XP_STRCAT(buf, tmp);                    
  1081.         }/* for i */
  1082. #if defined(DEBUG_tao)
  1083.         printf("\nXFE_ABDirListView::DragConvert:_XA_NETSCAPE_DIRSERV=%x\n", buf);
  1084. #endif
  1085.         return buf;
  1086.     }/* if */
  1087.     else if (atom == XFE_OutlinerDrop::_XA_NETSCAPE_PAB)    {
  1088. #if defined(DEBUG_tao)
  1089.         printf("\nXFE_ABDirListView::DragConvert:_XA_NETSCAPE_PAB\n");
  1090. #endif        
  1091.         uint32 count = 0;
  1092.         const int *indices = 0;
  1093.  
  1094.         m_outliner->getSelection(&indices, (int *) &count);
  1095.  
  1096.         char tmp[32];
  1097.         sprintf(tmp, "%d", count);
  1098.  
  1099.         int len = XP_STRLEN(tmp);
  1100.         char *buf = (char *) XtCalloc(len, sizeof(char));
  1101.         buf = XP_STRCAT(buf, tmp);        
  1102.         for (int i=0; i < count; i++) {
  1103.             sprintf(tmp, "%d", indices[i]);
  1104.             len += XP_STRLEN(tmp)+1;
  1105.             buf = XtRealloc(buf, len);
  1106.             buf = XP_STRCAT(buf, " ");        
  1107.             buf = XP_STRCAT(buf, tmp);                    
  1108.         }/* for i */
  1109. #if defined(DEBUG_tao)
  1110.         printf("\nXFE_ABDirListView::DragConvert:_XA_NETSCAPE_PAB=%x\n", buf);
  1111. #endif
  1112.         return buf;
  1113.     }/* else if */
  1114.     return (char *) NULL;
  1115. }
  1116.  
  1117. int
  1118. XFE_ABDirListView::ProcessTargets(int row, int col,
  1119.                                   Atom *targets,
  1120.                                   const char **data,
  1121.                                   int numItems)
  1122. {
  1123.     int i;
  1124.  
  1125.     D(("XFE_ABDirListView::ProcessTargets(row=%d, col=%d, numItems=%d)\n", row, col, numItems));
  1126.     
  1127.     for (i=0; i < numItems; i++) {
  1128.         if (targets[i]==None || data[i]==NULL || strlen(data[i])==0)
  1129.             continue;
  1130.         
  1131.         D(("  [%d] %s: \"%s\"\n",i,XmGetAtomName(XtDisplay(m_widget),targets[i]),data[i]));
  1132.         if (targets[i] == XFE_OutlinerDrop::_XA_NETSCAPE_DIRSERV) {
  1133. #if defined(DEBUG_tao)
  1134.             printf("\nXFE_ABDirListView::ProcessTargets:_XA_NETSCAPE_DIRSERV\n");
  1135. #endif        
  1136.             /* decode
  1137.              */            
  1138.             char *pStr = (char *) XP_STRDUP(data[i]);
  1139.             int   len = XP_STRLEN(pStr);
  1140.  
  1141.             uint32 pCount = 0;
  1142.             char tmp[32];
  1143.             sscanf(data[i], "%d", &pCount);
  1144.             int *indices = (int *) XP_CALLOC(pCount, sizeof(int));
  1145.             
  1146.             char *tok = 0,
  1147.                  *last = 0;
  1148.             int   count = 0;
  1149.             char *sep = " ";
  1150.  
  1151.             while (((tok=XP_STRTOK_R(count?nil:pStr, sep, &last)) != NULL)&&
  1152.                    XP_STRLEN(tok) &&
  1153.                    count < len) {
  1154.                 int index = atoi(tok);
  1155.                 if (!count)
  1156.                     XP_ASSERT(index == pCount);
  1157.                 else
  1158.                     indices[count-1] =     index;
  1159.                 count++;
  1160.             }/* while */
  1161.             return TRUE;
  1162.         }/* if */
  1163.         else if (targets[i] == XFE_OutlinerDrop::_XA_NETSCAPE_PAB) {
  1164.             D(("  [%d] %s: \"%s\"\n",i,XmGetAtomName(XtDisplay(m_widget),targets[i]),data[i]));
  1165. #if defined(DEBUG_tao)
  1166.             printf("\nXFE_ABDirListView::ProcessTargets:_XA_NETSCAPE_PAB\n");
  1167. #endif
  1168.             return TRUE;
  1169.         }/* elss if */    
  1170.     }/* for i */
  1171.     return FALSE;
  1172. }
  1173.  
  1174. /* external entries
  1175.  */
  1176. fe_icon_data*
  1177. XFE_ABDirListView::getDragIconData(void *this_ptr,
  1178.                                    int   row,
  1179.                                    int   column)
  1180. {
  1181.     XFE_ABDirListView *view = (XFE_ABDirListView*)this_ptr;    
  1182.     return view->GetDragIconData(row, column);
  1183. }
  1184.  
  1185. void
  1186. XFE_ABDirListView::getDragTargets(void  *this_ptr,
  1187.                                   int    row, int column,
  1188.                                   Atom **targets, int *num_targets)
  1189. {
  1190.     XFE_ABDirListView *view = (XFE_ABDirListView*)this_ptr;    
  1191.     view->GetDragTargets(row, column, targets, num_targets);
  1192. }
  1193.  
  1194. char *
  1195. XFE_ABDirListView::dragConvert(void *this_ptr,
  1196.                                Atom atom)
  1197. {
  1198.   XFE_ABDirListView *view = (XFE_ABDirListView*) this_ptr;
  1199.   
  1200.   return view->DragConvert(atom);
  1201. }
  1202.  
  1203. int
  1204. XFE_ABDirListView::processTargets(void *this_ptr,
  1205.                                   int row, int col,
  1206.                                   Atom *targets,
  1207.                                   const char **data,
  1208.                                   int numItems)
  1209. {
  1210.     XFE_ABDirListView *view = (XFE_ABDirListView*)this_ptr;
  1211.     
  1212.     return view->ProcessTargets(row, col, targets, data, numItems);
  1213. }
  1214.  
  1215. #else /* USE_MOTIF_DND */
  1216.  
  1217. // Address field drop site handler
  1218. void
  1219. XFE_ABDirListView::dirListDropCallback(Widget, 
  1220.                                        void          *cd,
  1221.                                        fe_dnd_Event   type,
  1222.                                        fe_dnd_Source *source,
  1223.                                        XEvent        */* event */) 
  1224. {
  1225.     XFE_ABDirListView *ad = (XFE_ABDirListView *)cd;
  1226.     
  1227.     if (type == FE_DND_DROP && 
  1228.         ad && 
  1229.         source)
  1230. #if defined(USE_ABCOM)
  1231.         ad->dirListDropCB(source, event);
  1232. #else
  1233.         ad->dirListDropCB(source);
  1234. #endif
  1235. }
  1236.  
  1237. #if defined(USE_ABCOM)
  1238. void
  1239. XFE_ABDirListView::dirListDropCB(fe_dnd_Source *source, XEvent *event)
  1240. {
  1241. #if defined(DEBUG_tao)
  1242.     printf("\nXFE_ABDirListView::dirListDropCB:srcType=%d\n",
  1243.            source->type);
  1244. #endif
  1245.     XP_ASSERT(source && event && m_outliner);
  1246.  
  1247.     unsigned int state = event->xbutton.state;
  1248.     XP_Bool shift = ((state & ShiftMask) != 0),
  1249.             ctrl = ((state & ControlMask) != 0);
  1250.  
  1251.  
  1252.     /* onto which 
  1253.      */
  1254.     int row = -1;
  1255.     int x, y;
  1256.  
  1257.     m_outliner->translateFromRootCoords(event->xbutton.x_root, 
  1258.                                         event->xbutton.y_root, 
  1259.                                         &x, &y);
  1260.     
  1261.     row = m_outliner->XYToRow(x, y);
  1262. #if defined(DEBUG_tao)
  1263.     printf("\nXFE_ABDirListView::entryListDropCallback,shift=%d, ctrl=%d, row=%d",
  1264.            shift, ctrl, row);
  1265. #endif
  1266.     if (row < 0 ||
  1267.         row >= m_outliner->getTotalLines())
  1268.         XP_ASSERT(0);
  1269.  
  1270.     AB_ContainerInfo *containerInfo = 
  1271.         AB_GetContainerForIndex(m_pane, (MSG_ViewIndex) row);
  1272.  
  1273.     switch (source->type) {
  1274.     case FE_DND_ADDRESSBOOK:
  1275.     case FE_DND_BOOKS_DIRECTORIES: {
  1276.         XFE_MNListView* listView = (XFE_MNListView *) source->closure;
  1277.         XFE_Outliner *outliner = listView->getOutliner();
  1278.         const int *indices = NULL;
  1279.         int32 numIndices = 0;
  1280.         outliner->getSelection(&indices, &numIndices);
  1281.         MSG_Pane *srcPane = listView->getPane();
  1282.         AB_DragEffect effect = 
  1283.             AB_DragEntriesIntoContainerStatus(srcPane,
  1284.                                               (const MSG_ViewIndex *) indices,
  1285.                                               (int32) numIndices,
  1286.                                               containerInfo,
  1287.                                               AB_Default_Drag); 
  1288.         int error = 0;
  1289.         if (effect == AB_Drag_Not_Allowed)
  1290.             return;
  1291.         else
  1292.             error = AB_DragEntriesIntoContainer(srcPane,
  1293.                                                 (const MSG_ViewIndex *) indices,
  1294.                                                 (int32) numIndices,
  1295.                                                 containerInfo,
  1296.                                                 effect);
  1297.     }
  1298.     
  1299.     break;
  1300.         
  1301.     default:
  1302.         break;
  1303.     }/* switch */
  1304. }
  1305.  
  1306. #else
  1307. void
  1308. XFE_ABDirListView::dirListDropCB(fe_dnd_Source *)
  1309. {
  1310. }
  1311. #endif 
  1312. #endif /* USE_MOTIF_DND */
  1313.  
  1314. #if defined(USE_ABCOM)
  1315.  
  1316. #endif /* USE_ABCOM */
  1317.