OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / subversion / subversioncontrol.cpp
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 **
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 **
23 ** Other Usage
24 **
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **************************************************************************/
32
33 #include "subversioncontrol.h"
34 #include "subversionplugin.h"
35
36 #include <QtCore/QFileInfo>
37
38 using namespace Subversion;
39 using namespace Subversion::Internal;
40
41 SubversionControl::SubversionControl(SubversionPlugin *plugin) :
42     m_enabled(true),
43     m_plugin(plugin)
44 {
45 }
46
47 QString SubversionControl::displayName() const
48 {
49     return QLatin1String("subversion");
50 }
51
52 bool SubversionControl::supportsOperation(Operation operation) const
53 {
54     bool rc = true;
55     switch (operation) {
56     case AddOperation:
57     case DeleteOperation:
58     case MoveOperation:
59     case AnnotateOperation:
60     case CheckoutOperation:
61     case GetRepositoryRootOperation:
62         break;
63     case OpenOperation:
64     case CreateRepositoryOperation:
65     case SnapshotOperations:
66         rc = false;
67         break;
68     }
69     return rc;
70 }
71
72 bool SubversionControl::vcsOpen(const QString & /* fileName */)
73 {
74     // Open for edit: N/A
75     return true;
76 }
77
78 bool SubversionControl::vcsAdd(const QString &fileName)
79 {
80     const QFileInfo fi(fileName);
81     return m_plugin->vcsAdd(fi.absolutePath(), fi.fileName());
82 }
83
84 bool SubversionControl::vcsDelete(const QString &fileName)
85 {
86     const QFileInfo fi(fileName);
87     return m_plugin->vcsDelete(fi.absolutePath(), fi.fileName());
88 }
89
90 bool SubversionControl::vcsMove(const QString &from, const QString &to)
91 {
92     const QFileInfo fromInfo(from);
93     const QFileInfo toInfo(to);
94     return m_plugin->vcsMove(fromInfo.absolutePath(), fromInfo.absoluteFilePath(), toInfo.absoluteFilePath());
95 }
96
97 bool SubversionControl::vcsCheckout(const QString &directory, const QByteArray &url)
98 {
99     return m_plugin->vcsCheckout(directory, url);
100 }
101
102 QString SubversionControl::vcsGetRepositoryURL(const QString &directory)
103 {
104     return m_plugin->vcsGetRepositoryURL(directory);
105 }
106
107 bool SubversionControl::vcsCreateRepository(const QString &)
108 {
109     return false;
110 }
111
112 QString SubversionControl::vcsCreateSnapshot(const QString &)
113 {
114     return QString();
115 }
116
117 QStringList SubversionControl::vcsSnapshots(const QString &)
118 {
119     return QStringList();
120 }
121
122 bool SubversionControl::vcsRestoreSnapshot(const QString &, const QString &)
123 {
124     return false;
125 }
126
127 bool SubversionControl::vcsRemoveSnapshot(const QString &, const QString &)
128 {
129     return false;
130 }
131
132 bool SubversionControl::managesDirectory(const QString &directory, QString *topLevel) const
133 {
134     return m_plugin->managesDirectory(directory, topLevel);
135 }
136
137 bool SubversionControl::vcsAnnotate(const QString &file, int line)
138 {
139     const QFileInfo fi(file);
140     m_plugin->vcsAnnotate(fi.absolutePath(), fi.fileName(), QString(), line);
141     return true;
142 }
143
144 void SubversionControl::emitRepositoryChanged(const QString &s)
145 {
146     emit repositoryChanged(s);
147 }
148
149 void SubversionControl::emitFilesChanged(const QStringList &l)
150 {
151     emit filesChanged(l);
152 }