Commit 571566bd authored by Andreas Traczyk's avatar Andreas Traczyk
Browse files

datatransfer: remove file name manipulation

Change-Id: I26decea445353a2bf1afc7dce456c33dd41d7b27
parent 36e9b93a
...@@ -579,26 +579,8 @@ PrivateBridging::acceptFile(const QString& arg) ...@@ -579,26 +579,8 @@ PrivateBridging::acceptFile(const QString& arg)
{ {
try { try {
auto interactionUid = arg.toLongLong(); auto interactionUid = arg.toLongLong();
lrc::api::datatransfer::Info info = {};
auto convUid = LRCInstance::getCurrentConvUid(); auto convUid = LRCInstance::getCurrentConvUid();
LRCInstance::getCurrentConversationModel()->getTransferInfo(interactionUid, info); LRCInstance::getCurrentConversationModel()->acceptTransfer(convUid, interactionUid);
// get full path
QString filename = LRCInstance::dataTransferModel().downloadDirectory;
if (!filename.isEmpty() && filename.right(1) != '/')
filename += "/";
auto wantedFilename = filename + info.displayName;
auto duplicate = 0;
while (QFile(wantedFilename).exists()) {
++duplicate;
auto splittedList = info.displayName.split(".");
if (splittedList.size() == 1)
wantedFilename = filename + info.displayName + " (" + QString::number(duplicate) + ")";
else
wantedFilename = filename + splittedList[0] + " (" + QString::number(duplicate) + ")" + "." +splittedList[1];
}
LRCInstance::getCurrentConversationModel()->acceptTransfer(convUid, interactionUid, wantedFilename);
} catch (...) { } catch (...) {
qDebug() << "JS bridging - exception during acceptFile: " << arg; qDebug() << "JS bridging - exception during acceptFile: " << arg;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment