diff --git a/kdecore/compression/kcompressor.cpp b/kdecore/compression/kcompressor.cpp index f7900871..6e40ac6c 100644 --- a/kdecore/compression/kcompressor.cpp +++ b/kdecore/compression/kcompressor.cpp @@ -71,9 +71,23 @@ KCompressor::KCompressorType KCompressor::type() const bool KCompressor::setType(const KCompressorType type) { + d->m_errorstring.clear(); if (type == KCompressor::TypeUnknown) { + d->m_errorstring = i18n("Invalid type: %1", int(type)); return false; } +#if !defined(HAVE_BZIP2_SUPPORT) + if (type == KCompressor::TypeBZip2) { + d->m_errorstring = i18n("Unsupported type: %1", int(type)); + return false; + } +#endif +#if !defined(HAVE_XZ_SUPPORT) + if (type == KCompressor::TypeXZ) { + d->m_errorstring = i18n("Unsupported type: %1", int(type)); + return false; + } +#endif d->m_type = type; return true; } @@ -254,7 +268,7 @@ bool KCompressor::process(const QByteArray &data) } #endif // HAVE_XZ_SUPPORT default: { - kWarning() << "Unsupported type" << d->m_type; + d->m_errorstring = i18n("Unsupported type: %1", int(d->m_type)); return false; } } diff --git a/kdecore/compression/kdecompressor.cpp b/kdecore/compression/kdecompressor.cpp index 12491ba9..698a4c0a 100644 --- a/kdecore/compression/kdecompressor.cpp +++ b/kdecore/compression/kdecompressor.cpp @@ -70,9 +70,23 @@ KDecompressor::KDecompressorType KDecompressor::type() const bool KDecompressor::setType(const KDecompressorType type) { + d->m_errorstring.clear(); if (type == KDecompressor::TypeUnknown) { + d->m_errorstring = i18n("Invalid type: %1", int(type)); return false; } +#if !defined(HAVE_BZIP2_SUPPORT) + if (type == KCompressor::TypeBZip2) { + d->m_errorstring = i18n("Unsupported type: %1", int(type)); + return false; + } +#endif +#if !defined(HAVE_XZ_SUPPORT) + if (type == KCompressor::TypeXZ) { + d->m_errorstring = i18n("Unsupported type: %1", int(type)); + return false; + } +#endif d->m_type = type; return true; } @@ -280,7 +294,7 @@ bool KDecompressor::process(const QByteArray &data) } #endif // HAVE_XZ_SUPPORT default: { - kWarning() << "Unsupported type" << d->m_type; + d->m_errorstring = i18n("Unsupported type: %1", int(d->m_type)); return false; } }