File indexing completed on 2024-05-12 16:40:16
0001 /* This file is part of the KDE project 0002 Copyright (C) 2003-2016 Jarosław Staniek <staniek@kde.org> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License as published by the Free Software Foundation; either 0007 version 2 of the License, or (at your option) any later version. 0008 0009 This library is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to 0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 * Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef KEXI_MIGRATE_MANAGER_P_H 0021 #define KEXI_MIGRATE_MANAGER_P_H 0022 0023 #include <QMap> 0024 0025 #include <KDbObject> 0026 #include <KDbResult> 0027 0028 class KexiMigratePluginMetaData; 0029 0030 namespace KexiMigration 0031 { 0032 0033 //! Internal class of the migrate manager. 0034 class MigrateManagerInternal : public QObject, public KDbResultable 0035 { 0036 Q_OBJECT 0037 public: 0038 /*! Used by self() */ 0039 MigrateManagerInternal(); 0040 0041 ~MigrateManagerInternal(); 0042 0043 QStringList driverIds(); 0044 0045 /*! Tries to load migrate driver @a id. 0046 @return driver, or @c nullptr on error (then error result is also set) */ 0047 KexiMigrate* driver(const QString& id); 0048 0049 const KexiMigratePluginMetaData* driverMetaData(const QString &id); 0050 0051 //! @return all migration driver IDs that support mimetype @a mimeType 0052 QStringList driverIdsForMimeType(const QString &mimeType); 0053 0054 //! @return all migration driver IDs that support source KDb database driver ID @a sourceDriverId 0055 QStringList driverIdsForSourceDriver(const QString &sourceDriverId); 0056 0057 //! @return user-visible message describing problem with lookup of migration drivers 0058 QStringList possibleProblemsMessage() const; 0059 0060 //! @return list of file MIME types that are supported by migration drivers 0061 QStringList supportedFileMimeTypes(); 0062 0063 //! @return list of KDb driver IDs supported that are supported by migration drivers 0064 QStringList supportedSourceDriverIds(); 0065 0066 protected Q_SLOTS: 0067 /*! Used to destroy all drivers on QApplication quit, so even if there are 0068 manager's static instances that are destroyed on program 0069 "static destruction", drivers are not kept after QApplication death. 0070 */ 0071 void slotAppQuits(); 0072 0073 protected: 0074 bool lookupDrivers(); 0075 0076 void clear(); 0077 0078 QMultiMap<QString, KexiMigratePluginMetaData*> m_metadata_by_mimetype; 0079 QMultiMap<QString, KexiMigratePluginMetaData*> m_metadataBySourceDrivers; 0080 QMap<QString, KexiMigratePluginMetaData*> m_driversMetaData; //!< used to store driver metadata 0081 QMap<QString, KexiMigrate*> m_drivers; //!< for owning drivers 0082 QStringList m_possibleProblems; 0083 bool m_lookupDriversNeeded; 0084 }; 0085 } 0086 0087 #endif