Example #1
0
void PreviewForm::accept() {
    int mib = encodingComboBox->itemData(
                      encodingComboBox->currentIndex()).toInt();
    QTextCodec *codec = QTextCodec::codecForMib(mib);
    qDebug () << " PreviewForm::accept() returning codec name " << codec->name();
    emit userCodec(fileName, codec->name(), format);
    QDialog::accept();

}
Example #2
0
/// The codecmanager constructs
/// This method registeres all codecs available in Qt
TextCodecManager::TextCodecManager()
{
    // append all special encodings
    QList<QByteArray> encList;
    encList << "UTF-8" << "UTF-16" << "UTF-16BE" << "UTF-16LE" << "UTF-32" << "UTF-32BE" << "UTF-32LE";
    foreach( QByteArray enc, encList ) {
        QTextCodec* codec = QTextCodec::codecForName(enc);
        giveTextCodec( new TextCodec( QString(codec->name()), codec, QTextCodec::IgnoreHeader ) );
        giveTextCodec( new TextCodec( QStringLiteral("%1 with BOM").arg( QString(codec->name()) ), codec, QTextCodec::DefaultConversion ) );
    }
Document* FileManager::newDocument() {
    const QString filenameScheme = QObject::tr("New File %0");
    static int counter = 0;

    QString filename;
    bool findNewFilename = false;
    do {
        filename = filenameScheme.arg(++counter);
        foreach(Document* d, m_documents) {
            if(d->documentInfo()->fileName() == filename) {
                findNewFilename = true;
                break;
            }
        }
    }while(findNewFilename);

    QTextCodec* codec = ApplicationManager::settings()->defaultEncoding();
    DocumentInfo docinfo(filename,codec->name(),0);

    Document* doc = new Document(docinfo, QString());

    m_documents.append(doc);
    m_documentMap.insert(filename, doc);

    emit documentOpened(doc);
    return doc;
}
Example #4
0
static
const char * staticCharset(int i)
{
    static QCString localcharset;

    switch ( i ) {
      case 0:
	return "UTF-8";
      case 1:
	return "ISO-10646-UCS-2";
      case 2:
	return ""; // in the 3rd place - some Xdnd targets might only look at 3
      case 3:
	if ( localcharset.isNull() ) {
	    QTextCodec *localCodec = QTextCodec::codecForLocale();
	    if ( localCodec ) {
		localcharset = localCodec->name();
		localcharset = localcharset.lower();
		stripws(localcharset);
	    } else {
		localcharset = "";
	    }
	}
	return localcharset;
    }
    return 0;
}
Example #5
0
TWScript::ParseHeaderResult TWScript::doParseHeader(const QStringList & lines)
{
	QString line, key, value;
	QFileInfo fi(m_Filename);
	
	m_FileSize = fi.size();
	m_LastModified = fi.lastModified();
	
	foreach (line, lines) {
		key = line.section(':', 0, 0).trimmed();
		value = line.section(':', 1).trimmed();
		
		if (key == "Title") m_Title = value;
		else if (key == "Description") m_Description = value;
		else if (key == "Author") m_Author = value;
		else if (key == "Version") m_Version = value;
		else if (key == "Script-Type") {
			if (value == "hook") m_Type = ScriptHook;
			else if (value == "standalone") m_Type = ScriptStandalone;
			else m_Type = ScriptUnknown;
		}
		else if (key == "Hook") m_Hook = value;
		else if (key == "Context") m_Context = value;
		else if (key == "Shortcut") m_KeySequence = QKeySequence(value);
		else if (key == "Encoding") {
			QTextCodec * codec = QTextCodec::codecForName(value.toUtf8());
			if (codec) {
				if (!m_Codec || codec->name() != m_Codec->name()) {
					m_Codec = codec;
					return ParseHeader_CodecChanged;
				}
			}
		}
	}
Example #6
0
void Menu::populateCharacterEncodingMenu()
{
	if (!m_actionGroup)
	{
		QList<int> textCodecs;
		textCodecs << 106 << 1015 << 1017 << 4 << 5 << 6 << 7 << 8 << 82 << 10 << 85 << 12 << 13 << 109 << 110 << 112 << 2250 << 2251 << 2252 << 2253 << 2254 << 2255 << 2256 << 2257 << 2258 << 18 << 39 << 17 << 38 << 2026;

		m_actionGroup = new QActionGroup(this);
		m_actionGroup->setExclusive(true);

		QAction *defaultAction = QMenu::addAction(tr("Auto Detect"));
		defaultAction->setData(-1);
		defaultAction->setCheckable(true);

		m_actionGroup->addAction(defaultAction);

		addSeparator();

		for (int i = 0; i < textCodecs.count(); ++i)
		{
			QTextCodec *codec = QTextCodec::codecForMib(textCodecs.at(i));

			if (!codec)
			{
				continue;
			}

			QAction *textCodecAction = QMenu::addAction(Utils::elideText(codec->name(), this));
			textCodecAction->setData(textCodecs.at(i));
			textCodecAction->setCheckable(true);

			m_actionGroup->addAction(textCodecAction);
		}
	}

	MainWindow *mainWindow = MainWindow::findMainWindow(parent());
	const QString encoding = (mainWindow ? mainWindow->getWindowsManager()->getOption(QLatin1String("Content/DefaultCharacterEncoding")).toString().toLower() : QString());

	for (int i = 2; i < actions().count(); ++i)
	{
		QAction *action = actions().at(i);

		if (!action)
		{
			continue;
		}

		action->setChecked(encoding == action->text().toLower());

		if (action->isChecked())
		{
			break;
		}
	}

	if (!m_actionGroup->checkedAction() && !actions().isEmpty())
	{
		actions().first()->setChecked(true);
	}
}
Example #7
0
/*!
 *\en
 *
 *\_en \ru
 *
 *\_ru
 */
QString
AExtText::getCodec() const
{
	QTextCodec *codec = text->codec();
	if ( codec ) return codec->name();
	return "";
}
Document* FileManager::openDocument(const QString& filename, QString* error) {
    QFileInfo fi(filename);
    QFile file(filename);

    if (!(fi.exists() && fi.isFile())){
        if(error)
            *error = tr("The file <br>\"%0\" <br>does not "
                        "exist or is no file.")
                        .arg(fi.absolutePath());
        return 0;
    }

    if (!file.open(QIODevice::ReadOnly|QIODevice::Text)){
        if(error)
            *error = tr("Unable to open the file<br>\"%0\" <br>"
                        "Check permissions or wether other programs "
                        "are locking the file.")
                        .arg(fi.absolutePath());
        return 0;
    }

    QByteArray contents = file.readAll();
    EncodingDetector detector(contents);
    QTextCodec* codec = detector.GetFontEncoding();//TODO:Delete?
    DocumentInfo docinfo(cleanPath(filename),codec->name(),fi.size());

    Document* doc = new Document(docinfo, codec->toUnicode(contents));
    file.close();

    m_documents.append(doc);
    m_documentMap.insert(cleanPath(filename), doc);

    emit documentOpened(doc);
    return doc;
}
Example #9
0
KTextEditor::Document* KateApp::openDocUrl (const KUrl &url, const QString &encoding, bool isTempFile)
{
  KateMainWindow *mainWindow = activeMainWindow ();

  if (!mainWindow)
    return 0;

  QTextCodec *codec = encoding.isEmpty() ? 0 : QTextCodec::codecForName(encoding.toLatin1());

  // this file is no local dir, open it, else warn
  bool noDir = !url.isLocalFile() || !QFileInfo (url.toLocalFile()).isDir();

  KTextEditor::Document *doc=0;
  
  if (noDir)
  {
    // show no errors...
    documentManager()->setSuppressOpeningErrorDialogs (true);

    // open a normal file
    if (codec)
      doc=mainWindow->viewManager()->openUrl( url, codec->name(), true, isTempFile);
    else
      doc=mainWindow->viewManager()->openUrl( url, QString(), true, isTempFile );
    
    // back to normal....
    documentManager()->setSuppressOpeningErrorDialogs (false);
  }
  else
    KMessageBox::sorry( mainWindow,
                        i18n("The file '%1' could not be opened: it is not a normal file, it is a folder.", url.url()) );

  return doc;
}
Example #10
0
bool KateApp::openURL (const KURL &url, const QString &encoding, bool isTempFile)
{
  KateMainWindow *mainWindow = activeMainWindow ();

  if (!mainWindow)
    return false;

  QTextCodec *codec = encoding.isEmpty() ? 0 : QTextCodec::codecForName(encoding.latin1());

  kdDebug () << "OPEN URL "<< encoding << endl;

  // this file is no local dir, open it, else warn
  bool noDir = !url.isLocalFile() || !QDir (url.path()).exists();

  if (noDir)
  {
    // open a normal file
    if (codec)
      mainWindow->viewManager()->openURL( url, codec->name(), true, isTempFile );
    else
      mainWindow->viewManager()->openURL( url, QString::null, true, isTempFile );
  }
  else
    KMessageBox::sorry( mainWindow,
                        i18n("The file '%1' could not be opened: it is not a normal file, it is a folder.").arg(url.url()) );

  return true;
}
Example #11
0
/*!
  Reads the settings stored in the file \a logger.ini.
*/
void TLogger::readSettings()
{
    // Sets the codec
    QSettings &settings = Tf::app()->loggerSettings();
    QByteArray codecName = settings.value(DEFAULT_TEXT_ENCODING).toByteArray().trimmed();
    if (!codecName.isEmpty()) {
        QTextCodec *c = QTextCodec::codecForName(codecName);
        if (c) {
            if (c->name() != QTextCodec::codecForLocale()->name()) {
                codec_ = c;
            }
            //tSystemDebug("set log text codec: %s", c->name().data());
        } else {
            tSystemError("log text codec matching the name could be not found: %s", codecName.data());
        }
    }

    layout_ = settingsValue("Layout", "%m%n").toByteArray();
    dateTimeFormat_ = settingsValue("DateTimeFormat").toByteArray();

    QByteArray pri = settingsValue("Threshold", "trace").toByteArray().toUpper().trimmed();
    threshold_ = priorityHash()->key(pri, TLogger::Trace);

    QFileInfo fi(settingsValue("Target", "log/app.log").toString());
    target_ = (fi.isAbsolute()) ? fi.absoluteFilePath() : Tf::app()->webRootPath() + fi.filePath();

    QDir dir = QFileInfo(target_).dir();
    if (!dir.exists()) {
        // Created a directory
        dir.mkpath(".");
    }
}
Example #12
0
bool Terminal::setEncoding(const QString& encoding)
{
    // Since there can be multiple names for the same codec (i.e., "utf8" and
    // "utf-8"), we need to get the codec in the system first and use its
    // canonical name
    QTextCodec* codec = QTextCodec::codecForName(encoding.toLatin1());
    if (!codec) {
        return false;
    }

    // Check whether encoding actually needs to be changed
    const QString encodingBeforeUpdate(m_encoding.getName());
    if (0 == encodingBeforeUpdate.compare(QString(codec->name()), Qt::CaseInsensitive)) {
        return false;
    }

    m_encoding.setEncoding(encoding);

    // Emit the signal only if the encoding actually was changed
    const QString encodingAfterUpdate(m_encoding.getName());
    if (0 == encodingBeforeUpdate.compare(encodingAfterUpdate, Qt::CaseInsensitive)) {
        return false;
    }

    emit encodingChanged(encoding);

    return true;
}
Example #13
0
/*!
	\brief Reset the subcontrols to reflect the current settings
	
	The name can be a bit misleading at first, it has been chosen
	because it directly maps to the effect a "cancel" button would
	have on the widget
*/
void QEditConfig::cancel()
{
	// reload the current config
	
	bool oldDir = m_direct;
	
	m_direct = false;
	
	cbFont->setFont(QDocument::font());
	spnFontSize->setValue(QDocument::font().pointSize());
	
	spnTabWidth->setValue(QDocument::tabStop());
	
	QDocument::WhiteSpaceMode ws = QDocument::showSpaces();
	chkShowTabsInText->setChecked(ws & QDocument::ShowTabs);
	chkShowLeadingWhitespace->setChecked(ws & QDocument::ShowLeading);
	chkShowTrailingWhitespace->setChecked(ws & QDocument::ShowTrailing);
	
	QDocument::LineEnding le = QDocument::defaultLineEnding();
	chkDetectLE->setChecked(le == QDocument::Conservative);
	cbLineEndings->setCurrentIndex(le ? le - 1 : 0);
	
	int flags = QEditor::defaultFlags();
	chkReplaceTabs->setChecked(flags & QEditor::ReplaceTabs);
	chkAutoRemoveTrailingWhitespace->setChecked(flags & QEditor::RemoveTrailing);
	chkPreserveTrailingIndent->setChecked(flags & QEditor::PreserveTrailingIndent);
	
	QTextCodec *c = QEditor::defaultCodec();
	cbEncoding->setCurrentIndex(cbEncoding->findText(c ? c->name() : QTextCodec::codecForLocale()->name()));
	
	m_direct = oldDir;
}
Example #14
0
 foreach( QByteArray name, names) {
     QTextCodec* codec = QTextCodec::codecForName(name);
     if( !codecRefMap_.contains( codec->name() ) ) {
         TextCodec* textCodec = new TextCodec( name, codec, QTextCodec::DefaultConversion );
         giveTextCodec( textCodec );
     }
 }
Example #15
0
void KPrWebPresentationWizard::finish()
{
    webPres.setAuthor( author->text() );
    webPres.setEMail( email->text() );
    webPres.setTitle( title->text() );

    QListViewItemIterator it( slideTitles );
    for ( ; it.current(); ++it )
        webPres.setSlideTitle( it.current()->text( 0 ).toInt() - 1, it.current()->text( 1 ) );

    webPres.setBackColor( backColor->color() );
    webPres.setTitleColor( titleColor->color() );
    webPres.setTextColor( textColor->color() );
    webPres.setPath( path->lineEdit()->text() );
    webPres.setZoom( zoom->value() );
    webPres.setTimeBetweenSlides( timeBetweenSlides->value() );
    webPres.setWriteHeader( writeHeader->isChecked() );
    webPres.setWriteFooter( writeFooter->isChecked() );
    webPres.setLoopSlides( loopSlides->isChecked() );
    webPres.setXML( doctype->currentItem() != 0 );
    bool found = false;
    QTextCodec *codecForEnc = KGlobal::charsets()->codecForName(KGlobal::charsets()->encodingForName(encoding->currentText()), found);
    if ( found )
    {
        webPres.setEncoding( codecForEnc->name() );
    }

    close();
    KPrWebPresentationCreateDialog::createWebPresentation( doc, view, webPres );
}
Example #16
0
void TransferTab::createCodecComboBox()
{
    QMap<QString, QString> codecMap;
    QRegExp iso8859RegExp("ISO[- ]8859-([0-9]+).*");

    foreach (QByteArray name, QTextCodec::availableCodecs()) {
        QTextCodec *codec = QTextCodec::codecForName(name);

        QString sortKey = codec->name().toUpper();
        int rank;

        if (sortKey.startsWith("UTF-8")) {
            rank = 1;
        } else if (sortKey.startsWith("UTF-16")) {
            rank = 2;
        } else if (iso8859RegExp.exactMatch(sortKey)) {
            if (iso8859RegExp.cap(1).size() == 1)
                rank = 3;
            else
                rank = 4;
        } else {
            rank = 5;
        }
        sortKey.prepend(QChar('0' + rank));

        codecMap.insert(sortKey, QString(name));
    }
Example #17
0
void KviWindow::saveProperties(KviConfigurationFile * pCfg)
{
	// store only the non-default text encoding.
	QString szCodec = m_szTextEncoding;
	QTextCodec * pCodec = defaultTextCodec();
	if(pCodec && m_pTextCodec)
	{
		if(KviQString::equalCI(szCodec, pCodec->name().data()))
			szCodec = KviQString::Empty; // store "default"
	}

	if(!szCodec.isEmpty())
		pCfg->writeEntry("TextEncoding", szCodec);
	if(m_pInput)
	{
		pCfg->writeEntry("inputToolButtonsHidden", m_pInput->isButtonsHidden());
		pCfg->writeEntry("commandLineIsUserFriendly", m_pInput->isUserFriendly());
	}

	/*
	if(m_pIrcView && m_eType == KviWindow::Channel)
	if(m_pIrcView->isLogging())
		pCfg->writeEntry("LoggingEnabled",m_pIrcView->isLogging());
	*/
}
Example #18
0
void MainWindow::showTextEncoding(QWidget* viewer)
{
    QTextCodec* textCodec = LOGVIEWERMANAGER()->textCodec(viewer);
    Q_ASSERT(textCodec);

    QString name = textCodec->name();
    static_cast<StatusBar*>(statusBar())->setTextCodec(name);
}
Example #19
0
int main( int argc, char ** argv )
{
  QApplication a( argc, argv );
  a.setOrganizationName(ORGNAME);
  a.setOrganizationDomain(ORGDOMAIN);
  a.setApplicationName(APPNAME);

  MyPasswordSafe myps;

  QTextCodec *codec = QTextCodec::codecForLocale();
  QTranslator qt(0);
#ifdef DEBUG
  cout << "Using locale: " << (const char *)codec->name() << endl;
#endif
  qt.load(QString("qt_") + codec->name(), locale_dir);
  a.installTranslator(&qt);
  QTranslator myapp(0);
  if(!myapp.load(QString("mypasswordsafe_") + codec->name(),
		 locale_dir)) {
#ifdef DEBUG
    cout << "No locale file for " << (const char *)codec->name()
	 << " found in " << locale_dir << endl;
#endif
  }
  else {
    a.installTranslator(&myapp);
  }

  if(myps.firstTime()) {
    myps.helpAbout(1); // show license
  }

  if(!doStartupDialog(&myps, argc, argv)) {
    return 0;
  }

  myps.show();
  //a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
  a.connect(&myps, SIGNAL(quit()), &a, SLOT(quit()));
  return a.exec();
}
void TMailMessage::init(const QByteArray &encoding)
{
    QTextCodec *codec = QTextCodec::codecForName(encoding);
    textCodec = (codec) ? codec : QTextCodec::codecForName("UTF-8");
    // Sets default values
    setCurrentDate();
    QByteArray type = DEFAULT_CONTENT_TYPE;
    type += "; charset=\"";
    type += codec->name();
    type += '\"';
    setContentType(type);
}
Example #21
0
void TextCodecQt::registerCodecs(TextCodecRegistrar registrar)
{
    QList<int> mibs = QTextCodec::availableMibs();
//     qDebug() << ">>>>>>>>> registerCodecs";

    for (int i = 0; i < mibs.size(); ++i) {
        QTextCodec *c = QTextCodec::codecForMib(mibs.at(i));
        const char *name = getAtomicName(c->name());
//         qDebug() << "    " << name;
        registrar(name, newTextCodecQt, 0);
    }
}
Example #22
0
QString Util::convertEncoding(const QByteArray &data)
{
    QTextCodec * codec = detectEncoding( data );

    if ( !codec )
    {
        qDebug("Util: failed to detect the data encoding");
        return "";
    }

    qDebug("Util: automatically detected encoding %s", codec->name().constData() );
    return codec->toUnicode( data );
}
Example #23
0
void PreviewForm::updateTextEdit()
{
    int mib = encodingComboBox->itemData(
                      encodingComboBox->currentIndex()).toInt();
    QTextCodec *codec = QTextCodec::codecForMib(mib);
    qDebug () << " PreviewForm::updateTextEdit() " << codec->name();
    QTextStream in(&encodedData);
    in.setAutoDetectUnicode(false);
    in.setCodec(codec);
    decodedStr = in.readAll();

    textEdit->setPlainText(decodedStr);
}
Example #24
0
void MainWindow::actionCharacterEncoding(QAction *action)
{
	QString encoding;

	if (action && action->data().toInt() > 0)
	{
		QTextCodec *codec = QTextCodec::codecForMib(action->data().toInt());

		if (codec)
		{
			encoding = codec->name();
		}
	}

	m_windowsManager->setDefaultCharacterEncoding(encoding.toLower());
}
Example #25
0
QTextCodec *LyricsParser::detectEncoding(const QByteArray &data, LyricsLoader::Properties &properties )
{
    // Now detect encoding
    QTextCodec * enc = 0;

    //qDebug("Supplied text: %s", data.constData() );

    if ( m_callback )
        enc = m_callback->detectTextCodec(data);

    if ( !enc )
        enc = QTextCodec::codecForName( "utf-8" );
    else
        properties[ LyricsLoader::PROP_DETECTED_ENCODING ] = enc->name();

    return enc;
}
Example #26
0
void TextCodecQt::registerEncodingNames(EncodingNameRegistrar registrar)
{
    QList<int> mibs = QTextCodec::availableMibs();
//     qDebug() << ">>>>>>>>> registerEncodingNames";

    for (int i = 0; i < mibs.size(); ++i) {
        QTextCodec *c = QTextCodec::codecForMib(mibs.at(i));
        const char *name = getAtomicName(c->name());
        registrar(name, name);
//         qDebug() << "    " << name << name;
        QList<QByteArray> aliases = c->aliases();
        for (int i = 0; i < aliases.size(); ++i) {
            const char *a = getAtomicName(aliases.at(i));
//             qDebug() << "     (a) " << a << name;
            registrar(a, name);
        }
    }
}
Example #27
0
/*!
    Searches all installed QTextCodec objects and returns the one
    which best matches \a name; the match is case-insensitive. Returns
    0 if no codec matching the name \a name could be found.
*/
QTextCodec *QTextCodec::codecForName(const QByteArray &name)
{
    if (name.isEmpty())
        return 0;

    setup();

    for (int i = 0; i < all->size(); ++i) {
        QTextCodec *cursor = all->at(i);
        if (nameMatch(cursor->name(), name))
            return cursor;
        QList<QByteArray> aliases = cursor->aliases();
        for (int i = 0; i < aliases.size(); ++i)
            if (nameMatch(aliases.at(i), name))
                return cursor;
    }

    return createForName(name);
}
Example #28
0
/*!
    \threadsafe
    Searches all installed QTextCodec objects and returns the one
    which best matches \a name; the match is case-insensitive. Returns
    0 if no codec matching the name \a name could be found.
*/
QTextCodec *QTextCodec::codecForName(const QByteArray &name)
{
    if (name.isEmpty())
        return 0;

    QMutexLocker locker(textCodecsMutex());

    QCoreGlobalData *globalData = QCoreGlobalData::instance();
    if (!globalData)
        return 0;
    setup();

#ifndef QT_USE_ICU
    QTextCodecCache *cache = &globalData->codecCache;
    QTextCodec *codec;
    if (cache) {
        codec = cache->value(name);
        if (codec)
            return codec;
    }

    for (TextCodecListConstIt it = globalData->allCodecs.constBegin(), cend = globalData->allCodecs.constEnd(); it != cend; ++it) {
        QTextCodec *cursor = *it;
        if (qTextCodecNameMatch(cursor->name(), name)) {
            if (cache)
                cache->insert(name, cursor);
            return cursor;
        }
        QList<QByteArray> aliases = cursor->aliases();
        for (ByteArrayListConstIt ait = aliases.constBegin(), acend = aliases.constEnd(); ait != acend; ++ait) {
            if (qTextCodecNameMatch(*ait, name)) {
                if (cache)
                    cache->insert(name, cursor);
                return cursor;
            }
        }
    }

    return 0;
#else
    return QIcuCodec::codecForNameUnlocked(name);
#endif
}
Example #29
0
QTextCodec* QTextCodec::codecForName(const char *name)
{
    if (name == 0 || *name == 0)
        return 0;

    setup();

    for (std::vector<QTextCodec*>::iterator i = all->begin(); i != all->end(); i++) {
        QTextCodec *cursor = *i;
        if (nameMatch(cursor->name(), name))
            return cursor;
        const Aliase* aliases = cursor->aliases();
        for (int i = 0; aliases[i]; ++i)
            if (nameMatch(aliases[i], name))
                return cursor;
    }

    return 0;
}
Example #30
0
/*!
    \threadsafe
    Searches all installed QTextCodec objects and returns the one
    which best matches \a name; the match is case-insensitive. Returns
    0 if no codec matching the name \a name could be found.
*/
QTextCodec *QTextCodec::codecForName(const QByteArray &name)
{
    if (name.isEmpty())
        return 0;

    QMutexLocker locker(textCodecsMutex());

    QCoreGlobalData *globalData = QCoreGlobalData::instance();
    if (!globalData)
        return 0;
        setup();

#ifndef QT_USE_ICU
    QTextCodecCache *cache = &globalData->codecCache;
    QTextCodec *codec;
    if (cache) {
        codec = cache->value(name);
        if (codec)
            return codec;
    }

    for (int i = 0; i < globalData->allCodecs.size(); ++i) {
        QTextCodec *cursor = globalData->allCodecs.at(i);
        if (qTextCodecNameMatch(cursor->name(), name)) {
            if (cache)
                cache->insert(name, cursor);
            return cursor;
        }
        QList<QByteArray> aliases = cursor->aliases();
        for (int y = 0; y < aliases.size(); ++y)
            if (qTextCodecNameMatch(aliases.at(y), name)) {
                if (cache)
                    cache->insert(name, cursor);
                return cursor;
            }
    }

    return 0;
#else
    return QIcuCodec::codecForNameUnlocked(name);
#endif
}