-rw-r--r-- | korganizer/kofilterview.cpp | 48 | ||||
-rw-r--r-- | korganizer/kofilterview.h | 4 |
2 files changed, 30 insertions, 22 deletions
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index 3333ac2..52bc463 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp | |||
@@ -51,362 +51,370 @@ class KONewCalPrefs : public QDialog | |||
51 | setCaption( i18n("Add new Calendar") ); | 51 | setCaption( i18n("Add new Calendar") ); |
52 | QVBoxLayout* lay = new QVBoxLayout( this ); | 52 | QVBoxLayout* lay = new QVBoxLayout( this ); |
53 | lay->setSpacing( 3 ); | 53 | lay->setSpacing( 3 ); |
54 | lay->setMargin( 3 ); | 54 | lay->setMargin( 3 ); |
55 | QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this ); | 55 | QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this ); |
56 | lay->addWidget( lab ); | 56 | lay->addWidget( lab ); |
57 | nameE = new KLineEdit( this ); | 57 | nameE = new KLineEdit( this ); |
58 | lay->addWidget( nameE ); | 58 | lay->addWidget( nameE ); |
59 | lab = new QLabel( i18n("Local ical (*.ics) file:"), this ); | 59 | lab = new QLabel( i18n("Local ical (*.ics) file:"), this ); |
60 | lay->addWidget( lab ); | 60 | lay->addWidget( lab ); |
61 | url = new KURLRequester ( this ); | 61 | url = new KURLRequester ( this ); |
62 | lay->addWidget( url ); | 62 | lay->addWidget( url ); |
63 | QPushButton * ok = new QPushButton( i18n("OK"), this ); | 63 | QPushButton * ok = new QPushButton( i18n("OK"), this ); |
64 | lay->addWidget( ok ); | 64 | lay->addWidget( ok ); |
65 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 65 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
66 | lay->addWidget( cancel ); | 66 | lay->addWidget( cancel ); |
67 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 67 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
68 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 68 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
69 | //resize( 200, 200 ); | 69 | //resize( 200, 200 ); |
70 | } | 70 | } |
71 | 71 | ||
72 | QString calName() { return nameE->text(); } | 72 | QString calName() { return nameE->text(); } |
73 | QString calFileName() { return url->url(); } | 73 | QString calFileName() { return url->url(); } |
74 | private: | 74 | private: |
75 | KLineEdit* nameE; | 75 | KLineEdit* nameE; |
76 | KURLRequester *url; | 76 | KURLRequester *url; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | 79 | ||
80 | KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, | 80 | KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, |
81 | const char* name,WFlags fl ) | 81 | const char* name,WFlags fl ) |
82 | : KOFilterView_base(parent,name,fl) | 82 | : KOFilterView_base(parent,name,fl) |
83 | { | 83 | { |
84 | mFilters = filterList; | 84 | mFilters = filterList; |
85 | 85 | ||
86 | connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); | 86 | connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); |
87 | connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); | 87 | connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); |
88 | connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); | 88 | connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); |
89 | } | 89 | } |
90 | 90 | ||
91 | KOFilterView::~KOFilterView() | 91 | KOFilterView::~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 | ||
96 | bool KOFilterView::filtersEnabled() | 96 | bool KOFilterView::filtersEnabled() |
97 | { | 97 | { |
98 | return mEnabledCheck->isChecked(); | 98 | return mEnabledCheck->isChecked(); |
99 | } | 99 | } |
100 | 100 | ||
101 | void KOFilterView::setFiltersEnabled(bool set) | 101 | void 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 | ||
108 | void KOFilterView::updateFilters() | 108 | void 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 | ||
119 | CalFilter *KOFilterView::selectedFilter() | 119 | CalFilter *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 | ||
125 | void KOFilterView::setSelectedFilter(QString filterName) | 125 | void 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 | } |
135 | void KOFilterView::setSelectedFilter( int fil ) | 135 | void 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 | ||
145 | KOCalEditView::KOCalEditView(QWidget* parent, | 145 | KOCalEditView::KOCalEditView(QWidget* parent, |
146 | const char* name ) | 146 | const char* name ) |
147 | : QWidget(parent,name) | 147 | : QScrollView(parent,name) |
148 | { | 148 | { |
149 | mw = 0; | 149 | mw = 0; |
150 | ml = new QVBoxLayout ( this ); | 150 | setResizePolicy( AutoOneFit ); |
151 | setFrameStyle ( QFrame::Panel | QFrame::Plain ); | ||
152 | setLineWidth ( 1 ); | ||
153 | setMidLineWidth ( 1 ); | ||
151 | } | 154 | } |
152 | 155 | ||
153 | KOCalEditView::~KOCalEditView() | 156 | KOCalEditView::~KOCalEditView() |
154 | { | 157 | { |
155 | // no need to delete child widgets, Qt does it all for us | 158 | // no need to delete child widgets, Qt does it all for us |
156 | } | 159 | } |
157 | void KOCalEditView::selectCal(int id ,bool b) | 160 | void KOCalEditView::selectCal(int id ,bool b) |
158 | { | 161 | { |
159 | KOPrefs::instance()->getCalendar( id )->isEnabled = b; | 162 | KOPrefs::instance()->getCalendar( id )->isEnabled = b; |
160 | emit calendarEnabled ( id, b ); | 163 | emit calendarEnabled ( id, b ); |
161 | emit needsUpdate(); | 164 | emit needsUpdate(); |
162 | 165 | ||
163 | } | 166 | } |
164 | void KOCalEditView::selectStdCal( int id, bool b ) | 167 | void KOCalEditView::selectStdCal( int id, bool b ) |
165 | { | 168 | { |
166 | 169 | ||
167 | if ( !b ) { | 170 | if ( !b ) { |
168 | KOCalCheckButton* it = (KOCalCheckButton*) sender(); | 171 | KOCalCheckButton* it = (KOCalCheckButton*) sender(); |
169 | if ( it ) { | 172 | if ( it ) { |
170 | it->blockSignals( true ); | 173 | it->blockSignals( true ); |
171 | it->setChecked( true ); | 174 | it->setChecked( true ); |
172 | it->blockSignals( false ); | 175 | it->blockSignals( false ); |
173 | return; | 176 | return; |
174 | } | 177 | } |
175 | return; | 178 | return; |
176 | } | 179 | } |
177 | KOCalCheckButton* sen = (KOCalCheckButton*) sender(); | 180 | KOCalCheckButton* sen = (KOCalCheckButton*) sender(); |
178 | KOCalCheckButton* it = mStdandardB.first(); | 181 | KOCalCheckButton* it = mStdandardB.first(); |
179 | while ( it ) { | 182 | while ( it ) { |
180 | if ( it->isChecked() ) { | 183 | if ( it->isChecked() ) { |
181 | if ( it != sen ) { | 184 | if ( it != sen ) { |
182 | it->blockSignals( true ); | 185 | it->blockSignals( true ); |
183 | it->setChecked( false ); | 186 | it->setChecked( false ); |
184 | it->blockSignals( false ); | 187 | it->blockSignals( false ); |
185 | break; | 188 | break; |
186 | } | 189 | } |
187 | } | 190 | } |
188 | it = mStdandardB.next(); | 191 | it = mStdandardB.next(); |
189 | } | 192 | } |
190 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 193 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
191 | while ( kkf ) { | 194 | while ( kkf ) { |
192 | kkf->isStandard = false; | 195 | kkf->isStandard = false; |
193 | kkf = KOPrefs::instance()->mCalendars.next(); | 196 | kkf = KOPrefs::instance()->mCalendars.next(); |
194 | } | 197 | } |
195 | KOPrefs::instance()->getCalendar( id )->isStandard = true; | 198 | KOPrefs::instance()->getCalendar( id )->isStandard = true; |
196 | emit setCalendarDefault ( id ); | 199 | emit setCalendarDefault ( id ); |
197 | } | 200 | } |
198 | 201 | ||
199 | void KOCalEditView::selectCalAlarm(int id ,bool b ) | 202 | void KOCalEditView::selectCalAlarm(int id ,bool b ) |
200 | { | 203 | { |
201 | KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; | 204 | KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; |
202 | emit alarmEnabled ( id , b ); | 205 | emit alarmEnabled ( id , b ); |
203 | emit needsUpdate(); | 206 | emit needsUpdate(); |
204 | } | 207 | } |
205 | void KOCalEditView::selectReadOnly(int id ,bool b ) | 208 | void KOCalEditView::selectReadOnly(int id ,bool b ) |
206 | { | 209 | { |
207 | KOPrefs::instance()->getCalendar( id )->isReadOnly = b; | 210 | KOPrefs::instance()->getCalendar( id )->isReadOnly = b; |
208 | emit calendarReadonly ( id , b ); | 211 | emit calendarReadonly ( id , b ); |
209 | if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) { | 212 | if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) { |
210 | KOPrefs::instance()->getCalendar( id )->isStandard = false; | 213 | KOPrefs::instance()->getCalendar( id )->isStandard = false; |
211 | KOPrefs::instance()->getCalendar( 1 )->isStandard = true; | 214 | KOPrefs::instance()->getCalendar( 1 )->isStandard = true; |
212 | emit setCalendarDefault ( 1 ); | 215 | emit setCalendarDefault ( 1 ); |
213 | } | 216 | } |
214 | emit needsUpdate(); | 217 | emit needsUpdate(); |
215 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); | 218 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); |
216 | 219 | ||
217 | } | 220 | } |
218 | void KOCalEditView::setColor( const QColor& c, int id ) | 221 | void KOCalEditView::setColor( const QColor& c, int id ) |
219 | { | 222 | { |
220 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; | 223 | KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; |
221 | emit needsUpdate(); | 224 | emit needsUpdate(); |
222 | } | 225 | } |
223 | void KOCalEditView::deleteCal( int id ) | 226 | void KOCalEditView::deleteCal( int id ) |
224 | { | 227 | { |
225 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); | 228 | KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); |
226 | QString name = kkf->mName; | 229 | QString name = kkf->mName; |
227 | QString file = kkf->mFileName; | 230 | QString file = kkf->mFileName; |
228 | 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; | 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; |
229 | if ( kkf->isStandard ) | 232 | if ( kkf->isStandard ) |
230 | selectStdCal( 1, true ); | 233 | selectStdCal( 1, true ); |
231 | emit removeCalendar ( id ); | 234 | emit removeCalendar ( id ); |
232 | KOPrefs::instance()->mCalendars.remove ( kkf ); | 235 | KOPrefs::instance()->mCalendars.remove ( kkf ); |
233 | emit needsUpdate(); | 236 | emit needsUpdate(); |
234 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); | 237 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); |
235 | } | 238 | } |
236 | void KOCalEditView::infoCal( int id ) | 239 | void KOCalEditView::infoCal( int id ) |
237 | { | 240 | { |
238 | QString name = KOPrefs::instance()->getCalendar( id )->mName; | 241 | QString name = KOPrefs::instance()->getCalendar( id )->mName; |
239 | QString file = KOPrefs::instance()->getCalendar( id )->mFileName; | 242 | QString file = KOPrefs::instance()->getCalendar( id )->mFileName; |
240 | if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { | 243 | if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { |
241 | 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) ) ) { | 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) ) ) { |
242 | emit calendarAdded( id ); | 245 | emit calendarAdded( id ); |
243 | emit needsUpdate(); | 246 | emit needsUpdate(); |
244 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); | 247 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); |
245 | } | 248 | } |
246 | } | 249 | } |
247 | else | 250 | else |
248 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); | 251 | KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); |
249 | } | 252 | } |
250 | void KOCalEditView::readConfig() | 253 | void KOCalEditView::readConfig() |
251 | { | 254 | { |
252 | 255 | ||
253 | mStdandardB.clear(); | 256 | mStdandardB.clear(); |
254 | mEnabledB.clear(); | 257 | mEnabledB.clear(); |
255 | mAlarmB.clear(); | 258 | mAlarmB.clear(); |
256 | mROB.clear(); | 259 | mROB.clear(); |
257 | 260 | ||
258 | if ( mw ) delete mw; | 261 | if ( mw ) delete mw; |
259 | mw = new QWidget ( this ); | 262 | mw = new QWidget ( viewport() ); |
260 | ml->addWidget ( mw ); | 263 | addChild(mw); |
261 | 264 | ||
262 | mainLayout = new QGridLayout ( mw , 2, 8 ); | 265 | mainLayout = new QGridLayout ( mw , 2, 8 ); |
263 | //mainLayout->setSpacing( 3 ); | 266 | mainLayout->setMargin( 3); |
267 | mainLayout->setSpacing( 2); | ||
264 | QPushButton * addBut = new QPushButton ( mw ); | 268 | QPushButton * addBut = new QPushButton ( mw ); |
265 | mainLayout->addWidget( addBut,0,0 ); | 269 | mainLayout->addWidget( addBut,0,0 ); |
266 | addBut->setPixmap ( SmallIcon("plus")); | 270 | addBut->setPixmap ( SmallIcon("plus")); |
267 | connect(addBut,SIGNAL(clicked()),SLOT(addCal())); | 271 | connect(addBut,SIGNAL(clicked()),SLOT(addCal())); |
268 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 272 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
269 | 273 | ||
270 | addBut = new QPushButton ( mw ); | 274 | addBut = new QPushButton ( mw ); |
271 | mainLayout->addWidget( addBut,0,1 ); | 275 | mainLayout->addWidget( addBut,0,1 ); |
272 | addBut->setPixmap ( SmallIcon("eye")); | 276 | addBut->setPixmap ( SmallIcon("eye")); |
273 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); | 277 | connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); |
274 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 278 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
275 | 279 | ||
276 | QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", mw ); | 280 | QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); |
277 | mainLayout->addWidget( lab,0,2 ); | 281 | mainLayout->addWidget( lab,0,2 ); |
278 | 282 | lab = new QLabel ( i18n(" "), mw ); | |
283 | mainLayout->addWidget( lab,0,3 ); | ||
284 | lab->setFixedWidth( 6 ); | ||
279 | addBut = new QPushButton ( mw ); | 285 | addBut = new QPushButton ( mw ); |
280 | mainLayout->addWidget( addBut,0,3 ); | 286 | mainLayout->addWidget( addBut,0,4 ); |
281 | addBut->setPixmap ( SmallIcon("bell")); | 287 | addBut->setPixmap ( SmallIcon("bell")); |
282 | connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); | 288 | connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); |
283 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 289 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
284 | 290 | ||
285 | addBut = new QPushButton ( mw ); | 291 | addBut = new QPushButton ( mw ); |
286 | mainLayout->addWidget( addBut,0,4 ); | 292 | mainLayout->addWidget( addBut,0,5 ); |
287 | addBut->setPixmap ( SmallIcon("pencil")); | 293 | addBut->setPixmap ( SmallIcon("pencil")); |
288 | connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); | 294 | connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); |
289 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 295 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
290 | 296 | ||
291 | lab = new QLabel ( i18n(" Color "), mw ); | 297 | lab = new QLabel ( i18n(" Color "), mw ); |
292 | mainLayout->addWidget( lab,0,5 ); | 298 | mainLayout->addWidget( lab,0,6 ); |
293 | #if 0 | 299 | #if 0 |
294 | addBut = new QPushButton ( mw ); | 300 | addBut = new QPushButton ( mw ); |
295 | mainLayout->addWidget( addBut,0,6 ); | 301 | mainLayout->addWidget( addBut,0,6 ); |
296 | addBut->setPixmap ( SmallIcon("minus")); | 302 | addBut->setPixmap ( SmallIcon("minus")); |
297 | connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); | 303 | connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); |
298 | addBut->setMaximumWidth( addBut->sizeHint().height() ); | 304 | addBut->setMaximumWidth( addBut->sizeHint().height() ); |
299 | #endif | 305 | #endif |
300 | 306 | ||
301 | 307 | ||
302 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 308 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
303 | int row = 1; | 309 | int row = 1; |
304 | while ( kkf ) { | 310 | while ( kkf ) { |
305 | 311 | int iii = 0; | |
306 | KOCalCheckButton* cb = new KOCalCheckButton( mw ); | 312 | KOCalCheckButton* cb = new KOCalCheckButton( mw ); |
307 | mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); | 313 | mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); |
308 | cb->setChecked( kkf->isStandard ); | 314 | cb->setChecked( kkf->isStandard ); |
309 | cb->setNum( kkf->mCalNumber ); | 315 | cb->setNum( kkf->mCalNumber ); |
310 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); | 316 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); |
311 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) | 317 | if ( kkf->mErrorOnLoad || kkf->isReadOnly ) |
312 | cb->setEnabled( false ); | 318 | cb->setEnabled( false ); |
313 | cb = new KOCalCheckButton( mw ); | 319 | cb = new KOCalCheckButton( mw ); |
314 | mainLayout->addWidget( cb,row,1 );mEnabledB.append( cb ); | 320 | mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); |
315 | cb->setChecked( kkf->isEnabled ); | 321 | cb->setChecked( kkf->isEnabled ); |
316 | cb->setNum( kkf->mCalNumber ); | 322 | cb->setNum( kkf->mCalNumber ); |
317 | if ( kkf->mErrorOnLoad ) | 323 | if ( kkf->mErrorOnLoad ) |
318 | cb->setEnabled( false ); | 324 | cb->setEnabled( false ); |
319 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); | 325 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); |
320 | KOCalButton* name = new KOCalButton( mw ); | 326 | KOCalButton* name = new KOCalButton( mw ); |
321 | name->setNum( kkf->mCalNumber ); | 327 | name->setNum( kkf->mCalNumber ); |
322 | name->setText( kkf->mName ); | 328 | name->setText( kkf->mName ); |
323 | mainLayout->addWidget( name,row,2 ); | 329 | mainLayout->addWidget( name,row,++iii ); |
324 | connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); | 330 | connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); |
331 | lab = new QLabel ( i18n(" "), mw ); | ||
332 | mainLayout->addWidget( lab,row,++iii ); | ||
325 | cb = new KOCalCheckButton( mw ); | 333 | cb = new KOCalCheckButton( mw ); |
326 | mainLayout->addWidget( cb,row,3 );mAlarmB.append( cb ); | 334 | mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb ); |
327 | cb->setChecked( kkf->isAlarmEnabled ); | 335 | cb->setChecked( kkf->isAlarmEnabled ); |
328 | cb->setNum( kkf->mCalNumber ); | 336 | cb->setNum( kkf->mCalNumber ); |
329 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); | 337 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); |
330 | if ( kkf->mErrorOnLoad ) | 338 | if ( kkf->mErrorOnLoad ) |
331 | cb->setEnabled( false ); | 339 | cb->setEnabled( false ); |
332 | cb = new KOCalCheckButton( mw ); | 340 | cb = new KOCalCheckButton( mw ); |
333 | mainLayout->addWidget( cb,row,4 );mROB.append( cb ); | 341 | mainLayout->addWidget( cb,row,++iii );mROB.append( cb ); |
334 | cb->setChecked( kkf->isReadOnly ); | 342 | cb->setChecked( kkf->isReadOnly ); |
335 | cb->setNum( kkf->mCalNumber ); | 343 | cb->setNum( kkf->mCalNumber ); |
336 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); | 344 | connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); |
337 | if ( kkf->mErrorOnLoad ) | 345 | if ( kkf->mErrorOnLoad ) |
338 | cb->setEnabled( false ); | 346 | cb->setEnabled( false ); |
339 | KColorButton *colb = new KColorButton( mw ); | 347 | KColorButton *colb = new KColorButton( mw ); |
340 | mainLayout->addWidget( colb,row,5 ); | 348 | mainLayout->addWidget( colb,row,++iii ); |
341 | colb->setID( kkf->mCalNumber ); | 349 | colb->setID( kkf->mCalNumber ); |
342 | colb->setColor( kkf->mDefaultColor ); | 350 | colb->setColor( kkf->mDefaultColor ); |
343 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); | 351 | connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); |
344 | if ( row > 1) { | 352 | if ( row > 1) { |
345 | KOCalButton* calb = new KOCalButton( mw ); | 353 | KOCalButton* calb = new KOCalButton( mw ); |
346 | mainLayout->addWidget( calb,row,6 ); | 354 | mainLayout->addWidget( calb,row,++iii ); |
347 | calb->setNum( kkf->mCalNumber ); | 355 | calb->setNum( kkf->mCalNumber ); |
348 | calb->setPixmap ( SmallIcon("minus")); | 356 | calb->setPixmap ( SmallIcon("minus")); |
349 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); | 357 | connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); |
350 | int hei = calb->sizeHint().height(); | 358 | int hei = calb->sizeHint().height(); |
351 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); | 359 | //calb->setMaximumSize( hei*9/10, hei*9/10 ); |
352 | } | 360 | } |
353 | ++row; | 361 | ++row; |
354 | kkf = KOPrefs::instance()->mCalendars.next(); | 362 | kkf = KOPrefs::instance()->mCalendars.next(); |
355 | } | 363 | } |
356 | lab = new QLabel ( "", mw ); | 364 | lab = new QLabel ( "", mw ); |
357 | mainLayout->addWidget( lab,row,0 ); | 365 | mainLayout->addWidget( lab,row,0 ); |
358 | mw->show(); | 366 | mw->show(); |
359 | 367 | ||
360 | } | 368 | } |
361 | void KOCalEditView::addCal() | 369 | void KOCalEditView::addCal() |
362 | { | 370 | { |
363 | KONewCalPrefs prefs ( this ); | 371 | KONewCalPrefs prefs ( this ); |
364 | if ( ! prefs.exec() ) | 372 | if ( ! prefs.exec() ) |
365 | return; | 373 | return; |
366 | QString name = prefs.calName(); | 374 | QString name = prefs.calName(); |
367 | QString file = prefs.calFileName(); | 375 | QString file = prefs.calFileName(); |
368 | QFileInfo fi ( file ); | 376 | QFileInfo fi ( file ); |
369 | if (!fi.exists() ) { | 377 | if (!fi.exists() ) { |
370 | KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!")); | 378 | KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!")); |
371 | return; | 379 | return; |
372 | } | 380 | } |
373 | KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); | 381 | KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); |
374 | kkf->mName = name; | 382 | kkf->mName = name; |
375 | kkf->mFileName = file; | 383 | kkf->mFileName = file; |
376 | emit calendarAdded( kkf->mCalNumber ); | 384 | emit calendarAdded( kkf->mCalNumber ); |
377 | emit needsUpdate(); | 385 | emit needsUpdate(); |
378 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); | 386 | QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); |
379 | } | 387 | } |
380 | void KOCalEditView::enableAll() | 388 | void KOCalEditView::enableAll() |
381 | { | 389 | { |
382 | toggleList( mEnabledB ); | 390 | toggleList( mEnabledB ); |
383 | } | 391 | } |
384 | void KOCalEditView::enableAlarm() | 392 | void KOCalEditView::enableAlarm() |
385 | { | 393 | { |
386 | toggleList( mAlarmB ); | 394 | toggleList( mAlarmB ); |
387 | } | 395 | } |
388 | void KOCalEditView::disableRO() | 396 | void KOCalEditView::disableRO() |
389 | { | 397 | { |
390 | toggleList( mROB ); | 398 | toggleList( mROB ); |
391 | } | 399 | } |
392 | void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) | 400 | void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) |
393 | { | 401 | { |
394 | bool dis = false; | 402 | bool dis = false; |
395 | KOCalCheckButton* it = list.first(); | 403 | KOCalCheckButton* it = list.first(); |
396 | while ( it ) { | 404 | while ( it ) { |
397 | if ( !it->isChecked() ) { | 405 | if ( !it->isChecked() ) { |
398 | dis = true; | 406 | dis = true; |
399 | break; | 407 | break; |
400 | } | 408 | } |
401 | it = list.next(); | 409 | it = list.next(); |
402 | } | 410 | } |
403 | it = list.first(); | 411 | it = list.first(); |
404 | while ( it ) { | 412 | while ( it ) { |
405 | it->setChecked(dis); | 413 | it->setChecked(dis); |
406 | it = list.next(); | 414 | it = list.next(); |
407 | } | 415 | } |
408 | } | 416 | } |
409 | void KOCalEditView::deleteAll() | 417 | void KOCalEditView::deleteAll() |
410 | { | 418 | { |
411 | qDebug("delteAll"); | 419 | qDebug("delteAll"); |
412 | } | 420 | } |
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h index 1849e36..e2ebdd4 100644 --- a/korganizer/kofilterview.h +++ b/korganizer/kofilterview.h | |||
@@ -1,156 +1,156 @@ | |||
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 <qpushbutton.h> | 29 | #include <qpushbutton.h> |
29 | #include <kconfig.h> | 30 | #include <kconfig.h> |
30 | #include "kofilterview_base.h" | 31 | #include "kofilterview_base.h" |
31 | 32 | ||
32 | #include <libkcal/calfilter.h> | 33 | #include <libkcal/calfilter.h> |
33 | 34 | ||
34 | class QGridLayout; | 35 | class QGridLayout; |
35 | 36 | ||
36 | using namespace KCal; | 37 | using namespace KCal; |
37 | class KOCalButton : public QPushButton | 38 | class KOCalButton : public QPushButton |
38 | { | 39 | { |
39 | Q_OBJECT | 40 | Q_OBJECT |
40 | public: | 41 | public: |
41 | KOCalButton( QWidget *parent=0, const char *name=0 ) : | 42 | KOCalButton( QWidget *parent=0, const char *name=0 ) : |
42 | QPushButton( parent, name) | 43 | QPushButton( parent, name) |
43 | { | 44 | { |
44 | connect( this, SIGNAL( clicked() ), | 45 | connect( this, SIGNAL( clicked() ), |
45 | SLOT( bottonClicked() )); | 46 | SLOT( bottonClicked() )); |
46 | mNumber = -1; | 47 | mNumber = -1; |
47 | } | 48 | } |
48 | void setNum ( int num ) {mNumber = num; } | 49 | void setNum ( int num ) {mNumber = num; } |
49 | signals: | 50 | signals: |
50 | void selectNum ( int ); | 51 | void selectNum ( int ); |
51 | private: | 52 | private: |
52 | int mNumber; | 53 | int mNumber; |
53 | void keyPressEvent ( QKeyEvent * e ) | 54 | void keyPressEvent ( QKeyEvent * e ) |
54 | { | 55 | { |
55 | e->ignore(); | 56 | e->ignore(); |
56 | } | 57 | } |
57 | 58 | ||
58 | private slots : | 59 | private slots : |
59 | void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); } | 60 | void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); } |
60 | }; | 61 | }; |
61 | class KOCalCheckButton : public QCheckBox | 62 | class KOCalCheckButton : public QCheckBox |
62 | { | 63 | { |
63 | Q_OBJECT | 64 | Q_OBJECT |
64 | public: | 65 | public: |
65 | KOCalCheckButton( QWidget *parent=0, const char *name=0 ) : | 66 | KOCalCheckButton( QWidget *parent=0, const char *name=0 ) : |
66 | QCheckBox( parent, name) | 67 | QCheckBox( parent, name) |
67 | { | 68 | { |
68 | connect( this, SIGNAL( toggled ( bool ) ), | 69 | connect( this, SIGNAL( toggled ( bool ) ), |
69 | SLOT( bottonClicked( bool ) )); | 70 | SLOT( bottonClicked( bool ) )); |
70 | mNumber = -1; | 71 | mNumber = -1; |
71 | //setMaximumWidth( 10 ); | 72 | //setMaximumWidth( 10 ); |
72 | 73 | ||
73 | } | 74 | } |
74 | void setNum ( int num ) {mNumber = num; } | 75 | void setNum ( int num ) {mNumber = num; } |
75 | signals: | 76 | signals: |
76 | void selectNum ( int, bool ); | 77 | void selectNum ( int, bool ); |
77 | private: | 78 | private: |
78 | int mNumber; | 79 | int mNumber; |
79 | void keyPressEvent ( QKeyEvent * e ) | 80 | void keyPressEvent ( QKeyEvent * e ) |
80 | { | 81 | { |
81 | e->ignore(); | 82 | e->ignore(); |
82 | } | 83 | } |
83 | 84 | ||
84 | private slots : | 85 | private slots : |
85 | void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } | 86 | void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } |
86 | }; | 87 | }; |
87 | 88 | ||
88 | 89 | ||
89 | 90 | ||
90 | class KOFilterView : public KOFilterView_base | 91 | class KOFilterView : public KOFilterView_base |
91 | { | 92 | { |
92 | Q_OBJECT | 93 | Q_OBJECT |
93 | public: | 94 | public: |
94 | KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); | 95 | KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); |
95 | ~KOFilterView(); | 96 | ~KOFilterView(); |
96 | 97 | ||
97 | void updateFilters(); | 98 | void updateFilters(); |
98 | 99 | ||
99 | bool filtersEnabled(); | 100 | bool filtersEnabled(); |
100 | void setFiltersEnabled(bool); | 101 | void setFiltersEnabled(bool); |
101 | CalFilter *selectedFilter(); | 102 | CalFilter *selectedFilter(); |
102 | void setSelectedFilter(QString); | 103 | void setSelectedFilter(QString); |
103 | void setSelectedFilter( int ); | 104 | void setSelectedFilter( int ); |
104 | 105 | ||
105 | signals: | 106 | signals: |
106 | void filterChanged(); | 107 | void filterChanged(); |
107 | void editFilters(); | 108 | void editFilters(); |
108 | 109 | ||
109 | private: | 110 | private: |
110 | QPtrList<CalFilter> *mFilters; | 111 | QPtrList<CalFilter> *mFilters; |
111 | }; | 112 | }; |
112 | 113 | ||
113 | class KOCalEditView : public QWidget | 114 | class KOCalEditView : public QScrollView |
114 | { | 115 | { |
115 | Q_OBJECT | 116 | Q_OBJECT |
116 | public: | 117 | public: |
117 | KOCalEditView( QWidget* parent=0,const char* name=0); | 118 | KOCalEditView( QWidget* parent=0,const char* name=0); |
118 | ~KOCalEditView(); | 119 | ~KOCalEditView(); |
119 | 120 | ||
120 | public slots: | 121 | public slots: |
121 | void addCal(); | 122 | void addCal(); |
122 | void enableAll(); | 123 | void enableAll(); |
123 | void enableAlarm(); | 124 | void enableAlarm(); |
124 | void disableRO(); | 125 | void disableRO(); |
125 | void deleteAll(); | 126 | void deleteAll(); |
126 | void selectStdCal(int,bool ); | 127 | void selectStdCal(int,bool ); |
127 | void selectCal(int,bool ); | 128 | void selectCal(int,bool ); |
128 | void selectCalAlarm(int,bool ); | 129 | void selectCalAlarm(int,bool ); |
129 | void selectReadOnly(int,bool ); | 130 | void selectReadOnly(int,bool ); |
130 | void setColor(const QColor &,int) ; | 131 | void setColor(const QColor &,int) ; |
131 | void deleteCal(int) ; | 132 | void deleteCal(int) ; |
132 | void infoCal(int) ; | 133 | void infoCal(int) ; |
133 | void readConfig(); | 134 | void readConfig(); |
134 | signals: | 135 | signals: |
135 | void alarmEnabled ( int cal, bool enable ); | 136 | void alarmEnabled ( int cal, bool enable ); |
136 | void calendarEnabled ( int cal, bool enable ); | 137 | void calendarEnabled ( int cal, bool enable ); |
137 | void calendarReadonly ( int cal, bool readonly ); | 138 | void calendarReadonly ( int cal, bool readonly ); |
138 | void setCalendarDefault ( int cal ); | 139 | void setCalendarDefault ( int cal ); |
139 | void removeCalendar ( int cal ); | 140 | void removeCalendar ( int cal ); |
140 | void calendarAdded( int ); | 141 | void calendarAdded( int ); |
141 | void needsUpdate(); | 142 | void needsUpdate(); |
142 | 143 | ||
143 | private: | 144 | private: |
144 | QVBoxLayout* ml; | ||
145 | QWidget *mw; | 145 | QWidget *mw; |
146 | void toggleList ( QPtrList<KOCalCheckButton> ); | 146 | void toggleList ( QPtrList<KOCalCheckButton> ); |
147 | QPtrList<KOCalCheckButton> mStdandardB; | 147 | QPtrList<KOCalCheckButton> mStdandardB; |
148 | QPtrList<KOCalCheckButton> mEnabledB; | 148 | QPtrList<KOCalCheckButton> mEnabledB; |
149 | QPtrList<KOCalCheckButton> mAlarmB; | 149 | QPtrList<KOCalCheckButton> mAlarmB; |
150 | QPtrList<KOCalCheckButton> mROB; | 150 | QPtrList<KOCalCheckButton> mROB; |
151 | QGridLayout* mainLayout; | 151 | QGridLayout* mainLayout; |
152 | }; | 152 | }; |
153 | 153 | ||
154 | 154 | ||
155 | 155 | ||
156 | #endif // KOFILTERVIEW_H | 156 | #endif // KOFILTERVIEW_H |