~ubuntu-branches/ubuntu/trusty/unity-scopes-shell/trusty-proposed

« back to all changes in this revision

Viewing changes to src/Unity/previewaction.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2013-11-20 12:52:16 UTC
  • Revision ID: package-import@ubuntu.com-20131120125216-8vhqqz0s234c3pg1
Tags: upstream-0.1+14.04.20131120
ImportĀ upstreamĀ versionĀ 0.1+14.04.20131120

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2013 Canonical, Ltd.
 
3
 *
 
4
 * Authors:
 
5
 *  Pawel Stolowski <pawel.stolowski@canonical.com>
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation; version 3.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
 */
 
19
 
 
20
#include "previewaction.h"
 
21
 
 
22
PreviewAction::PreviewAction(QObject *parent)
 
23
    : QObject(parent),
 
24
      m_unityAction(nullptr)
 
25
{
 
26
}
 
27
 
 
28
void PreviewAction::setUnityAction(unity::dash::Preview::ActionPtr unityAction)
 
29
{
 
30
    m_unityAction = unityAction;
 
31
 
 
32
    Q_EMIT previewActionChanged();
 
33
}
 
34
 
 
35
QString PreviewAction::id() const
 
36
{
 
37
    if (m_unityAction)
 
38
        return QString::fromStdString(m_unityAction->id);
 
39
    return QString();
 
40
}
 
41
 
 
42
QString PreviewAction::displayName() const
 
43
{
 
44
    if (m_unityAction)
 
45
        return QString::fromStdString(m_unityAction->display_name);
 
46
    return QString();
 
47
}
 
48
 
 
49
QString PreviewAction::iconHint() const
 
50
{
 
51
    if (m_unityAction)
 
52
        return QString::fromStdString(m_unityAction->icon_hint);
 
53
    return QString();
 
54
}
 
55
 
 
56
QString PreviewAction::extraText() const
 
57
{
 
58
    if (m_unityAction)
 
59
        return QString::fromStdString(m_unityAction->extra_text);
 
60
    return QString();
 
61
}
 
62
 
 
63
QString PreviewAction::activationUri() const
 
64
{
 
65
    if (m_unityAction)
 
66
        return QString::fromStdString(m_unityAction->activation_uri);
 
67
    return QString();
 
68
}
 
69
 
 
70
LayoutHint PreviewAction::layoutHint() const
 
71
{
 
72
    if (m_unityAction)
 
73
        return static_cast<LayoutHint>(m_unityAction->layout_hint);
 
74
    return LayoutHint::None;
 
75
}