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.
21 #include <QPushButton>
23 #include <KAuthorized>
27 #include <KStandardDirs>
29 #include "shellrunner.h"
30 #include "ui_shellOptions.h"
32 ShellRunner::ShellRunner( QObject
* parent
)
33 : Plasma::AbstractRunner( parent
),
36 setObjectName( i18n( "Command" ) );
37 m_enabled
= KAuthorized::authorizeKAction( "shell_access" );
40 ShellRunner::~ShellRunner()
45 QAction
* ShellRunner::accepts(const QString
& term
)
51 QString executable
= term
;
52 int space
= executable
.indexOf( " " );
55 executable
= executable
.left( space
);
58 executable
= KStandardDirs::findExe( executable
);
60 if ( !executable
.isEmpty() ) {
61 QAction
* action
= new QAction( KIcon( "exec" ), executable
, this );
68 bool ShellRunner::hasOptions()
73 QWidget
* ShellRunner::options()
77 m_options
= new QWidget
;
78 ui
.setupUi( m_options
);
84 bool ShellRunner::exec(QAction
* action
, const QString
& command
)
90 return (KRun::runCommand(command
, NULL
) != 0);
93 #include "shellrunner.moc"