~ubuntu-branches/ubuntu/quantal/kdepim/quantal

« back to all changes in this revision

Viewing changes to kalarm/cal/eventattribute.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2011-12-15 14:17:51 UTC
  • mto: This revision was merged to the branch mainline in revision 193.
  • Revision ID: package-import@ubuntu.com-20111215141751-bmhdpiwl23wd9w26
Tags: upstream-4.7.90
Import upstream version 4.7.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  eventattribute.cpp  -  per-user attributes for individual events
3
 
 *  Program:  kalarm
4
 
 *  Copyright © 2010 by David Jarvie <djarvie@kde.org>
5
 
 *
6
 
 *  This program is free software; you can redistribute it and/or modify
7
 
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation; either version 2 of the License, or
9
 
 *  (at your option) any later version.
10
 
 *
11
 
 *  This program is distributed in the hope that it will be useful,
12
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 
 *  GNU General Public License for more details.
15
 
 *
16
 
 *  You should have received a copy of the GNU General Public License along
17
 
 *  with this program; if not, write to the Free Software Foundation, Inc.,
18
 
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
 
 */
20
 
 
21
 
#include "eventattribute.h"
22
 
 
23
 
#include <QList>
24
 
#include <QByteArray>
25
 
 
26
 
namespace KAlarm
27
 
{
28
 
 
29
 
EventAttribute* EventAttribute::clone() const
30
 
{
31
 
    return new EventAttribute(*this);
32
 
}
33
 
 
34
 
QByteArray EventAttribute::serialized() const
35
 
{
36
 
kDebug()<<QByteArray::number(mCommandError);
37
 
    return QByteArray::number(mCommandError);
38
 
}
39
 
 
40
 
void EventAttribute::deserialize(const QByteArray& data)
41
 
{
42
 
    // Set default values
43
 
    mCommandError = KAEvent::CMD_NO_ERROR;
44
 
 
45
 
    bool ok;
46
 
    int c[1];
47
 
    const QList<QByteArray> items = data.simplified().split(' ');
48
 
    switch (items.count())
49
 
    {
50
 
        case 1:
51
 
            c[0] = items[0].toInt(&ok);
52
 
            if (!ok  ||  (c[0] & ~(KAEvent::CMD_ERROR | KAEvent::CMD_ERROR_PRE | KAEvent::CMD_ERROR_POST)))
53
 
                return;
54
 
            mCommandError = static_cast<KAEvent::CmdErrType>(c[0]);
55
 
kDebug()<<"command error="<<mCommandError;
56
 
            break;
57
 
 
58
 
        default:
59
 
            break;
60
 
    }
61
 
}
62
 
 
63
 
} // namespace KAlarm
64
 
 
65
 
// vim: et sw=4: