[Nmailserver-commits] SF.net SVN: nmailserver: [211] NMail/trunk
Brought to you by:
dframpton-oss,
tmyroadctfig
|
From: <tmy...@us...> - 2007-06-10 03:32:49
|
Revision: 211
http://svn.sourceforge.net/nmailserver/?rev=211&view=rev
Author: tmyroadctfig
Date: 2007-06-09 20:32:48 -0700 (Sat, 09 Jun 2007)
Log Message:
-----------
Further work on mail domain administration in UI.
Modified Paths:
--------------
NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.Designer.cs
NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.cs
NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.Designer.cs
NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.cs
NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.resx
NMail/trunk/NMail.Administration.WinForms/MainForm.cs
NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj
NMail/trunk/NMail.Icons/NMail.Icons.csproj
Added Paths:
-----------
NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.Designer.cs
NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.cs
NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.resx
NMail/trunk/NMail.Icons/Resources/16x16/actions/delete.png
NMail/trunk/NMail.Icons/Resources/16x16/actions/edit.png
Modified: NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.Designer.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.Designer.cs 2007-05-31 12:13:10 UTC (rev 210)
+++ NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.Designer.cs 2007-06-10 03:32:48 UTC (rev 211)
@@ -69,6 +69,7 @@
this.userNameTextBox.Name = "userNameTextBox";
this.userNameTextBox.Size = new System.Drawing.Size(132, 20);
this.userNameTextBox.TabIndex = 6;
+ this.userNameTextBox.Text = "Administrator";
//
// pictureBox1
//
Modified: NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.cs 2007-05-31 12:13:10 UTC (rev 210)
+++ NMail/trunk/NMail.Administration.WinForms/AuthenticationPrompt.cs 2007-06-10 03:32:48 UTC (rev 211)
@@ -33,6 +33,11 @@
this.pictureBox1.Image = IconHelper.GetImage("password", "apps", IconSize.s32x32);
}
+ protected override void OnShown(EventArgs e) {
+ base.OnShown(e);
+ this.passwordTextBox.Focus();
+ }
+
private void cancelButton_Click(object sender, EventArgs e) {
this.DialogResult = DialogResult.Cancel;
this.Close();
Added: NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.Designer.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.Designer.cs (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.Designer.cs 2007-06-10 03:32:48 UTC (rev 211)
@@ -0,0 +1,97 @@
+namespace NMail.Administration.WinForms.MailDomain {
+ partial class MailDomainEditor {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent() {
+ this.propertyGrid = new System.Windows.Forms.PropertyGrid();
+ this.bottomPanel = new System.Windows.Forms.Panel();
+ this.cancelButton = new System.Windows.Forms.Button();
+ this.okButton = new System.Windows.Forms.Button();
+ this.bottomPanel.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // propertyGrid
+ //
+ this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.propertyGrid.Location = new System.Drawing.Point(0, 0);
+ this.propertyGrid.Name = "propertyGrid";
+ this.propertyGrid.Size = new System.Drawing.Size(312, 266);
+ this.propertyGrid.TabIndex = 0;
+ //
+ // bottomPanel
+ //
+ this.bottomPanel.Controls.Add(this.cancelButton);
+ this.bottomPanel.Controls.Add(this.okButton);
+ this.bottomPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.bottomPanel.Location = new System.Drawing.Point(0, 266);
+ this.bottomPanel.Name = "bottomPanel";
+ this.bottomPanel.Size = new System.Drawing.Size(312, 43);
+ this.bottomPanel.TabIndex = 1;
+ //
+ // cancelButton
+ //
+ this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.cancelButton.Location = new System.Drawing.Point(84, 6);
+ this.cancelButton.Name = "cancelButton";
+ this.cancelButton.Size = new System.Drawing.Size(75, 23);
+ this.cancelButton.TabIndex = 1;
+ this.cancelButton.Text = "Cancel";
+ this.cancelButton.UseVisualStyleBackColor = true;
+ this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
+ //
+ // okButton
+ //
+ this.okButton.Location = new System.Drawing.Point(3, 6);
+ this.okButton.Name = "okButton";
+ this.okButton.Size = new System.Drawing.Size(75, 23);
+ this.okButton.TabIndex = 0;
+ this.okButton.Text = "OK";
+ this.okButton.UseVisualStyleBackColor = true;
+ this.okButton.Click += new System.EventHandler(this.okButton_Click);
+ //
+ // MailDomainEditor
+ //
+ this.AcceptButton = this.okButton;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.cancelButton;
+ this.ClientSize = new System.Drawing.Size(312, 309);
+ this.Controls.Add(this.propertyGrid);
+ this.Controls.Add(this.bottomPanel);
+ this.MinimumSize = new System.Drawing.Size(160, 100);
+ this.Name = "MailDomainEditor";
+ this.TabText = "Mail Domain Editor";
+ this.Text = "Mail Domain Editor";
+ this.bottomPanel.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.PropertyGrid propertyGrid;
+ private System.Windows.Forms.Panel bottomPanel;
+ private System.Windows.Forms.Button cancelButton;
+ private System.Windows.Forms.Button okButton;
+ }
+}
Added: NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.cs (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.cs 2007-06-10 03:32:48 UTC (rev 211)
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
+using System.Windows.Forms;
+
+using WeifenLuo.WinFormsUI.Docking;
+
+namespace NMail.Administration.WinForms.MailDomain {
+ /// <summary>
+ /// A simple editor for mail domains.
+ /// </summary>
+ public partial class MailDomainEditor : DockContent {
+ public MailDomainEditor() {
+ InitializeComponent();
+
+ this.MailDomain = new NMail.DataTypes.LocalStore.MailDomain();
+ }
+
+ /// <summary>
+ /// The text on the OK button.
+ /// </summary>
+ public string OkButtonText {
+ get {
+ return this.okButton.Text;
+ }
+ set {
+ this.okButton.Text = value;
+ }
+ }
+
+ private NMail.DataTypes.LocalStore.MailDomain mailDomain;
+
+ /// <summary>
+ /// The mail domain displayed in the editor.
+ /// </summary>
+ public NMail.DataTypes.LocalStore.MailDomain MailDomain {
+ get { return mailDomain; }
+ set {
+ mailDomain = value;
+ this.propertyGrid.SelectedObject = mailDomain;
+ }
+ }
+
+ private void okButton_Click(object sender, EventArgs e) {
+ this.DialogResult = DialogResult.OK;
+ this.Close();
+ }
+
+ private void cancelButton_Click(object sender, EventArgs e) {
+ this.DialogResult = DialogResult.Cancel;
+ this.Close();
+ }
+ }
+}
Added: NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.resx
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.resx (rev 0)
+++ NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainEditor.resx 2007-06-10 03:32:48 UTC (rev 211)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
\ No newline at end of file
Modified: NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.Designer.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.Designer.cs 2007-05-31 12:13:10 UTC (rev 210)
+++ NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.Designer.cs 2007-06-10 03:32:48 UTC (rev 211)
@@ -23,33 +23,40 @@
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
- this.mainDomainsListView = new System.Windows.Forms.ListView();
+ this.components = new System.ComponentModel.Container();
+ this.mailDomainsListView = new System.Windows.Forms.ListView();
this.idColumnHeader = new System.Windows.Forms.ColumnHeader();
this.primaryHostColumnHeader = new System.Windows.Forms.ColumnHeader();
this.secondaryColumnHeader = new System.Windows.Forms.ColumnHeader();
- this.editColumnHeader = new System.Windows.Forms.ColumnHeader();
+ this.imageList = new System.Windows.Forms.ImageList(this.components);
this.bottomPanel = new System.Windows.Forms.Panel();
this.refreshButton = new System.Windows.Forms.Button();
+ this.mailDomainContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.editMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.bottomPanel.SuspendLayout();
+ this.mailDomainContextMenu.SuspendLayout();
this.SuspendLayout();
//
- // mainDomainsListView
+ // mailDomainsListView
//
- this.mainDomainsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
+ this.mailDomainsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.idColumnHeader,
this.primaryHostColumnHeader,
- this.secondaryColumnHeader,
- this.editColumnHeader});
- this.mainDomainsListView.Dock = System.Windows.Forms.DockStyle.Fill;
- this.mainDomainsListView.FullRowSelect = true;
- this.mainDomainsListView.GridLines = true;
- this.mainDomainsListView.HideSelection = false;
- this.mainDomainsListView.Location = new System.Drawing.Point(0, 0);
- this.mainDomainsListView.Name = "mainDomainsListView";
- this.mainDomainsListView.Size = new System.Drawing.Size(620, 369);
- this.mainDomainsListView.TabIndex = 1;
- this.mainDomainsListView.UseCompatibleStateImageBehavior = false;
- this.mainDomainsListView.View = System.Windows.Forms.View.Details;
+ this.secondaryColumnHeader});
+ this.mailDomainsListView.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.mailDomainsListView.FullRowSelect = true;
+ this.mailDomainsListView.GridLines = true;
+ this.mailDomainsListView.HideSelection = false;
+ this.mailDomainsListView.Location = new System.Drawing.Point(0, 0);
+ this.mailDomainsListView.Name = "mailDomainsListView";
+ this.mailDomainsListView.Size = new System.Drawing.Size(620, 369);
+ this.mailDomainsListView.SmallImageList = this.imageList;
+ this.mailDomainsListView.TabIndex = 1;
+ this.mailDomainsListView.UseCompatibleStateImageBehavior = false;
+ this.mailDomainsListView.View = System.Windows.Forms.View.Details;
+ this.mailDomainsListView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.mailDomainsListView_MouseClick);
//
// idColumnHeader
//
@@ -66,9 +73,11 @@
this.secondaryColumnHeader.Text = "Additional Hosts";
this.secondaryColumnHeader.Width = 188;
//
- // editColumnHeader
+ // imageList
//
- this.editColumnHeader.Text = "Edit";
+ this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
+ this.imageList.ImageSize = new System.Drawing.Size(16, 16);
+ this.imageList.TransparentColor = System.Drawing.Color.Transparent;
//
// bottomPanel
//
@@ -89,28 +98,63 @@
this.refreshButton.UseVisualStyleBackColor = true;
this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click);
//
+ // mailDomainContextMenu
+ //
+ this.mailDomainContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.addToolStripMenuItem,
+ this.editMenuItem,
+ this.deleteToolStripMenuItem});
+ this.mailDomainContextMenu.Name = "mailDomainContextMenu";
+ this.mailDomainContextMenu.Size = new System.Drawing.Size(153, 92);
+ //
+ // addToolStripMenuItem
+ //
+ this.addToolStripMenuItem.Name = "addToolStripMenuItem";
+ this.addToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.addToolStripMenuItem.Text = "Add";
+ this.addToolStripMenuItem.Click += new System.EventHandler(this.addToolStripMenuItem_Click);
+ //
+ // editMenuItem
+ //
+ this.editMenuItem.Name = "editMenuItem";
+ this.editMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.editMenuItem.Text = "Edit...";
+ this.editMenuItem.Click += new System.EventHandler(this.editMenuItem_Click);
+ //
+ // deleteToolStripMenuItem
+ //
+ this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
+ this.deleteToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.deleteToolStripMenuItem.Text = "Delete";
+ this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click);
+ //
// MailDomainManager
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.mainDomainsListView);
+ this.Controls.Add(this.mailDomainsListView);
this.Controls.Add(this.bottomPanel);
this.Name = "MailDomainManager";
this.Size = new System.Drawing.Size(620, 408);
this.bottomPanel.ResumeLayout(false);
+ this.mailDomainContextMenu.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
- private System.Windows.Forms.ListView mainDomainsListView;
+ private System.Windows.Forms.ListView mailDomainsListView;
private System.Windows.Forms.ColumnHeader idColumnHeader;
private System.Windows.Forms.ColumnHeader primaryHostColumnHeader;
private System.Windows.Forms.ColumnHeader secondaryColumnHeader;
- private System.Windows.Forms.ColumnHeader editColumnHeader;
private System.Windows.Forms.Panel bottomPanel;
private System.Windows.Forms.Button refreshButton;
+ private System.Windows.Forms.ImageList imageList;
+ private System.Windows.Forms.ContextMenuStrip mailDomainContextMenu;
+ private System.Windows.Forms.ToolStripMenuItem editMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem addToolStripMenuItem;
}
}
Modified: NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.cs 2007-05-31 12:13:10 UTC (rev 210)
+++ NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.cs 2007-06-10 03:32:48 UTC (rev 211)
@@ -23,14 +23,24 @@
using System.Text;
using System.Windows.Forms;
+using WeifenLuo.WinFormsUI.Docking;
+
+using NMail.DataTypes;
using NMail.DataTypes.LocalStore;
+using NMail.Icons;
namespace NMail.Administration.WinForms.MailDomain {
+
public partial class MailDomainManager : UserControl {
public MailDomainManager(MainForm mainForm) {
InitializeComponent();
this.mainForm = mainForm;
+
+ this.imageList.Images.Add(IconHelper.GetImage("server", "actions", IconSize.s16x16));
+
+ this.editMenuItem.Image = IconHelper.GetImage("edit", "actions", IconSize.s16x16);
+ this.deleteToolStripMenuItem.Image = IconHelper.GetImage("delete", "actions", IconSize.s16x16);
}
MainForm mainForm;
@@ -41,11 +51,12 @@
ILocalStore localStore = this.mainForm.RemoteAdministration.NMailServer.LocalStore;
IList<NMail.DataTypes.LocalStore.MailDomain> mailDomains = localStore.GetMailDomains(this.mainForm.AuthenticationToken);
- this.mainDomainsListView.Items.Clear();
+ this.mailDomainsListView.Items.Clear();
// Add them to the list view
foreach (NMail.DataTypes.LocalStore.MailDomain mailDomain in mailDomains) {
-
+ ListViewItem item = new MailDomainListVieItem(mailDomain);
+ this.mailDomainsListView.Items.Add(item);
}
} catch (Exception ex) {
@@ -53,5 +64,129 @@
Program.ShowExceptionDialog(ex);
}
}
+
+ private MailDomainListVieItem clickedItem;
+
+ private void mailDomainsListView_MouseClick(object sender, MouseEventArgs e) {
+ if (e.Button == MouseButtons.Right) {
+ this.clickedItem = this.mailDomainsListView.GetItemAt(e.X, e.Y) as MailDomainListVieItem;
+ this.mailDomainContextMenu.Show(Control.MousePosition, ToolStripDropDownDirection.BelowRight);
+ }
+ }
+
+ private void addToolStripMenuItem_Click(object sender, EventArgs e) {
+ // Create a new editor and display it
+ MailDomainEditor editor = new MailDomainEditor();
+ editor.TabText = "Add Mail Domain";
+ editor.OkButtonText = "Add";
+ editor.Icon = IconHelper.GetIcon("server", "actions", IconSize.s16x16);
+ this.mainForm.DockFloat(editor, new Size(320, 440));
+
+ // Add a handler for the editor's closing event
+ editor.FormClosing += delegate(object s, FormClosingEventArgs fea) {
+
+ if (editor.DialogResult == DialogResult.OK) {
+ // Attempt to add the mail domain
+ try {
+ NMail.Authentication.IAuthenticationToken authToken = this.mainForm.AuthenticationToken;
+ this.mainForm.RemoteAdministration.NMailServer.LocalStore.CreateMailDomain(authToken, editor.MailDomain);
+ } catch (Exception ex) {
+ Program.ShowExceptionDialog(ex);
+ }
+
+ // Update the list of mail domains
+ refreshButton_Click(this, new EventArgs());
+ }
+ };
+ }
+
+ private void editMenuItem_Click(object sender, EventArgs e) {
+ if (this.clickedItem != null) {
+ // Create a new editor and display it
+ MailDomainEditor editor = new MailDomainEditor();
+ editor.Dock = DockStyle.Fill;
+ editor.TabText = "Edit Mail Domain";
+ editor.OkButtonText = "Update";
+ editor.Icon = IconHelper.GetIcon("server", "actions", IconSize.s16x16);
+ editor.MailDomain = this.clickedItem.MailDomain;
+ this.mainForm.DockFloat(editor, new Size(320, 440));
+
+ // Add a handler for the editor's closing event
+ editor.FormClosing += delegate(object s, FormClosingEventArgs fea) {
+
+ if (editor.DialogResult == DialogResult.OK) {
+ // Attempt to add the mail domain
+ try {
+ NMail.Authentication.IAuthenticationToken authToken = this.mainForm.AuthenticationToken;
+ this.mainForm.RemoteAdministration.NMailServer.LocalStore.UpdateMailDomain(authToken, editor.MailDomain);
+ } catch (Exception ex) {
+ Program.ShowExceptionDialog(ex);
+ }
+
+ // Update the list of mail domains
+ refreshButton_Click(this, new EventArgs());
+ }
+ };
+ }
+ }
+
+ private void deleteToolStripMenuItem_Click(object sender, EventArgs e) {
+ if (this.clickedItem != null) {
+ if (this.clickedItem.MailDomain.PrimaryHost.Domain == Domain.LocalHost) {
+
+ // Can't delete the localhost mail domain
+ MessageBox.Show(this,
+ "Can't delete the localhost mail domain.",
+ "Error",
+ MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ return;
+ }
+
+ // Prompt the user to confirm deletion
+ DialogResult result = MessageBox.Show(
+ this,
+ string.Format("Really delete mail domain '{0}'?", this.clickedItem.MailDomain.PrimaryHost.ToString()),
+ "Confirm delete...",
+ MessageBoxButtons.YesNo,
+ MessageBoxIcon.Warning,
+ MessageBoxDefaultButton.Button2);
+
+ if (result == DialogResult.Yes) {
+ // Attempt to delete the mail domain
+ try {
+ NMail.Authentication.IAuthenticationToken authToken = this.mainForm.AuthenticationToken;
+ this.mainForm.RemoteAdministration.NMailServer.LocalStore.DeleteMailDomain(authToken, this.clickedItem.MailDomain.MailDomainId);
+ } catch (Exception ex) {
+ Program.ShowExceptionDialog(ex);
+ }
+ }
+ }
+ }
}
+
+ public class MailDomainListVieItem : ListViewItem {
+
+ private NMail.DataTypes.LocalStore.MailDomain mailDomain;
+
+ public MailDomainListVieItem(NMail.DataTypes.LocalStore.MailDomain mailDomain) {
+ this.mailDomain = mailDomain;
+
+ this.SubItems[0] = new ListViewSubItem(this, mailDomain.MailDomainId.ToString());
+ this.SubItems.Add(new ListViewSubItem(this, mailDomain.PrimaryHost.ToString()));
+
+ string additional = string.Empty;
+ foreach (WildcardHost host in mailDomain.AdditionalHosts) {
+ additional += host.ToString() + "; ";
+ }
+ this.SubItems.Add(new ListViewSubItem(this, additional));
+ this.ImageIndex = 0;
+ }
+
+ public NMail.DataTypes.LocalStore.MailDomain MailDomain {
+ get {
+ return this.mailDomain;
+ }
+ }
+ }
}
Modified: NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.resx
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.resx 2007-05-31 12:13:10 UTC (rev 210)
+++ NMail/trunk/NMail.Administration.WinForms/MailDomain/MailDomainManager.resx 2007-06-10 03:32:48 UTC (rev 211)
@@ -117,4 +117,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <metadata name="imageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <metadata name="mailDomainContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>116, 17</value>
+ </metadata>
</root>
\ No newline at end of file
Modified: NMail/trunk/NMail.Administration.WinForms/MainForm.cs
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/MainForm.cs 2007-05-31 12:13:10 UTC (rev 210)
+++ NMail/trunk/NMail.Administration.WinForms/MainForm.cs 2007-06-10 03:32:48 UTC (rev 211)
@@ -321,6 +321,9 @@
}
protected void ShowStatusBrowser() {
+ this.statusBrowserDock.DockState = DockState.Document;
+ this.statusBrowserDock.DockHandler.DockTo(this.dockPanel.DockWindows[DockState.Document].NestedPanes[0], DockStyle.Fill, 0);
+ this.statusBrowserDock.DockHandler.Show();
}
#endregion
@@ -379,6 +382,7 @@
} else {
this.servicesDock.DockState = DockState.Document;
this.servicesDock.DockHandler.DockTo(this.dockPanel.DockWindows[DockState.Document].NestedPanes[0], DockStyle.Fill, 0);
+ this.servicesDock.DockHandler.Show();
}
}
#endregion
@@ -422,6 +426,7 @@
} else {
this.mailDomainManagerDock.DockState = DockState.Document;
this.mailDomainManagerDock.DockHandler.DockTo(this.dockPanel.DockWindows[DockState.Document].NestedPanes[0], DockStyle.Fill, 0);
+ this.mailDomainManagerDock.DockHandler.Show();
}
}
#endregion
@@ -435,5 +440,22 @@
private void exitMenuItem_Click(object sender, EventArgs e) {
this.Close();
}
+
+ public void DockFloat(DockContent dockContent, Size size) {
+ int centerThisX = this.Location.X + this.Size.Width / 2;
+ int centerThisY = this.Location.Y + this.Size.Height / 2;
+ Point centerThis = new Point(centerThisX, centerThisY);
+
+ Point halfChild = new Point(size.Width / 2, size.Height / 2);
+ Rectangle r = new Rectangle(
+ centerThis.X - halfChild.X,
+ centerThis.Y - halfChild.Y,
+ size.Width,
+ size.Height);
+
+ dockContent.DockPanel = this.dockPanel;
+ dockContent.DockHandler.FloatAt(r);
+ dockContent.Show();
+ }
}
}
\ No newline at end of file
Modified: NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj
===================================================================
--- NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj 2007-05-31 12:13:10 UTC (rev 210)
+++ NMail/trunk/NMail.Administration.WinForms/NMail.Administration.WinForms.csproj 2007-06-10 03:32:48 UTC (rev 211)
@@ -14,7 +14,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
+ <OutputPath>..\References\NMail\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -22,7 +22,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
+ <OutputPath>..\References\NMail\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -67,6 +67,12 @@
<Compile Include="ExceptionDialog.Designer.cs">
<DependentUpon>ExceptionDialog.cs</DependentUpon>
</Compile>
+ <Compile Include="MailDomain\MailDomainEditor.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="MailDomain\MailDomainEditor.Designer.cs">
+ <DependentUpon>MailDomainEditor.cs</DependentUpon>
+ </Compile>
<Compile Include="MailDomain\MailDomainManager.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -99,6 +105,10 @@
<SubType>Designer</SubType>
<DependentUpon>ExceptionDialog.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="MailDomain\MailDomainEditor.resx">
+ <SubType>Designer</SubType>
+ <DependentUpon>MailDomainEditor.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="MailDomain\MailDomainManager.resx">
<SubType>Designer</SubType>
<DependentUpon>MailDomainManager.cs</DependentUpon>
Modified: NMail/trunk/NMail.Icons/NMail.Icons.csproj
===================================================================
--- NMail/trunk/NMail.Icons/NMail.Icons.csproj 2007-05-31 12:13:10 UTC (rev 210)
+++ NMail/trunk/NMail.Icons/NMail.Icons.csproj 2007-06-10 03:32:48 UTC (rev 211)
@@ -57,6 +57,8 @@
<EmbeddedResource Include="Resources\22x22\actions\folder.png" />
<EmbeddedResource Include="Resources\22x22\actions\queue.png" />
<EmbeddedResource Include="Resources\32x32\apps\password.png" />
+ <EmbeddedResource Include="Resources\16x16\actions\delete.png" />
+ <EmbeddedResource Include="Resources\16x16\actions\edit.png" />
<Content Include="Resources\LGPL.txt" />
</ItemGroup>
<ItemGroup>
Added: NMail/trunk/NMail.Icons/Resources/16x16/actions/delete.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Icons/Resources/16x16/actions/delete.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: NMail/trunk/NMail.Icons/Resources/16x16/actions/edit.png
===================================================================
(Binary files differ)
Property changes on: NMail/trunk/NMail.Icons/Resources/16x16/actions/edit.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|