[dolphin] Don't rely on QByteArray -> const char * implicit conversion

Signed-off-by: Kevin Ottens <ervin@kde.org>
This commit is contained in:
Kevin Ottens 2023-12-27 19:08:36 +01:00
parent ea101adbf4
commit 17b913c3a7
2 changed files with 6 additions and 6 deletions

View file

@ -77,12 +77,12 @@ public:
action->setDisabled(true); action->setDisabled(true);
auto call = args.value(1).toLatin1(); auto call = args.value(1).toLatin1();
connect(action, &QAction::triggered, [helper, call, files] { connect(action, &QAction::triggered, [helper, call, files] {
helper->sendCommand(QByteArray(call + ":" + files + "\n")); helper->sendCommand(QByteArray(call + ":" + files + "\n").constData());
}); });
} }
}); });
QTimer::singleShot(100, &loop, &QEventLoop::quit); // add a timeout to be sure we don't freeze dolphin QTimer::singleShot(100, &loop, &QEventLoop::quit); // add a timeout to be sure we don't freeze dolphin
helper->sendCommand(QByteArray("GET_MENU_ITEMS:" + files + "\n")); helper->sendCommand(QByteArray("GET_MENU_ITEMS:" + files + "\n").constData());
loop.exec(QEventLoop::ExcludeUserInputEvents); loop.exec(QEventLoop::ExcludeUserInputEvents);
disconnect(con); disconnect(con);
if (menu->actions().isEmpty()) { if (menu->actions().isEmpty()) {
@ -111,20 +111,20 @@ public:
auto shareAction = menu->addAction(helper->shareActionTitle()); auto shareAction = menu->addAction(helper->shareActionTitle());
connect(shareAction, &QAction::triggered, this, [localFile, helper] { connect(shareAction, &QAction::triggered, this, [localFile, helper] {
helper->sendCommand(QByteArray("SHARE:" + localFile.toUtf8() + "\n")); helper->sendCommand(QByteArray("SHARE:" + localFile.toUtf8() + "\n").constData());
}); });
if (!helper->copyPrivateLinkTitle().isEmpty()) { if (!helper->copyPrivateLinkTitle().isEmpty()) {
auto copyPrivateLinkAction = menu->addAction(helper->copyPrivateLinkTitle()); auto copyPrivateLinkAction = menu->addAction(helper->copyPrivateLinkTitle());
connect(copyPrivateLinkAction, &QAction::triggered, this, [localFile, helper] { connect(copyPrivateLinkAction, &QAction::triggered, this, [localFile, helper] {
helper->sendCommand(QByteArray("COPY_PRIVATE_LINK:" + localFile.toUtf8() + "\n")); helper->sendCommand(QByteArray("COPY_PRIVATE_LINK:" + localFile.toUtf8() + "\n").constData());
}); });
} }
if (!helper->emailPrivateLinkTitle().isEmpty()) { if (!helper->emailPrivateLinkTitle().isEmpty()) {
auto emailPrivateLinkAction = menu->addAction(helper->emailPrivateLinkTitle()); auto emailPrivateLinkAction = menu->addAction(helper->emailPrivateLinkTitle());
connect(emailPrivateLinkAction, &QAction::triggered, this, [localFile, helper] { connect(emailPrivateLinkAction, &QAction::triggered, this, [localFile, helper] {
helper->sendCommand(QByteArray("EMAIL_PRIVATE_LINK:" + localFile.toUtf8() + "\n")); helper->sendCommand(QByteArray("EMAIL_PRIVATE_LINK:" + localFile.toUtf8() + "\n").constData());
}); });
} }
return { menuaction }; return { menuaction };

View file

@ -50,7 +50,7 @@ public:
QDir localPath(url.toLocalFile()); QDir localPath(url.toLocalFile());
const QByteArray localFile = localPath.canonicalPath().toUtf8(); const QByteArray localFile = localPath.canonicalPath().toUtf8();
helper->sendCommand(QByteArray("RETRIEVE_FILE_STATUS:" + localFile + "\n")); helper->sendCommand(QByteArray("RETRIEVE_FILE_STATUS:" + localFile + "\n").constData());
StatusMap::iterator it = m_status.find(localFile); StatusMap::iterator it = m_status.find(localFile);
if (it != m_status.constEnd()) { if (it != m_status.constEnd()) {