void FileTransferInstance::acceptRecvRequest()
{
    QString path;
    while (true)
    {
        path = QFileDialog::getSaveFileName(0, tr("Save a file","Title of the file saving dialog"), QDir::home().filePath(filename));
        if (path.isEmpty())
            return;
        else
        {
            //bool savable = QFileInfo(path).isWritable();
            //qDebug() << path << " is writable: " << savable;
            //qDebug() << "/home/bill/bliss.pdf writable: " << QFileInfo("/home/bill/bliss.pdf").isWritable();
            if (isFileWritable(path))
                break;
            else
                QMessageBox::warning(0, 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"));
        }
    }

    savePath = path;

    Core::getInstance()->acceptFileRecvRequest(friendId, fileNum, path);
    state = tsProcessing;

    startTime = QDateTime::currentDateTime();

    emit stateUpdated();
}
void FileTransferInstance::acceptRecvRequest()
{
    QString path = Settings::getInstance().getAutoAcceptDir(Core::getInstance()->getFriendAddress(friendId));
    if (path.isEmpty()) path = Settings::getInstance().getGlobalAutoAcceptDir();
    if (!path.isEmpty())
    {
        QDir dir(path);
        path = dir.filePath(filename);
        QFileInfo info(path);
        if (info.exists()) // emulate chrome
        {
            QString name = info.baseName(), ext = info.completeSuffix();
            int i = 0;
            do
            {
                path = dir.filePath(name + QString(" (%1)").arg(++i) + "." + ext);
            }
            while (QFileInfo(path).exists());
        }
        qDebug() << "File: auto saving to" << path;
    }
    else
    {
        while (true)
        {
            path = QFileDialog::getSaveFileName(0, tr("Save a file","Title of the file saving dialog"), QDir::home().filePath(filename));
            if (path.isEmpty())
                return;
            else
            {
                if (isFileWritable(path))
                    break;
                else
                    QMessageBox::warning(0, 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"));
            }
        }
    }

    savePath = path;

    Core::getInstance()->acceptFileRecvRequest(friendId, fileNum, path);
    state = tsProcessing;

    effStartTime = QDateTime::currentDateTime();

    emit stateUpdated();
}