File indexing completed on 2024-05-12 05:44:27
0001 /*************************************************************************** 0002 * Copyright (C) 2008 by Rajko Albrecht ral@alwins-world.de * 0003 * https://kde.org/applications/development/org.kde.kdesvn * 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 #ifndef SVNITEMNODE_H 0021 #define SVNITEMNODE_H 0022 0023 #include "svnitemmodelfwd.h" 0024 0025 #include "svnfrontend/svnitem.h" 0026 0027 #include <QColor> 0028 0029 class SvnActions; 0030 class MainTreeWidget; 0031 class SvnItemModel; 0032 0033 class SvnItemModelNode : public SvnItem 0034 { 0035 public: 0036 SvnItemModelNode(SvnItemModelNodeDir *_parent, SvnActions *, MainTreeWidget *); 0037 0038 int rowNumber() const; 0039 0040 SvnItemModelNodeDir *parent() const; 0041 0042 /************************ 0043 * Methods from SvnItem * 0044 ************************/ 0045 QString getParentDir() const override; 0046 SvnItem *getParentItem() const override; 0047 svn::Revision correctPeg() const override; 0048 void refreshStatus(bool children = false) override; 0049 SvnActions *getWrapper() const override; 0050 SvnItemModelNode *sItem() override 0051 { 0052 return this; 0053 } 0054 0055 // own 0056 virtual bool NodeIsDir() const; 0057 virtual bool NodeHasChilds() const; 0058 virtual char sortChar() const; 0059 0060 QColor backgroundColor() const; 0061 0062 protected: 0063 SvnItemModelNodeDir *_parentNode; 0064 SvnActions *_actions; 0065 MainTreeWidget *_display; 0066 }; 0067 0068 class SvnItemModelNodeDir final : public SvnItemModelNode 0069 { 0070 friend class SvnItemModel; 0071 0072 public: 0073 SvnItemModelNodeDir(SvnActions *, MainTreeWidget *); 0074 SvnItemModelNodeDir(SvnItemModelNodeDir *_parent, SvnActions *, MainTreeWidget *); 0075 ~SvnItemModelNodeDir() override; 0076 0077 // SvnItemModelNode 0078 bool NodeIsDir() const override; 0079 bool NodeHasChilds() const override; 0080 char sortChar() const override; 0081 0082 const QVector<SvnItemModelNode *> &childList() const; 0083 SvnItemModelNode *child(int row) const; 0084 0085 SvnItemModelNode *findPath(const QVector<QStringRef> &parts); 0086 int indexOf(const QString &fullPath) const; 0087 0088 bool contains(const QString &fullName) const; 0089 void clear(); 0090 0091 // SvnItem 0092 void refreshStatus(bool children = false) override; 0093 0094 protected: 0095 QVector<SvnItemModelNode *> m_Children; 0096 }; 0097 0098 #endif