Example #1
0
int CManageFileTransfer::SaveAs(QSharedPointer<CFileTransfer> file)
{
    int nRet = 0;
    QString szFile;
    QString szDir = CGlobalDir::Instance()->GetDirReceiveFile()
                         + QDir::separator() + file->GetFile();

    szFile = CTool::FileDialog(NULL, szDir, QString(), tr("Save as"), QFileDialog::AcceptSave);
    if(szFile.isEmpty())
        return -1;
    QFile f(szFile);
    if(f.exists())
    {
        if(QMessageBox::No ==
                QMessageBox::warning(NULL, tr("Save as"), 
                                     tr("File is exists. Do you save it?"),
                                     QMessageBox::Ok, 
                                     QMessageBox::No))
        {
            return 0;
        }
    }
    nRet = file->Accept(szFile);
    return nRet;
}
Example #2
0
int CManageFileTransfer::Accept(QSharedPointer<CFileTransfer> file)
{
    int nRet = 0;
    QString szTmp = CGlobalDir::Instance()->GetDirReceiveFile()//QStandardPaths::writableLocation(QStandardPaths::TempLocation) 
            + QDir::separator() 
            + file->GetFile();
    nRet = file->Accept(szTmp);
    return nRet;
}