2 * eventid.cpp - KAlarm unique event identifier for Akonadi
4 * Copyright © 2012 by David Jarvie <djarvie@kde.org>
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.
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.
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.
23 #include "collectionmodel.h"
27 #include "kalarm_debug.h"
29 /** Set by event ID and optional resource ID, in the format "[rid:]eid". */
30 EventId::EventId(const QString
& resourceEventId
)
32 bool resourceOk
= false;
33 QRegExp
rx(QStringLiteral("^\\w+:"));
34 if (rx
.indexIn(resourceEventId
) == 0)
36 // A resource ID has been supplied, so use it
37 int n
= rx
.matchedLength();
38 Akonadi::Collection c
= CollectionControlModel::collectionForResource(resourceEventId
.left(n
- 1));
41 second
= resourceEventId
.mid(n
);
47 // Only an event ID has been supplied (or the syntax was invalid)
49 second
= resourceEventId
;