Applets
urlitemlauncher.h
Go to the documentation of this file.00001 /* 00002 Copyright 2007 Robert Knight <robertknight@gmail.com> 00003 Copyright 2007 Kevin Ottens <ervin@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef URLITEMLAUNCHER_H 00022 #define URLITEMLAUNCHER_H 00023 00024 #include <QObject> 00025 #include <solid/storageaccess.h> 00026 00027 class QModelIndex; 00028 class KUrl; 00029 00030 namespace Kickoff 00031 { 00032 00039 class UrlItemHandler 00040 { 00041 public: 00042 virtual ~UrlItemHandler() {} 00043 virtual bool openUrl(const KUrl& url) = 0; 00044 }; 00045 00054 class UrlItemLauncher : public QObject 00055 { 00056 Q_OBJECT 00057 00058 public: 00059 UrlItemLauncher(QObject *parent = 0); 00060 virtual ~UrlItemLauncher(); 00061 00062 enum HandlerType 00063 { 00064 ProtocolHandler, 00065 ExtensionHandler 00066 }; 00067 static void addGlobalHandler(HandlerType type, 00068 const QString& name, 00069 UrlItemHandler *handler); 00070 00071 public Q_SLOTS: 00073 bool openItem(const QModelIndex& index); 00075 bool openUrl(const QString& url); 00076 00077 private Q_SLOTS: 00078 void onSetupDone(Solid::ErrorType error, QVariant errorData, const QString &udi); 00079 00080 private: 00081 class Private; 00082 Private * const d; 00083 }; 00084 00085 } 00086 00087 #endif // URLITEMLAUNCHER_H 00088