File indexing completed on 2024-05-12 16:39:38
0001 /* This file is part of the KDE project 0002 Copyright (C) 2003 Lucijan Busch <lucijan@kde.org> 0003 Copyright (C) 2003-2015 Jarosław Staniek <staniek@kde.org> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License as published by the Free Software Foundation; either 0008 version 2 of the License, or (at your option) any later version. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Library General Public License for more details. 0014 0015 You should have received a copy of the GNU Library General Public License 0016 along with this library; see the file COPYING.LIB. If not, write to 0017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 * Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #ifndef KEXIPARTINFO_H 0022 #define KEXIPARTINFO_H 0023 0024 #include <KPluginMetaData> 0025 0026 #include "kexi.h" 0027 #include "KexiPluginMetaData.h" 0028 0029 class QAction; 0030 class KexiProject; 0031 class KexiWindow; 0032 0033 namespace KexiPart 0034 { 0035 class Manager; 0036 class Item; 0037 class Part; 0038 0039 //! Provides information about a single Kexi Part plugin 0040 class KEXICORE_EXPORT Info : public KexiPluginMetaData 0041 { 0042 public: 0043 ~Info(); 0044 0045 /** 0046 * @return a symbolic type name e.g. "table" for a plugin of "org.kexi-project.table" id. 0047 * 0048 * In theory there can be multiple plugins (with different IDs) with the same type name. 0049 * Defined by a X-Kexi-TypeName field in "kexi_*.desktop" information files. 0050 */ 0051 QString typeName() const; 0052 0053 /** 0054 * @return a i18n'ed group name e.g. "Tables" or "Queries". 0055 * 0056 * Defined by a X-Kexi-GroupName[language] field in "kexi_*.desktop" information files. 0057 */ 0058 QString groupName() const; 0059 0060 /** 0061 * @return an untranslated group name e.g. "Tables" or "Queries". 0062 * 0063 * Defined by a X-Kexi-GroupName field in "kexi_*.desktop" information files. 0064 * Like groupName() but always in English. 0065 */ 0066 QString untranslatedGroupName() const; 0067 0068 /** 0069 * @return supported modes for dialogs created by this part, i.e. a combination 0070 * of Kexi::ViewMode enum elements. Modes are declared in related .desktop files 0071 * in the X-KDE-ServiceTypes field by specifying a list of types, currently 0072 * possible values are: "Kexi/Viewer" (data view), "Kexi/Designer" (design view), 0073 * "Kexi/Editor" (text view). 0074 * 0075 * This information is used to set supported view modes for every KexiView-derived 0076 * object created by a KexiPart. 0077 */ 0078 Kexi::ViewModes supportedViewModes() const; 0079 0080 /** 0081 * @return supported modes for dialogs created by this part in "user mode", i.e. a combination 0082 * of Kexi::ViewMode enum elements. 0083 * Modes are declared in related .desktop files in the X-Kexi-ServiceTypesInUserMode field 0084 * by specifying a list of types. For the list of possible values see supportedViewModes(). 0085 * 0086 * This information is used to set supported view modes for every KexiView-derived 0087 * object created by a KexiPart. 0088 */ 0089 Kexi::ViewModes supportedUserViewModes() const; 0090 0091 /** 0092 * @return true if the plugin should have a corresponding folder-like entry in 0093 * the Project Navigator (as a folder). 0094 * 0095 * Defined by a boolean X-Kexi-VisibleInProjectNavigator field in "kexi_*.desktop" 0096 * information files. 0097 */ 0098 bool isVisibleInNavigator() const; 0099 0100 /** 0101 * @return true if the part supports data exporting. 0102 * 0103 * Defined by a boolean X-Kexi-SupportsDataExport field in "kexi_*.desktop" 0104 * information files. 0105 */ 0106 bool isDataExportSupported() const; 0107 0108 /** 0109 * @return true if the part supports data printing. 0110 * 0111 * Defined by a boolean X-Kexi-SupportsPrinting field in "kexi_*.desktop" 0112 * information files. 0113 */ 0114 bool isPrintingSupported() const; 0115 0116 /** 0117 * @return true if the part supports execution. 0118 * 0119 * This is for example the case for the Macro and the Scripting plugins. 0120 * Defined by a boolean X-Kexi-SupportsExecution field in "kexi_*.desktop" 0121 * information files. 0122 */ 0123 bool isExecuteSupported() const; 0124 0125 /** 0126 * @return true if the property editing facilities should be displayed even 0127 * if the item's property set (KexiWindow::propertySet()) is 0. 0128 * 0129 * @c false by default. It is set to true e.g. for the "table" plugin. 0130 * Defined by a boolean X-Kexi-PropertyEditorAlwaysVisibleInDesignMode field 0131 * in "kexi_*.desktop" information files. 0132 */ 0133 bool isPropertyEditorAlwaysVisibleInDesignMode() const; 0134 0135 /** 0136 * @return "New object" action for this part. 0137 * @return "New object" action for this part. nullptr is returned if this part could 0138 * not create instances (e.g. CSV import) or if global structures such as action 0139 * collection are not (yet) set up. 0140 */ 0141 QAction* newObjectAction(); 0142 0143 protected: 0144 //! @todo KEXI3 fields of static plugins should be defined in .desktop files too (see KReport's static plugins) 0145 // /** 0146 // * Used in StaticPartInfo 0147 // */ 0148 // Info(const QString &id, const QString &iconName, const QString &objectName); 0149 0150 explicit Info(const QPluginLoader &loader); 0151 0152 friend class Manager; 0153 friend class ::KexiProject; 0154 friend class ::KexiWindow; 0155 0156 private: 0157 Q_DISABLE_COPY(Info) 0158 class Private; 0159 Private * const d; 0160 }; 0161 0162 } 0163 #endif