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
28 #include "akonadimodel.h"
29 #include "collectionmodel.h"
31 #include <AkonadiCore/agentinstance.h>
37 using namespace KAlarmCal
;
42 class KActionCollection
;
47 class AkonadiResourceCreator
;
54 This class provides a view of alarm calendar resources.
56 class ResourceSelector
: public QFrame
60 explicit ResourceSelector(QWidget
* parent
= Q_NULLPTR
);
61 void initActions(KActionCollection
*);
62 void setContextMenu(QMenu
*);
65 void resized(const QSize
& oldSize
, const QSize
& newSize
);
68 void resizeEvent(QResizeEvent
*) Q_DECL_OVERRIDE
;
71 void alarmTypeSelected();
74 void updateResource();
75 void removeResource();
76 void selectionChanged();
77 void contextMenuRequested(const QPoint
&);
78 void reloadResource();
83 void importCalendar();
84 void exportCalendar();
86 void archiveDaysChanged(int days
);
87 void resourceAdded(AkonadiResourceCreator
*, bool success
);
88 void slotCollectionAdded(const Akonadi::Collection
&);
89 void reinstateAlarmTypeScrollBars();
92 CalEvent::Type
currentResourceType() const;
93 Akonadi::Collection
currentResource() const;
95 CollectionView
* mListView
;
96 QList
<Akonadi::AgentInstance
> mAddAgents
; // agent added by addResource()
97 KComboBox
* mAlarmType
;
98 QPushButton
* mAddButton
;
99 QPushButton
* mDeleteButton
;
100 QPushButton
* mEditButton
;
101 CalEvent::Type mCurrentAlarmType
;
103 QAction
* mActionReload
;
104 QAction
* mActionShowDetails
;
105 QAction
* mActionSetColour
;
106 QAction
* mActionClearColour
;
107 QAction
* mActionEdit
;
108 QAction
* mActionUpdate
;
109 QAction
* mActionRemove
;
110 QAction
* mActionImport
;
111 QAction
* mActionExport
;
112 KToggleAction
* mActionSetDefault
;