1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
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.
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.
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.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
37 #include "sftpincomingpacket_p.h"
39 #include <utils/utils_global.h>
41 #include <QtCore/QByteArray>
42 #include <QtCore/QObject>
43 #include <QtCore/QSharedPointer>
44 #include <QtCore/QString>
49 class SftpChannelPrivate;
50 class SshChannelManager;
51 class SshSendFacility;
52 } // namespace Internal
54 class QTCREATOR_UTILS_EXPORT SftpChannel : public QObject
58 friend class Internal::SftpChannelPrivate;
59 friend class Internal::SshChannelManager;
61 typedef QSharedPointer<SftpChannel> Ptr;
63 enum State { Uninitialized, Initializing, Initialized, Closing, Closed };
69 SftpJobId listDirectory(const QString &dirPath);
70 SftpJobId createDirectory(const QString &dirPath);
71 SftpJobId removeDirectory(const QString &dirPath);
72 SftpJobId removeFile(const QString &filePath);
73 SftpJobId renameFileOrDirectory(const QString &oldPath,
74 const QString &newPath);
75 SftpJobId createFile(const QString &filePath, SftpOverwriteMode mode);
76 SftpJobId uploadFile(const QString &localFilePath,
77 const QString &remoteFilePath, SftpOverwriteMode mode);
78 SftpJobId downloadFile(const QString &remoteFilePath,
79 const QString &localFilePath, SftpOverwriteMode mode);
80 SftpJobId uploadDir(const QString &localDirPath,
81 const QString &remoteParentDirPath);
87 void initializationFailed(const QString &reason);
90 // error.isEmpty <=> finished successfully
91 void finished(Utils::SftpJobId job, const QString &error = QString());
94 * This signal is only emitted by the "List Directory" operation,
96 // TODO: Also emit for each file copied by uploadDir().
98 void dataAvailable(Utils::SftpJobId job, const QString &data);
101 SftpChannel(quint32 channelId, Internal::SshSendFacility &sendFacility);
103 Internal::SftpChannelPrivate *d;
108 #endif // SFTPCHANNEL_H