1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
|
#include "genericexportplugin.h"
#include "common/utils.h"
#include "services/notifymanager.h"
#include "common/unused.h"
#include "config_builder.h"
#include <QTextCodec>
bool GenericExportPlugin::initBeforeExport(Db* db, QIODevice* output, const ExportManager::StandardExportConfig& config)
{
this->db = db;
this->output = output;
this->config = &config;
if (standardOptionsToEnable().testFlag(ExportManager::CODEC))
{
codec = codecForName(this->config->codec);
if (!codec)
{
codec = defaultCodec();
notifyWarn(tr("Could not initialize text codec for exporting. Using default codec: %1").arg(QString::fromLatin1(codec->name())));
}
}
return beforeExport();
}
ExportManager::ExportModes GenericExportPlugin::getSupportedModes() const
{
return ExportManager::FILE|ExportManager::CLIPBOARD|ExportManager::DATABASE|ExportManager::TABLE|ExportManager::QUERY_RESULTS;
}
ExportManager::ExportProviderFlags GenericExportPlugin::getProviderFlags() const
{
return ExportManager::NONE;
}
QString GenericExportPlugin::getExportConfigFormName() const
{
return QString();
}
CfgMain* GenericExportPlugin::getConfig()
{
return nullptr;
}
QString GenericExportPlugin::getConfigFormName(ExportManager::ExportMode mode) const
{
UNUSED(mode);
return QString();
}
QString GenericExportPlugin::getMimeType() const
{
return QString();
}
QString GenericExportPlugin::getDefaultEncoding() const
{
return QString();
}
bool GenericExportPlugin::isBinaryData() const
{
return false;
}
void GenericExportPlugin::setExportMode(ExportManager::ExportMode mode)
{
this->exportMode = mode;
}
bool GenericExportPlugin::afterExportQueryResults()
{
return true;
}
bool GenericExportPlugin::afterExportTable()
{
return true;
}
bool GenericExportPlugin::initBeforeExport()
{
return true;
}
void GenericExportPlugin::write(const QString& str)
{
output->write(codec->fromUnicode(str));
}
void GenericExportPlugin::writeln(const QString& str)
{
write(str + "\n");
}
bool GenericExportPlugin::isTableExport() const
{
return exportMode == ExportManager::TABLE;
}
bool GenericExportPlugin::beforeExportTables()
{
return true;
}
bool GenericExportPlugin::afterExportTables()
{
return true;
}
bool GenericExportPlugin::beforeExportIndexes()
{
return true;
}
bool GenericExportPlugin::afterExportIndexes()
{
return true;
}
bool GenericExportPlugin::beforeExportTriggers()
{
return true;
}
bool GenericExportPlugin::afterExportTriggers()
{
return true;
}
bool GenericExportPlugin::beforeExportViews()
{
return true;
}
bool GenericExportPlugin::afterExportViews()
{
return true;
}
bool GenericExportPlugin::afterExportDatabase()
{
return true;
}
bool GenericExportPlugin::afterExport()
{
return true;
}
void GenericExportPlugin::cleanupAfterExport()
{
}
bool GenericExportPlugin::beforeExport()
{
return true;
}
|