• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kalarm

  • sources
  • kde-4.14
  • kdepim
  • kalarm
eventid.cpp
Go to the documentation of this file.
1 /*
2  * eventid.cpp - KAlarm unique event identifier for Akonadi
3  * Program: kalarm
4  * Copyright © 2012 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 #ifdef USE_AKONADI
22 
23 #include "eventid.h"
24 #include "collectionmodel.h"
25 
26 #include <kdebug.h>
27 #include <QString>
28 #include <QRegExp>
29 
31 EventId::EventId(const QString& resourceEventId)
32 {
33  bool resourceOk = false;
34  QRegExp rx(QLatin1String("^\\w+:"));
35  if (rx.indexIn(resourceEventId) == 0)
36  {
37  // A resource ID has been supplied, so use it
38  int n = rx.matchedLength();
39  Akonadi::Collection c = CollectionControlModel::collectionForResource(resourceEventId.left(n - 1));
40  {
41  first = c.id();
42  second = resourceEventId.mid(n);
43  resourceOk = true;
44  }
45  }
46  if (!resourceOk)
47  {
48  // Only an event ID has been supplied (or the syntax was invalid)
49  first = -1;
50  second = resourceEventId;
51  }
52 }
53 
54 #endif
55 
56 // vim: et sw=4:
eventid.h
CollectionControlModel::collectionForResource
static Akonadi::Collection collectionForResource(const QString &resourceId)
Return the collection ID for a given resource ID.
Definition: collectionmodel.cpp:1247
QRegExp
QString
collectionmodel.h
QString::mid
QString mid(int position, int n) const
QLatin1String
QString::left
QString left(int n) const
EventId::EventId
EventId()
Definition: eventid.h:40
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kalarm

Skip menu "kalarm"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal