2023-01-15 13:26:14 +01:00
|
|
|
#include "mainwindow.h"
|
2023-01-07 12:44:45 +01:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
#define READ 0
|
|
|
|
#define WRITE 1
|
|
|
|
|
2023-02-10 21:32:20 +01:00
|
|
|
extern QMap<int, QString> rsyncErrorStrings;
|
2023-03-09 18:13:46 +01:00
|
|
|
extern QApplication a;
|
2023-02-10 21:32:20 +01:00
|
|
|
|
2023-02-10 23:27:44 +01:00
|
|
|
// test return code of rsync
|
2023-03-08 16:03:24 +01:00
|
|
|
// return true in case of error
|
2023-02-27 23:48:05 +01:00
|
|
|
bool testRsyncReturn(MainWindow * w, QProcess * myProcess)
|
2023-01-07 12:44:45 +01:00
|
|
|
{
|
2023-03-11 13:53:05 +01:00
|
|
|
if (myProcess->exitStatus() != 0 and w->stopDlAsked != true)
|
2023-01-07 12:44:45 +01:00
|
|
|
{
|
2023-04-27 11:42:53 +02:00
|
|
|
cout << "rsync error: " << myProcess->error() << " : " << myProcess->errorString().toStdString() << endl;
|
2023-01-18 23:12:21 +01:00
|
|
|
QMessageBox::warning(
|
2023-03-08 16:03:24 +01:00
|
|
|
w,
|
2023-03-09 18:13:46 +01:00
|
|
|
a.applicationName(),
|
2023-02-10 21:32:20 +01:00
|
|
|
myProcess->errorString(),
|
|
|
|
QMessageBox::Ok,
|
|
|
|
QMessageBox::Ok);
|
|
|
|
return true;
|
2023-01-07 12:44:45 +01:00
|
|
|
}
|
2023-03-11 13:53:05 +01:00
|
|
|
w->stopDlAsked = false;
|
2023-02-10 21:32:20 +01:00
|
|
|
return false;
|
2023-01-07 12:44:45 +01:00
|
|
|
}
|
2023-02-27 23:48:05 +01:00
|
|
|
|
2023-03-04 19:12:13 +01:00
|
|
|
QString getFileType(QString filename)
|
|
|
|
{
|
|
|
|
QMimeDatabase db;
|
|
|
|
QMimeType mime = db.mimeTypeForFile(filename);
|
2023-03-05 13:38:28 +01:00
|
|
|
QString returnValue = mime.name().section('/',0 ,0);
|
2023-03-04 19:12:13 +01:00
|
|
|
return returnValue;
|
|
|
|
}
|
2023-03-08 16:03:24 +01:00
|
|
|
|