-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrucktypetotalspage.cpp
83 lines (64 loc) · 3.85 KB
/
trucktypetotalspage.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include <QtGui>
#include <QLabel>
#include <QVBoxLayout>
//#include <QtCore/private/qjnihelpers_p.h>
#include <QAndroidJniEnvironment>
#include <QAndroidJniObject>
#include "snowloadcountwiz.h"
#include "trucktypetotalspage.h"
TruckTypeTotalsPage::TruckTypeTotalsPage(QWidget *parent, WizData *tmpWizData) :
QWizardPage(parent)
{
wizData = tmpWizData;
QVBoxLayout *layout = new QVBoxLayout;
setTitle(tr("Truck Type Totals"));
lbl = new QLabel(tr("label test"));
lbl->setWordWrap(true);
layout->addWidget(lbl);
setLayout(layout);
}
int TruckTypeTotalsPage::nextId() const
{
return -1;
}
bool TruckTypeTotalsPage::validatePage()
{
qDebug() << "TruckTypeTotalsPage::validatePage()";
QString logFileName;
QString logtimeDisplayFormat;
QString logdateDisplayFormat;
//QString timeDisplayFormat;
logtimeDisplayFormat = QString("HHmm");
logdateDisplayFormat = QString("ddMMyyyy");
logFileName = "snowLoadCountLog";
logFileName += wizData->shiftStartTime;//Edit->time().toString(logtimeDisplayFormat);
logFileName += wizData->shiftStartDate;//Edit->date().toString(logdateDisplayFormat);
logFileName += ".txt";
wizData->logFileName = logFileName;
wizData->debugDataFields();
//wizData->writeStream();
//wizData->readStream();
sendSMS("6132187497", "blah");
return true;
}
void TruckTypeTotalsPage::sendSMS(QString phoneNumber, QString message)
{
QAndroidJniEnvironment env;
//SmsManager smsManager = SmsManager.getDefault();
QAndroidJniObject mySmsManager = QAndroidJniObject::callStaticObjectMethod("android/telephony/SmsManager", "getDefault", "()Landroid/telephony/SmsManager;" );
QAndroidJniObject myPhoneNumber = QAndroidJniObject::fromString(phoneNumber);
QAndroidJniObject myTextMessage = QAndroidJniObject::fromString(message);
QAndroidJniObject scAddress = NULL;
QAndroidJniObject sentIntent = NULL;
QAndroidJniObject deliveryIntent = NULL;
//smsManager.sendTextMessage("Phone Number", null, "Message", null, null);
//in background (Not showing message composer)
//<uses-permission android:name="android.permission.SEND_SMS"/>
//mySmsManager.callObjectMethod<void>("sendTextMessage", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/app/PendingIntent;Landroid/app/PendingIntent;)V", myPhoneNumber, scAddress, myTextMessage, sentIntent, deliveryIntent );
//mySmsManager.callMethod<void>("sendTextMessage", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/app/PendingIntent;Landroid/app/PendingIntent;)V" , myPhoneNumber, scAddress, myTextMessage, sentIntent, deliveryIntent );
mySmsManager.callMethod<void>("sendTextMessage", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/app/PendingIntent;Landroid/app/PendingIntent;)V" , myPhoneNumber.object<jstring>(), scAddress.object<jstring>(), myTextMessage.object<jstring>(), NULL, NULL );
//mySmsManager.callStaticObjectMethod<void>("sendTextMessage", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/app/PendingIntent;Landroid/app/PendingIntent;)V", myPhoneNumber, scAddress, myTextMessage, sentIntent, deliveryIntent );
//mySmsManager.callObjectMethod("sendTextMessage", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/app/PendingIntent;Landroid/app/PendingIntent;)V", myPhoneNumber, scAddress, myTextMessage, sentIntent, deliveryIntent );
//mySmsManager.callMethod("sendTextMessage", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/app/PendingIntent;Landroid/app/PendingIntent;)V" , myPhoneNumber, scAddress, myTextMessage, sentIntent, deliveryIntent );
//mySmsManager.callStaticObjectMethod("sendTextMessage", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/app/PendingIntent;Landroid/app/PendingIntent;)V", myPhoneNumber, scAddress, myTextMessage, sentIntent, deliveryIntent );
}