Ejemplo n.º 1
0
        /**
         * Registers a condition allowing to use the custom property with the specified
         * ID in views.
         */

        private static void RegisterCustomPropCondition(int propID)
        {
            IPropType propType = Core.ResourceStore.PropTypes [propID];

            string condName = GetConditionName(propType);

            IResource condition = null;

            if (propType.DataType == PropDataType.String || propType.DataType == PropDataType.Date)
            {
                condition = Core.FilterRegistry.CreateConditionTemplate(condName, condName,
                                                                        null, ConditionOp.Eq, propType.Name);
            }
            else if (propType.DataType == PropDataType.Int)
            {
                condition = Core.FilterRegistry.CreateConditionTemplate(condName, condName,
                                                                        null, ConditionOp.InRange, propType.Name, Int32.MinValue.ToString(), Int32.MaxValue.ToString());
            }
            else if (propType.DataType == PropDataType.Bool)
            {
                condition = Core.FilterRegistry.CreateStandardCondition(condName, condName,
                                                                        null, propType.Name, ConditionOp.HasProp);
            }

            if (condition != null)
            {
                Core.FilterRegistry.AssociateConditionWithGroup(condition, "Custom Property Conditions");
            }
        }
Ejemplo n.º 2
0
        private static void DeleteCustomPropCondition(int propID)
        {
            IPropType propType = Core.ResourceStore.PropTypes [propID];

            //  remove condition template which is made from this property
            string resTypeName = (propType.DataType != PropDataType.Bool) ? FilterManagerProps.ConditionTemplateResName :
                                 FilterManagerProps.ConditionResName;
            IResourceList conditions = Core.ResourceStore.FindResources(resTypeName, Core.Props.Name, GetConditionName(propType));

            if (conditions.Count == 1)
            {
                conditions[0].Delete();
            }

            //  remove views which use conditions based on condition templates
            conditions = Core.ResourceStore.FindResources(SelectionType.Normal, FilterManagerProps.ConditionResName,
                                                          "ApplicableToProp", propType.Name);
            IResourceList views = Core.ResourceStore.EmptyResourceList;

            foreach (IResource res in conditions)
            {
                views = views.Union(res.GetLinksOfType(FilterManagerProps.ViewResName, "LinkedCondition"));
            }
            foreach (IResource res in views)
            {
                Core.FilterRegistry.DeleteView(res);
            }
        }
Ejemplo n.º 3
0
        private void  WriteResource(IResource res, StreamWriter sw, string delimiter)
        {
            foreach (ColumnDescriptor descr in displayedColumns)
            {
                if ((descr.Flags & ColumnDescriptorFlags.FixedSize) == 0)
                {
                    string[] props = descr.PropNames;
                    string   prop  = (props[0][0] != '-') ? props[0] : props[0].Substring(1);
                    string   text  = string.Empty;

                    if (prop == "DisplayName")
                    {
                        text = res.DisplayName;
                    }
                    else
                    {
                        IPropType propType = Core.ResourceStore.PropTypes[prop];
                        if (propType.DataType != PropDataType.Link)
                        {
                            text = res.GetPropText(propType.Id);
                        }
                        else
                        {
                            IResourceList linked = res.GetLinksOfType(null, propType.Name);
                            if (linked.Count > 0)
                            {
                                text = linked[0].DisplayName;
                            }
                        }
                    }
                    sw.Write(text + delimiter);
                }
            }
            sw.WriteLine();
        }
Ejemplo n.º 4
0
        private void  WriteTableHeader(StreamWriter sw)
        {
            sw.WriteLine("<thead><tr>");
            foreach (ColumnDescriptor descr in displayedColumns)
            {
                if ((descr.Flags & ColumnDescriptorFlags.FixedSize) == 0)
                {
                    string[] props = descr.PropNames;
                    string   prop  = (props[0][0] != '-') ? props[0] : props[0].Substring(1);
                    string   text;
                    sw.Write("<th>");

                    if (prop == "DisplayName")
                    {
                        text = prop;
                    }
                    else
                    {
                        IPropType propType = Core.ResourceStore.PropTypes[prop];
                        text = !String.IsNullOrEmpty(propType.DisplayName) ? propType.DisplayName : propType.Name;
                    }
                    sw.Write(HtmlTools.SafeHtmlDecode(text));
                    sw.WriteLine("</th>");
                }
            }
            sw.WriteLine("</tr></thead>");
        }
