00001 /* This file is part of the KDE project 00002 Copyright (C) 2004 - 2005 Dag Andersen <danders@get2net.dk> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; 00007 version 2 of the License. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KPTCALENDARLISTDIALOG_H 00021 #define KPTCALENDARLISTDIALOG_H 00022 00023 #include "kptcalendarlistdialogbase.h" 00024 #include "kptcalendaredit.h" 00025 #include "kptcalendar.h" 00026 00027 #include <kdialog.h> 00028 00029 #include <QString> 00030 #include <QList> 00031 00032 class KCommand; 00033 00034 namespace KPlato 00035 { 00036 00037 class CalendarListViewItem; 00038 class Project; 00039 class Part; 00040 00041 class CalendarListDialogImpl : public CalendarListDialogBase { 00042 Q_OBJECT 00043 public: 00044 CalendarListDialogImpl(Project &project, QWidget *parent); 00045 ~CalendarListDialogImpl(); 00046 void setBaseCalendars(); 00047 00048 Calendar *getCalendar() { return calendar->getCalendar(); } 00049 void setCalendar(Calendar *cal); 00050 00051 QList<CalendarListViewItem*> &deletedItems(); 00052 00053 void renameStopped(QTreeWidgetItem *item); 00054 00055 public slots: 00056 void slotSelectionChanged(); 00057 void slotSelectionChanged(QTreeWidgetItem *listItem); 00058 void slotItemChanged(QTreeWidgetItem*, int); 00059 00060 private slots: 00061 void slotBaseCalendarActivated(int id); 00062 void slotCalendarModified(); 00063 void slotDeleteClicked(); 00064 void slotAddClicked(); 00065 void slotEnableButtonOk(bool on); 00066 void slotListDoubleClicked(const QModelIndex &index); 00067 void slotListDoubleClicked(QTreeWidgetItem *item, int col); 00068 00069 signals: 00070 void obligatedFieldsFilled(bool yes); 00071 void calendarModified(); 00072 void calendarChanged(); 00073 void enableButtonOk(bool on); 00074 00075 void selectionChanged(); 00076 00077 protected: 00078 CalendarListViewItem *findItem(Calendar *cal); 00079 00080 private: 00081 Project &project; 00082 QList<CalendarListViewItem*> m_deletedItems; 00083 QList<CalendarListViewItem*> baseCalendarList; 00084 QTreeWidgetItem *m_renameItem; 00085 }; 00086 00087 class CalendarListDialog : public KDialog { 00088 Q_OBJECT 00089 public: 00090 CalendarListDialog(Project &project, QWidget *parent=0, const char *name=0); 00091 00092 KCommand *buildCommand(Part *part); 00093 00094 protected slots: 00095 void slotOk(); 00096 00097 private: 00098 Project &project; 00099 CalendarListDialogImpl *dia; 00100 }; 00101 00102 } //KPlato namespace 00103 00104 #endif // CALENDARLISTDIALOG_H