SVN_SILENT made messages (.desktop file)
[kdepim.git] / kalarm / resourceselector.h
blob642e030806569ebbc6d1f6df8d494f04bca85781
1 /*
2 * resourceselector.h - alarm calendar resource selection widget
3 * Program: kalarm
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>
33 #include <QFrame>
34 #include <QSize>
35 #include <QList>
37 using namespace KAlarmCal;
39 class QPushButton;
40 class QResizeEvent;
41 class QAction;
42 class KActionCollection;
43 class KToggleAction;
44 class KComboBox;
45 class QMenu;
46 class ResourceView;
47 class AkonadiResourceCreator;
48 namespace Akonadi {
49 class Collection;
53 /**
54 This class provides a view of alarm calendar resources.
56 class ResourceSelector : public QFrame
58 Q_OBJECT
59 public:
60 explicit ResourceSelector(QWidget* parent = Q_NULLPTR);
61 void initActions(KActionCollection*);
62 void setContextMenu(QMenu*);
64 Q_SIGNALS:
65 void resized(const QSize& oldSize, const QSize& newSize);
67 protected:
68 void resizeEvent(QResizeEvent*) Q_DECL_OVERRIDE;
70 private Q_SLOTS:
71 void alarmTypeSelected();
72 void addResource();
73 void editResource();
74 void updateResource();
75 void removeResource();
76 void selectionChanged();
77 void contextMenuRequested(const QPoint&);
78 void reloadResource();
79 void saveResource();
80 void setStandard();
81 void setColour();
82 void clearColour();
83 void importCalendar();
84 void exportCalendar();
85 void showInfo();
86 void archiveDaysChanged(int days);
87 void resourceAdded(AkonadiResourceCreator*, bool success);
88 void slotCollectionAdded(const Akonadi::Collection&);
89 void reinstateAlarmTypeScrollBars();
91 private:
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;
102 QMenu* mContextMenu;
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;
115 #endif
117 // vim: et sw=4: