2
Copyright 2007 Robert Knight <robertknight@gmail.com>
3
Copyright 2007 Kevin Ottens <ervin@kde.org>
5
This library is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Library General Public
7
License as published by the Free Software Foundation; either
8
version 2 of the License, or (at your option) any later version.
10
This library is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
Library General Public License for more details.
15
You should have received a copy of the GNU Library General Public License
16
along with this library; see the file COPYING.LIB. If not, write to
17
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
Boston, MA 02110-1301, USA.
21
#ifndef URLITEMLAUNCHER_H
22
#define URLITEMLAUNCHER_H
24
#include "core/kickoff_export.h"
27
#include <solid/storageaccess.h>
36
* UrlItemHandler is an abstract base class for handlers which can open particular
39
* @see UrlItemLauncher
44
virtual ~UrlItemHandler() {}
45
virtual bool openUrl(const KUrl& url) = 0;
49
* UrlItemLauncher provides facilities to open a item from a Kickoff model based on its UrlRole
52
* By default, a UrlItemLauncher opens all URLs using the KRun class. Additional handlers can be created
53
* to handle URLs with particular protocols or extensions differently. Handlers can be
54
* registered using the static addGlobalHandler() method.
56
class KICKOFF_EXPORT UrlItemLauncher : public QObject
61
UrlItemLauncher(QObject *parent = 0);
62
virtual ~UrlItemLauncher();
68
static void addGlobalHandler(HandlerType type,
70
UrlItemHandler *handler);
73
/** Open the specified @p index from a Kickoff model. */
74
bool openItem(const QModelIndex& index);
75
/** Open the specified @p url */
76
bool openUrl(const QString& url);
79
void onSetupDone(Solid::ErrorType error, QVariant errorData, const QString &udi);
88
#endif // URLITEMLAUNCHER_H