summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kofilterview.cpp11
-rw-r--r--korganizer/kofilterview.h2
2 files changed, 10 insertions, 3 deletions
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index a653c18..105028a 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -90,266 +90,271 @@ KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent,
90 90
91KOFilterView::~KOFilterView() 91KOFilterView::~KOFilterView()
92{ 92{
93 // no need to delete child widgets, Qt does it all for us 93 // no need to delete child widgets, Qt does it all for us
94} 94}
95 95
96bool KOFilterView::filtersEnabled() 96bool KOFilterView::filtersEnabled()
97{ 97{
98 return mEnabledCheck->isChecked(); 98 return mEnabledCheck->isChecked();
99} 99}
100 100
101void KOFilterView::setFiltersEnabled(bool set) 101void KOFilterView::setFiltersEnabled(bool set)
102{ 102{
103 mEnabledCheck->setChecked(set); 103 mEnabledCheck->setChecked(set);
104 emit filterChanged(); 104 emit filterChanged();
105} 105}
106 106
107 107
108void KOFilterView::updateFilters() 108void KOFilterView::updateFilters()
109{ 109{
110 mSelectionCombo->clear(); 110 mSelectionCombo->clear();
111 111
112 CalFilter *filter = mFilters->first(); 112 CalFilter *filter = mFilters->first();
113 while(filter) { 113 while(filter) {
114 mSelectionCombo->insertItem(filter->name()); 114 mSelectionCombo->insertItem(filter->name());
115 filter = mFilters->next(); 115 filter = mFilters->next();
116 } 116 }
117} 117}
118 118
119CalFilter *KOFilterView::selectedFilter() 119CalFilter *KOFilterView::selectedFilter()
120{ 120{
121 CalFilter *f = mFilters->at(mSelectionCombo->currentItem()); 121 CalFilter *f = mFilters->at(mSelectionCombo->currentItem());
122 return f; 122 return f;
123} 123}
124 124
125void KOFilterView::setSelectedFilter(QString filterName) 125void KOFilterView::setSelectedFilter(QString filterName)
126{ 126{
127 int filter_num = mSelectionCombo->count(); 127 int filter_num = mSelectionCombo->count();
128 int i; 128 int i;
129 for (i=0;i<filter_num;i++) { 129 for (i=0;i<filter_num;i++) {
130 if (mSelectionCombo->text(i)==filterName) 130 if (mSelectionCombo->text(i)==filterName)
131 mSelectionCombo->setCurrentItem(i); 131 mSelectionCombo->setCurrentItem(i);
132 } 132 }
133 emit filterChanged(); 133 emit filterChanged();
134} 134}
135void KOFilterView::setSelectedFilter( int fil ) 135void KOFilterView::setSelectedFilter( int fil )
136{ 136{
137 if ( fil >= mSelectionCombo->count() ) 137 if ( fil >= mSelectionCombo->count() )
138 return; 138 return;
139 mSelectionCombo->setCurrentItem( fil ); 139 mSelectionCombo->setCurrentItem( fil );
140 emit filterChanged(); 140 emit filterChanged();
141} 141}
142 142
143 143
144 144
145KOCalEditView::KOCalEditView(QWidget* parent, 145KOCalEditView::KOCalEditView(QWidget* parent,
146 const char* name ) 146 const char* name )
147 : QScrollView(parent,name) 147 : QScrollView(parent,name)
148{ 148{
149 mw = 0; 149 mw = 0;
150 setResizePolicy( AutoOneFit ); 150 setResizePolicy( AutoOneFit );
151 setFrameStyle ( QFrame::Panel | QFrame::Plain ); 151 setFrameStyle ( QFrame::Panel | QFrame::Plain );
152 setLineWidth ( 1 ); 152 setLineWidth ( 1 );
153 setMidLineWidth ( 1 ); 153 setMidLineWidth ( 1 );
154 setFocusPolicy(NoFocus);
154} 155}
155 156
156KOCalEditView::~KOCalEditView() 157KOCalEditView::~KOCalEditView()
157{ 158{
158 // no need to delete child widgets, Qt does it all for us 159 // no need to delete child widgets, Qt does it all for us
159} 160}
160void KOCalEditView::selectCal(int id ,bool b) 161void KOCalEditView::selectCal(int id ,bool b)
161{ 162{
162 KOPrefs::instance()->getCalendar( id )->isEnabled = b; 163 KOPrefs::instance()->getCalendar( id )->isEnabled = b;
163 emit calendarEnabled ( id, b ); 164 emit calendarEnabled ( id, b );
164 emit needsUpdate(); 165 emit needsUpdate();
165 166
166} 167}
167void KOCalEditView::selectStdCal( int id, bool b ) 168void KOCalEditView::selectStdCal( int id, bool b )
168{ 169{
169 170
170 if ( !b ) { 171 if ( !b ) {
171 KOCalCheckButton* it = (KOCalCheckButton*) sender(); 172 KOCalCheckButton* it = (KOCalCheckButton*) sender();
172 if ( it ) { 173 if ( it ) {
173 it->blockSignals( true ); 174 it->blockSignals( true );
174 it->setChecked( true ); 175 it->setChecked( true );
175 it->blockSignals( false ); 176 it->blockSignals( false );
176 return; 177 return;
177 } 178 }
178 return; 179 return;
179 } 180 }
180 KOCalCheckButton* sen = (KOCalCheckButton*) sender(); 181 KOCalCheckButton* sen = (KOCalCheckButton*) sender();
181 KOCalCheckButton* it = mStdandardB.first(); 182 KOCalCheckButton* it = mStdandardB.first();
182 while ( it ) { 183 while ( it ) {
183 if ( it->isChecked() ) { 184 if ( it->isChecked() ) {
184 if ( it != sen ) { 185 if ( it != sen ) {
185 it->blockSignals( true ); 186 it->blockSignals( true );
186 it->setChecked( false ); 187 it->setChecked( false );
187 it->blockSignals( false ); 188 it->blockSignals( false );
188 break; 189 break;
189 } 190 }
190 } 191 }
191 it = mStdandardB.next(); 192 it = mStdandardB.next();
192 } 193 }
193 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 194 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
194 while ( kkf ) { 195 while ( kkf ) {
195 kkf->isStandard = false; 196 kkf->isStandard = false;
196 kkf = KOPrefs::instance()->mCalendars.next(); 197 kkf = KOPrefs::instance()->mCalendars.next();
197 } 198 }
198 KOPrefs::instance()->getCalendar( id )->isStandard = true; 199 KOPrefs::instance()->getCalendar( id )->isStandard = true;
199 emit setCalendarDefault ( id ); 200 emit setCalendarDefault ( id );
200} 201}
201 202
202void KOCalEditView::selectCalAlarm(int id ,bool b ) 203void KOCalEditView::selectCalAlarm(int id ,bool b )
203{ 204{
204 KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; 205 KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b;
205 emit alarmEnabled ( id , b ); 206 emit alarmEnabled ( id , b );
206 emit needsUpdate(); 207 emit needsUpdate();
207} 208}
208void KOCalEditView::selectReadOnly(int id ,bool b ) 209void KOCalEditView::selectReadOnly(int id ,bool b )
209{ 210{
210 KOPrefs::instance()->getCalendar( id )->isReadOnly = b; 211 KOPrefs::instance()->getCalendar( id )->isReadOnly = b;
211 emit calendarReadonly ( id , b ); 212 emit calendarReadonly ( id , b );
212 if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) { 213 if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) {
213 KOPrefs::instance()->getCalendar( id )->isStandard = false; 214 KOPrefs::instance()->getCalendar( id )->isStandard = false;
214 KOPrefs::instance()->getCalendar( 1 )->isStandard = true; 215 KOPrefs::instance()->getCalendar( 1 )->isStandard = true;
215 emit setCalendarDefault ( 1 ); 216 emit setCalendarDefault ( 1 );
216 } 217 }
217 emit needsUpdate(); 218 emit needsUpdate();
218 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 219 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
219 220
220} 221}
221void KOCalEditView::setColor( const QColor& c, int id ) 222void KOCalEditView::setColor( const QColor& c, int id )
222{ 223{
223 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; 224 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c;
224 emit needsUpdate(); 225 emit needsUpdate();
225} 226}
226void KOCalEditView::deleteCal( int id ) 227void KOCalEditView::deleteCal( int id )
227{ 228{
228 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); 229 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id );
229 QString name = kkf->mName; 230 QString name = kkf->mName;
230 QString file = kkf->mFileName; 231 QString file = kkf->mFileName;
231 if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b><tr> Do you want to remove this calendar from KO/Pi? (The file is not removed, of course!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; 232 if ( KMessageBox::warningContinueCancel( this, i18n("The calendar<tr><b>%1</b><tr>is displaying file<tr><b>%2</b><tr>Do you want to remove<tr>this calendar from KO/Pi?<tr>(The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return;
232 if ( kkf->isStandard ) 233 if ( kkf->isStandard )
233 selectStdCal( 1, true ); 234 selectStdCal( 1, true );
234 emit removeCalendar ( id ); 235 emit removeCalendar ( id );
235 KOPrefs::instance()->mCalendars.remove ( kkf ); 236 KOPrefs::instance()->mCalendars.remove ( kkf );
236 emit needsUpdate(); 237 emit needsUpdate();
237 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 238 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
238} 239}
239void KOCalEditView::infoCal( int id ) 240void KOCalEditView::infoCal( int id )
240{ 241{
241 QString name = KOPrefs::instance()->getCalendar( id )->mName; 242 QString name = KOPrefs::instance()->getCalendar( id )->mName;
242 QString file = KOPrefs::instance()->getCalendar( id )->mFileName; 243 QString file = KOPrefs::instance()->getCalendar( id )->mFileName;
243 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { 244 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) {
244 if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) { 245 if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <tr><b>%1</b><tr> is not loaded! Loading of file <tr><b>%2</b><tr> failed! <tr><b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) {
245 emit calendarAdded( id ); 246 emit calendarAdded( id );
246 emit needsUpdate(); 247 emit needsUpdate();
247 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 248 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
248 } 249 }
249 } 250 }
250 else 251 else
251 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); 252 KMessageBox::information( this, i18n("The calendar <tr><b>%1</b><tr>is displaying file<tr><b>%2</b>").arg(name).arg(file) );
252} 253}
253void KOCalEditView::readConfig() 254void KOCalEditView::readConfig()
254{ 255{
255 256
256 mStdandardB.clear(); 257 mStdandardB.clear();
257 mEnabledB.clear(); 258 mEnabledB.clear();
258 mAlarmB.clear(); 259 mAlarmB.clear();
259 mROB.clear(); 260 mROB.clear();
260 261
261 if ( mw ) delete mw; 262 if ( mw ) delete mw;
262 mw = new QWidget ( viewport() ); 263 mw = new QWidget ( viewport() );
263 addChild(mw); 264 addChild(mw);
264 265
265 mainLayout = new QGridLayout ( mw , 2, 8 ); 266 mainLayout = new QGridLayout ( mw , 2, 8 );
266 mainLayout->setMargin( 3); 267 mainLayout->setMargin( 3);
267 mainLayout->setSpacing( 2); 268 mainLayout->setSpacing( 2);
268 QPushButton * addBut = new QPushButton ( mw ); 269 QPushButton * addBut = new QPushButton ( mw );
270 addBut->setFocusPolicy(NoFocus);
269 mainLayout->addWidget( addBut,0,0 ); 271 mainLayout->addWidget( addBut,0,0 );
270 addBut->setPixmap ( SmallIcon("plus")); 272 addBut->setPixmap ( SmallIcon("plus"));
271 connect(addBut,SIGNAL(clicked()),SLOT(addCal())); 273 connect(addBut,SIGNAL(clicked()),SLOT(addCal()));
272 addBut->setMaximumWidth( addBut->sizeHint().height() ); 274 addBut->setMaximumWidth( addBut->sizeHint().height() );
273 275
274 addBut = new QPushButton ( mw ); 276 addBut = new QPushButton ( mw );
277 addBut->setFocusPolicy(NoFocus);
275 mainLayout->addWidget( addBut,0,1 ); 278 mainLayout->addWidget( addBut,0,1 );
276 addBut->setPixmap ( SmallIcon("eye")); 279 addBut->setPixmap ( SmallIcon("eye"));
277 connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); 280 connect(addBut,SIGNAL(clicked()),SLOT(enableAll()));
278 addBut->setMaximumWidth( addBut->sizeHint().height() ); 281 addBut->setMaximumWidth( addBut->sizeHint().height() );
279 282
280 QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); 283 QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw );
281 mainLayout->addWidget( lab,0,2 ); 284 mainLayout->addWidget( lab,0,2 );
282 lab = new QLabel ( i18n(" "), mw ); 285 lab = new QLabel ( i18n(" "), mw );
283 mainLayout->addWidget( lab,0,3 ); 286 mainLayout->addWidget( lab,0,3 );
284 lab->setFixedWidth( 6 ); 287 lab->setFixedWidth( 6 );
285 addBut = new QPushButton ( mw ); 288 addBut = new QPushButton ( mw );
289 addBut->setFocusPolicy(NoFocus);
286 mainLayout->addWidget( addBut,0,4 ); 290 mainLayout->addWidget( addBut,0,4 );
287 addBut->setPixmap ( SmallIcon("bell")); 291 addBut->setPixmap ( SmallIcon("bell"));
288 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); 292 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm()));
289 addBut->setMaximumWidth( addBut->sizeHint().height() ); 293 addBut->setMaximumWidth( addBut->sizeHint().height() );
290 294
291 addBut = new QPushButton ( mw ); 295 addBut = new QPushButton ( mw );
296 addBut->setFocusPolicy(NoFocus);
292 mainLayout->addWidget( addBut,0,5 ); 297 mainLayout->addWidget( addBut,0,5 );
293 addBut->setPixmap ( SmallIcon("pencil")); 298 addBut->setPixmap ( SmallIcon("pencil"));
294 connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); 299 connect(addBut,SIGNAL(clicked()),SLOT(disableRO()));
295 addBut->setMaximumWidth( addBut->sizeHint().height() ); 300 addBut->setMaximumWidth( addBut->sizeHint().height() );
296 301
297 lab = new QLabel ( i18n(" Color "), mw ); 302 lab = new QLabel ( i18n(" Color "), mw );
298 mainLayout->addWidget( lab,0,6 ); 303 mainLayout->addWidget( lab,0,6 );
299#if 0 304#if 0
300 addBut = new QPushButton ( mw ); 305 addBut = new QPushButton ( mw );
301 mainLayout->addWidget( addBut,0,6 ); 306 mainLayout->addWidget( addBut,0,6 );
302 addBut->setPixmap ( SmallIcon("minus")); 307 addBut->setPixmap ( SmallIcon("minus"));
303 connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); 308 connect(addBut,SIGNAL(clicked()),SLOT(deleteAll()));
304 addBut->setMaximumWidth( addBut->sizeHint().height() ); 309 addBut->setMaximumWidth( addBut->sizeHint().height() );
305#endif 310#endif
306 311
307 312
308 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 313 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
309 int row = 1; 314 int row = 1;
310 while ( kkf ) { 315 while ( kkf ) {
311 int iii = 0; 316 int iii = 0;
312 KOCalCheckButton* cb = new KOCalCheckButton( mw ); 317 KOCalCheckButton* cb = new KOCalCheckButton( mw );
313 mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); 318 mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb );
314 cb->setChecked( kkf->isStandard ); 319 cb->setChecked( kkf->isStandard );
315 cb->setNum( kkf->mCalNumber ); 320 cb->setNum( kkf->mCalNumber );
316 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); 321 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) );
317 if ( kkf->mErrorOnLoad || kkf->isReadOnly ) 322 if ( kkf->mErrorOnLoad || kkf->isReadOnly )
318 cb->setEnabled( false ); 323 cb->setEnabled( false );
319 cb = new KOCalCheckButton( mw ); 324 cb = new KOCalCheckButton( mw );
320 mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); 325 mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb );
321 cb->setChecked( kkf->isEnabled ); 326 cb->setChecked( kkf->isEnabled );
322 cb->setNum( kkf->mCalNumber ); 327 cb->setNum( kkf->mCalNumber );
323 if ( kkf->mErrorOnLoad ) 328 if ( kkf->mErrorOnLoad )
324 cb->setEnabled( false ); 329 cb->setEnabled( false );
325 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); 330 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) );
326 KOCalButton* name = new KOCalButton( mw ); 331 KOCalButton* name = new KOCalButton( mw );
327 name->setNum( kkf->mCalNumber ); 332 name->setNum( kkf->mCalNumber );
328 name->setText( kkf->mName ); 333 name->setText( kkf->mName );
329 mainLayout->addWidget( name,row,++iii ); 334 mainLayout->addWidget( name,row,++iii );
330 connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); 335 connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) );
331 lab = new QLabel ( i18n(" "), mw ); 336 lab = new QLabel ( i18n(" "), mw );
332 mainLayout->addWidget( lab,row,++iii ); 337 mainLayout->addWidget( lab,row,++iii );
333 cb = new KOCalCheckButton( mw ); 338 cb = new KOCalCheckButton( mw );
334 mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb ); 339 mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb );
335 cb->setChecked( kkf->isAlarmEnabled ); 340 cb->setChecked( kkf->isAlarmEnabled );
336 cb->setNum( kkf->mCalNumber ); 341 cb->setNum( kkf->mCalNumber );
337 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); 342 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) );
338 if ( kkf->mErrorOnLoad ) 343 if ( kkf->mErrorOnLoad )
339 cb->setEnabled( false ); 344 cb->setEnabled( false );
340 cb = new KOCalCheckButton( mw ); 345 cb = new KOCalCheckButton( mw );
341 mainLayout->addWidget( cb,row,++iii );mROB.append( cb ); 346 mainLayout->addWidget( cb,row,++iii );mROB.append( cb );
342 cb->setChecked( kkf->isReadOnly ); 347 cb->setChecked( kkf->isReadOnly );
343 cb->setNum( kkf->mCalNumber ); 348 cb->setNum( kkf->mCalNumber );
344 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); 349 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) );
345 if ( kkf->mErrorOnLoad ) 350 if ( kkf->mErrorOnLoad )
346 cb->setEnabled( false ); 351 cb->setEnabled( false );
347 if ( row > 1) { 352 if ( row > 1) {
348 KColorButton *colb = new KColorButton( mw ); 353 KColorButton *colb = new KColorButton( mw );
349 mainLayout->addWidget( colb,row,++iii ); 354 mainLayout->addWidget( colb,row,++iii );
350 colb->setID( kkf->mCalNumber ); 355 colb->setID( kkf->mCalNumber );
351 colb->setColor( kkf->mDefaultColor ); 356 colb->setColor( kkf->mDefaultColor );
352 connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); 357 connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) );
353 KOCalButton* calb = new KOCalButton( mw ); 358 KOCalButton* calb = new KOCalButton( mw );
354 mainLayout->addWidget( calb,row,++iii ); 359 mainLayout->addWidget( calb,row,++iii );
355 calb->setNum( kkf->mCalNumber ); 360 calb->setNum( kkf->mCalNumber );
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h
index e2ebdd4..3ab316f 100644
--- a/korganizer/kofilterview.h
+++ b/korganizer/kofilterview.h
@@ -1,135 +1,137 @@
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#include <qcheckbox.h> 27#include <qcheckbox.h>
28#include <qscrollview.h> 28#include <qscrollview.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <kconfig.h> 30#include <kconfig.h>
31#include "kofilterview_base.h" 31#include "kofilterview_base.h"
32 32
33#include <libkcal/calfilter.h> 33#include <libkcal/calfilter.h>
34 34
35class QGridLayout; 35class QGridLayout;
36 36
37using namespace KCal; 37using namespace KCal;
38class KOCalButton : public QPushButton 38class KOCalButton : public QPushButton
39{ 39{
40 Q_OBJECT 40 Q_OBJECT
41 public: 41 public:
42 KOCalButton( QWidget *parent=0, const char *name=0 ) : 42 KOCalButton( QWidget *parent=0, const char *name=0 ) :
43 QPushButton( parent, name) 43 QPushButton( parent, name)
44 { 44 {
45 connect( this, SIGNAL( clicked() ), 45 connect( this, SIGNAL( clicked() ),
46 SLOT( bottonClicked() )); 46 SLOT( bottonClicked() ));
47 mNumber = -1; 47 mNumber = -1;
48 setFocusPolicy(NoFocus);
48 } 49 }
49 void setNum ( int num ) {mNumber = num; } 50 void setNum ( int num ) {mNumber = num; }
50 signals: 51 signals:
51 void selectNum ( int ); 52 void selectNum ( int );
52private: 53private:
53 int mNumber; 54 int mNumber;
54 void keyPressEvent ( QKeyEvent * e ) 55 void keyPressEvent ( QKeyEvent * e )
55 { 56 {
56 e->ignore(); 57 e->ignore();
57 } 58 }
58 59
59private slots : 60private slots :
60 void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); } 61 void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); }
61}; 62};
62class KOCalCheckButton : public QCheckBox 63class KOCalCheckButton : public QCheckBox
63{ 64{
64 Q_OBJECT 65 Q_OBJECT
65 public: 66 public:
66 KOCalCheckButton( QWidget *parent=0, const char *name=0 ) : 67 KOCalCheckButton( QWidget *parent=0, const char *name=0 ) :
67 QCheckBox( parent, name) 68 QCheckBox( parent, name)
68 { 69 {
69 connect( this, SIGNAL( toggled ( bool ) ), 70 connect( this, SIGNAL( toggled ( bool ) ),
70 SLOT( bottonClicked( bool ) )); 71 SLOT( bottonClicked( bool ) ));
71 mNumber = -1; 72 mNumber = -1;
73 setFocusPolicy(NoFocus);
72 //setMaximumWidth( 10 ); 74 //setMaximumWidth( 10 );
73 75
74 } 76 }
75 void setNum ( int num ) {mNumber = num; } 77 void setNum ( int num ) {mNumber = num; }
76 signals: 78 signals:
77 void selectNum ( int, bool ); 79 void selectNum ( int, bool );
78private: 80private:
79 int mNumber; 81 int mNumber;
80 void keyPressEvent ( QKeyEvent * e ) 82 void keyPressEvent ( QKeyEvent * e )
81 { 83 {
82 e->ignore(); 84 e->ignore();
83 } 85 }
84 86
85private slots : 87private slots :
86 void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } 88 void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); }
87}; 89};
88 90
89 91
90 92
91class KOFilterView : public KOFilterView_base 93class KOFilterView : public KOFilterView_base
92{ 94{
93 Q_OBJECT 95 Q_OBJECT
94 public: 96 public:
95 KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); 97 KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0);
96 ~KOFilterView(); 98 ~KOFilterView();
97 99
98 void updateFilters(); 100 void updateFilters();
99 101
100 bool filtersEnabled(); 102 bool filtersEnabled();
101 void setFiltersEnabled(bool); 103 void setFiltersEnabled(bool);
102 CalFilter *selectedFilter(); 104 CalFilter *selectedFilter();
103 void setSelectedFilter(QString); 105 void setSelectedFilter(QString);
104 void setSelectedFilter( int ); 106 void setSelectedFilter( int );
105 107
106 signals: 108 signals:
107 void filterChanged(); 109 void filterChanged();
108 void editFilters(); 110 void editFilters();
109 111
110 private: 112 private:
111 QPtrList<CalFilter> *mFilters; 113 QPtrList<CalFilter> *mFilters;
112}; 114};
113 115
114class KOCalEditView : public QScrollView 116class KOCalEditView : public QScrollView
115{ 117{
116 Q_OBJECT 118 Q_OBJECT
117 public: 119 public:
118 KOCalEditView( QWidget* parent=0,const char* name=0); 120 KOCalEditView( QWidget* parent=0,const char* name=0);
119 ~KOCalEditView(); 121 ~KOCalEditView();
120 122
121 public slots: 123 public slots:
122 void addCal(); 124 void addCal();
123 void enableAll(); 125 void enableAll();
124 void enableAlarm(); 126 void enableAlarm();
125 void disableRO(); 127 void disableRO();
126 void deleteAll(); 128 void deleteAll();
127 void selectStdCal(int,bool ); 129 void selectStdCal(int,bool );
128 void selectCal(int,bool ); 130 void selectCal(int,bool );
129 void selectCalAlarm(int,bool ); 131 void selectCalAlarm(int,bool );
130 void selectReadOnly(int,bool ); 132 void selectReadOnly(int,bool );
131 void setColor(const QColor &,int) ; 133 void setColor(const QColor &,int) ;
132 void deleteCal(int) ; 134 void deleteCal(int) ;
133 void infoCal(int) ; 135 void infoCal(int) ;
134 void readConfig(); 136 void readConfig();
135 signals: 137 signals: