示例#1
0
        private void MessageView_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Right)
            {
                return;
            }

            MessageNode item = MessageView.GetNodeAt(e.Location) as MessageNode;

            if (item == null)
            {
                return;
            }

            ContextMenuStripEx menu = new ContextMenuStripEx();

            if (item.Message.Header.TargetID == Core.UserID)
            {
                menu.Items.Add(new MessageMenuItem(item.Message, "Reply", null, new EventHandler(Message_Reply)));
            }

            menu.Items.Add(new MessageMenuItem(item.Message, "Forward", null, new EventHandler(Message_Forward)));
            menu.Items.Add("-");
            menu.Items.Add(new MessageMenuItem(item.Message, "Delete", MailRes.delete, new EventHandler(Message_Delete)));

            menu.Show(MessageView, e.Location);
        }
示例#2
0
        private void AddMessage(LocalMail message, bool ensureVisible)
        {
            bool local = (message.Header.TargetID == Core.UserID);

            if (local && !ReceivedButton.Checked)
            {
                return;
            }

            if (!local && !SentButton.Checked)
            {
                return;
            }

            // find thread id and add to thread
            MessageNode node = new MessageNode(this, message);

            // interate through parents
            foreach (MessageNode parent in MessageView.Nodes)
            {
                if (Utilities.MemCompare(parent.Message.Header.MailID, node.Message.Header.MailID))
                {
                    parent.UpdateRow();
                    return;
                }

                // iterate through children
                if (parent.Message.Header.ThreadID == message.Header.ThreadID)
                {
                    foreach (MessageNode child in parent.Nodes)
                    {
                        if (Utilities.MemCompare(child.Message.Header.MailID, node.Message.Header.MailID))
                        {
                            child.UpdateRow();
                            return;
                        }
                    }

                    // not found add to thread
                    parent.Nodes.Add(node);
                    node.UpdateRow();

                    if (!message.Header.Read || ensureVisible)
                    {
                        parent.Expand();
                    }

                    return;
                }
            }

            // thread not found add as parent, sort new to old
            MessageView.Nodes.Insert(0, node);
            node.UpdateRow(); // update here so node knows whether to put subject or quip
        }
示例#3
0
        private void ShowSelected()
        {
            if (MessageView.SelectedNodes.Count == 0)
            {
                ShowMessage(null);
                return;
            }

            MessageNode item = (MessageNode)MessageView.SelectedNodes[0];

            ShowMessage(item.Message);
        }
示例#4
0
        public override void Init()
        {
            Mail.MailUpdate += new MailUpdateHandler(OnMailUpdate);

            MessageView.BeginUpdate();

            RefreshView();

            if (MessageView.Nodes.Count > 0)
            {
                MessageNode node = MessageView.Nodes[0] as MessageNode;

                MessageView.Select(node);
                ShowMessage(node.Message);
            }
            MessageView.EndUpdate();
        }
示例#5
0
        private void MessageHeader_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            string url = e.Url.OriginalString;

            if (GuiUtils.IsRunningOnMono() && url.StartsWith("wyciwyg"))
            {
                return;
            }

            url = url.Replace("http://", "");
            url = url.TrimEnd('/');

            string[] parts = url.Split('/');

            if (parts.Length < 1)
            {
                return;
            }

            if (MessageView.SelectedNodes.Count == 0)
            {
                return;
            }

            if (parts[0] == "about")
            {
                return;
            }

            MessageNode item = MessageView.SelectedNodes[0] as MessageNode;

            if (item == null)
            {
                return;
            }

            LocalMail message = item.Message;

            if (parts[0] == "attach" && parts.Length > 1)
            {
                int index = int.Parse(parts[1]);

                if (index < message.Attached.Count)
                {
                    string path = Core.User.RootPath + Path.DirectorySeparatorChar +
                                  "Downloads" + Path.DirectorySeparatorChar + message.Attached[index].Name;


                    try
                    {
                        if (!File.Exists(path))
                        {
                            Utilities.ExtractAttachedFile(Mail.GetLocalPath(message.Header),
                                                          message.Header.LocalKey,
                                                          message.Header.FileStart,
                                                          message.Attached.Select(a => a.Size).ToArray(),
                                                          index,
                                                          path);
                        }

                        Process.Start(path);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(this, "Error Opening Attachment: " + ex.Message);
                    }
                }
            }

            if (parts[0] == "reply")
            {
                Message_Reply(new MessageMenuItem(message), null);
            }

            else if (parts[0] == "forward")
            {
                Message_Forward(new MessageMenuItem(message), null);
            }

            else if (parts[0] == "delete")
            {
                Message_Delete(new MessageMenuItem(message), null);
            }

            e.Cancel = true;
        }
示例#6
0
        private void AddMessage(LocalMail message, bool ensureVisible)
        {
            bool local = (message.Header.TargetID == Core.UserID);

            if(local && !ReceivedButton.Checked)
                return;

            if(!local && !SentButton.Checked)
                return;

            // find thread id and add to thread
            MessageNode node = new MessageNode(this, message);

            // interate through parents
            foreach (MessageNode parent in MessageView.Nodes)
            {
                if (Utilities.MemCompare(parent.Message.Header.MailID, node.Message.Header.MailID))
                {
                    parent.UpdateRow();
                    return;
                }

                // iterate through children
                if (parent.Message.Header.ThreadID == message.Header.ThreadID)
                {
                    foreach (MessageNode child in parent.Nodes)
                        if (Utilities.MemCompare(child.Message.Header.MailID, node.Message.Header.MailID))
                        {
                            child.UpdateRow();
                            return;
                        }

                    // not found add to thread
                    parent.Nodes.Add(node);
                    node.UpdateRow();

                    if(!message.Header.Read || ensureVisible)
                        parent.Expand();

                    return;
                }
            }

            // thread not found add as parent, sort new to old
            MessageView.Nodes.Insert(0, node);
            node.UpdateRow(); // update here so node knows whether to put subject or quip
        }