1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-15 20:35:17 +03:00

Re #1567: introduced unlink() function that takes QString parameter

This commit is contained in:
Damjan Adamic 2014-08-03 18:03:13 +02:00
parent c0e612531d
commit 4103adf75d
7 changed files with 19 additions and 19 deletions

View file

@ -376,7 +376,7 @@ void burnConfigDialog::restFuses(bool eeProtect)
lfuses="lfuse:w:0x3F:m"; lfuses="lfuse:w:0x3F:m";
} }
file.close(); file.close();
unlink(tempFile.toAscii()); unlink(tempFile);
} }
else { else {
lfuses="lfuse:w:0x3F:m"; lfuses="lfuse:w:0x3F:m";

View file

@ -156,12 +156,8 @@ void CompareDialog::dropEvent(QDropEvent *event)
void CompareDialog::closeEvent(QCloseEvent *event) void CompareDialog::closeEvent(QCloseEvent *event)
{ {
QByteArray ba = curvefile5.toLatin1(); unlink(curvefile5);
char *name = ba.data(); unlink(curvefile9);
unlink(name);
ba = curvefile9.toLatin1();
name = ba.data();
unlink(name);
} }
CompareDialog::~CompareDialog() CompareDialog::~CompareDialog()

View file

@ -964,3 +964,10 @@ QString index2version(int index)
return QString(); return QString();
} }
} }
int unlink(const QString & fileName)
{
QByteArray ba = fileName.toLatin1();
return unlink(ba.constData());
}

View file

@ -139,4 +139,7 @@ class QTimeS : public QTime
int seconds() const { return hour()*3600 + minute()*60 + second(); }; int seconds() const { return hour()*3600 + minute()*60 + second(); };
}; };
int unlink(const QString & fileName);
#endif // HELPERS_H #endif // HELPERS_H

View file

@ -806,7 +806,7 @@ QStringList MainWindow::GetSambaArguments(const QString &tcl)
QString tclFilename = QDir::tempPath() + "/temp.tcl"; QString tclFilename = QDir::tempPath() + "/temp.tcl";
if (QFile::exists(tclFilename)) { if (QFile::exists(tclFilename)) {
unlink(tclFilename.toAscii()); unlink(tclFilename);
} }
QFile tclFile(tclFilename); QFile tclFile(tclFilename);
if (!tclFile.open(QIODevice::WriteOnly | QIODevice::Text)) { if (!tclFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
@ -963,7 +963,7 @@ void MainWindow::readEeprom()
child->newFile(); child->newFile();
child->loadFile(tempFile, false); child->loadFile(tempFile, false);
child->show(); child->show();
unlink(tempFile.toAscii()); unlink(tempFile);
} }
} }
@ -1194,7 +1194,7 @@ void MainWindow::writeBackup()
} }
fileName = restoreFile; fileName = restoreFile;
} }
unlink(tempFlash.toAscii()); unlink(tempFlash);
} }
else { else {
if (backupEnable) { if (backupEnable) {

View file

@ -571,9 +571,7 @@ void MdiChild::writeEeprom() // write to Tx
} }
tempFile=restoreFile; tempFile=restoreFile;
} }
QByteArray ba = tempFlash.toLatin1(); unlink(tempFlash);
char *name = ba.data();
unlink(name);
} }
else { else {
if (backupEnable) { if (backupEnable) {

View file

@ -61,12 +61,8 @@ PrintDialog::PrintDialog(QWidget *parent, FirmwareInterface * firmware, GeneralS
void PrintDialog::closeEvent(QCloseEvent *event) void PrintDialog::closeEvent(QCloseEvent *event)
{ {
if (printfilename.isEmpty()) { if (printfilename.isEmpty()) {
QByteArray ba = curvefile5.toLatin1(); unlink(curvefile5);
char *name = ba.data(); unlink(curvefile9);
unlink(name);
ba = curvefile9.toLatin1();
name = ba.data();
unlink(name);
} }
} }