Warning, file /pim/kalarm/src/resourceselector.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  *  resourceselector.h  -  alarm calendar resource selection widget
0003  *  Program:  kalarm
0004  *  SPDX-FileCopyrightText: 2006-2022 David Jarvie <djarvie@kde.org>
0005  *  Based on KOrganizer's ResourceView class and KAddressBook's ResourceSelection class,
0006  *  SPDX-FileCopyrightText: 2003, 2004 Cornelius Schumacher <schumacher@kde.org>
0007  *  SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
0008  *  SPDX-FileCopyrightText: 2004 Tobias Koenig <tokoe@kde.org>
0009  *
0010  *  SPDX-License-Identifier: GPL-2.0-or-later
0011  */
0012 
0013 #pragma once
0014 
0015 #include "resources/resource.h"
0016 
0017 #include <QFrame>
0018 #include <QSize>
0019 
0020 using namespace KAlarmCal;
0021 
0022 class QPushButton;
0023 class QResizeEvent;
0024 class QAction;
0025 class KActionCollection;
0026 class KToggleAction;
0027 class QComboBox;
0028 class QMenu;
0029 class MainWindow;
0030 class ResourceView;
0031 
0032 
0033 /**
0034   This class provides a view of alarm calendar resources.
0035 */
0036 class ResourceSelector : public QFrame
0037 {
0038     Q_OBJECT
0039 public:
0040     explicit ResourceSelector(MainWindow* parentWindow, QWidget* parent = nullptr);
0041     void  initActions(KActionCollection*);
0042 
0043     /** Automatically resize this widget to fit the number of calendars in the
0044      *  list, whenever the number changes.
0045      */
0046     void setResizeToList()    { mResizeToList = true; }
0047 
0048 Q_SIGNALS:
0049     /** Emitted when the widget has been resized. */
0050     void  resized(const QSize& oldSize, const QSize& newSize);
0051 
0052 protected:
0053     void  resizeEvent(QResizeEvent*) override;
0054 
0055 private Q_SLOTS:
0056     void  alarmTypeSelected();
0057     void  addResource();
0058     void  editResource();
0059     void  updateResource();
0060     void  removeResource();
0061     void  selectionChanged();
0062     void  contextMenuRequested(const QPoint&);
0063     void  reloadResource();
0064     void  saveResource();
0065     void  setStandard();
0066     void  setColour();
0067     void  clearColour();
0068     void  importCalendar();
0069     void  exportCalendar();
0070     void  showInfo();
0071     void  archiveDaysChanged(int days);
0072     void  slotResourceAdded(Resource&, CalEvent::Type);
0073     void  reinstateAlarmTypeScrollBars();
0074     void  resizeToList();
0075 
0076 private:
0077     CalEvent::Type currentResourceType() const;
0078     Resource currentResource() const;
0079 
0080     MainWindow*     mMainWindow;
0081     ResourceView*   mListView;
0082     QComboBox*      mAlarmType;
0083     QPushButton*    mAddButton;
0084     QPushButton*    mDeleteButton;
0085     QPushButton*    mEditButton;
0086     CalEvent::Type  mCurrentAlarmType;
0087     QMenu*          mContextMenu {nullptr};
0088     QAction*        mActionReload {nullptr};
0089     QAction*        mActionShowDetails {nullptr};
0090     QAction*        mActionSetColour {nullptr};
0091     QAction*        mActionClearColour {nullptr};
0092     QAction*        mActionEdit {nullptr};
0093     QAction*        mActionUpdate {nullptr};
0094     QAction*        mActionRemove {nullptr};
0095     QAction*        mActionImport {nullptr};
0096     QAction*        mActionExport {nullptr};
0097     KToggleAction*  mActionSetDefault {nullptr};
0098     bool            mResizeToList {false};    // widget should be resized when calendar list changes
0099 };
0100 
0101 // vim: et sw=4: