2
* Copyright (C) 2013 Canonical, Ltd.
5
* Pawel Stolowski <pawel.stolowski@canonical.com>
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.
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.
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/>.
21
#include "variantutils.h"
23
Result::Result(QObject *parent) :
28
Result::Result(unity::dash::Preview::Ptr preview, QObject *parent) :
34
void Result::setPreview(unity::dash::Preview::Ptr preview)
39
QString Result::uri() const
41
return m_preview != nullptr ? QString::fromStdString(m_preview->preview_result.uri) : QString::null;
44
QString Result::iconHint() const
46
return m_preview != nullptr ? QString::fromStdString(m_preview->preview_result.icon_hint) : QString::null;
49
unsigned Result::categoryIndex() const
51
return m_preview != nullptr ? m_preview->preview_result.category_index : 0;
54
unsigned Result::resultType() const
56
return m_preview != nullptr ? m_preview->preview_result.result_type : 0;
59
QString Result::mimeType() const
61
return m_preview != nullptr ? QString::fromStdString(m_preview->preview_result.mimetype) : QString::null;
64
QString Result::title() const
66
return m_preview != nullptr ? QString::fromStdString(m_preview->preview_result.name) : QString::null;
69
QString Result::comment() const
71
return m_preview != nullptr ? QString::fromStdString(m_preview->preview_result.comment) : QString::null;
74
QString Result::dndUri() const
76
return m_preview != nullptr ? QString::fromStdString(m_preview->preview_result.dnd_uri) : QString::null;
79
QVariant Result::metadata() const
81
return m_preview != nullptr ? convertToQVariantHash(m_preview->preview_result.hints) : QVariant();