void SunBak::onBackup()
{
while (it != FBak.end())
{
// Grab file
tr("%1") .arg(filename));
{
QMessageBox::information(this, tr
("Unable to open file"),
file.
errorString());
return;
}
data = file.readAll();
if (data.
isEmpty()){ QMessageBox::warning(this, tr
("Not reading data!"), tr
("What the hell?"));
} file.close();
filename = it->getFile();
QMessageBox::information(this, tr
("Test:"), tr
("%1") .
arg(filename
));
QFile fileSave
(filename
);
//file.open(QIODevice::WriteOnly);
{
QMessageBox::information(this, tr
("Unable to open file"), fileSave.
errorString());
// return;
}
if (fileSave.write(data) == -1)
{
QMessageBox::critical(this, tr
("Error!"), tr
("File %1 not written!") .
arg(filename
));
}
it++;
}
}
void SunBak::onBackup()
{
while (it != FBak.end())
{
// Grab file
QByteArray data;
QString filename = it->FullPath();
QMessageBox::information(this, tr("Backing up file."),
tr("%1") .arg(filename));
QFile file(filename);
if (!file.open(QIODevice::ReadOnly))
{
QMessageBox::information(this, tr("Unable to open file"), file.errorString());
return;
}
data = file.readAll();
if (data.isEmpty()){ QMessageBox::warning(this, tr("Not reading data!"), tr("What the hell?")); }
file.close();
filename = it->getFile();
QMessageBox::information(this, tr("Test:"), tr("%1") .arg(filename));
QFile fileSave(filename);
//file.open(QIODevice::WriteOnly);
if (!fileSave.open(QIODevice::WriteOnly))
{
QMessageBox::information(this, tr("Unable to open file"), fileSave.errorString());
// return;
}
if (fileSave.write(data) == -1)
{
QMessageBox::critical(this, tr("Error!"), tr("File %1 not written!") .arg(filename));
}
it++;
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks