Exemplo n.º 1
0
        public KTreeNode(KfsStatusPath obj, ImageListManager mgr, IAppHelper _helper)
            : base()
        {
            Debug.Assert(obj.IsDir());
            m_helper = _helper;

            m_childs = new SortedDictionary<string, KListViewItem>();
            m_onServer = obj.OnServer();

            m_lvImageListMgr = mgr;

            this.Text = obj.IsRoot() ? "Share" : obj.Name;
            this.ImageKey = "FolderClosed";
            this.SelectedImageKey = "FolderOpened";
            m_status = obj.Status;
            m_name = obj.Name;

            CreateChilds(obj);
        }
Exemplo n.º 2
0
        public void UpdateInfos(KfsStatusPath obj)
        {
            m_fileName = obj.Name;

            if ((obj.IsDir() && obj.HasServerDir()) ||
                (obj.IsFile() && obj.HasServerFile() && !((KfsServerFile)obj.ServerObject).HasCurrentVersion()))
            {
                // Get the creator if obj is a directory on the server or if its a new file
                // that has no current version yet.
                m_modifiedBy = m_helper.GetUserDisplayName((UInt32)obj.ServerObject.CreationUserID);
            }
            else if(obj.IsFile() && obj.HasServerFile() &&
                ((KfsServerFile)obj.ServerObject).HasCurrentVersion() &&
                (obj.Status !=  PathStatus.ModifiedCurrent && obj.Status != PathStatus.ModifiedStale))
            {
                // We have a file and its current version, and it is NOT modified locally.
                m_modifiedBy = m_helper.GetUserDisplayName(((KfsServerFile)obj.ServerObject).CurrentVersion.UserID);
            }
            else
            {
                m_modifiedBy = m_helper.GetUserDisplayName(m_helper.GetKwmUserID());
            }

            m_modifiedDate = obj.LastModifiedDate;

            m_path = obj.Path;
            m_status = obj.Status;
            m_onServer = obj.OnServer();

            m_size = obj.Size;

            m_isFile = obj.IsFile();
            m_isDirectory = obj.IsDir();

            this.Text = m_fileName;
            this.Name = m_fileName;

            // FIXME : need a way to distinguish between an upload and a download.
            // Always set the icon, play with ShowIcon to display it or not.
            // This crashes the kwm with a Corrupted memory exception. See if the ressource is ok.
            /*((CustomListViewSubItem)SubItems[TransferStatusKey]).icon = KwmAppControls.Properties.Resources.download;
            if (obj.Share.IsTransferringFile(m_path))
                ((CustomListViewSubItem)SubItems[TransferStatusKey]).showIcon = true;
            else
                ((CustomListViewSubItem)SubItems[TransferStatusKey]).showIcon = true;
             * */

            SubItems[ModifiedDateKey].Text = m_modifiedDate.ToString();
            SubItems[ModifiedByKey].Text = m_modifiedBy;

            if (m_size != UInt64.MaxValue)
                SubItems[SizeKey].Text = Base.GetHumanFileSize(m_size);
            else if (m_status == PathStatus.Directory)
                SubItems[SizeKey].Text = "";
            else
                SubItems[SizeKey].Text = "In progress...";

            if (m_status == PathStatus.Directory)
            {
                if (obj.OnServer())
                    SubItems[StatusKey].Text = "";
                else
                    SubItems[StatusKey].Text = "Not Added";
            }
            else
            {
                SubItems[StatusKey].Text = Base.GetEnumDescription(m_status);
                m_hasCurrentVersion = (obj.HasServerFile() && ((KfsServerFile)obj.ServerObject).HasCurrentVersion());
            }

            Font strikeout = new Font(this.Font, FontStyle.Strikeout);
            Font standard = new Font(this.Font, FontStyle.Regular);
            Font italic = new Font(this.Font, FontStyle.Italic);

            // Set default color and style
            this.Font = standard;
            this.ForeColor = Color.Black;

            // Modify color / style for specific statuses.
            switch (m_status)
            {
                case PathStatus.NotAdded:
                    this.Font = italic;
                    break;
                case PathStatus.Directory:
                    if (!m_onServer)
                        this.Font = italic;
                    break;
                case PathStatus.DirFileConflict:
                case PathStatus.FileDirConflict:
                case PathStatus.ModifiedStale:
                    this.ForeColor = Color.Red;
                    break;
                case PathStatus.NotDownloaded:
                    this.ForeColor = Color.DarkGray;
                    break;
            }
        }
Exemplo n.º 3
0
Arquivo: KfsGate.cs Projeto: tmbx/kwm
 /// <summary>
 /// Helper method for ResolveTypeConflicts.
 /// </summary>
 /// <param name="sp"></param>
 /// <returns>True to cancel the operation.</returns>
 private void ResolveTypeConflictRecursive(KfsStatusPath sp)
 {
     Debug.Assert(sp.IsDir());
     foreach (KfsStatusPath s in sp.ChildTree.Values)
     {
         if (s.IsDir())
         {
             ResolveTypeConflictRecursive(s);
         }
         else if (s.IsTypeConflict())
         {
             DoResolveTypeConflict(s);
         }
         // else: no problem, keep going.
     }
 }