• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KIO

  • sources
  • kde-4.14
  • kdelibs
  • kio
  • kio
kfileitemactions_p.h
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  Copyright (C) 1998-2009 David Faure <faure@kde.org>
3 
4  This library is free software; you can redistribute it and/or modify
5  it under the terms of the GNU Library General Public License as published
6  by the Free Software Foundation; either version 2 of the License or
7  ( at your option ) version 3 or, at the discretion of KDE e.V.
8  ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version.
9 
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.
14 
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.
19 */
20 
21 #ifndef KFILEITEMACTIONS_P_H
22 #define KFILEITEMACTIONS_P_H
23 
24 #include <kfileitemlistproperties.h>
25 #include <kfileitem.h>
26 #include <kactioncollection.h>
27 #include <kserviceaction.h>
28 #include <kservice.h>
29 #include <QActionGroup>
30 #include <QObject>
31 
32 class KFileItemActions;
33 
34 typedef QList<KServiceAction> ServiceList;
35 
36 class KFileItemActionsPrivate : public QObject
37 {
38  Q_OBJECT
39 public:
40  KFileItemActionsPrivate(KFileItemActions *qq);
41  ~KFileItemActionsPrivate();
42 
43  int insertServicesSubmenus(const QMap<QString, ServiceList>& list, QMenu* menu, bool isBuiltin);
44  int insertServices(const ServiceList& list, QMenu* menu, bool isBuiltin);
45 
46  // For "open with"
47  KService::List associatedApplications(const QString& traderConstraint);
48  KAction* createAppAction(const KService::Ptr& service, bool singleOffer);
49 
50  struct ServiceRank
51  {
52  int score;
53  KService::Ptr service;
54  };
55 
56  // Inline function for sorting lists of ServiceRank
57  static bool lessRank(const ServiceRank& id1, const ServiceRank& id2)
58  {
59  return id1.score < id2.score;
60  }
61 
62  QStringList listMimeTypes(const KFileItemList& items);
63  QStringList listPreferredServiceIds(const QStringList& mimeTypeList, const QString& traderConstraint);
64 
65 public Q_SLOTS:
66  void slotRunPreferredApplications();
67 
68 private:
69  void openWithByMime(const KFileItemList& fileItems);
70 
71 private Q_SLOTS:
72  // For servicemenus
73  void slotExecuteService(QAction* act);
74  // For "open with" applications
75  void slotRunApplication(QAction* act);
76  void slotOpenWithDialog();
77 
78 public:
79  KFileItemActions* const q;
80  KFileItemListProperties m_props;
81  QStringList m_mimeTypeList;
82  QString m_traderConstraint;
83  KFileItemList m_fileOpenList;
84  QActionGroup m_executeServiceActionGroup;
85  QActionGroup m_runApplicationActionGroup;
86  QList<KAction*> m_ownActions;
87  QWidget* m_parentWidget;
88 };
89 
90 Q_DECLARE_METATYPE(KService::Ptr)
91 Q_DECLARE_METATYPE(KServiceAction)
92 
93 #endif /* KFILEITEMACTIONS_P_H */
94 
KFileItemActionsPrivate::insertServicesSubmenus
int insertServicesSubmenus(const QMap< QString, ServiceList > &list, QMenu *menu, bool isBuiltin)
Definition: kfileitemactions.cpp:111
KFileItemActionsPrivate::m_ownActions
QList< KAction * > m_ownActions
Definition: kfileitemactions_p.h:86
KSharedPtr< KService >
QWidget
KFileItemActionsPrivate::~KFileItemActionsPrivate
~KFileItemActionsPrivate()
Definition: kfileitemactions.cpp:106
QActionGroup
KFileItemActionsPrivate
Definition: kfileitemactions_p.h:36
KFileItemActionsPrivate::KFileItemActionsPrivate
KFileItemActionsPrivate(KFileItemActions *qq)
Definition: kfileitemactions.cpp:93
KFileItemActionsPrivate::m_runApplicationActionGroup
QActionGroup m_runApplicationActionGroup
Definition: kfileitemactions_p.h:85
kactioncollection.h
QMap
Definition: netaccess.h:36
KFileItemActionsPrivate::slotRunPreferredApplications
void slotRunPreferredApplications()
Definition: kfileitemactions.cpp:602
KFileItemActions
This class creates and handles the actions for a url (or urls) in a popupmenu.
Definition: kfileitemactions.h:44
KServiceAction
KFileItemActionsPrivate::m_parentWidget
QWidget * m_parentWidget
Definition: kfileitemactions_p.h:87
KFileItemActionsPrivate::m_traderConstraint
QString m_traderConstraint
Definition: kfileitemactions_p.h:82
KFileItemActionsPrivate::ServiceRank::service
KService::Ptr service
Definition: kfileitemactions_p.h:53
KFileItemActionsPrivate::ServiceRank
Definition: kfileitemactions_p.h:50
QObject
ServiceList
QList< KServiceAction > ServiceList
Definition: kfileitemactions_p.h:32
KFileItemList
List of KFileItems, which adds a few helper methods to QList.
Definition: kfileitem.h:674
KFileItemActionsPrivate::m_fileOpenList
KFileItemList m_fileOpenList
Definition: kfileitemactions_p.h:83
QString
QList< KServiceAction >
QStringList
kservice.h
KFileItemActionsPrivate::m_executeServiceActionGroup
QActionGroup m_executeServiceActionGroup
Definition: kfileitemactions_p.h:84
QMenu
KFileItemListProperties
Provides information about the common properties of a group of KFileItem objects. ...
Definition: kfileitemlistproperties.h:49
KFileItemActionsPrivate::m_props
KFileItemListProperties m_props
Definition: kfileitemactions_p.h:80
KFileItemActionsPrivate::lessRank
static bool lessRank(const ServiceRank &id1, const ServiceRank &id2)
Definition: kfileitemactions_p.h:57
QAction
KAction
KFileItemActionsPrivate::insertServices
int insertServices(const ServiceList &list, QMenu *menu, bool isBuiltin)
Definition: kfileitemactions.cpp:133
kfileitemlistproperties.h
KFileItemActionsPrivate::ServiceRank::score
int score
Definition: kfileitemactions_p.h:52
KFileItemActionsPrivate::listPreferredServiceIds
QStringList listPreferredServiceIds(const QStringList &mimeTypeList, const QString &traderConstraint)
Definition: kfileitemactions.cpp:681
KFileItemActionsPrivate::listMimeTypes
QStringList listMimeTypes(const KFileItemList &items)
Definition: kfileitemactions.cpp:671
KFileItemActionsPrivate::q
KFileItemActions *const q
Definition: kfileitemactions_p.h:79
kserviceaction.h
KFileItemActionsPrivate::createAppAction
KAction * createAppAction(const KService::Ptr &service, bool singleOffer)
Definition: kfileitemactions.cpp:693
kfileitem.h
KFileItemActionsPrivate::m_mimeTypeList
QStringList m_mimeTypeList
Definition: kfileitemactions_p.h:81
KRecentDirs::list
QStringList list(const QString &fileClass)
Returns a list of directories associated with this file-class.
Definition: krecentdirs.cpp:60
KFileItemActionsPrivate::associatedApplications
KService::List associatedApplications(const QString &traderConstraint)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:53 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal