1
/* This file is part of the KDE project
2
Copyright (C) 2003 Lucijan Busch <lucijan@kde.org>
3
Copyright (C) 2003-2016 Jarosław Staniek <staniek@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 KEXIPARTMANAGER_H
22
#define KEXIPARTMANAGER_H
24
//! @todo KEXI3 #include "kexistaticpart.h"
25
#include "kexiinternalpart.h"
36
typedef QHash<QString, Info*> PartInfoDict;
37
typedef QHash<QString, Info*>::iterator PartInfoDictIterator;
38
typedef QList<Info*> PartInfoList;
39
typedef QList<Info*>::iterator PartInfoListIterator;
40
typedef QHash<QString, Part*> PartDict;
43
* @short KexiPart's manager: looks up and instantiates KexiPart-based plugins
45
* It creates instances only when needed.
47
class KEXICORE_EXPORT Manager : public QObject, public KDbResultable
55
* \return a part object for specified plugin ID @a pluginId, e.g. "org.kexi-project.table"
56
* @note For compatibility with Kexi <= 2, if a string without any dot is provided, "org.kexi-project."
57
* will be prepended to the ID.
58
* Dynamically loads a plugin using KexiPart::Info if needed. Returns 0 if loading failed.
60
Part *partForPluginId(const QString& pluginId);
63
* \return a part object for specified info. Dlopens a part using KexiPart::Info
64
* if needed. Return 0 if loading failed.
66
Part *part(Info *info);
69
* \return the info for a corresponding plugin ID, e.g. "org.kexi-project.table"
70
* @note For compatibility with Kexi <= 2, if a string without any dot is provided, "org.kexi-project."
71
* will be prepended to the ID.
73
Info *infoForPluginId(const QString& pluginId);
76
* @return a list of the available KexiParts-based plugins in a well-defined order
77
* Can return 0 if no plugins have been found, what means the installation is broken.
79
PartInfoList* infoList();
82
void partLoaded(KexiPart::Part*);
83
void newObjectRequested(KexiPart::Info *info);
86
//! Used by StaticPart
87
//! @todo KEXI3 void insertStaticPart(KexiPart::StaticPart* part);
89
//! Used by KexiInternalPart
90
KexiInternalPart* internalPartForPluginId(const QString& pluginId);
94
* creates an empty instance
96
explicit Manager(QObject *parent = 0);
99
* Queries the plugin system and creates a list of available parts.
100
* @return false if required servicetype was not found (what means the installation is broken).
102
//! @todo Allow refreshing!!!! (will need calling removeClient() by Part objects)
103
//! @todo This method generates a few warnings, maybe we want to optionally display them somewhere (via the message handler)?
106
template <typename PartClass>
107
PartClass* part(Info *info, QHash<QString, PartClass*> *partDict);
109
Q_DISABLE_COPY(Manager)
114
//! @todo KEXI3 friend KexiPart::StaticPart::StaticPart(const QString&, const QString&, const QString&);
115
friend class ::KexiInternal;
116
friend KexiInternalPart* KexiInternalPart::part(KDbMessageHandler*, const QString&);