-rw-r--r-- | korganizer/kofilterview.cpp | 21 | ||||
-rw-r--r-- | korganizer/kofilterview.h | 23 |
2 files changed, 43 insertions, 1 deletions
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index 1479208..f0d17b5 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp | |||
@@ -1,95 +1,116 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qcombobox.h> | 25 | #include <qcombobox.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | 27 | ||
28 | |||
28 | #include <libkcal/calfilter.h> | 29 | #include <libkcal/calfilter.h> |
29 | 30 | ||
30 | #include "kofilterview.h" | 31 | #include "kofilterview.h" |
31 | 32 | ||
32 | KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, | 33 | KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, |
33 | const char* name,WFlags fl ) | 34 | const char* name,WFlags fl ) |
34 | : KOFilterView_base(parent,name,fl) | 35 | : KOFilterView_base(parent,name,fl) |
35 | { | 36 | { |
36 | mFilters = filterList; | 37 | mFilters = filterList; |
37 | 38 | ||
38 | connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); | 39 | connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); |
39 | connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); | 40 | connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); |
40 | connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); | 41 | connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); |
41 | } | 42 | } |
42 | 43 | ||
43 | KOFilterView::~KOFilterView() | 44 | KOFilterView::~KOFilterView() |
44 | { | 45 | { |
45 | // no need to delete child widgets, Qt does it all for us | 46 | // no need to delete child widgets, Qt does it all for us |
46 | } | 47 | } |
47 | 48 | ||
48 | bool KOFilterView::filtersEnabled() | 49 | bool KOFilterView::filtersEnabled() |
49 | { | 50 | { |
50 | return mEnabledCheck->isChecked(); | 51 | return mEnabledCheck->isChecked(); |
51 | } | 52 | } |
52 | 53 | ||
53 | void KOFilterView::setFiltersEnabled(bool set) | 54 | void KOFilterView::setFiltersEnabled(bool set) |
54 | { | 55 | { |
55 | mEnabledCheck->setChecked(set); | 56 | mEnabledCheck->setChecked(set); |
56 | emit filterChanged(); | 57 | emit filterChanged(); |
57 | } | 58 | } |
58 | 59 | ||
59 | 60 | ||
60 | void KOFilterView::updateFilters() | 61 | void KOFilterView::updateFilters() |
61 | { | 62 | { |
62 | mSelectionCombo->clear(); | 63 | mSelectionCombo->clear(); |
63 | 64 | ||
64 | CalFilter *filter = mFilters->first(); | 65 | CalFilter *filter = mFilters->first(); |
65 | while(filter) { | 66 | while(filter) { |
66 | mSelectionCombo->insertItem(filter->name()); | 67 | mSelectionCombo->insertItem(filter->name()); |
67 | filter = mFilters->next(); | 68 | filter = mFilters->next(); |
68 | } | 69 | } |
69 | } | 70 | } |
70 | 71 | ||
71 | CalFilter *KOFilterView::selectedFilter() | 72 | CalFilter *KOFilterView::selectedFilter() |
72 | { | 73 | { |
73 | CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); | 74 | CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); |
74 | return f; | 75 | return f; |
75 | } | 76 | } |
76 | 77 | ||
77 | void KOFilterView::setSelectedFilter(QString filterName) | 78 | void KOFilterView::setSelectedFilter(QString filterName) |
78 | { | 79 | { |
79 | int filter_num = mSelectionCombo->count(); | 80 | int filter_num = mSelectionCombo->count(); |
80 | int i; | 81 | int i; |
81 | for (i=0;i<filter_num;i++) { | 82 | for (i=0;i<filter_num;i++) { |
82 | if (mSelectionCombo->text(i)==filterName) | 83 | if (mSelectionCombo->text(i)==filterName) |
83 | mSelectionCombo->setCurrentItem(i); | 84 | mSelectionCombo->setCurrentItem(i); |
84 | } | 85 | } |
85 | emit filterChanged(); | 86 | emit filterChanged(); |
86 | } | 87 | } |
87 | void KOFilterView::setSelectedFilter( int fil ) | 88 | void KOFilterView::setSelectedFilter( int fil ) |
88 | { | 89 | { |
89 | if ( fil >= mSelectionCombo->count() ) | 90 | if ( fil >= mSelectionCombo->count() ) |
90 | return; | 91 | return; |
91 | mSelectionCombo->setCurrentItem( fil ); | 92 | mSelectionCombo->setCurrentItem( fil ); |
92 | emit filterChanged(); | 93 | emit filterChanged(); |
93 | } | 94 | } |
94 | 95 | ||
95 | 96 | ||
97 | |||
98 | KOCalEditView::KOCalEditView(QWidget* parent, | ||
99 | const char* name,WFlags fl ) | ||
100 | : QWidget(parent,name,fl) | ||
101 | { | ||
102 | /* | ||
103 | connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); | ||
104 | connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); | ||
105 | connect(mEditButton,SIGNAL(clicked()),SIGNAL(editCalEdits())); | ||
106 | */ | ||
107 | } | ||
108 | |||
109 | KOCalEditView::~KOCalEditView() | ||
110 | { | ||
111 | // no need to delete child widgets, Qt does it all for us | ||
112 | } | ||
113 | void KOCalEditView::readConfig( KConfig *) | ||
114 | { | ||
115 | |||
116 | } | ||
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h index 9ba2673..2ac4da1 100644 --- a/korganizer/kofilterview.h +++ b/korganizer/kofilterview.h | |||
@@ -1,57 +1,78 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | #ifndef KOFILTERVIEW_H | 23 | #ifndef KOFILTERVIEW_H |
24 | #define KOFILTERVIEW_H | 24 | #define KOFILTERVIEW_H |
25 | 25 | ||
26 | #include <qstring.h> | 26 | #include <qstring.h> |
27 | 27 | #include <kconfig.h> | |
28 | #include "kofilterview_base.h" | 28 | #include "kofilterview_base.h" |
29 | 29 | ||
30 | #include <libkcal/calfilter.h> | 30 | #include <libkcal/calfilter.h> |
31 | 31 | ||
32 | using namespace KCal; | 32 | using namespace KCal; |
33 | 33 | ||
34 | class KOFilterView : public KOFilterView_base | 34 | class KOFilterView : public KOFilterView_base |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | public: | 37 | public: |
38 | KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); | 38 | KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); |
39 | ~KOFilterView(); | 39 | ~KOFilterView(); |
40 | 40 | ||
41 | void updateFilters(); | 41 | void updateFilters(); |
42 | 42 | ||
43 | bool filtersEnabled(); | 43 | bool filtersEnabled(); |
44 | void setFiltersEnabled(bool); | 44 | void setFiltersEnabled(bool); |
45 | CalFilter *selectedFilter(); | 45 | CalFilter *selectedFilter(); |
46 | void setSelectedFilter(QString); | 46 | void setSelectedFilter(QString); |
47 | void setSelectedFilter( int ); | 47 | void setSelectedFilter( int ); |
48 | 48 | ||
49 | signals: | 49 | signals: |
50 | void filterChanged(); | 50 | void filterChanged(); |
51 | void editFilters(); | 51 | void editFilters(); |
52 | 52 | ||
53 | private: | 53 | private: |
54 | QPtrList<CalFilter> *mFilters; | 54 | QPtrList<CalFilter> *mFilters; |
55 | }; | 55 | }; |
56 | 56 | ||
57 | class KOCalEditView : public QWidget | ||
58 | { | ||
59 | Q_OBJECT | ||
60 | public: | ||
61 | KOCalEditView( QWidget* parent=0,const char* name=0, WFlags fl=0); | ||
62 | ~KOCalEditView(); | ||
63 | |||
64 | void readConfig( KConfig *); | ||
65 | |||
66 | signals: | ||
67 | void alarmEnabled ( int cal, bool enable ); | ||
68 | void calendarEnabled ( int cal, bool enable ); | ||
69 | void calendarReadonly ( int cal, bool readonly ); | ||
70 | void setCalendarDefault ( int cal ); | ||
71 | void removeCalendar ( int cal ); | ||
72 | |||
73 | private: | ||
74 | }; | ||
75 | |||
76 | |||
77 | |||
57 | #endif // KOFILTERVIEW_H | 78 | #endif // KOFILTERVIEW_H |