]>
cloud.milkyroute.net Git - dolphin.git/blob - src/revisioncontrolplugin.cpp
1 /***************************************************************************
2 * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #include "revisioncontrolplugin.h"
22 #include <kfileitem.h>
25 #include <QTextStream>
27 RevisionControlPlugin::RevisionControlPlugin()
31 RevisionControlPlugin::~RevisionControlPlugin()
35 // ----------------------------------------------------------------------------
37 SubversionPlugin::SubversionPlugin() :
43 SubversionPlugin::~SubversionPlugin()
47 QString
SubversionPlugin::fileName() const
52 bool SubversionPlugin::beginRetrieval(const QString
& directory
)
54 Q_ASSERT(directory
.endsWith('/'));
55 m_directory
= directory
;
57 QFile
file(directory
+ ".svn/entries");
58 if (!file
.open(QIODevice::ReadOnly
| QIODevice::Text
)) {
62 QTextStream
in(&file
);
68 const bool isRevisioned
= !line
.isEmpty() &&
69 ((line
== QLatin1String("dir")) ||
70 (line
== QLatin1String("file")));
72 RevisionInfo info
; // TODO
73 m_revisionInfoHash
.insert(fileName
, info
);
79 void SubversionPlugin::endRetrieval()
83 RevisionControlPlugin::RevisionState
SubversionPlugin::revisionState(const KFileItem
& item
)
85 const QString name
= item
.name();
86 if (m_revisionInfoHash
.contains(name
)) {
88 return RevisionControlPlugin::LatestRevision
;
91 return RevisionControlPlugin::LocalRevision
;