Ejemplo n.º 5
0
 internal void AppendPropType(IPropType type)
 {
     string[] newPropNames = new string [ColDesc.PropNames.Length + 1];
     Array.Copy(ColDesc.PropNames, newPropNames, ColDesc.PropNames.Length);
     newPropNames [ColDesc.PropNames.Length] = type.Name;
     ColDesc.PropNames = newPropNames;
 }
Ejemplo n.º 6
0
        private void CreateCustomPropControl(IPropType type, object propValue,
                                             bool valuesDiffer, int valueX, ref int curY)
        {
            ICustomPropertyEditor propEditor = null;

            switch (type.DataType)
            {
            case PropDataType.String:
                propEditor = new StringPropertyEditor();
                break;

            case PropDataType.Int:
                propEditor = new IntPropertyEditor();
                break;

            case PropDataType.Date:
                propEditor = new DatePropertyEditor();
                break;

            case PropDataType.Bool:
                propEditor = new BoolPropertyEditor();
                break;

            default:
                throw new Exception("Unsupported custom property type " + type.DataType);
            }

            int editorX = 4;

            if (propEditor.NeedLabel())
            {
                Label lbl = new Label();

                if (type.Name.StartsWith("Custom."))
                {
                    lbl.Text = type.Name.Substring(7);
                }
                else
                {
                    lbl.Text = type.Name;
                }

                lbl.Location  = new Point(4, curY);
                lbl.AutoSize  = true;
                lbl.FlatStyle = FlatStyle.System;
                _contentPane.Controls.Add(lbl);

                editorX = valueX;
            }

            Rectangle ctlRect = new Rectangle(editorX, curY, 120, 24);
            Control   editCtl = propEditor.CreateControl(ctlRect, type, propValue, valuesDiffer);

            _contentPane.Controls.Add(editCtl);
            _propControls [type.Id] = propEditor;

            curY += 28;
        }
Ejemplo n.º 7
0
        private void OnCustomPropertyAdded(object sender, ResourceIndexEventArgs e)
        {
            int       propTypeID = e.Resource.GetIntProp("ID");
            IPropType propType   = ICore.Instance.ResourceStore.PropTypes [propTypeID];

            if (propType.DataType == PropDataType.Bool)
            {
                _columnManager.RegisterPropertyToTextCallback(propTypeID, BoolPropToString);
            }
        }
Ejemplo n.º 8
0
 public Control CreateControl(Rectangle rect, IPropType type, object curValue, bool valuesDiffer)
 {
     _datePicker                 = new DatePickerCtrl();
     _datePicker.Bounds          = rect;
     _datePicker.ShowClearButton = true;
     if (curValue != null)
     {
         _datePicker.CurrentDate = (DateTime)curValue;
     }
     _datePicker.ValueChanged += new EventHandler(OnValueChanged);
     return(_datePicker);
 }
