summaryrefslogtreecommitdiffstats
path: root/src/svnfrontend/svnitem.h
blob: 73b7c9ac632c918ac714fb88f1f8927504840c8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/***************************************************************************
 *   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