summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-12 22:36:41 (UTC)
committer zautrix <zautrix>2005-06-12 22:36:41 (UTC)
commit5e4f16e92a96bdf89f82be3b231d18ae9e257486 (patch) (unidiff)
tree6bf55a0ae92e95dc598a813ed7b7eef5c00dfb4f
parent8cfca2b9b7ece646229a72843cf8d6d63e7b8af9 (diff)
downloadkdepimpi-5e4f16e92a96bdf89f82be3b231d18ae9e257486.zip
kdepimpi-5e4f16e92a96bdf89f82be3b231d18ae9e257486.tar.gz
kdepimpi-5e4f16e92a96bdf89f82be3b231d18ae9e257486.tar.bz2
fixxxx
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp7
-rw-r--r--korganizer/kofilterview.cpp251
-rw-r--r--korganizer/kofilterview.h118
-rw-r--r--korganizer/koprefs.cpp7
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--libkdepim/kcmconfigs/kdepimconfigwidget.cpp1
-rw-r--r--microkde/kcolorbutton.cpp7
-rw-r--r--microkde/kcolorbutton.h3
8 files changed, 321 insertions, 74 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 753d81f..1024b4e 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -3931,26 +3931,29 @@ void CalendarView::toggleFilter()
3931} 3931}
3932 3932
3933KOFilterView *CalendarView::filterView() 3933KOFilterView *CalendarView::filterView()
3934{ 3934{
3935 return mFilterView; 3935 return mFilterView;
3936} 3936}
3937void CalendarView::selectFilter( int fil ) 3937void CalendarView::selectFilter( int fil )
3938{ 3938{
3939 mFilterView->setSelectedFilter( fil ); 3939 mFilterView->setSelectedFilter( fil );
3940} 3940}
3941void CalendarView::showFilter(bool visible) 3941void CalendarView::showFilter(bool visible)
3942{ 3942{
3943#if 0 3943#if 1
3944 if (visible) mCalEditView->show(); 3944 if (visible) {
3945 mCalEditView->readConfig();
3946 mCalEditView->show();
3947 }
3945 else mCalEditView->hide(); 3948 else mCalEditView->hide();
3946#else 3949#else
3947 if (visible) mFilterView->show(); 3950 if (visible) mFilterView->show();
3948 else mFilterView->hide(); 3951 else mFilterView->hide();
3949#endif 3952#endif
3950} 3953}
3951void CalendarView::toggleFilerEnabled( ) 3954void CalendarView::toggleFilerEnabled( )
3952{ 3955{
3953 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); 3956 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
3954 if ( !mFilterView->filtersEnabled() ) 3957 if ( !mFilterView->filtersEnabled() )
3955 topLevelWidget()->setCaption( i18n("Filter disabled ") ); 3958 topLevelWidget()->setCaption( i18n("Filter disabled ") );
3956 3959
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index dc6237b..d79b28e 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -17,31 +17,74 @@
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#include <qlayout.h> 27#include <qlayout.h>
28#include <qlabel.h> 28#include <qlabel.h>
29#include <qdialog.h>
29 30
30 31
31#include <libkcal/calfilter.h> 32#include <libkcal/calfilter.h>
32 33
33#include "kofilterview.h" 34#include "kofilterview.h"
35#include "koprefs.h"
34#include <kiconloader.h> 36#include <kiconloader.h>
35#include <kglobal.h> 37#include <kglobal.h>
38#include <kcolorbutton.h>
39#include <kmessagebox.h>
40
41
42#include <kurlrequester.h>
43#include <klineedit.h>
44
45class KONewCalPrefs : public QDialog
46{
47 public:
48 KONewCalPrefs( QWidget *parent=0, const char *name=0 ) :
49 QDialog( parent, name, true )
50 {
51 setCaption( i18n("Add new Calendar") );
52 QVBoxLayout* lay = new QVBoxLayout( this );
53 lay->setSpacing( 3 );
54 lay->setMargin( 3 );
55 QLabel * lab = new QLabel( i18n("<b>Name of new calendar:</b>"), this );
56 lay->addWidget( lab );
57 nameE = new KLineEdit( this );
58 lay->addWidget( nameE );
59 lab = new QLabel( i18n("Local ical (*.ics) file:"), this );
60 lay->addWidget( lab );
61 url = new KURLRequester ( this );
62 lay->addWidget( url );
63 QPushButton * ok = new QPushButton( i18n("OK"), this );
64 lay->addWidget( ok );
65 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
66 lay->addWidget( cancel );
67 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
68 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
69 resize( 200, 200 );
70 }
71
72 QString calName() { return nameE->text(); }
73 QString calFileName() { return url->url(); }
74private:
75 KLineEdit* nameE;
76 KURLRequester *url;
77};
78
36 79
37KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent, 80KOFilterView::KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent,
38 const char* name,WFlags fl ) 81 const char* name,WFlags fl )
39 : KOFilterView_base(parent,name,fl) 82 : KOFilterView_base(parent,name,fl)
40{ 83{
41 mFilters = filterList; 84 mFilters = filterList;
42 85
43 connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); 86 connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged()));
44 connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); 87 connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged()));
45 connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters())); 88 connect(mEditButton,SIGNAL(clicked()),SIGNAL(editFilters()));
46} 89}
47 90
@@ -94,83 +137,247 @@ void KOFilterView::setSelectedFilter( int fil )
94 if ( fil >= mSelectionCombo->count() ) 137 if ( fil >= mSelectionCombo->count() )
95 return; 138 return;
96 mSelectionCombo->setCurrentItem( fil ); 139 mSelectionCombo->setCurrentItem( fil );
97 emit filterChanged(); 140 emit filterChanged();
98} 141}
99 142
100 143
101 144
102KOCalEditView::KOCalEditView(QWidget* parent, 145KOCalEditView::KOCalEditView(QWidget* parent,
103 const char* name ) 146 const char* name )
104 : QWidget(parent,name) 147 : QWidget(parent,name)
105{ 148{
106 /* 149 mw = 0;
107 connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); 150 ml = new QVBoxLayout ( this );
108 connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); 151}
109 connect(mEditButton,SIGNAL(clicked()),SIGNAL(editCalEdits())); 152
110 */ 153KOCalEditView::~KOCalEditView()
111 QGridLayout* mainLayout = new QGridLayout ( this , 2, 6 ); 154{
112 QPushButton * addBut = new QPushButton ( this ); 155 // no need to delete child widgets, Qt does it all for us
156}
157void KOCalEditView::selectCal(int id ,bool b)
158{
159 KOPrefs::instance()->getCalendar( id )->isEnabled = b;
160 emit calendarEnabled ( id, b );
161
162}
163void KOCalEditView::selectStdCal( int id, bool b )
164{
165
166 if ( !b ) {
167 KOCalCheckButton* it = (KOCalCheckButton*) sender();
168 if ( it ) {
169 it->blockSignals( true );
170 it->setChecked( true );
171 it->blockSignals( false );
172 return;
173 }
174 return;
175 }
176 KOCalCheckButton* sen = (KOCalCheckButton*) sender();
177 KOCalCheckButton* it = mStdandardB.first();
178 while ( it ) {
179 if ( it->isChecked() ) {
180 if ( it != sen ) {
181 it->blockSignals( true );
182 it->setChecked( false );
183 it->blockSignals( false );
184 break;
185 }
186 }
187 it = mStdandardB.next();
188 }
189 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
190 while ( kkf ) {
191 kkf->isStandard = false;
192 kkf = KOPrefs::instance()->mCalendars.next();
193 }
194 KOPrefs::instance()->getCalendar( id )->isStandard = true;
195 emit setCalendarDefault ( id );
196}
197
198void KOCalEditView::selectCalAlarm(int id ,bool b )
199{
200 KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b;
201 emit alarmEnabled ( id , b );
202}
203void KOCalEditView::selectReadOnly(int id ,bool b )
204{
205 KOPrefs::instance()->getCalendar( id )->isReadOnly = b;
206 emit calendarReadonly ( id , b );
207
208}
209void KOCalEditView::setColor( const QColor& c, int id )
210{
211 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c;
212}
213void KOCalEditView::deleteCal( int id )
214{
215 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id );
216 QString name = kkf->mName;
217 QString file = kkf->mFileName;
218 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;
219 emit removeCalendar ( id );
220 KOPrefs::instance()->mCalendars.remove ( kkf );
221 readConfig();
222}
223void KOCalEditView::infoCal( int id )
224{
225 QString name = KOPrefs::instance()->getCalendar( id )->mName;
226 QString file = KOPrefs::instance()->getCalendar( id )->mFileName;
227 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) );
228}
229void KOCalEditView::readConfig()
230{
231
232 mStdandardB.clear();
233 mEnabledB.clear();
234 mAlarmB.clear();
235 mROB.clear();
236
237 if ( mw ) delete mw;
238 mw = new QWidget ( this );
239 ml->addWidget ( mw );
240
241 mainLayout = new QGridLayout ( mw , 2, 8 );
242 mainLayout->setSpacing( 3 );
243 QPushButton * addBut = new QPushButton ( mw );
113 mainLayout->addWidget( addBut,0,0 ); 244 mainLayout->addWidget( addBut,0,0 );
114 addBut->setPixmap ( SmallIcon("plus")); 245 addBut->setPixmap ( SmallIcon("plus"));
115 connect(addBut,SIGNAL(clicked()),SLOT(addCal())); 246 connect(addBut,SIGNAL(clicked()),SLOT(addCal()));
116 addBut->setMaximumWidth( addBut->sizeHint().height() ); 247 addBut->setMaximumWidth( addBut->sizeHint().height() );
117 248
118 addBut = new QPushButton ( this ); 249 addBut = new QPushButton ( mw );
119 mainLayout->addWidget( addBut,0,1 ); 250 mainLayout->addWidget( addBut,0,1 );
120 addBut->setPixmap ( SmallIcon("eye")); 251 addBut->setPixmap ( SmallIcon("eye"));
121 connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); 252 connect(addBut,SIGNAL(clicked()),SLOT(enableAll()));
122 addBut->setMaximumWidth( addBut->sizeHint().height() ); 253 addBut->setMaximumWidth( addBut->sizeHint().height() );
123 254
124 QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", this ); 255 QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", mw );
125 mainLayout->addWidget( lab,0,2 ); 256 mainLayout->addWidget( lab,0,2 );
126 257
127 addBut = new QPushButton ( this ); 258 addBut = new QPushButton ( mw );
128 mainLayout->addWidget( addBut,0,3 ); 259 mainLayout->addWidget( addBut,0,3 );
129 addBut->setPixmap ( SmallIcon("bell")); 260 addBut->setPixmap ( SmallIcon("bell"));
130 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); 261 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm()));
131 addBut->setMaximumWidth( addBut->sizeHint().height() ); 262 addBut->setMaximumWidth( addBut->sizeHint().height() );
132 263
133 addBut = new QPushButton ( this ); 264 addBut = new QPushButton ( mw );
134 mainLayout->addWidget( addBut,0,4 ); 265 mainLayout->addWidget( addBut,0,4 );
135 addBut->setPixmap ( SmallIcon("pencil")); 266 addBut->setPixmap ( SmallIcon("pencil"));
136 connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); 267 connect(addBut,SIGNAL(clicked()),SLOT(disableRO()));
137 addBut->setMaximumWidth( addBut->sizeHint().height() ); 268 addBut->setMaximumWidth( addBut->sizeHint().height() );
138 269
139 addBut = new QPushButton ( this ); 270 lab = new QLabel ( i18n(" Color "), mw );
140 mainLayout->addWidget( addBut,0,5 ); 271 mainLayout->addWidget( lab,0,5 );
272#if 0
273 addBut = new QPushButton ( mw );
274 mainLayout->addWidget( addBut,0,6 );
141 addBut->setPixmap ( SmallIcon("minus")); 275 addBut->setPixmap ( SmallIcon("minus"));
142 connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); 276 connect(addBut,SIGNAL(clicked()),SLOT(deleteAll()));
143 addBut->setMaximumWidth( addBut->sizeHint().height() ); 277 addBut->setMaximumWidth( addBut->sizeHint().height() );
278#endif
144 279
145 280
281 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
282 int row = 1;
283 while ( kkf ) {
146 284
285 KOCalCheckButton* cb = new KOCalCheckButton( mw );
286 mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb );
287 cb->setChecked( kkf->isStandard );
288 cb->setNum( kkf->mCalNumber );
289 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) );
290 cb = new KOCalCheckButton( mw );
291 mainLayout->addWidget( cb,row,1 );mEnabledB.append( cb );
292 cb->setChecked( kkf->isEnabled );
293 cb->setNum( kkf->mCalNumber );
294 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) );
295 KOCalButton* name = new KOCalButton( mw );
296 name->setNum( kkf->mCalNumber );
297 name->setText( kkf->mName );
298 mainLayout->addWidget( name,row,2 );
299 connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) );
300 cb = new KOCalCheckButton( mw );
301 mainLayout->addWidget( cb,row,3 );mAlarmB.append( cb );
302 cb->setChecked( kkf->isAlarmEnabled );
303 cb->setNum( kkf->mCalNumber );
304 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) );
305 cb = new KOCalCheckButton( mw );
306 mainLayout->addWidget( cb,row,4 );mROB.append( cb );
307 cb->setChecked( kkf->isReadOnly );
308 cb->setNum( kkf->mCalNumber );
309 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) );
310 KColorButton *colb = new KColorButton( mw );
311 mainLayout->addWidget( colb,row,5 );
312 colb->setID( kkf->mCalNumber );
313 colb->setColor( kkf->mDefaultColor );
314 connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) );
315 if ( row > 1) {
316 KOCalButton* calb = new KOCalButton( mw );
317 mainLayout->addWidget( calb,row,6 );
318 calb->setNum( kkf->mCalNumber );
319 calb->setPixmap ( SmallIcon("minus"));
320 connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) );
321 int hei = calb->sizeHint().height();
322 calb->setMaximumSize( hei*9/10, hei*9/10 );
147} 323}
148 324 ++row;
149KOCalEditView::~KOCalEditView() 325 kkf = KOPrefs::instance()->mCalendars.next();
150{
151 // no need to delete child widgets, Qt does it all for us
152} 326}
153void KOCalEditView::readConfig( KConfig *) 327 lab = new QLabel ( "", mw );
154{ 328 mainLayout->addWidget( lab,row,0 );
329 mw->show();
155 330
156} 331}
157void KOCalEditView::addCal() 332void KOCalEditView::addCal()
158{ 333{
159 qDebug("addcal "); 334 qDebug("addcal ");
335 KONewCalPrefs prefs ( this );
336 if ( ! prefs.exec() )
337 return;
338 QString name = prefs.calName();
339 QString file = prefs.calFileName();
340 QFileInfo fi ( file );
341 if (!fi.exists() ) {
342 KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!"));
343 return;
344 }
345 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar();
346 kkf->mName = name;
347 kkf->mFileName = file;
348 emit calendarAdded( kkf->mCalNumber );
349 readConfig();
160} 350}
161void KOCalEditView::enableAll() 351void KOCalEditView::enableAll()
162{ 352{
163 qDebug("enableAll"); 353 toggleList( mEnabledB );
164} 354}
165void KOCalEditView::enableAlarm() 355void KOCalEditView::enableAlarm()
166{ 356{
167 qDebug("enableAlarm"); 357 toggleList( mAlarmB );
168} 358}
169void KOCalEditView::disableRO() 359void KOCalEditView::disableRO()
170{ 360{
171 qDebug("OCalEditView::disableRO() "); 361 toggleList( mROB );
362}
363void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list )
364{
365 bool dis = false;
366 KOCalCheckButton* it = list.first();
367 while ( it ) {
368 if ( !it->isChecked() ) {
369 dis = true;
370 break;
371 }
372 it = list.next();
373 }
374 it = list.first();
375 while ( it ) {
376 it->setChecked(dis);
377 it = list.next();
378 }
172} 379}
173void KOCalEditView::deleteAll() 380void KOCalEditView::deleteAll()
174{ 381{
175 qDebug("delteAll"); 382 qDebug("delteAll");
176} 383}
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h
index 060108f..aaf0eb6 100644
--- a/korganizer/kofilterview.h
+++ b/korganizer/kofilterview.h
@@ -22,73 +22,27 @@
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 <qpushbutton.h> 28#include <qpushbutton.h>
29#include <kconfig.h> 29#include <kconfig.h>
30#include "kofilterview_base.h" 30#include "kofilterview_base.h"
31 31
32#include <libkcal/calfilter.h> 32#include <libkcal/calfilter.h>
33 33
34using namespace KCal; 34class QGridLayout;
35
36class KOFilterView : public KOFilterView_base
37{
38 Q_OBJECT
39 public:
40 KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0);
41 ~KOFilterView();
42
43 void updateFilters();
44
45 bool filtersEnabled();
46 void setFiltersEnabled(bool);
47 CalFilter *selectedFilter();
48 void setSelectedFilter(QString);
49 void setSelectedFilter( int );
50
51 signals:
52 void filterChanged();
53 void editFilters();
54
55 private:
56 QPtrList<CalFilter> *mFilters;
57};
58
59class KOCalEditView : public QWidget
60{
61 Q_OBJECT
62 public:
63 KOCalEditView( QWidget* parent=0,const char* name=0);
64 ~KOCalEditView();
65
66 void readConfig( KConfig *);
67 public slots:
68 void addCal();
69 void enableAll();
70 void enableAlarm();
71 void disableRO();
72 void deleteAll();
73 signals:
74 void alarmEnabled ( int cal, bool enable );
75 void calendarEnabled ( int cal, bool enable );
76 void calendarReadonly ( int cal, bool readonly );
77 void setCalendarDefault ( int cal );
78 void removeCalendar ( int cal );
79
80 private:
81};
82 35
36using namespace KCal;
83class KOCalButton : public QPushButton 37class KOCalButton : public QPushButton
84{ 38{
85 Q_OBJECT 39 Q_OBJECT
86 public: 40 public:
87 KOCalButton( QWidget *parent=0, const char *name=0 ) : 41 KOCalButton( QWidget *parent=0, const char *name=0 ) :
88 QPushButton( parent, name) 42 QPushButton( parent, name)
89 { 43 {
90 connect( this, SIGNAL( clicked() ), 44 connect( this, SIGNAL( clicked() ),
91 SLOT( bottonClicked() )); 45 SLOT( bottonClicked() ));
92 mNumber = -1; 46 mNumber = -1;
93 } 47 }
94 void setNum ( int num ) {mNumber = num; } 48 void setNum ( int num ) {mNumber = num; }
@@ -105,29 +59,97 @@ private slots :
105 void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); } 59 void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); }
106}; 60};
107class KOCalCheckButton : public QCheckBox 61class KOCalCheckButton : public QCheckBox
108{ 62{
109 Q_OBJECT 63 Q_OBJECT
110 public: 64 public:
111 KOCalCheckButton( QWidget *parent=0, const char *name=0 ) : 65 KOCalCheckButton( QWidget *parent=0, const char *name=0 ) :
112 QCheckBox( parent, name) 66 QCheckBox( parent, name)
113 { 67 {
114 connect( this, SIGNAL( toggled ( bool ) ), 68 connect( this, SIGNAL( toggled ( bool ) ),
115 SLOT( bottonClicked( bool ) )); 69 SLOT( bottonClicked( bool ) ));
116 mNumber = -1; 70 mNumber = -1;
71 //setMaximumWidth( 10 );
72
117 } 73 }
118 void setNum ( int num ) {mNumber = num; } 74 void setNum ( int num ) {mNumber = num; }
119 signals: 75 signals:
120 void selectNum ( int, bool ); 76 void selectNum ( int, bool );
121private: 77private:
122 int mNumber; 78 int mNumber;
123 void keyPressEvent ( QKeyEvent * e ) 79 void keyPressEvent ( QKeyEvent * e )
124 { 80 {
125 e->ignore(); 81 e->ignore();
126 } 82 }
127 83
128private slots : 84private slots :
129 void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } 85 void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); }
130}; 86};
131 87
132 88
89
90class KOFilterView : public KOFilterView_base
91{
92 Q_OBJECT
93 public:
94 KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0);
95 ~KOFilterView();
96
97 void updateFilters();
98
99 bool filtersEnabled();
100 void setFiltersEnabled(bool);
101 CalFilter *selectedFilter();
102 void setSelectedFilter(QString);
103 void setSelectedFilter( int );
104
105 signals:
106 void filterChanged();
107 void editFilters();
108
109 private:
110 QPtrList<CalFilter> *mFilters;
111};
112
113class KOCalEditView : public QWidget
114{
115 Q_OBJECT
116 public:
117 KOCalEditView( QWidget* parent=0,const char* name=0);
118 ~KOCalEditView();
119
120 void readConfig();
121 public slots:
122 void addCal();
123 void enableAll();
124 void enableAlarm();
125 void disableRO();
126 void deleteAll();
127 void selectStdCal(int,bool );
128 void selectCal(int,bool );
129 void selectCalAlarm(int,bool );
130 void selectReadOnly(int,bool );
131 void setColor(const QColor &,int) ;
132 void deleteCal(int) ;
133 void infoCal(int) ;
134 signals:
135 void alarmEnabled ( int cal, bool enable );
136 void calendarEnabled ( int cal, bool enable );
137 void calendarReadonly ( int cal, bool readonly );
138 void setCalendarDefault ( int cal );
139 void removeCalendar ( int cal );
140 void calendarAdded( int );
141
142 private:
143 QVBoxLayout* ml;
144 QWidget *mw;
145 void toggleList ( QPtrList<KOCalCheckButton> );
146 QPtrList<KOCalCheckButton> mStdandardB;
147 QPtrList<KOCalCheckButton> mEnabledB;
148 QPtrList<KOCalCheckButton> mAlarmB;
149 QPtrList<KOCalCheckButton> mROB;
150 QGridLayout* mainLayout;
151};
152
153
154
133#endif // KOFILTERVIEW_H 155#endif // KOFILTERVIEW_H
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 179f586..bc6aae4 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -433,47 +433,50 @@ void KOPrefs::usrReadConfig()
433 config()->setGroup("Category Colors"); 433 config()->setGroup("Category Colors");
434 QStringList::Iterator it; 434 QStringList::Iterator it;
435 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { 435 for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) {
436 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); 436 setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor));
437 437
438 } 438 }
439 config()->setGroup("CCal"); 439 config()->setGroup("CCal");
440 int numCals = config()->readNumEntry("NumberCalendars",0 ); 440 int numCals = config()->readNumEntry("NumberCalendars",0 );
441 mNextAvailableCalendar = 1; 441 mNextAvailableCalendar = 1;
442 if ( numCals == 0 ) { 442 if ( numCals == 0 ) {
443 KopiCalendarFile *kkf = getNewCalendar(); 443 KopiCalendarFile *kkf = getNewCalendar();
444 kkf->isStandard = true; 444 kkf->isStandard = true;
445 kkf->mName = i18n("Standard Calendar"); 445 kkf->mName = i18n("Standard");
446 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 446 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
447 } 447 }
448 while ( mNextAvailableCalendar <= numCals ) { 448 while ( mNextAvailableCalendar <= numCals ) {
449 qDebug("Read cal #%d ", mNextAvailableCalendar ); 449 qDebug("Read cal #%d ", mNextAvailableCalendar );
450 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar ); 450 QString prefix = "Cal_" +QString::number( mNextAvailableCalendar );
451 KopiCalendarFile *kkf = getNewCalendar(); 451 KopiCalendarFile *kkf = getNewCalendar();
452 kkf->isStandard = config()->readBoolEntry( prefix+"_isStandard", false ); 452 kkf->isStandard = config()->readBoolEntry( prefix+"_isStandard", false );
453 kkf->isEnabled = config()->readBoolEntry( prefix+"_isEnabled", true); 453 kkf->isEnabled = config()->readBoolEntry( prefix+"_isEnabled", true);
454 kkf->isAlarmEnabled = config()->readBoolEntry( prefix+"_isAlarmEnabled", true); 454 kkf->isAlarmEnabled = config()->readBoolEntry( prefix+"_isAlarmEnabled", true);
455 kkf->isReadOnly = config()->readBoolEntry( prefix+"_isReadOnly", false); 455 kkf->isReadOnly = config()->readBoolEntry( prefix+"_isReadOnly", false);
456 kkf->mName = config()->readEntry( prefix+"_Name", "Calendar"); 456 kkf->mName = config()->readEntry( prefix+"_Name", "Calendar");
457 kkf->mFileName = config()->readEntry( prefix+"_FileName", kkf->mFileName); 457 kkf->mFileName = config()->readEntry( prefix+"_FileName", kkf->mFileName);
458 kkf->mDefaultColor = config()->readColorEntry( prefix+"_Color",&mEventColor); 458 kkf->mDefaultColor = config()->readColorEntry( prefix+"_Color",&mEventColor);
459 if ( kkf->mCalNumber == 1 ) { 459 if ( kkf->mCalNumber == 1 ) {
460 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" ); 460 kkf->mFileName = locateLocal( "data", "korganizer/mycalendar.ics" );
461 //kkf->mName = i18n("Standard Calendar");
462 } 461 }
463 } 462 }
464 463
465 KPimPrefs::usrReadConfig(); 464 KPimPrefs::usrReadConfig();
466} 465}
467 466
467KopiCalendarFile * KOPrefs::getCalendar( int num )
468{
469 return mDefCalColors[num-1];
470}
468 471
469KopiCalendarFile * KOPrefs::getNewCalendar() 472KopiCalendarFile * KOPrefs::getNewCalendar()
470{ 473{
471 KopiCalendarFile * kkf = new KopiCalendarFile(); 474 KopiCalendarFile * kkf = new KopiCalendarFile();
472 kkf->mCalNumber = mNextAvailableCalendar; 475 kkf->mCalNumber = mNextAvailableCalendar;
473 mDefCalColors.resize( mNextAvailableCalendar ); 476 mDefCalColors.resize( mNextAvailableCalendar );
474 mDefCalColors[mNextAvailableCalendar-1] = kkf; 477 mDefCalColors[mNextAvailableCalendar-1] = kkf;
475 ++mNextAvailableCalendar; 478 ++mNextAvailableCalendar;
476 kkf->mDefaultColor = mEventColor; 479 kkf->mDefaultColor = mEventColor;
477 kkf->mName = i18n("New Calendar"); 480 kkf->mName = i18n("New Calendar");
478 mCalendars.append( kkf ); 481 mCalendars.append( kkf );
479 return kkf; 482 return kkf;
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 7d71cbd..f114d88 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -84,24 +84,25 @@ class KOPrefs : public KPimPrefs
84 84
85 /** Set preferences to default values */ 85 /** Set preferences to default values */
86 void usrSetDefaults(); 86 void usrSetDefaults();
87 87
88 /** Read preferences from config file */ 88 /** Read preferences from config file */
89 void usrReadConfig(); 89 void usrReadConfig();
90 90
91 /** Write preferences to config file */ 91 /** Write preferences to config file */
92 void usrWriteConfig(); 92 void usrWriteConfig();
93 void setCategoryDefaults(); 93 void setCategoryDefaults();
94 void setAllDefaults(); 94 void setAllDefaults();
95 KopiCalendarFile * getNewCalendar(); 95 KopiCalendarFile * getNewCalendar();
96 KopiCalendarFile * getCalendar( int );
96 void deleteCalendar( int ); 97 void deleteCalendar( int );
97 QColor defaultColor( int ) const; 98 QColor defaultColor( int ) const;
98 protected: 99 protected:
99 void setTimeZoneIdDefault(); 100 void setTimeZoneIdDefault();
100 101
101 /** Fill empty mail fields with default values. */ 102 /** Fill empty mail fields with default values. */
102 void fillMailDefaults(); 103 void fillMailDefaults();
103 104
104 private: 105 private:
105 /** Constructor disabled for public. Use instance() to create a KOPrefs 106 /** Constructor disabled for public. Use instance() to create a KOPrefs
106 object. */ 107 object. */
107 KOPrefs(); 108 KOPrefs();
diff --git a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
index a0f9d2e..ff1e240 100644
--- a/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
+++ b/libkdepim/kcmconfigs/kdepimconfigwidget.cpp
@@ -80,24 +80,25 @@ $Id$
80#include "extensionwidget.h" 80#include "extensionwidget.h"
81*/ 81*/
82 82
83#include "qapplication.h" 83#include "qapplication.h"
84 84
85#include "kpimglobalprefs.h" 85#include "kpimglobalprefs.h"
86 86
87#include "kdepimconfigwidget.h" 87#include "kdepimconfigwidget.h"
88#include <kprefs.h> 88#include <kprefs.h>
89#include <kmessagebox.h> 89#include <kmessagebox.h>
90 90
91 91
92
92KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name ) 93KDEPIMConfigWidget::KDEPIMConfigWidget(KPimGlobalPrefs *prefs, QWidget *parent, const char *name )
93 : KPrefsWidget(prefs, parent, name ) 94 : KPrefsWidget(prefs, parent, name )
94{ 95{
95 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email")); 96 mExternalAppsMap.insert(ExternalAppHandler::EMAIL, i18n("Email"));
96 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone")); 97 mExternalAppsMap.insert(ExternalAppHandler::PHONE, i18n("Phone"));
97 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS")); 98 mExternalAppsMap.insert(ExternalAppHandler::SMS, i18n("SMS"));
98 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax")); 99 mExternalAppsMap.insert(ExternalAppHandler::FAX, i18n("Fax"));
99 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager")); 100 mExternalAppsMap.insert(ExternalAppHandler::PAGER, i18n("Pager"));
100 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP")); 101 mExternalAppsMap.insert(ExternalAppHandler::SIP, i18n("SIP"));
101 102
102 103
103 QVBoxLayout *topLayout = new QVBoxLayout( this, 0, 104 QVBoxLayout *topLayout = new QVBoxLayout( this, 0,
diff --git a/microkde/kcolorbutton.cpp b/microkde/kcolorbutton.cpp
index 96dc256..197bea2 100644
--- a/microkde/kcolorbutton.cpp
+++ b/microkde/kcolorbutton.cpp
@@ -7,41 +7,48 @@
7#ifdef DESKTOP_VERSION 7#ifdef DESKTOP_VERSION
8#include <qcolordialog.h> 8#include <qcolordialog.h>
9#endif 9#endif
10void KColorButton:: edit() 10void KColorButton:: edit()
11{ 11{
12 12
13#ifdef DESKTOP_VERSION 13#ifdef DESKTOP_VERSION
14 QColor col = QColorDialog::getColor ( mColor ); 14 QColor col = QColorDialog::getColor ( mColor );
15 if ( col.isValid () ) { 15 if ( col.isValid () ) {
16 mColor = col; 16 mColor = col;
17 setColor ( mColor ); 17 setColor ( mColor );
18 emit changed ( mColor ); 18 emit changed ( mColor );
19 emit changedID ( mColor, id );
19 } 20 }
20#else 21#else
21 KColorDialog* k = new KColorDialog( this ); 22 KColorDialog* k = new KColorDialog( this );
22 k->setColor( mColor ); 23 k->setColor( mColor );
23 int res = k->exec(); 24 int res = k->exec();
24 if ( res ) { 25 if ( res ) {
25 mColor = k->getColor(); 26 mColor = k->getColor();
26 setColor ( mColor ); 27 setColor ( mColor );
27 emit changed ( mColor ); 28 emit changed ( mColor );
29 emit changedID ( mColor, id );
28 } 30 }
29 delete k; 31 delete k;
30#endif 32#endif
31} 33}
32KColorButton::KColorButton( QWidget *p ):QPushButton( p ) 34KColorButton::KColorButton( QWidget *p ):QPushButton( p )
33{ 35{
34 int size = 24; 36 int size = 24;
35 if( QApplication::desktop()->width() < 480 || QApplication::desktop()->height() <= 320 ) 37 if( QApplication::desktop()->width() < 480 || QApplication::desktop()->height() <= 320 )
36 size = 18; 38 size = 18;
37 setFixedSize( size,size ); 39 setFixedSize( size,size );
40 int id = 0;
38 connect ( this, SIGNAL( clicked() ), this ,SLOT (edit() )); 41 connect ( this, SIGNAL( clicked() ), this ,SLOT (edit() ));
39 42
40} 43}
44void KColorButton::setID ( int i)
45{
46 id = i;
47}
41void KColorButton::setColor ( const QColor & c) 48void KColorButton::setColor ( const QColor & c)
42{ 49{
43 mColor = c; 50 mColor = c;
44 QPixmap pix ( height() - 4, width() - 4 ); 51 QPixmap pix ( height() - 4, width() - 4 );
45 pix.fill( c ); 52 pix.fill( c );
46 setPixmap ( pix ); 53 setPixmap ( pix );
47} 54}
diff --git a/microkde/kcolorbutton.h b/microkde/kcolorbutton.h
index 88b3774..983771b 100644
--- a/microkde/kcolorbutton.h
+++ b/microkde/kcolorbutton.h
@@ -5,22 +5,25 @@
5#include <qcolor.h> 5#include <qcolor.h>
6#include <kglobal.h> 6#include <kglobal.h>
7#include <qpixmap.h> 7#include <qpixmap.h>
8#include <qlabel.h> 8#include <qlabel.h>
9 9
10 10
11class KColorButton : public QPushButton 11class KColorButton : public QPushButton
12{ 12{
13Q_OBJECT 13Q_OBJECT
14public: 14public:
15 KColorButton( QWidget *p ); 15 KColorButton( QWidget *p );
16 void setColor ( const QColor &); 16 void setColor ( const QColor &);
17 void setID ( int i) ;
17 QColor color() const { return mColor ; } 18 QColor color() const { return mColor ; }
18 signals: 19 signals:
19 void changed(const QColor &); 20 void changed(const QColor &);
21 void changedID(const QColor &, int id);
20private slots: 22private slots:
21 void edit(); 23 void edit();
22 private: 24 private:
23 QColor mColor; 25 QColor mColor;
26 int id;
24}; 27};
25 28
26#endif 29#endif