1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

FileTransferWidget: use baseName instead of completeBaseName + tweaked

autoAccept
This commit is contained in:
krepa098 2015-01-12 16:03:47 +01:00
parent 62b4b83106
commit 29fc6ab03f

View File

@ -74,7 +74,7 @@ void FileTransferWidget::autoAcceptTransfer(const QString &path)
int number = 0; int number = 0;
QString suffix = QFileInfo(fileInfo.fileName).completeSuffix(); QString suffix = QFileInfo(fileInfo.fileName).completeSuffix();
QString base = QFileInfo(fileInfo.fileName).completeBaseName(); QString base = QFileInfo(fileInfo.fileName).baseName();
do do
{ {
@ -83,16 +83,12 @@ void FileTransferWidget::autoAcceptTransfer(const QString &path)
} }
while(QFileInfo(filepath).exists()); while(QFileInfo(filepath).exists());
if(!isFilePathWritable(filepath)) //Do not automatically accept the file-transfer if the path is not writable.
{ //The user can still accept it manually.
QMessageBox::warning(0, if(isFilePathWritable(filepath))
tr("Location not writable","Title of permissions popup"),
tr("You do not have permission to write that location. Choose another, or cancel the save dialog.", "text of permissions popup"));
return;
}
//everything ok!
Core::getInstance()->acceptFileRecvRequest(fileInfo.friendId, fileInfo.fileNum, filepath); Core::getInstance()->acceptFileRecvRequest(fileInfo.friendId, fileInfo.fileNum, filepath);
else
qDebug() << "Warning: Cannot write to " << filepath;
} }
void FileTransferWidget::acceptTransfer(const QString &filepath) void FileTransferWidget::acceptTransfer(const QString &filepath)