Thread
:
QDBus and connect to com.nokia.csd.Call
View Single Post
vhs
2010-04-22 , 21:35
Posts: 6 | Thanked: 3 times | Joined on Apr 2010
#
6
Try something in these lines. I haven't compiled it, so there may be some errors.
class MyClass : public QObject
{
Q_OBJECT
private:
QLabel *label;
public:
MyClass(QObject *parent = 0)
{
label = new QLabel();
}
~MyClass(){}
void setText(QString s)
{
label->setText(s);
}
public slots:
void receiveCall(QString path, QString callNum);
}
method "receiveCall" is implemented as:
void MyClass::receiveCall(QString path, QString callNum)
{
setText("Incoming call: " + path + " " + callNum);
}
In main.cpp:
static QDBusConnection conn = QDBusConnection::systemBus();
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MyClass *mycall = new MyClass();
bool result = conn.connect("com.nokia.csd.Call", "/com/nokia/csd/call", "com.nokia.csd.Call", "Coming", mycall, SLOT(receiveCall(QString,QString)));
if(result)
{
mycall->setText("DBus connected OK!");
}
else
{
mycall->setText("DBus connected ERROR!");
}
return a.exec();
}
Quote & Reply
|
vhs
View Public Profile
Send a private message to vhs
Find all posts by vhs