Active Topics

 


Reply
Thread Tools
Posts: 42 | Thanked: 12 times | Joined on Dec 2009 @ Kuopio, Finland
#1
Hello,

I am trying to fetch users SMS from the device but it seems like it doesn't function correctly.

I am using following:

const QDateTime minimumDate(QDate(2009,8,20));

QMessageFilter includeFilter(QMessageFilter::byTimeStamp(minimumD ate, QMessageDataComparator::GreaterThanEqual));

includeFilter &= QMessageFilter::byType(QMessage::Sms);

QtMobility::QMessageIdList ids = QtMobility::QMessageManager().queryMessages(includ eFilter);


And ids list returns empty (It works for Email).

Can anyone else confirm this bug when running application in N900? I am using QtCreator on Windows 7 and USB networking connection to n900. QTCreator Emulator doesn't have any SMS messages in it to test against.

My other - very ugly and n900 only - solution would be to use sql to fetch SMS from the rtcom sqlite database, but I wouldn't like to use that option.
 
Posts: 432 | Thanked: 645 times | Joined on Mar 2009
#2
Hi,

are you running the application from QtCreator directly? I've seen some issues reading the contact database, as it does not execute the application as "user" but as "developer". Try to run the application from the device as "user" and see what happens.

Daniel
 
nicolai's Avatar
Posts: 1,637 | Thanked: 4,424 times | Joined on Apr 2009 @ Germany
#3
Hi trotor,

a minimal working example:

mobtest.pro
Code:
TARGET = mobtest
SOURCES = mobtest.cpp
OBJECTS_DIR = build
MOC_DIR = build
DESTDIR = build

TEMPLATE = app
CONFIG += mobility

MOBILITY += messaging
mobtest.cpp
Code:
#include <iostream>
#include <QObject>
#include <QDebug>
#include <QMessage>
#include <QMessageManager>
#include <QMessageFilter>
#include <QDate>
#include <QApplication>
QTM_USE_NAMESPACE
int main(int argc, char** argv)
{  
  QApplication app(argc, argv);
  qWarning("start");
  const QDateTime minimumDate(QDate(2010, 7, 20));
  QMessageFilter include_Filter(QMessageFilter::byTimeStamp(minimumDate, QMessageDataComparator::GreaterThanEqual));
  
  include_Filter &= QMessageFilter::byType(QMessage::Sms);
  QtMobility::QMessageIdList ids = QtMobility::QMessageManager().queryMessages(include_Filter);
  foreach(const QMessageId& id, ids)
  {
    QMessage message = QtMobility::QMessageManager().message(id);
    QString msg = id.toString();
    msg += " : ";
    msg += message.subject();
    qWarning() << msg;
  }
  qWarning("done");
  return app.exec();
}
compiled with
Code:
mad qmake
mad make
Running on device (as user)
Code:
run-standalone ./mobtest
Finds and prints the messages.

regards
Nicolai
 
Posts: 42 | Thanked: 12 times | Joined on Dec 2009 @ Kuopio, Finland
#4
Originally Posted by danielwilms View Post
Hi,

are you running the application from QtCreator directly? I've seen some issues reading the contact database, as it does not execute the application as "user" but as "developer". Try to run the application from the device as "user" and see what happens.

Daniel
This seemed like fair and clear reason so I tried it out. It seems like you both were correct. It actually has something to do with the permissions/whatnot of developer user.

Is it possible to run software in the phone as user (or with user permission level) directly from the 'build' click from qtcreator?

I managed to get it run correctly by doing build, close window, then from system console su user - appname (i connect there with rootshell, even that wasn't enough). But I find that way a bit cumbersome compared to "writecode-press f5-see what happens" -way which I am used to.

I have been spoiled by Visual Studio and C#.

Biiiig Thank you to both of you (no thank you button visible)!!!!

p.s. I already did workaround by reading sqlite database directly before you answered. I found out there is actually el.db and el-v1.db in my n900. v1 one is 'current'.
 
Reply


 
Forum Jump


All times are GMT. The time now is 02:30.