<commit_before>/*
 *  alarmresources.h  -  alarm calendar resources
 *  Program:  kalarm
 *  Copyright © 2006-2008 by <NAME> <<EMAIL>>
 *  Based on calendarresources.h in libkcal,
 *  Copyright (c) 2003 <NAME> <<EMAIL>>
 *  Copyright (C) 2003-2004 <NAME> <<EMAIL>>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  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; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#ifndef ALARMRESOURCES_H
#define ALARMRESOURCES_H

#include <kdatetime.h>
#include <kresources/manager.h>

#include "alarmresource.h"
#include "kcalendar.h"

class KConfigGroup;
namespace KCal { class Event; }
using KCal::CalendarLocal;
using KCal::ResourceCalendar;


/** Provides access to all alarm calendar resources. */
class KALARM_EXPORT AlarmResources : public KCal::Calendar, public KRES::ManagerObserver<AlarmResource>
{
		Q_OBJECT
	public:
		enum Change { Added, Deleted, Invalidated, Enabled, ReadOnly, Location, Colour };
		// Return code when the user can cancel an operation
		enum Result { Success, Cancelled, Failed };

		class Ticket
		{
		    friend class AlarmResources;
		  public:
		    AlarmResource* resource() const  { return mResource; }
		  private:
		    Ticket(AlarmResource* r) : mResource(r) { }
		    AlarmResource* mResource;
		};

		/** Create the alarm calendar resources instance.
		 *  @return The alarm calendar resources instance, or 0 if either a reserved
		 *          file name was used or it has already been created.
		 */
		static AlarmResources* create(const KDateTime::Spec& timeSpec, bool activeOnly = false, bool passiveClient = false);
		static QString creationError()   { return mConstructionError; }
		virtual ~AlarmResources();
		/** Return the alarm calendar resources instance.
		 *  @return The alarm calendar resources instance, or 0 if not already created.
		 */
		static AlarmResources* instance()   { return mInstance; }
		/** Set a reserved local calendar file path which can't be used by this class. */
		static void setReservedFile(const QString& path)     { mReservedFile = path; }

		/** Set whether the application has a GUI. This determines whether error or<commit_msg>Update comments for SVN commit r921387.<commit_after>/*
 *  alarmresources.h  -  alarm calendar resources
 *  Program:  kalarm
 *  Copyright © 2006-2009 by <NAME> <<EMAIL>>
 *  Based on calendarresources.h in libkcal,
 *  Copyright (c) 2003 <NAME> <<EMAIL>>
 *  Copyright (C) 2003-2004 <NAME> <<EMAIL>>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  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; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#ifndef ALARMRESOURCES_H
#define ALARMRESOURCES_H

#include <kdatetime.h>
#include <kresources/manager.h>

#include "alarmresource.h"
#include "kcalendar.h"

class KConfigGroup;
namespace KCal { class Event; }
using KCal::CalendarLocal;
using KCal::ResourceCalendar;


/** Provides access to all alarm calendar resources. */
class KALARM_EXPORT AlarmResources : public KCal::Calendar, public KRES::ManagerObserver<AlarmResource>
{
		Q_OBJECT
	public:
		enum Change { Added, Deleted, Invalidated, Enabled, ReadOnly, Location, Colour };
		// Return code when the user can cancel an operation
		enum Result { Success, Cancelled, Failed };

		class Ticket
		{
		    friend class AlarmResources;
		  public:
		    AlarmResource* resource() const  { return mResource; }
		  private:
		    Ticket(AlarmResource* r) : mResource(r) { }
		    AlarmResource* mResource;
		};

		/** Create the alarm calendar resources instance.
		 *  If the alarm calendar resources instance has already been created,
		 *  the existing instance is returned regardless of parameters passed.
		 *  @return The alarm calendar resources instance, or 0 if a reserved
		 *          file name was used (in which case, use creationError() to
		 *          fetch the error message).
		 */
		static AlarmResources* create(const KDateTime::Spec& timeSpec, bool activeOnly = false, bool passiveClient = false);
		static QString creationError()   { return mConstructionError; }
		virtual ~AlarmResources();
		/** Return the alarm calendar resources instance.
		 *  @return The alarm calendar resources instance, or 0 if not already created.
		 */
		static AlarmResources* instance()   { return mInstance; }
		/** Set a reserved local calendar file path which can't be used by this class. */
		static void setReservedFile(const QString& path)     { mReservedFile = path; }

		/** Set whether the application has a GUI. This determines whether error or
{'fraction_non_alphanumeric': 0.081779810059796, 'fraction_numerical': 0.013014421385860007, 'mean_word_length': 3.79915611814346, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '907904', 'n_tokens_mistral': 1696, 'n_tokens_neox': 1528, 'n_words': 668}