1 /*
2  * This file is part of TelepathyQt
3  *
4  * Copyright (C) 2011 Collabora Ltd. <http://www.collabora.co.uk/>
5  * Copyright (C) 2011 Nokia Corporation
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21 
22 #ifndef _TelepathyQt_examples_file_transfer_file_sender_h_HEADER_GUARD_
23 #define _TelepathyQt_examples_file_transfer_file_sender_h_HEADER_GUARD_
24 
25 #include <TelepathyQt/Constants>
26 #include <TelepathyQt/Types>
27 
28 using namespace Tp;
29 
30 namespace Tp
31 {
32 class PendingOperation;
33 }
34 
35 class FileSender : public QObject
36 {
37     Q_OBJECT
38     Q_DISABLE_COPY(FileSender)
39 
40 public:
41     FileSender(const QString &accountName, const QString &receiverID,
42             const QString &filePath, QObject *parent);
43     ~FileSender();
44 
45 private Q_SLOTS:
46     void onAMReady(Tp::PendingOperation *op);
47     void onAccountReady(Tp::PendingOperation *op);
48     void onAccountConnectionChanged(const Tp::ConnectionPtr &conn);
49     void onContactRetrieved(Tp::PendingOperation *op);
50     void onContactCapabilitiesChanged();
51     void onTransferRequestFinished(Tp::PendingOperation *op);
52     void onSendFinished(Tp::PendingOperation *op);
53 
54 private:
55     QString mAccountName;
56     QString mReceiver;
57     QString mFilePath;
58     bool mTransferRequested;
59 
60     AccountManagerPtr mAM;
61     AccountPtr mAccount;
62     ConnectionPtr mConnection;
63     ContactPtr mContact;
64 };
65 
66 #endif
67