00001
00023 #ifndef _TelepathyQt4_file_transfer_channel_h_HEADER_GUARD_
00024 #define _TelepathyQt4_file_transfer_channel_h_HEADER_GUARD_
00025
00026 #ifndef IN_TELEPATHY_QT4_HEADER
00027 #error IN_TELEPATHY_QT4_HEADER
00028 #endif
00029
00030 #include <TelepathyQt4/Channel>
00031
00032 namespace Tp
00033 {
00034
00035 class TELEPATHY_QT4_EXPORT FileTransferChannel : public Channel
00036 {
00037 Q_OBJECT
00038 Q_DISABLE_COPY(FileTransferChannel)
00039
00040 public:
00041 static const Feature FeatureCore;
00042
00043 static FileTransferChannelPtr create(const ConnectionPtr &connection,
00044 const QString &objectPath, const QVariantMap &immutableProperties);
00045
00046 virtual ~FileTransferChannel();
00047
00048 FileTransferState state() const;
00049 FileTransferStateChangeReason stateReason() const;
00050
00051 QString fileName() const;
00052 QString contentType() const;
00053 qulonglong size() const;
00054 QString uri() const;
00055
00056 FileHashType contentHashType() const;
00057 QString contentHash() const;
00058
00059 QString description() const;
00060
00061 QDateTime lastModificationTime() const;
00062
00063 qulonglong initialOffset() const;
00064
00065 qulonglong transferredBytes() const;
00066
00067 PendingOperation *cancel();
00068
00069 Q_SIGNALS:
00070 void stateChanged(Tp::FileTransferState state,
00071 Tp::FileTransferStateChangeReason reason);
00072 void initialOffsetDefined(qulonglong initialOffset);
00073 void transferredBytesChanged(qulonglong count);
00074
00075 protected:
00076 FileTransferChannel(const ConnectionPtr &connection, const QString &objectPath,
00077 const QVariantMap &immutableProperties,
00078 const Feature &coreFeature = FileTransferChannel::FeatureCore);
00079
00080 SupportedSocketMap availableSocketTypes() const;
00081
00082 virtual void connectToHost();
00083 bool isConnected() const;
00084 void setConnected();
00085
00086 bool isFinished() const;
00087 virtual void setFinished();
00088
00089 private Q_SLOTS:
00090 TELEPATHY_QT4_NO_EXPORT void gotProperties(QDBusPendingCallWatcher *watcher);
00091
00092 TELEPATHY_QT4_NO_EXPORT void changeState();
00093 TELEPATHY_QT4_NO_EXPORT void onStateChanged(uint state, uint stateReason);
00094 TELEPATHY_QT4_NO_EXPORT void onInitialOffsetDefined(qulonglong initialOffset);
00095 TELEPATHY_QT4_NO_EXPORT void onTransferredBytesChanged(qulonglong count);
00096
00097 protected Q_SLOTS:
00098 TELEPATHY_QT4_NO_EXPORT void onUriDefined(const QString &uri);
00099
00100 private:
00101 struct Private;
00102 friend struct Private;
00103 Private *mPriv;
00104 };
00105
00106 }
00107
00108 #endif