2 * Copyright (C) 2006 Aaron Seigo <aseigo@kde.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License version 2 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 Library General Public
14 * License along with this program; if not, write to the
15 * Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #include "shellrunner.h"
23 #include <QPushButton>
25 #include <KAuthorized>
29 #include <KStandardDirs>
31 #include "ui_shellOptions.h"
33 ShellRunner::ShellRunner(QObject
*parent
, const QVariantList
&args
)
34 : Plasma::AbstractRunner(parent
, args
)
38 setObjectName(i18n("Command"));
39 setHasMatchOptions(true);
40 setPriority(AbstractRunner::HighestPriority
);
41 m_enabled
= KAuthorized::authorizeKAction("shell_access");
44 ShellRunner::~ShellRunner()
48 void ShellRunner::match(Plasma::SearchContext
*search
)
54 if (search
->type() == Plasma::SearchContext::Executable
||
55 search
->type() == Plasma::SearchContext::ShellCommand
) {
56 const QString term
= search
->searchTerm();
57 Plasma::SearchMatch
* match
= new Plasma::SearchMatch(this);
58 match
->setType(Plasma::SearchMatch::ExactMatch
);
59 match
->setIcon(KIcon("system-run"));
60 match
->setText(i18n("Run %1", term
));
61 match
->setRelevance(1);
62 search
->addMatch(term
, match
);
66 void ShellRunner::createMatchOptions(QWidget
* parent
)
72 void ShellRunner::exec(const Plasma::SearchContext
*search
, const Plasma::SearchMatch
*action
)
79 KRun::runCommand(search
->searchTerm(), NULL
);
82 #include "shellrunner.moc"