* { font-family: Consolas, Lucida Console, Courier New; font-size: 100%; }
h1 { font-size: 150%; }
td.linenos { background-color: #f0f0f0; padding-right: 10px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
pre { line-height: 100%; width: 100%; }
.highlight span { width: 100%; display:-moz-inline-stack; display:inline-block; zoom:1; *display:inline; }
body { background: #ffffff; }
body .c { color: #999988; font-style: italic } /* Comment */
body .err { color: #a61717; background-color: #e3d2d2 } /* Error */
body .k { font-weight: bold } /* Keyword */
body .o { font-weight: bold } /* Operator */
body .cm { color: #999988; font-style: italic } /* Comment.Multiline */
body .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
body .c1 { color: #999988; font-style: italic } /* Comment.Single */
body .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
body .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
body .ge { font-style: italic } /* Generic.Emph */
body .gr { color: #aa0000 } /* Generic.Error */
body .gh { color: #999999 } /* Generic.Heading */
body .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
body .go { color: #888888 } /* Generic.Output */
body .gp { color: #555555 } /* Generic.Prompt */
body .gs { font-weight: bold } /* Generic.Strong */
body .gu { color: #aaaaaa } /* Generic.Subheading */
body .gt { color: #aa0000 } /* Generic.Traceback */
body .kc { font-weight: bold } /* Keyword.Constant */
body .kd { font-weight: bold } /* Keyword.Declaration */
body .kp { font-weight: bold } /* Keyword.Pseudo */
body .kr { font-weight: bold } /* Keyword.Reserved */
body .kt { color: #445588; font-weight: bold } /* Keyword.Type */
body .m { color: #009999 } /* Literal.Number */
body .s { color: #bb8844 } /* Literal.String */
body .na { color: #008080 } /* Name.Attribute */
body .nb { color: #999999 } /* Name.Builtin */
body .nc { color: #445588; font-weight: bold } /* Name.Class */
body .no { color: #008080 } /* Name.Constant */
body .ni { color: #800080 } /* Name.Entity */
body .ne { color: #990000; font-weight: bold } /* Name.Exception */
body .nf { color: #990000; font-weight: bold } /* Name.Function */
body .nn { color: #555555 } /* Name.Namespace */
body .nt { color: #000080 } /* Name.Tag */
body .nv { color: #008080 } /* Name.Variable */
body .ow { font-weight: bold } /* Operator.Word */
body .w { color: #bbbbbb } /* Text.Whitespace */
body .mf { color: #009999 } /* Literal.Number.Float */
body .mh { color: #009999 } /* Literal.Number.Hex */
body .mi { color: #009999 } /* Literal.Number.Integer */
body .mo { color: #009999 } /* Literal.Number.Oct */
body .sb { color: #bb8844 } /* Literal.String.Backtick */
body .sc { color: #bb8844 } /* Literal.String.Char */
body .sd { color: #bb8844 } /* Literal.String.Doc */
body .s2 { color: #bb8844 } /* Literal.String.Double */
body .se { color: #bb8844 } /* Literal.String.Escape */
body .sh { color: #bb8844 } /* Literal.String.Heredoc */
body .si { color: #bb8844 } /* Literal.String.Interpol */
body .sx { color: #bb8844 } /* Literal.String.Other */
body .sr { color: #808000 } /* Literal.String.Regex */
body .s1 { color: #bb8844 } /* Literal.String.Single */
body .ss { color: #bb8844 } /* Literal.String.Symbol */
body .bp { color: #999999 } /* Name.Builtin.Pseudo */
body .vc { color: #008080 } /* Name.Variable.Class */
body .vg { color: #008080 } /* Name.Variable.Global */
body .vi { color: #008080 } /* Name.Variable.Instance */
body .il { color: #009999 } /* Literal.Number.Integer.Long */
Info
Revision:3357
Author:alk
Date:2008-07-01 01:22:20 +0300 (Tue, 01 Jul 2008)
Comment:- User selection dialog complete
Changes
U trunk/src/client/console/libnxmc/userSelectionDialog.cpp
U trunk/src/client/console/libnxmc/userSelectionDialog.h
A trunk/src/client/console/nxmc/rc/icons/normal/everyone.png
A trunk/src/client/console/nxmc/rc/icons/normal/user.png
A trunk/src/client/console/nxmc/rc/icons/normal/userGroup.png
A trunk/src/client/console/nxmc/rc/icons/small/everyone.png
A trunk/src/client/console/nxmc/rc/icons/small/user.png
A trunk/src/client/console/nxmc/rc/icons/small/userGroup.png
U trunk/src/client/console/nxmc/rc/manual.xrc
U trunk/src/client/console/nxmc/rc/nxmc.fbp
Diff
Modified: trunk/src/client/console/libnxmc/userSelectionDialog.cpp
===================================================================
--- trunk/src/client/console/libnxmc/userSelectionDialog.cpp 2008-06-30 17:42:08 UTC (rev 3356)
+++ trunk/src/client/console/libnxmc/userSelectionDialog.cpp 2008-06-30 22:22:20 UTC (rev 3357)
@@ -46,6 +46,13 @@
wxXmlResource::Get()->LoadDialog(this, parent, _T("nxUserSelDlg"));
GetSizer()->Fit(this);
+
+ m_showPublic = false;
+ m_showGroups = true;
+ m_singleSelection = true;
+
+ m_selectedUsersCount = 0;
+ m_selectedUsers = NULL;
}
@@ -57,37 +64,205 @@
{
wxConfig::Get()->Write(_T("/UserSelDlg/SortMode"), m_sortMode);
wxConfig::Get()->Write(_T("/UserSelDlg/SortDir"), m_sortDir);
+
+ wxListCtrl *wndListCtrl = XRCCTRL(*this, "wndListCtrl", wxListCtrl);
+ NXMCSaveListCtrlColumns(wxConfig::Get(), *wndListCtrl, _T("/UserSelDlg/UserList"));
+
+ wxSize size = this->GetSize();
+ wxConfig::Get()->Write(_T("/UserSelDlg/SizeX"), size.GetX());
+ wxConfig::Get()->Write(_T("/UserSelDlg/SizeY"), size.GetY());
+
+ if (m_selectedUsers != NULL)
+ {
+ delete m_selectedUsers;
+ m_selectedUsers = NULL;
+ }
}
//
+// Setters
+//
+
+void nxUserSelectionDialog::SetShowGroups(bool flag)
+{
+ m_showGroups = flag;
+}
+
+void nxUserSelectionDialog::SetShowPublic(bool flag)
+{
+ m_showPublic = flag;
+}
+
+void nxUserSelectionDialog::SetSingleSelection(bool flag)
+{
+ m_singleSelection = flag;
+}
+
+// Getters
+
+DWORD nxUserSelectionDialog::GetSelectedUsersCount()
+{
+ return m_selectedUsersCount;
+}
+
+DWORD *nxUserSelectionDialog::GetSelectedUsers()
+{
+ return m_selectedUsers;
+}
+
+//
// Data exchange
//
bool nxUserSelectionDialog::TransferDataFromWindow(void)
{
+ wxListCtrl *list = XRCCTRL(*this, "wndListCtrl", wxListCtrl);
+
+ m_selectedUsersCount = list->GetSelectedItemCount();
+ m_selectedUsers = new DWORD[m_selectedUsersCount];
+
+ long item = -1;
+ int i = 0;
+ do
+ {
+ item = list->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ if (item != -1)
+ {
+ m_selectedUsers[i++] = (DWORD)list->GetItemData(item);
+ }
+ } while (item != -1);
+
return true;
}
bool nxUserSelectionDialog::TransferDataToWindow(void)
{
- wxListCtrl *wndListCtrl = XRCCTRL(*this, "wndListCtrl", wxListCtrl);
+ return true;
+}
- int width = wndListCtrl->GetClientSize().x;
- wndListCtrl->InsertColumn(0, _T("Name"), wxLIST_FORMAT_LEFT, 150);
- wndListCtrl->InsertColumn(1, _T("Full Name"), wxLIST_FORMAT_LEFT, width - 150 - wxSystemSettings::GetMetric(wxSYS_VSCROLL_X));
+//
+// Object comparison callback
+//
- return true;
+static int wxCALLBACK CompareObjects(long item1, long item2, long sortData)
+{
+ int rc = 0;
+
+ if (((item1 & GROUP_FLAG) && (item2 & GROUP_FLAG)) || (!(item1 & GROUP_FLAG) && !(item2 & GROUP_FLAG)))
+ {
+ rc = ((unsigned long)item1) - ((unsigned long)item2);
+ }
+ else if (item1 & GROUP_FLAG)
+ {
+ rc = -1;
+ }
+ else if (item2 & GROUP_FLAG)
+ {
+ rc = 1;
+ }
+
+
+ return rc;
}
-
//
// Dialog initialization handler
//
void nxUserSelectionDialog::OnInitDialog(wxInitDialogEvent &event)
{
+ wxListCtrl *list = XRCCTRL(*this, "wndListCtrl", wxListCtrl);
+
+ // cleanup it not first invocation
+ m_selectedUsersCount = 0;
+ if (m_selectedUsers != NULL)
+ {
+ delete m_selectedUsers;
+ m_selectedUsers = NULL;
+ }
+ list->ClearAll();
+
+ // set selection type
+ list->SetSingleStyle(wxLC_SINGLE_SEL, m_singleSelection);
+
+ // load and assign icons
+ wxImageList *imageList = new wxImageList(16, 16);
+
+ imageList->Add(wxXmlResource::Get()->LoadIcon(_T("icoSmallUser")));
+ imageList->Add(wxXmlResource::Get()->LoadIcon(_T("icoSmallUserGroup")));
+ imageList->Add(wxXmlResource::Get()->LoadIcon(_T("icoSmallEveryone")));
+ list->AssignImageList(imageList, wxIMAGE_LIST_SMALL);
+
+ // load and set dialog size
+ int sizeX, sizeY;
+ wxConfig::Get()->Read(_T("/UserSelDlg/SizeX"), &sizeX, 400);
+ wxConfig::Get()->Read(_T("/UserSelDlg/SizeY"), &sizeY, 300);
+
+ this->SetMinSize(wxSize(300, 200));
+ this->SetSize(wxSize(sizeX, sizeY));
+ this->Layout();
+
+ // add columns
+ int width = list->GetClientSize().GetX();
+ list->InsertColumn(0, _T("Name"), wxLIST_FORMAT_LEFT, 200);
+ list->InsertColumn(1, _T("Full Name"), wxLIST_FORMAT_LEFT, width - 200 - wxSystemSettings::GetMetric(wxSYS_VSCROLL_X));
+
+ NXMCLoadListCtrlColumns(wxConfig::Get(), *list, _T("/UserSelDlg/UserList"));
+
+ // Populate list
+ NXC_USER *userList;
+ DWORD i, userCount;
+ //NXCLockUserDB(NXMCGetSession());
+
+ if (m_showPublic)
+ {
+ int item = list->InsertItem(0x7FFFFFFF, _T("[public]"), 2);
+ list->SetItemData(item, GROUP_EVERYONE);
+ }
+ if (NXCGetUserDB(NXMCGetSession(), &userList, &userCount))
+ {
+ for(i = 0; i < userCount; i++)
+ {
+ if (userList[i].wFlags & UF_DELETED)
+ {
+ continue;
+ }
+
+ if (!m_showGroups && (userList[i].dwId & GROUP_FLAG))
+ {
+ continue;
+ }
+
+ //if (!(userList[i].dwId & GROUP_FLAG) && !(userList[i].wFlags & UF_DELETED))
+ int imageIndex;
+ if (userList[i].dwId == GROUP_EVERYONE)
+ {
+ imageIndex = 2;
+ }
+ else
+ {
+ if (userList[i].dwId & GROUP_FLAG)
+ {
+ imageIndex = 1;
+ }
+ else
+ {
+ imageIndex = 0;
+ }
+ }
+
+ long item = list->InsertItem(0x7FFFFFFF, userList[i].szName, imageIndex);
+ list->SetItem(item, 1, userList[i].szFullName);
+ list->SetItemData(item, userList[i].dwId);
+ }
+ }
+ //NXCUnlockUserDB(NXMCGetSession());
+
+ list->SortItems(CompareObjects, 0);
+
+ // Set focus to "OK"
wxWindow *wnd;
wnd = FindWindowById(wxID_OK, this);
@@ -120,5 +295,8 @@
void nxUserSelectionDialog::OnListItemActivate(wxListEvent &event)
{
-
+ if (Validate() && TransferDataFromWindow())
+ {
+ EndDialog(wxID_OK);
+ }
}
Modified: trunk/src/client/console/libnxmc/userSelectionDialog.h
===================================================================
--- trunk/src/client/console/libnxmc/userSelectionDialog.h 2008-06-30 17:42:08 UTC (rev 3356)
+++ trunk/src/client/console/libnxmc/userSelectionDialog.h 2008-06-30 22:22:20 UTC (rev 3357)
@@ -29,6 +29,13 @@
nxUserSelectionDialog(wxWindow *parent);
virtual ~nxUserSelectionDialog();
+ void SetShowGroups(bool flag);
+ void SetShowPublic(bool flag);
+ void SetSingleSelection(bool flag);
+
+ DWORD GetSelectedUsersCount();
+ DWORD *GetSelectedUsers();
+
protected:
virtual bool TransferDataFromWindow(void);
virtual bool TransferDataToWindow(void);
@@ -36,7 +43,13 @@
private:
int m_sortMode;
int m_sortDir;
+ bool m_showGroups;
+ bool m_showPublic;
+ bool m_singleSelection;
+ DWORD m_selectedUsersCount;
+ DWORD *m_selectedUsers;
+
void OnInitDialog(wxInitDialogEvent &event);
void OnListColumnClick(wxListEvent &event);
void OnListItemActivate(wxListEvent &event);
Property changes on: trunk/src/client/console/nxmc/rc/icons/normal/everyone.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/src/client/console/nxmc/rc/icons/normal/user.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/src/client/console/nxmc/rc/icons/normal/userGroup.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/src/client/console/nxmc/rc/icons/small/everyone.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/src/client/console/nxmc/rc/icons/small/user.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/src/client/console/nxmc/rc/icons/small/userGroup.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/src/client/console/nxmc/rc/manual.xrc
===================================================================
--- trunk/src/client/console/nxmc/rc/manual.xrc 2008-06-30 17:42:08 UTC (rev 3356)
+++ trunk/src/client/console/nxmc/rc/manual.xrc 2008-06-30 22:22:20 UTC (rev 3357)
@@ -48,6 +48,14 @@
<!-- Miscellanious normal size icons -->
<object class="wxIcon" name="icoConfig">icons/normal/config.png</object>
<object class="wxIcon" name="icoUnknown">icons/normal/unknown.png</object>
+
+ <!-- User icons -->
+ <object class="wxIcon" name="icoSmallUser">icons/small/user.png</object>
+ <object class="wxIcon" name="icoSmallUserGroup">icons/small/userGroup.png</object>
+ <object class="wxIcon" name="icoSmallEveryone">icons/small/everyone.png</object>
+ <object class="wxIcon" name="icoUser">icons/normal/user.png</object>
+ <object class="wxIcon" name="icoUserGroup">icons/normal/userGroup.png</object>
+ <object class="wxIcon" name="icoEveryone">icons/normal/everyone.png</object>
<!-- Busy dialog -->
<object class="wxDialog" name="nxBusyDialog">
Modified: trunk/src/client/console/nxmc/rc/nxmc.fbp
===================================================================
--- trunk/src/client/console/nxmc/rc/nxmc.fbp 2008-06-30 17:42:08 UTC (rev 3356)
+++ trunk/src/client/console/nxmc/rc/nxmc.fbp 2008-06-30 22:22:20 UTC (rev 3357)
@@ -1341,7 +1341,7 @@
</object>
</object>
</object>
- <object class="Dialog" expanded="1">
+ <object class="Dialog" expanded="0">
<property name="bg"></property>
<property name="center">wxBOTH</property>
<property name="context_help"></property>
@@ -1866,10 +1866,10 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
- <property name="minimum_size"></property>
+ <property name="minimum_size">300,200</property>
<property name="name">nxUserSelDlg</property>
<property name="pos"></property>
- <property name="size">438,292</property>
+ <property name="size">426,367</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Select User</property>
Received on Tue Jul 01 2008 - 01:22:20 EEST
This archive was generated by hypermail 2.2.0 : Tue Jul 01 2008 - 01:17:17 EEST