Remove QTextCodec usage
We are converting a base64 string here, no reason so convert that with CP1251 specifically.
This commit is contained in:
parent
5aed795363
commit
812db0ccde
3 changed files with 1 additions and 11 deletions
|
@ -20,5 +20,4 @@ target_link_libraries(kdeconnect_sms
|
||||||
KF6::I18n
|
KF6::I18n
|
||||||
KF6::Notifications
|
KF6::Notifications
|
||||||
Qt::Widgets
|
Qt::Widgets
|
||||||
Qt::Core5Compat # for QTextCodec
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QMimeDatabase>
|
#include <QMimeDatabase>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QTextCodec>
|
|
||||||
|
|
||||||
#include <core/daemon.h>
|
#include <core/daemon.h>
|
||||||
#include <core/device.h>
|
#include <core/device.h>
|
||||||
|
@ -31,7 +30,6 @@ SmsPlugin::SmsPlugin(QObject *parent, const QVariantList &args)
|
||||||
, m_telepathyInterface(QStringLiteral("org.freedesktop.Telepathy.ConnectionManager.kdeconnect"), QStringLiteral("/kdeconnect"))
|
, m_telepathyInterface(QStringLiteral("org.freedesktop.Telepathy.ConnectionManager.kdeconnect"), QStringLiteral("/kdeconnect"))
|
||||||
, m_conversationInterface(new ConversationsDbusInterface(this))
|
, m_conversationInterface(new ConversationsDbusInterface(this))
|
||||||
{
|
{
|
||||||
m_codec = QTextCodec::codecForName(CODEC_NAME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SmsPlugin::~SmsPlugin()
|
SmsPlugin::~SmsPlugin()
|
||||||
|
@ -217,11 +215,9 @@ Attachment SmsPlugin::createAttachmentFromUrl(const QString &url)
|
||||||
QFileInfo fileInfo(file);
|
QFileInfo fileInfo(file);
|
||||||
QString fileName(fileInfo.fileName());
|
QString fileName(fileInfo.fileName());
|
||||||
|
|
||||||
QByteArray byteArray = file.readAll().toBase64();
|
QString base64EncodedFile = QString::fromLatin1(file.readAll().toBase64());
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
QString base64EncodedFile = m_codec->toUnicode(byteArray);
|
|
||||||
|
|
||||||
QMimeDatabase mimeDatabase;
|
QMimeDatabase mimeDatabase;
|
||||||
QString mimeType = mimeDatabase.mimeTypeForFile(url).name();
|
QString mimeType = mimeDatabase.mimeTypeForFile(url).name();
|
||||||
|
|
||||||
|
|
|
@ -133,10 +133,6 @@
|
||||||
|
|
||||||
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_SMS)
|
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_SMS)
|
||||||
|
|
||||||
#define CODEC_NAME "CP1251"
|
|
||||||
|
|
||||||
class QTextCodec;
|
|
||||||
|
|
||||||
class SmsPlugin : public KdeConnectPlugin
|
class SmsPlugin : public KdeConnectPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -203,5 +199,4 @@ private:
|
||||||
|
|
||||||
QDBusInterface m_telepathyInterface;
|
QDBusInterface m_telepathyInterface;
|
||||||
ConversationsDbusInterface *m_conversationInterface;
|
ConversationsDbusInterface *m_conversationInterface;
|
||||||
QTextCodec *m_codec;
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue