~artmello/gallery-app/gallery-app-convergence_fullscreen

813.1.1 by Guenter Schwann
Use content hub for content picking
1
/*
2
 * Copyright (C) 2013 Canonical, Ltd.
3
 *
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; version 3.
7
 *
8
 * This program is distributed in the hope that it will be useful,
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 * GNU General Public License for more details.
12
 *
13
 * You should have received a copy of the GNU General Public License
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 *
16
 */
17
18
#ifndef CONTENTCOMMUNICATOR_H
19
#define CONTENTCOMMUNICATOR_H
20
21
#include <com/ubuntu/content/import_export_handler.h>
836.1.2 by Guenter Schwann
Add missing include
22
#include <com/ubuntu/content/transfer.h>
813.1.1 by Guenter Schwann
Use content hub for content picking
23
24
#include <QUrl>
25
#include <QVector>
26
27
using namespace com::ubuntu;
28
29
/*!
813.1.11 by Guenter Schwann
Fix comments from MR
30
 * Class to handle the communication with the content manager
813.1.1 by Guenter Schwann
Use content hub for content picking
31
 */
32
class ContentCommunicator : public content::ImportExportHandler
33
{
34
    Q_OBJECT
850.1.1 by Guenter Schwann
Fix getting the correct selection type fixes LP: #1229801
35
    Q_PROPERTY(bool singleContentPickMode READ singleContentPickMode NOTIFY singleContentPickModeChanged)
836.1.1 by Guenter Schwann
Get and use single/multiselection in pick mode from transfer object
36
    Q_PROPERTY(SelectionType selectionType READ selectionType NOTIFY selectionTypeChanged)
37
    Q_ENUMS(SelectionType)
813.1.1 by Guenter Schwann
Use content hub for content picking
38
39
public:
836.1.1 by Guenter Schwann
Get and use single/multiselection in pick mode from transfer object
40
    enum SelectionType {
41
        SingleSelect = content::Transfer::single,
42
        MultiSelect = content::Transfer::multiple
43
    };
44
813.1.1 by Guenter Schwann
Use content hub for content picking
45
    ContentCommunicator(QObject *parent = nullptr);
46
47
    virtual void handle_import(content::Transfer*);
813.1.11 by Guenter Schwann
Fix comments from MR
48
    virtual void handle_export(content::Transfer *transfer);
813.1.1 by Guenter Schwann
Use content hub for content picking
49
50
    void cancelTransfer();
51
    void returnPhotos(const QVector<QUrl> &urls);
52
836.1.1 by Guenter Schwann
Get and use single/multiselection in pick mode from transfer object
53
    SelectionType selectionType() const;
850.1.1 by Guenter Schwann
Fix getting the correct selection type fixes LP: #1229801
54
    bool singleContentPickMode() const;
836.1.1 by Guenter Schwann
Get and use single/multiselection in pick mode from transfer object
55
813.1.1 by Guenter Schwann
Use content hub for content picking
56
signals:
57
    void photoRequested();
836.1.1 by Guenter Schwann
Get and use single/multiselection in pick mode from transfer object
58
    void selectionTypeChanged();
850.1.1 by Guenter Schwann
Fix getting the correct selection type fixes LP: #1229801
59
    void singleContentPickModeChanged();
813.1.1 by Guenter Schwann
Use content hub for content picking
60
61
private:
62
    content::Transfer *m_transfer;
63
};
64
65
#endif // CONTENTCOMMUNICATOR_H