~ubuntu-sdk-team/ubuntu-ui-toolkit/ellipticSubTitles

« back to all changes in this revision

Viewing changes to src/UbuntuToolkit/privates/uccontenthub_p.h

Add support for interacting with Content Hub Clipboard UI via DBus calls. Fixes: https://bugs.launchpad.net/bugs/1563440.

Approved by ubuntu-sdk-build-bot, Christian Dywan.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2016 Canonical Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Author: Arthur Mello <arthur.mello@canonical.com>
 
17
 */
 
18
 
 
19
#ifndef UCCONTENTHUB_P_H
 
20
#define UCCONTENTHUB_P_H
 
21
 
 
22
#include <QtCore/QObject>
 
23
 
 
24
#include <UbuntuToolkit/ubuntutoolkitglobal.h>
 
25
 
 
26
class QMimeData;
 
27
class QDBusInterface;
 
28
class QQuickItem;
 
29
 
 
30
UT_NAMESPACE_BEGIN
 
31
 
 
32
class UBUNTUTOOLKIT_EXPORT UCContentHub : public QObject
 
33
{
 
34
    Q_OBJECT
 
35
 
 
36
    Q_PROPERTY(bool canPaste READ canPaste NOTIFY canPasteChanged)
 
37
 
 
38
public:
 
39
    UCContentHub(QObject* parent = 0);
 
40
    ~UCContentHub();
 
41
 
 
42
    Q_INVOKABLE void requestPaste(QQuickItem *targetItem);
 
43
 
 
44
    bool canPaste();
 
45
    QString getAppProfile();
 
46
    QMimeData* deserializeMimeData(const QByteArray &serializedMimeData);
 
47
 
 
48
Q_SIGNALS:
 
49
    void pasteSelected(QQuickItem *targetItem, const QString &data);
 
50
    void canPasteChanged();
 
51
 
 
52
public Q_SLOTS:
 
53
    void onPasteSelected(QString appId, QByteArray mimedata, bool pasteAsRichText);
 
54
    void onPasteboardChanged();
 
55
 
 
56
private:
 
57
    bool checkPasteFormats();
 
58
 
 
59
    QDBusInterface *m_dbusIface;
 
60
    QDBusInterface *m_contentHubIface;
 
61
 
 
62
    bool m_canPaste;
 
63
    QQuickItem *m_targetItem;
 
64
};
 
65
 
 
66
UT_NAMESPACE_END
 
67
 
 
68
#endif  // UCCONTENTHUB_P_H