~content-hub-team/content-hub/trunk

« back to all changes in this revision

Viewing changes to import/Ubuntu/Content/contenttransfer.cpp

  • Committer: Tarmac
  • Author(s): Ken VanDine
  • Date: 2013-09-30 18:39:00 UTC
  • mfrom: (48.1.1 content-hub-lp1231368)
  • Revision ID: tarmac-20130930183900-61vw3dr45uph3six
Pulled back in all the changes that were reverted in rev 47.  Bug (LP: #1231368) seemed to be caused by gallery-app needing a rebuild against this version of content-hub.

Approved by PS Jenkins bot, Günter Schwann.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 */
16
16
 
17
17
#include "contenttransfer.h"
18
 
#include <contentitem.h>
 
18
#include "contentitem.h"
19
19
 
20
20
#include <com/ubuntu/content/item.h>
21
21
 
39
39
      m_transfer(0),
40
40
      m_state(Aborted),
41
41
      m_direction(Import),
42
 
      m_selectionType(Single)
 
42
      m_selectionType(Single),
 
43
      m_store(0)
43
44
{
44
45
    qDebug() << Q_FUNC_INFO;
45
46
}
99
100
 
100
101
    if (m_state == Created && (m_selectionType != type)) {
101
102
        m_transfer->setSelectionType(static_cast<cuc::Transfer::SelectionType>(type));
102
 
        updateSelectionType();
103
103
    }
104
104
}
105
105
 
134
134
}
135
135
 
136
136
/*!
 
137
 * \qmlmethod ContentTransfer::finalize()
 
138
 *
 
139
 *  FIXME add documentation
 
140
 */
 
141
bool ContentTransfer::finalize()
 
142
{
 
143
    qDebug() << Q_FUNC_INFO;
 
144
    return m_transfer->finalize();
 
145
}
 
146
 
 
147
/*!
 
148
 * \brief ContentTransfer::store
 
149
 * \return
 
150
 */
 
151
const QString ContentTransfer::store() const
 
152
{
 
153
    qDebug() << Q_FUNC_INFO;
 
154
    return m_transfer->store().uri();
 
155
}
 
156
 
 
157
void ContentTransfer::setStore(ContentStore* contentStore)
 
158
{
 
159
    qDebug() << Q_FUNC_INFO;
 
160
 
 
161
    if (!m_transfer)
 
162
    {
 
163
        qWarning() << Q_FUNC_INFO << "invalid transfer";
 
164
        return;
 
165
    }
 
166
    m_transfer->setStore(contentStore->store());
 
167
}
 
168
 
 
169
/*!
137
170
 * \brief ContentTransfer::transfer
138
171
 * \return
139
172
 */
165
198
    m_transfer = transfer;
166
199
 
167
200
    updateSelectionType();
 
201
    updateStore();
168
202
    updateState();
169
203
 
170
204
    if (m_state == Charged && m_direction == Import)
171
205
        collectItems();
172
206
 
 
207
    connect(m_transfer, SIGNAL(selectionTypeChanged()), this, SLOT(updateSelectionType()));
 
208
    connect(m_transfer, SIGNAL(storeChanged()), this, SLOT(updateStore()));
173
209
    connect(m_transfer, SIGNAL(stateChanged()), this, SLOT(updateState()));
174
 
    connect(m_transfer, SIGNAL(selectionTypeChanged()), this, SLOT(updateSelectionType()));
175
210
}
176
211
 
177
212
/*!
220
255
    m_selectionType = static_cast<ContentTransfer::SelectionType>(m_transfer->selectionType());
221
256
    Q_EMIT selectionTypeChanged();
222
257
}
 
258
 
 
259
 
 
260
/*!
 
261
 * \brief ContentTransfer::updateStore update the store from the hub transfer object
 
262
 */
 
263
void ContentTransfer::updateStore()
 
264
{
 
265
    qDebug() << Q_FUNC_INFO;
 
266
    if (!m_transfer)
 
267
        return;
 
268
 
 
269
    m_store = m_transfer->store();
 
270
    Q_EMIT storeChanged();
 
271
}