File indexing completed on 2024-05-19 12:55:03
0001 /* This file is part of the KDE project 0002 Copyright (C) 2003-2016 Jarosław Staniek <staniek@kde.org> 0003 0004 This program 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 program 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 program; see the file COPYING. 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_H 0021 #define KEXI_MIGRATE_MANAGER_H 0022 0023 #include <QObject> 0024 #include <QMap> 0025 0026 #include <kservice.h> 0027 0028 #include <core/KexiMigrateManagerInterface.h> 0029 0030 #include "keximigrate.h" 0031 0032 namespace KexiMigration 0033 { 0034 0035 class MigrateManagerInternal; 0036 0037 //! @short Migration library management, for finding and loading migration drivers. 0038 class KEXIMIGRATE_EXPORT MigrateManager : public QObject, 0039 public KexiMigrateManagerInterface 0040 { 0041 Q_OBJECT 0042 public: 0043 MigrateManager(); 0044 0045 virtual ~MigrateManager(); 0046 0047 //! @return result of the recent operation. 0048 KDbResult result() const; 0049 0050 //! @return KDbResultable object for the recent operation. 0051 //! It adds serverResultName() in addition to the result(). 0052 const KDbResultable* resultable() const; 0053 0054 /*! Tries to load db driver with identifier @a id. 0055 The id is case insensitive. 0056 \return db driver, or @c nullptr on error (then error message is also set) */ 0057 KexiMigrate* driver(const QString &id); 0058 0059 /*! returns list of available drivers IDs. 0060 That drivers can be loaded by first use of driver() method. */ 0061 const QStringList driverIds(); 0062 0063 /*! @return list of driver IDs for @a mimeType mime type. 0064 Empty list is returned if no driver has been found. 0065 Works only with drivers of file-based databases such as SQLite. 0066 The lookup is case insensitive. */ 0067 QStringList driverIdsForMimeType(const QString &mimeType); 0068 0069 /*! @return list of all migration driver IDs that support source KDb database 0070 driver ID @a sourceDriverId. 0071 The lookup is case insensitive. */ 0072 QStringList driverIdsForSourceDriver(const QString &sourceDriverId); 0073 0074 //! @todo copied from KDbDriverManager, merge it. 0075 /*! HTML information about possible problems encountered. 0076 It's displayed in 'details' section, if an error encountered. 0077 Currently it contains a list of incompatible migration drivers. */ 0078 QString possibleProblemsMessage() const; 0079 0080 //! @return list of file MIME types that are supported by migration drivers 0081 QStringList supportedFileMimeTypes() override; 0082 0083 //! @return list of KDb driver IDs supported that are supported by migration drivers 0084 QStringList supportedSourceDriverIds() override; 0085 }; 0086 0087 } //namespace KexiMigrate 0088 0089 #endif