on e82caeb help sign in
unity8/plugins/Unity/result.cpp
82 lines 2.3 kB history raw
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 */
20#include "result.h"
21#include "variantutils.h"
23Result::Result(QObject *parent) :
24 QObject(parent)
28Result::Result(unity::dash::Preview::Ptr preview, QObject *parent) :
29 QObject(parent),
30 m_preview(preview)
34void Result::setPreview(unity::dash::Preview::Ptr preview)
36 m_preview = preview;
39QString Result::uri() const
41 return m_preview != nullptr ? QString::fromStdString(m_preview->preview_result.uri) : QString::null;
44QString Result::iconHint() const
46 return m_preview != nullptr ? QString::fromStdString(m_preview->preview_result.icon_hint) : QString::null;
49unsigned Result::categoryIndex() const
51 return m_preview != nullptr ? m_preview->preview_result.category_index : 0;
54unsigned Result::resultType() const
56 return m_preview != nullptr ? m_preview->preview_result.result_type : 0;
59QString Result::mimeType() const
61 return m_preview != nullptr ? QString::fromStdString(m_preview->preview_result.mimetype) : QString::null;
64QString Result::title() const
66 return m_preview != nullptr ? QString::fromStdString(m_preview->preview_result.name) : QString::null;
69QString Result::comment() const
71 return m_preview != nullptr ? QString::fromStdString(m_preview->preview_result.comment) : QString::null;
74QString Result::dndUri() const
76 return m_preview != nullptr ? QString::fromStdString(m_preview->preview_result.dnd_uri) : QString::null;
79QVariant Result::metadata() const
81 return m_preview != nullptr ? convertToQVariantHash(m_preview->preview_result.hints) : QVariant();