aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/help/searchtaskhandler.cpp
blob: 196aacbe5cbed1523cf1dc4024e972c5c812a37b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (C) 2016 Orgad Shaneh <orgads@gmail.com>.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "searchtaskhandler.h"

#include "helptr.h"

#include <projectexplorer/task.h>

#include <QAction>
#include <QApplication>
#include <QClipboard>
#include <QUrl>

using namespace Help::Internal;

bool SearchTaskHandler::canHandle(const ProjectExplorer::Task &task) const
{
    return !task.summary.isEmpty();
}

void SearchTaskHandler::handle(const ProjectExplorer::Task &task)
{
    emit search(QUrl("https://www.google.com/search?q=" + task.summary));
}

QAction *SearchTaskHandler::createAction(QObject *parent) const
{
    return new QAction(Tr::tr("Get Help Online"), parent);
}