/***************************************************************************
 *   Copyright (C) 2005-2007 by Rajko Albrecht                             *
 *   ral@alwins-world.de                                                   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
 ***************************************************************************/

#ifndef __SVN_ITEM_H
#define __SVN_ITEM_H

#include "smart_pointer.h"
#include "svnqttypes.h"
#include <kmimetype.h>
#include <tqstring.h>
#include <tqdatetime.h>
#include <tqpixmap.h>
#include <tqptrlist.h>

class FileListViewItem;
class SvnItem_p;
class SvnActions;
class KFileItem;
class KURL;

namespace svn
{
    class Revision;
}

class SvnItem
{
public:
    SvnItem();
    SvnItem(const svn::StatusPtr&);
    virtual ~SvnItem();

    virtual const TQString&fullName()const;
    virtual const TQString&shortName()const;
    virtual const TQString&Url()const;
    virtual const KURL&kdeName(const svn::Revision&);
    virtual KMimeType::Ptr mimeType();
    virtual const TQDateTime&fullDate()const;
    virtual bool isDir()const;
    virtual bool isVersioned()const;
    virtual bool isConflicted()const;
    virtual bool isValid()const;
    virtual bool isRealVersioned()const;
    virtual bool isIgnored()const;
    virtual bool isRemoteAdded()const;
    virtual TQString infoText()const;
    virtual TQString cmtAuthor()const;
    virtual long int cmtRev()const;
    virtual bool isLocked()const;
    virtual TQString lockOwner()const;
    virtual TQString getParentDir()const=0;
    virtual SvnItem* getParentItem()const=0;
    virtual const svn::Revision&correctPeg()const=0;
    virtual void refreshStatus(bool childs=false,TQPtrList<SvnItem> *exclude = 0,bool depsonly=false)=0;

    TQPixmap getPixmap(int size,bool overlay=true);
    TQPixmap getPixmap(const TQPixmap&,int size,bool overlay=true);

    virtual FileListViewItem*fItem(){return 0;}
    virtual void setStat(const svn::StatusPtr&);
    virtual const svn::StatusPtr& stat()const;
    virtual bool isModified()const;
    bool isNormal()const;
    bool isMissing()const;
    bool isDeleted()const;
    const TQString& getToolTipText();
    KFileItem*fileItem();

protected:
    bool m_overlaycolor;
    enum color_type {
        NONE = 0,
        UPDATES = 1,
        MODIFIED = 2,
        LOCKED = 3,
        ADDED = 4,
        DELETED = 5,
        MISSING = 6,
        NOTVERSIONED = 7,
        CONFLICT = 8,
        NEEDLOCK = 9
    };
    color_type m_bgColor;
    svn::smart_pointer<SvnItem_p> p_Item;
    virtual SvnActions*getWrapper()const = 0;

    static TQPixmap internalTransform(const TQPixmap&,int size);

};

typedef TQPtrList<SvnItem> SvnItemList;
typedef TQPtrListIterator<SvnItem> SvnItemListIterator;

#endif
