~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to solid/modemmanager-0.4/modemgsmsmsinterface.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright 2008 Will Stephenson <wstephenson@kde.org>
 
3
Copyright 2010 Lamarque Souza <lamarque@gmail.com>
 
4
 
 
5
This program is free software; you can redistribute it and/or
 
6
modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of
 
7
the License or (at your option) version 3 or any later version
 
8
accepted by the membership of KDE e.V. (or its successor approved
 
9
by the membership of KDE e.V.), which shall act as a proxy
 
10
defined in Section 14 of version 3 of the license.
 
11
 
 
12
This program is distributed in the hope that it will be useful,
 
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
GNU General Public License for more details.
 
16
 
 
17
You should have received a copy of the GNU General Public License
 
18
along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
*/
 
20
 
 
21
#include "manager.h"
 
22
#include "modemgsmsmsinterface.h"
 
23
#include "modemgsmsmsinterface_p.h"
 
24
 
 
25
#include <KDebug>
 
26
 
 
27
MMModemGsmSmsInterfacePrivate::MMModemGsmSmsInterfacePrivate(const QString &path, QObject *owner)
 
28
    : MMModemInterfacePrivate(path, owner), modemGsmSmsIface(MMModemManager::DBUS_SERVICE, path, QDBusConnection::systemBus())
 
29
{
 
30
}
 
31
 
 
32
MMModemGsmSmsInterface::MMModemGsmSmsInterface(const QString & path, MMModemManager * manager, QObject * parent)
 
33
    : MMModemInterface(*new MMModemGsmSmsInterfacePrivate(path, this), manager, parent)
 
34
{
 
35
    Q_D(const MMModemGsmSmsInterface);
 
36
    connect( &d->modemGsmSmsIface, SIGNAL(smsReceived(uint, bool)),
 
37
                this, SIGNAL(smsReceived(int, bool)));
 
38
    connect( &d->modemGsmSmsIface, SIGNAL(completed(uint, bool)),
 
39
                this, SIGNAL(completed(int, bool)));
 
40
}
 
41
 
 
42
MMModemGsmSmsInterface::~MMModemGsmSmsInterface()
 
43
{
 
44
}
 
45
 
 
46
void MMModemGsmSmsInterface::deleteSms(const int index)
 
47
{
 
48
    Q_D(MMModemGsmSmsInterface);
 
49
    d->modemGsmSmsIface.Delete(index);
 
50
}
 
51
 
 
52
QVariantMap MMModemGsmSmsInterface::get(const int index)
 
53
{
 
54
    Q_D(MMModemGsmSmsInterface);
 
55
    QDBusReply<QVariantMap> sms = d->modemGsmSmsIface.Get(index);
 
56
 
 
57
    if (sms.isValid()) {
 
58
        return sms.value();
 
59
    }
 
60
 
 
61
    return QVariantMap();
 
62
}
 
63
 
 
64
int MMModemGsmSmsInterface::getFormat()
 
65
{
 
66
    Q_D(MMModemGsmSmsInterface);
 
67
    QDBusReply<uint> format = d->modemGsmSmsIface.GetFormat();
 
68
 
 
69
    if (format.isValid()) {
 
70
        return format.value();
 
71
    }
 
72
 
 
73
    return 0;
 
74
}
 
75
 
 
76
void MMModemGsmSmsInterface::setFormat(const int format)
 
77
{
 
78
    Q_D(MMModemGsmSmsInterface);
 
79
    d->modemGsmSmsIface.SetFormat(format);
 
80
}
 
81
 
 
82
QString MMModemGsmSmsInterface::getSmsc()
 
83
{
 
84
    Q_D(MMModemGsmSmsInterface);
 
85
    QDBusReply<QString> smsc = d->modemGsmSmsIface.GetSmsc();
 
86
 
 
87
    if (smsc.isValid()) {
 
88
        return smsc.value();
 
89
    }
 
90
 
 
91
    return QString();
 
92
}
 
93
 
 
94
QList<QVariantMap> MMModemGsmSmsInterface::list()
 
95
{
 
96
    Q_D(MMModemGsmSmsInterface);
 
97
    QDBusReply<QList<QVariantMap> > sms = d->modemGsmSmsIface.List();
 
98
 
 
99
    if (sms.isValid()) {
 
100
        return sms.value();
 
101
    }
 
102
 
 
103
    return QList<QVariantMap>();
 
104
}
 
105
 
 
106
void MMModemGsmSmsInterface::save(const QVariantMap & properties)
 
107
{
 
108
    Q_D(MMModemGsmSmsInterface);
 
109
    d->modemGsmSmsIface.Save(properties);
 
110
}
 
111
 
 
112
void MMModemGsmSmsInterface::send(const QVariantMap & properties)
 
113
{
 
114
    Q_D(MMModemGsmSmsInterface);
 
115
    d->modemGsmSmsIface.Save(properties);
 
116
}
 
117
 
 
118
void MMModemGsmSmsInterface::sendFromStorage(const int index)
 
119
{
 
120
    Q_D(MMModemGsmSmsInterface);
 
121
    d->modemGsmSmsIface.SendFromStorage(index);
 
122
}
 
123
 
 
124
void MMModemGsmSmsInterface::setIndication(const int mode, const int mt, const int bm, const int ds, const int brf)
 
125
{
 
126
    Q_D(MMModemGsmSmsInterface);
 
127
    d->modemGsmSmsIface.SetIndication(mode, mt, bm, ds, brf);
 
128
}
 
129
 
 
130
#include "modemgsmsmsinterface.moc"
 
131