KIO
kfileitemactions_p.h
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 Copyright (C) 1998-2009 David Faure <faure@kde.org> 00003 00004 This library is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU Library General Public License as published 00006 by the Free Software Foundation; either version 2 of the License or 00007 ( at your option ) version 3 or, at the discretion of KDE e.V. 00008 ( which shall act as a proxy as in section 14 of the GPLv3 ), 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 KFILEITEMACTIONS_P_H 00022 #define KFILEITEMACTIONS_P_H 00023 00024 #include <kfileitemlistproperties.h> 00025 #include <kfileitem.h> 00026 #include <kactioncollection.h> 00027 #include <kserviceaction.h> 00028 #include <kservice.h> 00029 #include <QActionGroup> 00030 #include <QObject> 00031 00032 class KFileItemActions; 00033 00034 typedef QList<KServiceAction> ServiceList; 00035 00036 class KFileItemActionsPrivate : public QObject 00037 { 00038 Q_OBJECT 00039 public: 00040 KFileItemActionsPrivate(KFileItemActions *qq); 00041 ~KFileItemActionsPrivate(); 00042 00043 int insertServicesSubmenus(const QMap<QString, ServiceList>& list, QMenu* menu, bool isBuiltin); 00044 int insertServices(const ServiceList& list, QMenu* menu, bool isBuiltin); 00045 00046 // For "open with" 00047 KService::List associatedApplications(const QString& traderConstraint); 00048 KAction* createAppAction(const KService::Ptr& service, bool singleOffer); 00049 00050 struct ServiceRank 00051 { 00052 int score; 00053 KService::Ptr service; 00054 }; 00055 00056 // Inline function for sorting lists of ServiceRank 00057 static bool lessRank(const ServiceRank& id1, const ServiceRank& id2) 00058 { 00059 return id1.score < id2.score; 00060 } 00061 00062 QStringList listMimeTypes(const KFileItemList& items); 00063 QStringList listPreferredServiceIds(const QStringList& mimeTypeList, const QString& traderConstraint); 00064 00065 public Q_SLOTS: 00066 void slotRunPreferredApplications(); 00067 00068 private: 00069 void openWithByMime(const KFileItemList& fileItems); 00070 00071 private Q_SLOTS: 00072 // For servicemenus 00073 void slotExecuteService(QAction* act); 00074 // For "open with" applications 00075 void slotRunApplication(QAction* act); 00076 void slotOpenWithDialog(); 00077 00078 public: 00079 KFileItemActions* const q; 00080 KFileItemListProperties m_props; 00081 QStringList m_mimeTypeList; 00082 QString m_traderConstraint; 00083 KFileItemList m_fileOpenList; 00084 QActionGroup m_executeServiceActionGroup; 00085 QActionGroup m_runApplicationActionGroup; 00086 QList<KAction*> m_ownActions; 00087 QWidget* m_parentWidget; 00088 }; 00089 00090 Q_DECLARE_METATYPE(KService::Ptr) 00091 Q_DECLARE_METATYPE(KServiceAction) 00092 00093 #endif /* KFILEITEMACTIONS_P_H */ 00094
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Wed May 2 2012 18:21:08 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2012 The KDE developers.
Generated on Wed May 2 2012 18:21:08 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.