File indexing completed on 2024-05-12 05:44:24

0001 /***************************************************************************
0002  *   Copyright (C) 2005-2009 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 #include "propertyitem.h"
0021 
0022 PropertyListViewItem::PropertyListViewItem(QTreeWidget *parent, const QString &aStartName, const QString &aStartValue)
0023     : QTreeWidgetItem(parent, _RTTI_)
0024     , m_currentName(aStartName)
0025     , m_startName(aStartName)
0026     , m_currentValue(aStartValue)
0027     , m_startValue(aStartValue)
0028     , m_deleted(false)
0029 {
0030     setText(0, startName());
0031     setText(1, startValue());
0032 }
0033 
0034 void PropertyListViewItem::setName(const QString &name)
0035 {
0036     m_currentName = name;
0037     setText(0, name);
0038 }
0039 
0040 void PropertyListViewItem::setValue(const QString &value)
0041 {
0042     m_currentValue = value;
0043     setText(1, value);
0044 }
0045 
0046 bool PropertyListViewItem::different() const
0047 {
0048     return m_currentName != m_startName || m_currentValue != m_startValue || deleted();
0049 }
0050 
0051 void PropertyListViewItem::deleteIt()
0052 {
0053     m_deleted = true;
0054     setIcon(0, QIcon::fromTheme(QStringLiteral("dialog-cancel")));
0055 }
0056 
0057 void PropertyListViewItem::unDeleteIt()
0058 {
0059     m_deleted = false;
0060     setIcon(0, QIcon());
0061 }
0062 
0063 bool PropertyListViewItem::protected_Property(const QString &what)
0064 {
0065     return (what.compare(QLatin1String("svn:mergeinfo")) == 0 || what.compare(QLatin1String("svn:special")) == 0);
0066 }