CLI Improvements

* Fix #6001 - only use `--notes` in Add/Edit commands to prevent clash with password generator option `-n`.

* Fix #6119 - Send Unicode to clip command; Windows only understands UTF-16 encoding.

* Fix #6128 - `clip` command will default to clearing the clipboard after 10 seconds. To disable clearing set timeout to 0.
This commit is contained in:
Jonathan White committed 2021-04-25 07:38:21 -04:00
1 parent be3e77d721
commit 8a7be101e4
6 files changed
+52 -47

No files matched your search

+8 -1
View File
@@ -308,7 +308,14 @@ namespace Utils
continue;
}
if (clipProcess->write(text.toLatin1()) == -1) {
#ifdef Q_OS_WIN
// Windows clip command only understands Unicode written as UTF-16
auto data = QByteArray::fromRawData(reinterpret_cast<const char*>(text.utf16()), text.size() * 2);
if (clipProcess->write(data) == -1) {
#else
// Other platforms understand UTF-8
if (clipProcess->write(text.toUtf8()) == -1) {
#endif
qDebug("Unable to write to process : %s", qPrintable(clipProcess->errorString()));
}
clipProcess->waitForBytesWritten();