From 3c330186b1c9b8e6f58e29739918bf2b8a5f4f68 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Wed, 23 Mar 2011 12:15:24 +0100 Subject: trigger file path definable --- fbgui.conf | 1 + src/downloadmanager.cpp | 2 -- src/fbgui.cpp | 13 ++++++++++--- src/fbgui.h | 2 +- src/javascriptinterface.cpp | 1 + src/main.cpp | 1 + 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/fbgui.conf b/fbgui.conf index c903615..a1717be 100644 --- a/fbgui.conf +++ b/fbgui.conf @@ -2,3 +2,4 @@ pbs_url=http://132.230.4.27 download_directory=/tmp/fbgui update_interval=5 +file_trigger=/tmp/trigger_fbgui diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp index 0cd7c80..ab1b0ad 100644 --- a/src/downloadmanager.cpp +++ b/src/downloadmanager.cpp @@ -193,11 +193,9 @@ void DownloadManager::downloadFinished() // ---------------------------------------------------------------------------------------- void DownloadManager::completeKCL(){ // check if current download is kcl - if (outfile.fileName() == downloadDir.absoluteFilePath("kcl")){ qxtLog->debug() << "Completing kernel command line ..."; outfile.write(" session=" + sessionID.toUtf8()); - } } /******************************************************************************************************** diff --git a/src/fbgui.cpp b/src/fbgui.cpp index 3ee9f83..d4b5c82 100644 --- a/src/fbgui.cpp +++ b/src/fbgui.cpp @@ -37,8 +37,15 @@ fbgui::fbgui() //watchDHCP(); // PBS test (working dont delete) + QFileInfo fi("/tmp/serial"); + if (fi.exists()) + qxtLog->debug() << "Found /tmp/serial !"; + else + qxtLog->debug() << "No file /tmp/serial !"; + // TODO append serial number to postData. + QNetworkRequest req(baseURL); - QByteArray postData = "mac=d8:d3:85:80:81:8b&hardwarehash=12341234123412341234123412341234&bootisoID=1"; + QByteArray postData = "mac=d8:d3:85:80:81:8b&hardwarehash=12341234123412341234123412341234&bootisoID=1&serial="; _webView->load(req, QNetworkAccessManager::PostOperation, postData); @@ -146,8 +153,8 @@ void fbgui::watchDHCP() { _webView->load(QUrl("qrc:/html/loadAbout.html")); // TODO change directory to the right one... - qxtLog->debug() << "Watching /etc/fbgui"; - QStringList pathToWatch("/etc/fbgui"); + qxtLog->debug() << "Watching " << fileToTriggerURL; + QStringList pathToWatch(fileToTriggerURL); _watcher = new QFileSystemWatcher(pathToWatch, this); QObject::connect(_watcher, SIGNAL(directoryChanged(const QString&)), this, SLOT(netAccessible(const QString&))); } diff --git a/src/fbgui.h b/src/fbgui.h index 5751ea9..0e660a5 100644 --- a/src/fbgui.h +++ b/src/fbgui.h @@ -28,7 +28,7 @@ #define DEFAULT_DOWNLOAD_DIR "/tmp/fbgui/downloads" #define DEFAULT_CONFIG_PATH "/etc/fbgui.conf" #define DEFAULT_UPDATE_INTERVAL 1; -#define DEFAULT_FILE_TRIGGER "/tmp/fbgui/net" +#define DEFAULT_FILE_TRIGGER "/tmp/trigger_fbgui" // Global settings diff --git a/src/javascriptinterface.cpp b/src/javascriptinterface.cpp index 001753c..e9ae7d4 100644 --- a/src/javascriptinterface.cpp +++ b/src/javascriptinterface.cpp @@ -22,6 +22,7 @@ void JavascriptInterface::attachToDOM(){ //------------------------------------------------------------------------------------------------------- void JavascriptInterface::notify(const QString& msg){ + qxtLog->debug() << "Notifying: " << msg; QString code = QString("notify('\%1')").arg(msg); _parent->evaluateJavaScript(code); } diff --git a/src/main.cpp b/src/main.cpp index d35909d..fc75aab 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -119,6 +119,7 @@ int main(int argc, char *argv[]) else fileToTriggerURL = DEFAULT_FILE_TRIGGER; + qDebug() << "file to trigger: " << fileToTriggerURL; // setting directory for downloads if (clOpts.contains("downloadDir")){ -- cgit v1.2.3-55-g7522