add a c++ qobject will be used to do notifications

This commit is contained in:
Marco Martin 2015-04-26 15:50:59 +02:00
parent 3275b8b698
commit 3fab7b980c
4 changed files with 76 additions and 0 deletions

View file

@ -2,6 +2,7 @@
set(plasmaphonedialer_SRCS
main.cpp
dialerutils.cpp
)
add_executable(plasmaphonedialer ${plasmaphonedialer_SRCS})

View file

@ -0,0 +1,33 @@
/*
* Copyright 2015 Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "dialerutils.h"
#include <QDebug>
DialerUtils::DialerUtils(QObject *parent)
: QObject(parent)
{
}
DialerUtils::~DialerUtils()
{
}
#include "moc_dialerutils.cpp"

37
dialer/src/dialerutils.h Normal file
View file

@ -0,0 +1,37 @@
/*
* Copyright 2015 Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef DIALERUTILS_H
#define DIALERUTILS_H
#include <QObject>
class DialerUtils : public QObject
{
Q_OBJECT
public:
DialerUtils(QObject *parent = 0);
virtual ~DialerUtils();
private:
};
#endif

View file

@ -19,6 +19,8 @@
#include <QApplication>
#include "dialerutils.h"
#include <klocalizedstring.h>
#include <qcommandlineparser.h>
#include <qcommandlineoption.h>
@ -67,6 +69,9 @@ int main(int argc, char **argv)
obj->loadPackage(packagePath);
obj->engine()->rootContext()->setContextProperty("commandlineArguments", parser.positionalArguments());
DialerUtils *dialerUtils = new DialerUtils;
obj->engine()->rootContext()->setContextProperty("dialerUtils", QVariant::fromValue(dialerUtils));
obj->completeInitialization();
if (!obj->package().metadata().isValid()) {