Fixing gui
[mnenc] / unlock / unlock.cpp
index b918e15..21f841a 100644 (file)
@@ -19,7 +19,9 @@
 
 
 #include "unlock.hpp"
-
+#include <string>
+#include <iostream>
+#include <fstream>
 unlock::unlock(QWidget *parent) : QMainWindow(parent)
 {
        ui.setupUi( this );
@@ -29,7 +31,22 @@ unlock::unlock(QWidget *parent) : QMainWindow(parent)
 void unlock::Close()
 {
 // can also add any extra closedown code here before we actually do close the GUI
+       std::string message = "0_Unlock|" + this->ui.lineEdit->text().toStdString();
+       std::ofstream os("/tmp/mnencdfifo");
+       os << message;
+       os.close();
 
+       std::string line;
+       std::ifstream reply("/tmp/mnencdfifo");
+       if (reply.is_open())
+       {
+               while (! reply.eof() )
+               {
+                       getline (reply,line);
+                       std::cout << line << std::endl;
+               }
+               reply.close();
+       }
 
 // now close for real
        close();