summaryrefslogtreecommitdiffstats
path: root/src/svnfrontend/svnitem.h
blob: ac901724e01eed8dfe1e46564ec924c1f349d022 (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 "src/svnqt/smart_pointer.hpp"
#include "src/svnqt/svnqttypes.hpp"
#include <kmimetype.h>
#include <qstring.h>
#include <qdatetime.h>
#include <qpixmap.h>
#include <qptrlist.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 QString&fullName()const;
    virtual const QString&shortName()const;
    virtual const QString&Url()const;
    virtual const KURL&kdeName(const svn::Revision&);
    virtual KMimeType::Ptr mimeType();
    virtual const QDateTime&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 QString infoText()const;
    virtual QString cmtAuthor()const;
    virtual long int cmtRev()const;
    virtual bool isLocked()const;
    virtual QString lockOwner()const;
    virtual QString getParentDir()const=0;
    virtual SvnItem* getParentItem()const=0;
    virtual const svn::Revision&correctPeg()const=0;
    virtual void refreshStatus(bool childs=false,QPtrList<SvnItem> *exclude = 0,bool depsonly=false)=0;

    QPixmap getPixmap(int size,bool overlay=true);
    QPixmap getPixmap(const QPixmap&,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 QString& 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 QPixmap internalTransform(const QPixmap&,int size);

};

typedef QPtrList<SvnItem> SvnItemList;
typedef QPtrListIterator<SvnItem> SvnItemListIterator;

#endif