File indexing completed on 2024-04-28 05:42:05

0001 /***************************************************************************
0002  *   Copyright (C) 2005-2009 by Rajko Albrecht                             *
0003  *   ral@alwins-world.de                                                   *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program; if not, write to the                         *
0017  *   Free Software Foundation, Inc.,                                       *
0018  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
0019  ***************************************************************************/
0020 
0021 #ifndef SVN_ITEM_H
0022 #define SVN_ITEM_H
0023 
0024 #include "svnqt/status.h"
0025 #include <QDateTime>
0026 #include <QMimeType>
0027 #include <QPixmap>
0028 #include <QScopedPointer>
0029 #include <QString>
0030 
0031 class SvnItemModelNode;
0032 class SvnItem_p;
0033 class SvnActions;
0034 class KFileItem;
0035 
0036 namespace svn
0037 {
0038 class Revision;
0039 }
0040 
0041 class SvnItem
0042 {
0043 public:
0044     SvnItem();
0045     explicit SvnItem(const svn::StatusPtr &);
0046     virtual ~SvnItem();
0047 
0048     virtual const QString &fullName() const;
0049     virtual const QString &shortName() const;
0050     virtual const QUrl &Url() const;
0051     virtual const QUrl &kdeName(const svn::Revision &);
0052     virtual QMimeType mimeType();
0053     virtual const QDateTime &fullDate() const;
0054     virtual bool isDir() const;
0055     virtual bool isVersioned() const;
0056     virtual bool isConflicted() const;
0057     virtual bool isValid() const;
0058     virtual bool isRealVersioned() const;
0059     virtual bool isIgnored() const;
0060     virtual bool isRemoteAdded() const;
0061     virtual bool isChanged() const;
0062     virtual bool isLocalAdded() const;
0063     virtual QString infoText() const;
0064     virtual QString cmtAuthor() const;
0065     virtual long int cmtRev() const;
0066     virtual bool isLocked() const;
0067     virtual QString lockOwner() const;
0068     virtual QString getParentDir() const = 0;
0069     virtual SvnItem *getParentItem() const = 0;
0070     virtual svn::Revision correctPeg() const = 0;
0071     virtual svn::Revision revision() const;
0072     virtual void refreshStatus(bool children = false) = 0;
0073 
0074     QPixmap getPixmap(int size, bool overlay = true);
0075     QPixmap getPixmap(const QPixmap &, int size, bool overlay = true);
0076 
0077     virtual SvnItemModelNode *sItem()
0078     {
0079         return nullptr;
0080     }
0081     virtual void setStat(const svn::StatusPtr &);
0082     virtual const svn::StatusPtr &stat() const;
0083     virtual bool isModified() const;
0084     virtual bool isChildModified() const;
0085     bool isNormal() const;
0086     bool isMissing() const;
0087     bool isDeleted() const;
0088     const QString &getToolTipText();
0089     virtual void generateToolTip(const svn::InfoEntry &entry);
0090     bool hasToolTipText();
0091     KFileItem fileItem();
0092 
0093 protected:
0094     bool m_overlaycolor;
0095     enum color_type { NONE = 0, UPDATES = 1, MODIFIED = 2, LOCKED = 3, ADDED = 4, DELETED = 5, MISSING = 6, NOTVERSIONED = 7, CONFLICT = 8, NEEDLOCK = 9 };
0096     color_type m_bgColor;
0097     QScopedPointer<SvnItem_p> p_Item;
0098     virtual SvnActions *getWrapper() const = 0;
0099 
0100     static QPixmap internalTransform(const QPixmap &, int size);
0101 };
0102 
0103 #endif