Ejemplo n.º 9
0
 public IPropType this [string propName]
 {
     get
     {
         IPropType propType = (IPropType)_propTypeNameCache [propName];
         if (propType == null)
         {
             throw new StorageException("Invalid property type name " + propName);
         }
         return(propType);
     }
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Return true if property with such Id represents a custom type.
 /// </summary>
 /// <param name="propID">Id of a property.</param>
 public static bool IsCustomPropType(int propID)
 {
     GetCustomProperties();
     for (int i = 0; i < _customPropTypes.Count; i++)
     {
         IPropType propType = (IPropType)_customPropTypes [i];
         if (propType.Id == propID)
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 11
0
 public Control CreateControl(Rectangle rect, IPropType type, object curValue, bool valuesDiffer)
 {
     _editBox        = new TextBox();
     _editBox.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
     _editBox.Bounds = rect;
     if (curValue != null)
     {
         _editBox.Text = curValue.ToString();
     }
     if (valuesDiffer)
     {
         _editBox.BackColor = SystemColors.ControlLight;
     }
     _editBox.TextChanged += new EventHandler(OnTextChanged);
     return(_editBox);
 }
Ejemplo n.º 12
0
        internal void RegisterFormatters()
        {
            _columnManager.RegisterPropertyToTextCallback(Core.Props.Date, DateToString);
            _columnManager.RegisterPropertyToTextCallback(Core.Props.Size, SizeString);

            _customProperties = ResourceTypeHelper.GetCustomProperties();
            foreach (IResource res in _customProperties)
            {
                int       propTypeID = res.GetIntProp("ID");
                IPropType propType   = Core.ResourceStore.PropTypes [propTypeID];
                if (propType.DataType == PropDataType.Bool)
                {
                    _columnManager.RegisterPropertyToTextCallback(propTypeID, BoolPropToString);
                }
            }
            _customProperties.ResourceAdded += OnCustomPropertyAdded;
        }
Ejemplo n.º 13
0
 public Control CreateControl(Rectangle rect, IPropType type, object curValue, bool valuesDiffer)
 {
     _checkBox           = new CheckBox();
     _checkBox.Bounds    = rect;
     _checkBox.Text      = type.DisplayName;
     _checkBox.FlatStyle = FlatStyle.System;
     if (valuesDiffer)
     {
         _checkBox.CheckState = CheckState.Indeterminate;
     }
     else if (curValue != null)
     {
         bool isChecked = (bool)curValue;
         _checkBox.Checked = isChecked;
     }
     _checkBox.CheckedChanged += new EventHandler(_checkBox_OnCheckedChanged);
     return(_checkBox);
 }
Ejemplo n.º 14
0
        private void  WriteResource2Entry(IResource res, XmlTextWriter writer)
        {
            writer.WriteStartElement("resource");
            writer.WriteAttributeString("type", res.Type);
            writer.WriteAttributeString("id", res.Id.ToString());

            IPropertyCollection props = res.Properties;

            foreach (IResourceProperty prop in props)
            {
                IPropType type = Core.ResourceStore.PropTypes[prop.Name];
                if (!type.HasFlag(PropTypeFlags.Internal))
                {
                    WriteResourceProperty2Entry(res, prop, writer);
                }
            }
            writer.WriteEndElement();
        }
Ejemplo n.º 15
0
 public Control CreateControl(Rectangle rect, IPropType type, object curValue, bool valuesDiffer)
 {
     _upDown        = new NumericUpDownSettingEditor();
     _upDown.Bounds = rect;
     if (curValue != null)
     {
         _upDown.Text = curValue.ToString();
     }
     else
     {
         _upDown.Text = "";
         if (valuesDiffer)
         {
             _upDown.BackColor = SystemColors.ControlLight;
         }
     }
     _upDown.TextChanged += new EventHandler(OnTextChanged);
     return(_upDown);
 }
Ejemplo n.º 16
0
        private static string GetConditionName(IPropType propType)
        {
            switch (propType.DataType)
            {
            case PropDataType.String:
                return("'" + propType.DisplayName + "' is equal to %value%");

            case PropDataType.Int:
                return("'" + propType.DisplayName + "' is in %range%");

            case PropDataType.Date:
                return("'" + propType.DisplayName + "' is in %range%");

            case PropDataType.Bool:
                return("Has property '" + propType.DisplayName + "'");

            default:
                return(propType.DisplayName);
            }
        }
Ejemplo n.º 17
0
        /**
         * Checks if any of the resources in the list has the property with
         * the specified ID.
         */

        public virtual bool HasProp(int propID)
        {
            lock (this)
            {
                if (_propertyProviders != null)
                {
                    for (int i = 0; i < _propertyProviders.Count; i++)
                    {
                        if ((_propertyProviders [i] as IPropertyProvider).HasProp(propID))
                        {
                            return(true);
                        }
                    }
                }

                IPropType propType = MyPalStorage.Storage.PropTypes [propID];
                if (propType.HasFlag(PropTypeFlags.Virtual))
                {
                    return(false);
                }

                PropDataType dataType = propType.DataType;
                if (dataType == PropDataType.LongString || dataType == PropDataType.Blob || dataType == PropDataType.Double)
                {
                    Instantiate();
                    for (int i = 0; i < _list.Count; i++)
                    {
                        IResource res = MyPalStorage.Storage.TryLoadResource(_list [i]);
                        if (res != null && res.HasProp(propID))
                        {
                            return(true);
                        }
                    }
                    return(false);
                }
            }
            return(Intersect(MyPalStorage.Storage.FindResourcesWithProp(null, propID)).Count > 0);
        }
Ejemplo n.º 18
0
        private SerializationMode GetSerializationMode(IResourceSerializer serializer, IResource resource, IResourceProperty property)
        {
            SerializationMode serMode = serializer.GetSerializationMode(resource, property.Name);

            if (serMode == SerializationMode.Default)
            {
                IPropType propType = Core.ResourceStore.PropTypes [property.Name];
                if (propType.HasFlag(PropTypeFlags.AskSerialize))
                {
                    return(SerializationMode.AskSerialize);
                }
                if (propType.HasFlag(PropTypeFlags.NoSerialize))
                {
                    return(SerializationMode.NoSerialize);
                }
                if (property.DataType == PropDataType.Link && propType.HasFlag(PropTypeFlags.Internal))
                {
                    return(SerializationMode.NoSerialize);
                }
                return(SerializationMode.Serialize);
            }
            return(serMode);
        }
Ejemplo n.º 19
0
        private static void RegisterMailTypes(OutlookPlugin ownerPlugin, IContactManager contactManager)
        {
            if (RS.ResourceTypes.Exist("MAPIFolderRoot"))
            {
                IResourceList resourcesToDelete = RS.GetAllResources("MAPIFolderRoot");
                foreach (IResource resource in resourcesToDelete)
                {
                    resource.Delete();
                }
            }
            RegisterResources(ownerPlugin);
            PROP.SyncVersion =
                RS.PropTypes.Register(STR.SyncVersion, PropDataType.Int, PropTypeFlags.Internal | PropTypeFlags.NoSerialize);

            PROP.EntryID = ResourceTypeHelper.UpdatePropTypeRegistration(STR.EntryID, PropDataType.String,
                                                                         PropTypeFlags.Internal | PropTypeFlags.NoSerialize);
            PROP.StoreID   = RS.PropTypes.Register(STR.StoreID, PropDataType.String, PropTypeFlags.Internal | PropTypeFlags.NoSerialize);
            PROP.RecordKey = ResourceTypeHelper.UpdatePropTypeRegistration(STR.RecordKey, PropDataType.String,
                                                                           PropTypeFlags.Internal | PropTypeFlags.NoSerialize);
            PROP.InternetMsgID = ResourceTypeHelper.UpdatePropTypeRegistration(STR.InternetMsgID,
                                                                               PropDataType.String, PropTypeFlags.Internal);
            PROP.ReplyTo                  = ResourceTypeHelper.UpdatePropTypeRegistration(STR.ReplyTo, PropDataType.String, PropTypeFlags.Internal);
            PROP.ConversationIndex        = RS.PropTypes.Register("ConversationIndex", PropDataType.String, PropTypeFlags.Internal);
            PROP.ReplyToConversationIndex = RS.PropTypes.Register("ReplyToConversationIndex", PropDataType.String, PropTypeFlags.Internal);

            PROP.SentOn          = RS.PropTypes.Register(STR.SentOn, PropDataType.Date);
            PROP.LastReceiveDate = RS.PropTypes.Register(STR.LastReceiveDate, PropDataType.Date);

            PROP.Extension       = RS.PropTypes.Register(STR.Extension, PropDataType.String);
            PROP.ResType         = RS.PropTypes.Register("ResType", PropDataType.String, PropTypeFlags.Internal);
            PROP.AttachmentIndex = RS.PropTypes.Register(STR.AttachmentIndex, PropDataType.Int, PropTypeFlags.Internal);
            PROP.AttachMethod    = RS.PropTypes.Register(STR.AttachMethod, PropDataType.Int, PropTypeFlags.Internal);

            PROP.ResourceTransfer = RS.PropTypes.Register("ResorceTransfer", PropDataType.Bool, PropTypeFlags.Internal);

            CorrectDeletedItemsProperty();

            PROP.DeletedInIMAP         = RS.PropTypes.Register("DeletedInIMAP", PropDataType.Bool, PropTypeFlags.Internal);
            PROP.IgnoredFolder         = RS.PropTypes.Register("IgnoredFolder", PropDataType.Int, PropTypeFlags.Internal);
            PROP.DefaultFolderEntryIDs = RS.PropTypes.Register(STR.DefaultFolderEntryIDs, PropDataType.StringList, PropTypeFlags.Internal);
            PROP.MySelf           = Core.ContactManager.Props.Myself;
            PROP.Imported         = RS.PropTypes.Register(STR.Imported, PropDataType.Int, PropTypeFlags.Internal);
            PROP.OpenIgnoreFolder = RS.PropTypes.Register("OpenIgnoreFolder", PropDataType.Int, PropTypeFlags.Internal);
            PROP.OpenSelectFolder = RS.PropTypes.Register("OpenSelectFolder", PropDataType.Int, PropTypeFlags.Internal);
            PROP.MessageFlag      = RS.PropTypes.Register(STR.MessageFlag, PropDataType.String, PropTypeFlags.Internal);
            PROP.LastModifiedTime = ResourceTypeHelper.UpdatePropTypeRegistration("LastModifiedTime",
                                                                                  PropDataType.Date, PropTypeFlags.Internal);
            PROP.Priority        = RS.PropTypes.Register(STR.Priority, PropDataType.Int);
            PROP.EmbeddedMessage = RS.PropTypes.Register(STR.EmbeddedMessage, PropDataType.Bool, PropTypeFlags.Internal);
            PROP.Importance      = RS.PropTypes.Register(STR.Importance, PropDataType.Int);
            PROP.SeeAll          = RS.PropTypes.Register("SeeAll", PropDataType.Bool, PropTypeFlags.Internal);
            PROP.ContainerClass  = RS.PropTypes.Register(STR.ContainerClass, PropDataType.String, PropTypeFlags.Internal);
            PROP.BodyFormat      = RS.PropTypes.Register(STR.BodyFormat, PropDataType.String, PropTypeFlags.Internal);
            PROP.DefaultFolder   = RS.PropTypes.Register(STR.DefaultFolder, PropDataType.Bool, PropTypeFlags.Internal);
            PROP.MAPIVisible     = RS.PropTypes.Register(STR.MAPIVisible, PropDataType.Bool, PropTypeFlags.Internal);
            PROP.ShowPictures    = RS.PropTypes.Register(STR.ShowPictures, PropDataType.Bool, PropTypeFlags.Internal);
            PROP.NoFormat        = RS.PropTypes.Register(STR.NoFormat, PropDataType.Bool, PropTypeFlags.Internal);

            PROP.SyncComplete          = RS.PropTypes.Register("SyncComplete", PropDataType.Bool, PropTypeFlags.Internal);
            PROP.Target                = ResourceTypeHelper.UpdatePropTypeRegistration("Target", PropDataType.Link, PropTypeFlags.DirectedLink);
            PROP.IgnoreContactImport   = RS.PropTypes.Register(STR.IgnoreContactImport, PropDataType.Bool, PropTypeFlags.Internal);
            PROP.DeletedItemsFolder    = RS.PropTypes.Register(STR.DeletedItemsFolder, PropDataType.Bool, PropTypeFlags.Internal);
            PROP.DefaultDeletedItems   = RS.PropTypes.Register(STR.DefaultDeletedItems, PropDataType.Bool, PropTypeFlags.Internal);
            PROP.DeletedItemsEntryID   = RS.PropTypes.Register(STR.DeletedItemsEntryID, PropDataType.String, PropTypeFlags.Internal);
            PROP.JunkEmailEntryID      = RS.PropTypes.Register(STR.JunkEmailEntryID, PropDataType.String, PropTypeFlags.Internal);
            PROP.PR_STORE_SUPPORT_MASK = RS.PropTypes.Register(STR.PR_STORE_SUPPORT_MASK, PropDataType.Int, PropTypeFlags.Internal);
            PROP.StoreSupported        = RS.PropTypes.Register(STR.StoreSupported, PropDataType.Bool, PropTypeFlags.Internal);
            PROP.StoreTypeChecked      = RS.PropTypes.Register(STR.StoreTypeChecked, PropDataType.Bool, PropTypeFlags.Internal);
            PROP.PR_CONTENT_COUNT      = RS.PropTypes.Register(STR.PR_CONTENT_COUNT, PropDataType.Int, PropTypeFlags.Internal);
            PROP.PR_ICON_INDEX         = RS.PropTypes.Register(STR.PR_ICON_INDEX, PropDataType.Int, PropTypeFlags.Internal);
            CommonProps.Register();

            if (RS.PropTypes.Exist(STR.PR_ATTACH_CONTENT_ID))
            {
                IResourceList list = RS.FindResourcesWithProp(STR.Email, STR.PR_ATTACH_CONTENT_ID);
                foreach (IResource mail in list)
                {
                    mail.SetProp(CommonProps.ContentId, mail.GetStringProp(STR.PR_ATTACH_CONTENT_ID));
                    mail.DeleteProp(STR.PR_ATTACH_CONTENT_ID);
                }
                IPropType propType = RS.PropTypes[STR.PR_ATTACH_CONTENT_ID];
                RS.PropTypes.Delete(propType.Id);
            }
            PROP.PR_ATTACH_NUM = RS.PropTypes.Register(STR.PR_ATTACH_NUM, PropDataType.Int, PropTypeFlags.Internal);
            PROP.LastMailDate  = RS.PropTypes.Register(STR.LastMailDate, PropDataType.Date, PropTypeFlags.Internal);
            PROP.OMTaskId      = RS.PropTypes.Register(STR.OMTaskId, PropDataType.String, PropTypeFlags.Internal | PropTypeFlags.NoSerialize);

            PROP.AttachmentPicWidth  = RS.PropTypes.Register(STR.Width, PropDataType.Int, PropTypeFlags.Internal);
            PROP.AttachmentPicHeight = RS.PropTypes.Register(STR.Height, PropDataType.Int, PropTypeFlags.Internal);

            PROP.From = contactManager.Props.LinkFrom;
            PROP.To   = contactManager.Props.LinkTo;
            PROP.CC   = contactManager.Props.LinkCC;

            PROP.EmailAccountFrom = Core.ContactManager.Props.LinkEmailAcctFrom;
            PROP.EmailAccountTo   = Core.ContactManager.Props.LinkEmailAcctTo;
            PROP.EmailAccountCC   = Core.ContactManager.Props.LinkEmailAcctCC;
            RS.RegisterLinkRestriction(STR.Email, PROP.From, "Contact", 0, 1);

            PROP.SelectedInFolder = RS.PropTypes.Register("SelectedInFolder", PropDataType.Link, PropTypeFlags.Internal);

            PROP.Attachment = Core.ResourceStore.PropTypes.Register(STR.Attachment, PropDataType.Link,
                                                                    PropTypeFlags.SourceLink | PropTypeFlags.DirectedLink, ownerPlugin);
            RS.PropTypes.RegisterDisplayName(PROP.Attachment, "Outlook Message", "Attachment");

            PROP.AttType            = RS.PropTypes.Register(STR.AttachmentType, PropDataType.Link, PropTypeFlags.Internal);
            PROP.OwnerStore         = RS.PropTypes.Register("OwnerStore", PropDataType.Link, PropTypeFlags.Internal);
            PROP.TopLevelCategory   = RS.PropTypes.Register("TopLevelCategory", PropDataType.Link, PropTypeFlags.Internal);
            PROP.InternalAttachment = RS.PropTypes.Register("InternalAttachment", PropDataType.Link, PropTypeFlags.Internal);

            IResource     propMAPIFolderLink = RS.FindUniqueResource("PropType", "Name", STR.MAPIFolder);
            PropTypeFlags flags = PropTypeFlags.Normal | PropTypeFlags.CountUnread;

            if (propMAPIFolderLink != null)
            {
                propMAPIFolderLink.SetProp("Flags", (int)flags);
                PROP.MAPIFolder = propMAPIFolderLink.GetIntProp("ID");
            }
            else
            {
                PROP.MAPIFolder = RS.PropTypes.Register(STR.MAPIFolder, PropDataType.Link, flags);
            }
            RS.PropTypes.RegisterDisplayName(PROP.MAPIFolder, "Outlook Folder");

            RS.ResourceTypes.Register(STR.Task, "Subject");

            RS.RegisterUniqueRestriction(STR.Email, PROP.EntryID);
            RS.RegisterUniqueRestriction(STR.OutlookABDescriptor, PROP.EntryID);
            RS.RegisterUniqueRestriction("AddressBook", PROP.EntryID);
            RS.RegisterUniqueRestriction(STR.MAPIInfoStore, PROP.EntryID);
            RS.RegisterUniqueRestriction(STR.MAPIInfoStore, PROP.DeletedItemsEntryID);
            RS.RegisterUniqueRestriction(STR.MAPIInfoStore, PROP.JunkEmailEntryID);
            RS.RegisterUniqueRestriction("Contact", PROP.EntryID);
            RS.RegisterUniqueRestriction(STR.MAPIStore, PROP.StoreID);

            RS.RegisterLinkRestriction(STR.Email, PROP.MAPIFolder, STR.MAPIFolder, 0, 1);
            RS.RegisterUniqueRestriction(STR.MAPIFolder, PROP.EntryID);
            RS.RegisterLinkRestriction(STR.MAPIFolder, Core.Props.Parent, null, 1, 1);
            RS.RegisterLinkRestriction(STR.MAPIFolder, PROP.OwnerStore, STR.MAPIStore, 1, 1);
            RS.RegisterLinkRestriction(STR.Email, PROP.OwnerStore, STR.MAPIStore, 0, 1);
            RS.DeleteUniqueRestriction(STR.Task, PROP.OMTaskId);
            RS.RegisterUniqueRestriction(STR.Task, PROP.EntryID);

            RemoveInvalidAttachmentResources();
            RemoveAttachmentResources();
            UpdateOutlookAttachments( );
            ChangeDatePropForMAPIStore();

            PROP.Status      = RS.PropTypes.Register("Status", PropDataType.Int);
            PROP.RemindDate  = RS.PropTypes.Register("RemindDate", PropDataType.Date);
            PROP.StartDate   = RS.PropTypes.Register("StartDate", PropDataType.Date);
            PROP.Description = RS.PropTypes.Register("Description", PropDataType.String);
            //  NB: this prop format must coinside with that in TasksPlugin.
            PROP.SuperTaskLink = RS.PropTypes.Register(STR.SuperTaskLink, PropDataType.Link, PropTypeFlags.DirectedLink | PropTypeFlags.Internal);
            RS.ResourceTypes.Register("SentItemsEnumSign", "", ResourceTypeFlags.NoIndex | ResourceTypeFlags.Internal);
            UpdateLastMailDateForFolders();
            RemoveWrongGlobalBooks();
            RemoveOMTaskIDs();
            UpdateDeletedItemsFolders();
            DeleteInvalidMAPIFolders();
            UpdateMapiInfoStores();
            _registered = true;
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Return true if property with such Id exists (registered) in the system and
        /// its underlying type is string.
        /// </summary>
        /// <param name="propId">Id of a property.</param>
        public static bool IsStringProp(int propId)
        {
            IPropType type = Core.ResourceStore.PropTypes[propId];

            return(type != null && type.DataType == PropDataType.String);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Return true if link with the given Id is an "account" link, that
        /// is connects a Contact and Account resource types.
        /// </summary>
        /// <param name="linkId">Id of a link.</param>
        public static bool IsAccountLink(int linkId)
        {
            IPropType type = Core.ResourceStore.PropTypes[linkId];

            return((type != null) && type.HasFlag(PropTypeFlags.ContactAccount));
        }
Ejemplo n.º 22
0
 internal static IPropValue ParseVarPropType_PropInfo_Length_VarSizeValue(IPropType varPropType, byte[] buffer, ref int pos)
 {
     VarPropType_PropInfo_Length_VarSizeValue varPropValue = new VarPropType_PropInfo_Length_VarSizeValue(varPropType as IVarPropType);
     varPropValue.ParsePropValue(buffer, ref pos);
     return varPropValue;
 }
Ejemplo n.º 23
0
 protected AbstractDefaultProp(IPropType type)
 {
     this.Id         = this.getNextAssignableIdAndIncrement();
     this.Class      = type;
     this.Qualitates = new List <IQualitas> ();
 }
Ejemplo n.º 24
0
 internal static IPropValue ParseMvPropType_PropInfo_Length_IFixSizeValue_Length_VarSizeValue(IPropType mvPropType, byte[] buffer, ref int pos)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 25
0
        /**
         * Fills the checklistbox with properties for the specified resource list.
         */

        private void FillPropertyList()
        {
            IResourceList allPropList = Core.ResourceStore.GetAllResources("PropType");

            allPropList.Sort(new SortSettings(ResourceProps.DisplayName, true));
            ArrayList    propTypeList = new ArrayList();
            IntHashTable propTypeHash = new IntHashTable();

            foreach (IResource res in allPropList)
            {
                int propId = res.GetIntProp("ID");
                if (!Core.ResourceStore.PropTypes [propId].HasFlag(PropTypeFlags.Internal))
                {
                    if (StateHasProp(_state, propId) || _availableColumns.IndexOf(propId) >= 0 ||
                        _resourceList.HasProp(propId))
                    {
                        IPropType propType = Core.ResourceStore.PropTypes [propId];
                        propTypeList.Add(propType);
                        propTypeHash [propId] = propType;
                    }
                }
            }
            if (StateHasProp(_state, ResourceProps.DisplayName) || IsDisplayNameColumnAvailable())
            {
                IPropType displayNamePropType = Core.ResourceStore.PropTypes [ResourceProps.DisplayName];
                propTypeList.Add(displayNamePropType);
                propTypeHash [ResourceProps.DisplayName] = displayNamePropType;
            }

            Hashtable nameToPropTagMap = new Hashtable();

            // first, add the columns already in the list, in the list order
            foreach (ColumnDescriptor colDesc in _state.Columns)
            {
                int[] propIds = _displayColumnManager.PropNamesToIDs(colDesc.PropNames, true);
                if (propIds.Length == 1 && propIds [0] == ResourceProps.Type)
                {
                    continue;
                }

                bool[] reverseLinks = new bool [propIds.Length];
                for (int i = 0; i < propIds.Length; i++)
                {
                    reverseLinks [i] = AreLinksReverse(_resourceList, propIds [i]);
                }
                for (int i = 0; i < propIds.Length; i++)
                {
                    IPropType propType = (IPropType)propTypeHash [propIds [i]];
                    if (propType == null)
                    {
                        propType = (IPropType)propTypeHash [-propIds [i]];
                    }
                    if (propType != null)
                    {
                        propTypeList.Remove(propType);
                    }
                }
                PropertyTypeTag tag = AddItemForPropType(colDesc, propIds, reverseLinks, true);
                nameToPropTagMap [tag.ToString()] = tag;
            }

            AddUncheckedColumns(propTypeList, _resourceList, nameToPropTagMap);
        }
Ejemplo n.º 26
0
 internal static IPropValue ParseFixPropType_PropInfo_FixedSizeValue(IPropType fixPropType, byte[] buffer, ref int pos)
 {
     FixPropType_PropInfo_FixedSizeValue fixedPropValue = new FixPropType_PropInfo_FixedSizeValue(fixPropType as IFixedPropType);
     fixedPropValue.ParsePropValue(buffer, ref pos);
     return fixedPropValue;
 }
Ejemplo n.º 27
0
        public void CheckInvalidPropType()
        {
            IPropType propType = _storage.PropTypes [-255];

            propType = propType;
        }