|
@@ -21,6 +21,7 @@ using namespace std;
|
|
|
int inpipefd[2];
|
|
|
int outpipefd[2];
|
|
|
char buf[1024];
|
|
|
+QUrl sendFileUrl = QUrl("");
|
|
|
|
|
|
bool programActive = true;
|
|
|
|
|
@@ -90,13 +91,22 @@ QMLHandler::QMLHandler(QObject *parent) : QObject(parent) {}
|
|
|
|
|
|
// Sending
|
|
|
void QMLHandler::onSendingSelectFileButton(QUrl url) {
|
|
|
- emit log("File Selected: " + url.toString());
|
|
|
- emit sendingSetFileUrlText("Selected File: " + url.toString());
|
|
|
+ sendFileUrl = url.toLocalFile();
|
|
|
+ emit log("File Selected: " + sendFileUrl.toString());
|
|
|
+ emit sendingSetFileUrlText("Selected File: " + sendFileUrl.toString());
|
|
|
+ emit sendingEnableSendButton();
|
|
|
}
|
|
|
|
|
|
-void QMLHandler::onSendingSendFileButton() { emit log("Sending File !"); }
|
|
|
+void QMLHandler::onSendingSendFileButton() {
|
|
|
+ QString command = "put " + sendFileUrl.toString() + "\n";
|
|
|
+ write(outpipefd[1], command.toUtf8().constData(), strlen(command.toUtf8().constData()));
|
|
|
+}
|
|
|
|
|
|
// Receiving
|
|
|
+void QMLHandler::onReceivingGetFileButton(QString fileName) {
|
|
|
+ QString command = "get " + fileName + "\n";
|
|
|
+ write(outpipefd[1], command.toUtf8().constData(), strlen(command.toUtf8().constData()));
|
|
|
+}
|
|
|
|
|
|
// Messages
|
|
|
void QMLHandler::onMessagesSendButton(QString msg) { emit message(msg); }
|