2
* Copyright (C) 2016 Canonical Ltd
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 3 as
6
* published by the Free Software Foundation.
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.
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/>.
16
* Kyle Nitzsche <kyle.nitzsche@canonical.com>
21
#include <unity/scopes/ActivationResponse.h>
22
#include <unity/scopes/CannedQuery.h>
25
#include <QTextStream>
29
namespace usc = unity::scopes;
32
Action(usc::Result const& result,
33
usc::ActionMetadata const& metadata,
34
std::string const& cache_dir,
35
std::string const& scope_id)
36
: usc::ActivationQueryBase(result, metadata),
37
cache_dir_(cache_dir),
42
usc::ActivationResponse
45
if (result()["action"].get_string() == "hide_hints")
47
QFile file(QString("%1/%2").arg(QString::fromStdString(cache_dir_),"hints_is_hidden"));
48
file.open(QIODevice::Append | QIODevice::Text);
49
QTextStream out(&file);
50
out << QDateTime::currentDateTime().toString();
53
usc::CannedQuery cq(scope_id_);
54
return usc::ActivationResponse(cq);
56
return usc::ActivationResponse(usc::ActivationResponse::Status::NotHandled);