2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $TOG: SortCmd.C /main/8 1998/10/22 19:57:10 mgreess $ */
29 #include "MotifCmds.h"
30 #include "MsgHndArray.hh"
36 RoamMenuWindow *window,
38 ) : ToggleButtonCmd ( name, label, active, FALSE, XmONE_OF_MANY_ROUND )
40 // initialize the internal state
42 _sortstyle = sortstyle;
43 _sorter = new Sort ();
49 MsgScrollingList *displayList;
50 DtMail::MailBox *mbox;
53 theRoamApp.busyAllWindows(GETMSG(DT_catd, 1, 219, "Sorting..."));
56 mbox = _sortparent->mailbox();
58 // Get array of message handles from scrolling list
59 displayList = _sortparent->list();
61 MsgHndArray *selected_messages = displayList->selected();
63 // Sort array of message handles
64 current_msg = _sorter->sortMessages (displayList, mbox, _sortstyle);
66 // The array of message handles is sorted. Now we need to update
67 // the display preserving the state of the selected messages.
68 displayList->updateListItems(current_msg, FALSE, selected_messages);
70 delete selected_messages;
73 _sortparent->last_sorted_by(_sortstyle);
74 _sortparent->message_summary();
76 theRoamApp.unbusyAllWindows();