When copying a file path from the result list to the clipboard, replace the implicit conversion from latin1 with fromLocal8Bit(), which is not guaranteed to make sense but will probably work in more cases
This commit is contained in:
parent
51b171d0e7
commit
825c9d9cf7
@ -708,11 +708,17 @@ void ResList::menuCopyFN()
|
||||
Rcl::Doc doc;
|
||||
if (getDoc(m_popDoc, doc)) {
|
||||
LOGDEB(("menuCopyFN: Got doc, fn: [%s]\n", doc.url.c_str()));
|
||||
// Our urls currently always begin with "file://"
|
||||
QApplication::clipboard()->setText(doc.url.c_str()+7,
|
||||
QClipboard::Selection);
|
||||
QApplication::clipboard()->setText(doc.url.c_str()+7,
|
||||
QClipboard::Clipboard);
|
||||
// Our urls currently always begin with "file://"
|
||||
//
|
||||
// Problem: setText expects a QString. Passing a (const char*)
|
||||
// as we used to do causes an implicit conversion from
|
||||
// latin1. File are binary and the right approach would be no
|
||||
// conversion, but it's probably better (less worse...) to
|
||||
// make a "best effort" tentative and try to convert from the
|
||||
// locale's charset than accept the default conversion.
|
||||
QString qfn = QString::fromLocal8Bit(doc.url.c_str()+7);
|
||||
QApplication::clipboard()->setText(qfn, QClipboard::Selection);
|
||||
QApplication::clipboard()->setText(qfn, QClipboard::Clipboard);
|
||||
}
|
||||
}
|
||||
void ResList::menuCopyURL()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user