2 * resourceselector.h - alarm calendar resource selection widget
4 * Copyright © 2006-2011 by David Jarvie <djarvie@kde.org>
5 * Based on KOrganizer's ResourceView class and KAddressBook's ResourceSelection class,
6 * Copyright (C) 2003,2004 Cornelius Schumacher <schumacher@kde.org>
7 * Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
8 * Copyright (c) 2004 Tobias Koenig <tokoe@kde.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 #ifndef RESOURCESELECTOR_H
26 #define RESOURCESELECTOR_H
29 #include "akonadimodel.h"
30 #include "collectionmodel.h"
32 #include <akonadi/agentinstance.h>
34 #include "alarmresource.h"
35 #include "alarmresources.h"
38 #include <QModelIndex>
48 class KActionCollection
;
55 class AkonadiResourceCreator
;
56 class CollectionFilterCheckListModel
;
61 using KCal::ResourceCalendar
;
66 This class provides a view of alarm calendar resources.
68 class ResourceSelector
: public QFrame
73 explicit ResourceSelector(QWidget
* parent
= 0);
75 explicit ResourceSelector(AlarmResources
*, QWidget
* parent
= 0);
76 AlarmResources
* calendar() const { return mCalendar
; }
78 void initActions(KActionCollection
*);
79 void setContextMenu(KMenu
*);
82 void resized(const QSize
& oldSize
, const QSize
& newSize
);
85 virtual void resizeEvent(QResizeEvent
*);
88 void alarmTypeSelected();
92 void updateResource();
94 void removeResource();
95 void selectionChanged();
96 void contextMenuRequested(const QPoint
&);
97 void reloadResource();
102 void importCalendar();
103 void exportCalendar();
105 void archiveDaysChanged(int days
);
107 void resourceAdded(AkonadiResourceCreator
*, bool success
);
108 void slotCollectionAdded(const Akonadi::Collection
&);
110 void slotStatusChanged(AlarmResource
*, AlarmResources::Change
);
112 void reinstateAlarmTypeScrollBars();
115 KAlarm::CalEvent::Type
currentResourceType() const;
117 Akonadi::Collection
currentResource() const;
119 CollectionView
* mListView
;
120 QList
<Akonadi::AgentInstance
> mAddAgents
; // agent added by addResource()
122 AlarmResource
* currentResource() const;
124 AlarmResources
* mCalendar
;
125 ResourceView
* mListView
;
127 KComboBox
* mAlarmType
;
128 QPushButton
* mAddButton
;
129 QPushButton
* mDeleteButton
;
130 QPushButton
* mEditButton
;
131 KAlarm::CalEvent::Type mCurrentAlarmType
;
133 KAction
* mActionReload
;
134 KAction
* mActionSave
;
135 KAction
* mActionShowDetails
;
136 KAction
* mActionSetColour
;
137 KAction
* mActionClearColour
;
138 KAction
* mActionEdit
;
140 KAction
* mActionUpdate
;
142 KAction
* mActionRemove
;
143 KAction
* mActionImport
;
144 KAction
* mActionExport
;
145 KToggleAction
* mActionSetDefault
;