I'm trying to implement some code that will, detect if the phone is in Offline Profile, then it will prompt the user some message telling him that he is in Offline Mode.
But i've tried a lot of methods and look through a lot of guides, what I searched is only some guide that will display my device's profile.
Below is the codes for the webview application i made. All i want is to detect the offline mode and display a message, then proceed to my html view. I've implemented the GetDeviceInfo.h file i get from some guide.
But yeah, it doesnt work
#include <QtGui>
#include <QtWebKit>
#include "qwebviewselectionsuppressor.h"
#include <QSystemDeviceInfo>
#include <QMessageBox>
#include "GetDeviceInfo.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QSystemDeviceInfo* deviceInfo = new QSystemDeviceInfo();
QSystemDeviceInfo::Profile prof = deviceInfo->currentProfile();
if(prof == QSystemDeviceInfo::OfflineProfile){
QMessageBox msgBox;
msgBox.setText("Your device is currently in Offline Mode, please switch it to Normal Mode in order to proceed.");
msgBox.exec();
}
QWebView view;
QWebViewSelectionSuppressor suppressor(&view);
view.setWindowTitle("World Cup App");
view.load(QUrl("qrc:/html/widget.html"));
view.show();
return app.exec();
}
Here's the original code of this page before i implement the codes:
Can someone please teach me how to do it in a simple way? Thanks a lot for helping.#include <QtGui>
#include <QtWebKit>
#include "qwebviewselectionsuppressor.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWebView view;
QWebViewSelectionSuppressor suppressor(&view);
view.setWindowTitle("World Cup App");
view.load(QUrl("qrc:/html/widget.html"));
view.show();
return app.exec();
}


Reply With Quote



