summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-06-17 10:27:21 (UTC)
committer zautrix <zautrix>2005-06-17 10:27:21 (UTC)
commitec691904e9c129fda7514179910c5be9bf0d908b (patch) (unidiff)
tree75984d135b97049af03ba22eab7f7db53a8a7922 /korganizer
parent56f20e7a0a6b8ecf84d11ced19f870241a13c17d (diff)
downloadkdepimpi-ec691904e9c129fda7514179910c5be9bf0d908b.zip
kdepimpi-ec691904e9c129fda7514179910c5be9bf0d908b.tar.gz
kdepimpi-ec691904e9c129fda7514179910c5be9bf0d908b.tar.bz2
fixxx
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp6
-rw-r--r--korganizer/kofilterview.cpp6
-rw-r--r--korganizer/kotodoview.cpp18
-rw-r--r--korganizer/mainwindow.cpp19
4 files changed, 19 insertions, 30 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index eac2f29..d25f632 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -3933,193 +3933,197 @@ void CalendarView::processIncidenceSelection( Incidence *incidence )
3933 emit groupEventsSelected( true ); 3933 emit groupEventsSelected( true );
3934 } else { 3934 } else {
3935 emit groupEventsSelected(false); 3935 emit groupEventsSelected(false);
3936 } 3936 }
3937 return; 3937 return;
3938 } else { 3938 } else {
3939 emit todoSelected( false ); 3939 emit todoSelected( false );
3940 emit organizerEventsSelected(false); 3940 emit organizerEventsSelected(false);
3941 emit groupEventsSelected(false); 3941 emit groupEventsSelected(false);
3942 } 3942 }
3943 return; 3943 return;
3944 } 3944 }
3945 3945
3946 /* if ( incidence && incidence->typeID() == todoID ) { 3946 /* if ( incidence && incidence->typeID() == todoID ) {
3947 emit todoSelected( true ); 3947 emit todoSelected( true );
3948 } else { 3948 } else {
3949 emit todoSelected( false ); 3949 emit todoSelected( false );
3950 }*/ 3950 }*/
3951} 3951}
3952 3952
3953 3953
3954void CalendarView::checkClipboard() 3954void CalendarView::checkClipboard()
3955{ 3955{
3956#ifndef KORG_NODND 3956#ifndef KORG_NODND
3957 if (ICalDrag::canDecode(QApplication::clipboard()->data())) { 3957 if (ICalDrag::canDecode(QApplication::clipboard()->data())) {
3958 emit pasteEnabled(true); 3958 emit pasteEnabled(true);
3959 } else { 3959 } else {
3960 emit pasteEnabled(false); 3960 emit pasteEnabled(false);
3961 } 3961 }
3962#endif 3962#endif
3963} 3963}
3964 3964
3965void CalendarView::showDates(const DateList &selectedDates) 3965void CalendarView::showDates(const DateList &selectedDates)
3966{ 3966{
3967 // kdDebug() << "CalendarView::selectDates()" << endl; 3967 // kdDebug() << "CalendarView::selectDates()" << endl;
3968 3968
3969 3969
3970 if ( !mBlockShowDates ) { 3970 if ( !mBlockShowDates ) {
3971 if ( mViewManager->currentView() ) { 3971 if ( mViewManager->currentView() ) {
3972 updateView( selectedDates.first(), selectedDates.last() ); 3972 updateView( selectedDates.first(), selectedDates.last() );
3973 } else { 3973 } else {
3974 mViewManager->showAgendaView(); 3974 mViewManager->showAgendaView();
3975 } 3975 }
3976 } 3976 }
3977 3977
3978 QDate date = selectedDates.first(); 3978 QDate date = selectedDates.first();
3979 if ( ! date.isValid() ) { 3979 if ( ! date.isValid() ) {
3980 topLevelWidget()->setCaption(""); 3980 topLevelWidget()->setCaption("");
3981 return; 3981 return;
3982 } 3982 }
3983 3983
3984 QString selDates; 3984 QString selDates;
3985 selDates = KGlobal::locale()->formatDate( date, true); 3985 selDates = KGlobal::locale()->formatDate( date, true);
3986 if (selectedDates.first() < selectedDates.last() ) 3986 if (selectedDates.first() < selectedDates.last() )
3987 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); 3987 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
3988 else { 3988 else {
3989 QString addString; 3989 QString addString;
3990 if ( date == QDateTime::currentDateTime().date() ) 3990 if ( date == QDateTime::currentDateTime().date() )
3991 addString = i18n("Today"); 3991 addString = i18n("Today");
3992 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 3992 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
3993 addString = i18n("Tomorrow"); 3993 addString = i18n("Tomorrow");
3994 else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) 3994 else if ( date == QDateTime::currentDateTime().date().addDays(-1) )
3995 addString = i18n("Yesterday"); 3995 addString = i18n("Yesterday");
3996 else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) 3996 else if ( date == QDateTime::currentDateTime().date().addDays(-2) )
3997 addString = i18n("Day before yesterday"); 3997 addString = i18n("Day before yesterday");
3998 else if ( date == QDateTime::currentDateTime().date().addDays(2) ) 3998 else if ( date == QDateTime::currentDateTime().date().addDays(2) )
3999 addString = i18n("Day after tomorrow"); 3999 addString = i18n("Day after tomorrow");
4000 if ( !addString.isEmpty() ) { 4000 if ( !addString.isEmpty() ) {
4001 topLevelWidget()->setCaption( addString+", " + selDates ); 4001 topLevelWidget()->setCaption( addString+", " + selDates );
4002 return; 4002 return;
4003 } 4003 }
4004 } 4004 }
4005 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 4005 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
4006 4006
4007} 4007}
4008 4008
4009QPtrList<CalFilter> CalendarView::filters() 4009QPtrList<CalFilter> CalendarView::filters()
4010{ 4010{
4011 return mFilters; 4011 return mFilters;
4012 4012
4013} 4013}
4014void CalendarView::editFilters() 4014void CalendarView::editFilters()
4015{ 4015{
4016 // kdDebug() << "CalendarView::editFilters()" << endl; 4016 // kdDebug() << "CalendarView::editFilters()" << endl;
4017 4017
4018 CalFilter *filter = mFilters.first(); 4018 CalFilter *filter = mFilters.first();
4019 while(filter) { 4019 while(filter) {
4020 kdDebug() << " Filter: " << filter->name() << endl; 4020 kdDebug() << " Filter: " << filter->name() << endl;
4021 filter = mFilters.next(); 4021 filter = mFilters.next();
4022 } 4022 }
4023 4023
4024 mDialogManager->showFilterEditDialog(&mFilters); 4024 mDialogManager->showFilterEditDialog(&mFilters);
4025 updateFilter(); 4025 updateFilter();
4026} 4026}
4027void CalendarView::toggleFilter() 4027void CalendarView::toggleFilter()
4028{ 4028{
4029 showFilter(! mCalEditView->isVisible()); 4029 if ( mLeftFrame->isHidden() ) {
4030 toggleExpand();
4031 showFilter( true );
4032 } else
4033 showFilter(! mCalEditView->isVisible());
4030} 4034}
4031 4035
4032KOFilterView *CalendarView::filterView() 4036KOFilterView *CalendarView::filterView()
4033{ 4037{
4034 return mFilterView; 4038 return mFilterView;
4035} 4039}
4036void CalendarView::selectFilter( int fil ) 4040void CalendarView::selectFilter( int fil )
4037{ 4041{
4038 mFilterView->setSelectedFilter( fil ); 4042 mFilterView->setSelectedFilter( fil );
4039} 4043}
4040void CalendarView::showFilter(bool visible) 4044void CalendarView::showFilter(bool visible)
4041{ 4045{
4042#if 1 4046#if 1
4043 if (visible) { 4047 if (visible) {
4044 mCalEditView->readConfig(); 4048 mCalEditView->readConfig();
4045 mCalEditView->show(); 4049 mCalEditView->show();
4046 QValueList<int> sizes; 4050 QValueList<int> sizes;
4047 sizes = mLeftFrame->sizes(); 4051 sizes = mLeftFrame->sizes();
4048 if ( sizes.count() == 4 && sizes[3] < 20 ) { 4052 if ( sizes.count() == 4 && sizes[3] < 20 ) {
4049 sizes.clear(); 4053 sizes.clear();
4050 sizes << 100; 4054 sizes << 100;
4051 sizes << 0; 4055 sizes << 0;
4052 sizes << 0; 4056 sizes << 0;
4053 sizes << 100; 4057 sizes << 100;
4054 mLeftFrame->setSizes(sizes); 4058 mLeftFrame->setSizes(sizes);
4055 } 4059 }
4056#if 0 4060#if 0
4057 sizes = mLeftFrame->sizes(); 4061 sizes = mLeftFrame->sizes();
4058 int ccc = 0; 4062 int ccc = 0;
4059 while ( ccc < sizes.count()) { 4063 while ( ccc < sizes.count()) {
4060 qDebug("size %d %d ", ccc, sizes[ccc]); 4064 qDebug("size %d %d ", ccc, sizes[ccc]);
4061 ++ccc; 4065 ++ccc;
4062 } 4066 }
4063#endif 4067#endif
4064 4068
4065 } 4069 }
4066 else { 4070 else {
4067 mCalEditView->hide(); 4071 mCalEditView->hide();
4068 } 4072 }
4069#else 4073#else
4070 if (visible) mFilterView->show(); 4074 if (visible) mFilterView->show();
4071 else mFilterView->hide(); 4075 else mFilterView->hide();
4072#endif 4076#endif
4073} 4077}
4074void CalendarView::toggleFilerEnabled( ) 4078void CalendarView::toggleFilerEnabled( )
4075{ 4079{
4076 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); 4080 mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() );
4077 if ( !mFilterView->filtersEnabled() ) 4081 if ( !mFilterView->filtersEnabled() )
4078 topLevelWidget()->setCaption( i18n("Filter disabled ") ); 4082 topLevelWidget()->setCaption( i18n("Filter disabled ") );
4079 4083
4080} 4084}
4081void CalendarView::updateFilter() 4085void CalendarView::updateFilter()
4082{ 4086{
4083 CalFilter *filter = mFilterView->selectedFilter(); 4087 CalFilter *filter = mFilterView->selectedFilter();
4084 if (filter) { 4088 if (filter) {
4085 QString mess; 4089 QString mess;
4086 if (mFilterView->filtersEnabled()) { 4090 if (mFilterView->filtersEnabled()) {
4087 mess = i18n("Filter selected: ")+filter->name(); 4091 mess = i18n("Filter selected: ")+filter->name();
4088 filter->setEnabled(true); 4092 filter->setEnabled(true);
4089 } 4093 }
4090 else filter->setEnabled(false); 4094 else filter->setEnabled(false);
4091 mCalendar->setFilter(filter); 4095 mCalendar->setFilter(filter);
4092 updateView(); 4096 updateView();
4093 if ( !mess.isEmpty() ) 4097 if ( !mess.isEmpty() )
4094 topLevelWidget()->setCaption( mess ); 4098 topLevelWidget()->setCaption( mess );
4095 4099
4096 } 4100 }
4097 emit filtersUpdated(); 4101 emit filtersUpdated();
4098} 4102}
4099 4103
4100void CalendarView::filterEdited() 4104void CalendarView::filterEdited()
4101{ 4105{
4102 mFilterView->updateFilters(); 4106 mFilterView->updateFilters();
4103 updateFilter(); 4107 updateFilter();
4104 writeSettings(); 4108 writeSettings();
4105} 4109}
4106 4110
4107 4111
4108void CalendarView::takeOverEvent() 4112void CalendarView::takeOverEvent()
4109{ 4113{
4110 Incidence *incidence = currentSelection(); 4114 Incidence *incidence = currentSelection();
4111 4115
4112 if (!incidence) return; 4116 if (!incidence) return;
4113 4117
4114 incidence->setOrganizer(KOPrefs::instance()->email()); 4118 incidence->setOrganizer(KOPrefs::instance()->email());
4115 incidence->recreate(); 4119 incidence->recreate();
4116 incidence->setReadOnly(false); 4120 incidence->setReadOnly(false);
4117 4121
4118 updateView(); 4122 updateView();
4119} 4123}
4120 4124
4121void CalendarView::takeOverCalendar() 4125void CalendarView::takeOverCalendar()
4122{ 4126{
4123 // TODO: Create Calendar::allIncidences() function and use it here 4127 // TODO: Create Calendar::allIncidences() function and use it here
4124 4128
4125 clearAllViews(); 4129 clearAllViews();
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp
index e4dc751..bb88386 100644
--- a/korganizer/kofilterview.cpp
+++ b/korganizer/kofilterview.cpp
@@ -102,323 +102,323 @@ void KOFilterView::setSelectedFilter(QString filterName)
102void KOFilterView::setSelectedFilter( int fil ) 102void KOFilterView::setSelectedFilter( int fil )
103{ 103{
104 if ( fil >= mSelectionCombo->count() ) 104 if ( fil >= mSelectionCombo->count() )
105 return; 105 return;
106 mSelectionCombo->setCurrentItem( fil ); 106 mSelectionCombo->setCurrentItem( fil );
107 emit filterChanged(); 107 emit filterChanged();
108} 108}
109 109
110 110
111 111
112KOCalEditView::KOCalEditView(QWidget* parent, 112KOCalEditView::KOCalEditView(QWidget* parent,
113 const char* name ) 113 const char* name )
114 : QScrollView(parent,name) 114 : QScrollView(parent,name)
115{ 115{
116 mw = 0; 116 mw = 0;
117 setResizePolicy( AutoOneFit ); 117 setResizePolicy( AutoOneFit );
118 setFrameStyle ( QFrame::Panel | QFrame::Plain ); 118 setFrameStyle ( QFrame::Panel | QFrame::Plain );
119 setLineWidth ( 1 ); 119 setLineWidth ( 1 );
120 setMidLineWidth ( 1 ); 120 setMidLineWidth ( 1 );
121 setFocusPolicy(NoFocus); 121 setFocusPolicy(NoFocus);
122} 122}
123 123
124KOCalEditView::~KOCalEditView() 124KOCalEditView::~KOCalEditView()
125{ 125{
126 // no need to delete child widgets, Qt does it all for us 126 // no need to delete child widgets, Qt does it all for us
127} 127}
128void KOCalEditView::selectCal(int id ,bool b) 128void KOCalEditView::selectCal(int id ,bool b)
129{ 129{
130 KOPrefs::instance()->getCalendar( id )->isEnabled = b; 130 KOPrefs::instance()->getCalendar( id )->isEnabled = b;
131 emit calendarEnabled ( id, b ); 131 emit calendarEnabled ( id, b );
132 emit needsUpdate(); 132 emit needsUpdate();
133 133
134} 134}
135void KOCalEditView::selectStdCal( int id, bool b ) 135void KOCalEditView::selectStdCal( int id, bool b )
136{ 136{
137 137
138 if ( !b ) { 138 if ( !b ) {
139 KOCalCheckButton* it = (KOCalCheckButton*) sender(); 139 KOCalCheckButton* it = (KOCalCheckButton*) sender();
140 if ( it ) { 140 if ( it ) {
141 it->blockSignals( true ); 141 it->blockSignals( true );
142 it->setChecked( true ); 142 it->setChecked( true );
143 it->blockSignals( false ); 143 it->blockSignals( false );
144 return; 144 return;
145 } 145 }
146 return; 146 return;
147 } 147 }
148 KOCalCheckButton* sen = (KOCalCheckButton*) sender(); 148 KOCalCheckButton* sen = (KOCalCheckButton*) sender();
149 KOCalCheckButton* it = mStdandardB.first(); 149 KOCalCheckButton* it = mStdandardB.first();
150 while ( it ) { 150 while ( it ) {
151 if ( it->isChecked() ) { 151 if ( it->isChecked() ) {
152 if ( it != sen ) { 152 if ( it != sen ) {
153 it->blockSignals( true ); 153 it->blockSignals( true );
154 it->setChecked( false ); 154 it->setChecked( false );
155 it->blockSignals( false ); 155 it->blockSignals( false );
156 break; 156 break;
157 } 157 }
158 } 158 }
159 it = mStdandardB.next(); 159 it = mStdandardB.next();
160 } 160 }
161 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 161 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
162 while ( kkf ) { 162 while ( kkf ) {
163 kkf->isStandard = false; 163 kkf->isStandard = false;
164 kkf = KOPrefs::instance()->mCalendars.next(); 164 kkf = KOPrefs::instance()->mCalendars.next();
165 } 165 }
166 KOPrefs::instance()->getCalendar( id )->isStandard = true; 166 KOPrefs::instance()->getCalendar( id )->isStandard = true;
167 emit setCalendarDefault ( id ); 167 emit setCalendarDefault ( id );
168} 168}
169 169
170void KOCalEditView::selectCalAlarm(int id ,bool b ) 170void KOCalEditView::selectCalAlarm(int id ,bool b )
171{ 171{
172 KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b; 172 KOPrefs::instance()->getCalendar( id )->isAlarmEnabled = b;
173 emit alarmEnabled ( id , b ); 173 emit alarmEnabled ( id , b );
174 emit needsUpdate(); 174 emit needsUpdate();
175} 175}
176void KOCalEditView::selectReadOnly(int id ,bool b ) 176void KOCalEditView::selectReadOnly(int id ,bool b )
177{ 177{
178 KOPrefs::instance()->getCalendar( id )->isReadOnly = b; 178 KOPrefs::instance()->getCalendar( id )->isReadOnly = b;
179 emit calendarReadonly ( id , b ); 179 emit calendarReadonly ( id , b );
180 if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) { 180 if ( KOPrefs::instance()->getCalendar( id )->isStandard && b && id > 1 ) {
181 KOPrefs::instance()->getCalendar( id )->isStandard = false; 181 KOPrefs::instance()->getCalendar( id )->isStandard = false;
182 KOPrefs::instance()->getCalendar( 1 )->isStandard = true; 182 KOPrefs::instance()->getCalendar( 1 )->isStandard = true;
183 emit setCalendarDefault ( 1 ); 183 emit setCalendarDefault ( 1 );
184 } 184 }
185 emit needsUpdate(); 185 emit needsUpdate();
186 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 186 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
187 187
188} 188}
189void KOCalEditView::setColor( const QColor& c, int id ) 189void KOCalEditView::setColor( const QColor& c, int id )
190{ 190{
191 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c; 191 KOPrefs::instance()->getCalendar( id )->mDefaultColor = c;
192 emit needsUpdate(); 192 emit needsUpdate();
193} 193}
194void KOCalEditView::deleteCal( int id ) 194void KOCalEditView::deleteCal( int id )
195{ 195{
196 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id ); 196 KopiCalendarFile * kkf = KOPrefs::instance()->getCalendar( id );
197 QString name = kkf->mName; 197 QString name = kkf->mName;
198 QString file = kkf->mFileName; 198 QString file = KGlobal::formatMessage ( kkf->mFileName ,0 );
199 if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return; 199 if ( KMessageBox::warningContinueCancel( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>. Do you want to remove this calendar from KO/Pi? (The file is not removed!)").arg(name).arg(file) ) != KMessageBox::Continue ) return;
200 if ( kkf->isStandard ) 200 if ( kkf->isStandard )
201 selectStdCal( 1, true ); 201 selectStdCal( 1, true );
202 emit removeCalendar ( id ); 202 emit removeCalendar ( id );
203 KOPrefs::instance()->mCalendars.remove ( kkf ); 203 KOPrefs::instance()->mCalendars.remove ( kkf );
204 emit needsUpdate(); 204 emit needsUpdate();
205 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 205 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
206} 206}
207void KOCalEditView::infoCal( int id ) 207void KOCalEditView::infoCal( int id )
208{ 208{
209 QString name = KOPrefs::instance()->getCalendar( id )->mName; 209 QString name = KOPrefs::instance()->getCalendar( id )->mName;
210 QString file = KOPrefs::instance()->getCalendar( id )->mFileName; 210 QString file = KGlobal::formatMessage ( KOPrefs::instance()->getCalendar( id )->mFileName, 0 );
211 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { 211 if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) {
212 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) ) ) { 212 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) ) ) {
213 emit calendarAdded( id ); 213 emit calendarAdded( id );
214 emit needsUpdate(); 214 emit needsUpdate();
215 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 215 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
216 } 216 }
217 } 217 }
218 else 218 else
219 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); 219 KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) );
220} 220}
221void KOCalEditView::readConfig() 221void KOCalEditView::readConfig()
222{ 222{
223 223
224 mStdandardB.clear(); 224 mStdandardB.clear();
225 mEnabledB.clear(); 225 mEnabledB.clear();
226 mAlarmB.clear(); 226 mAlarmB.clear();
227 mROB.clear(); 227 mROB.clear();
228 228
229 if ( mw ) delete mw; 229 if ( mw ) delete mw;
230 mw = new QWidget ( viewport() ); 230 mw = new QWidget ( viewport() );
231 addChild(mw); 231 addChild(mw);
232 232
233 mainLayout = new QGridLayout ( mw , 2, 8 ); 233 mainLayout = new QGridLayout ( mw , 2, 8 );
234 mainLayout->setMargin( 3); 234 mainLayout->setMargin( 3);
235 mainLayout->setSpacing( 2); 235 mainLayout->setSpacing( 2);
236 QPushButton * addBut = new QPushButton ( mw ); 236 QPushButton * addBut = new QPushButton ( mw );
237 addBut->setFocusPolicy(NoFocus); 237 addBut->setFocusPolicy(NoFocus);
238 mainLayout->addWidget( addBut,0,0 ); 238 mainLayout->addWidget( addBut,0,0 );
239 addBut->setPixmap ( SmallIcon("plus")); 239 addBut->setPixmap ( SmallIcon("plus"));
240 connect(addBut,SIGNAL(clicked()),SLOT(addCal())); 240 connect(addBut,SIGNAL(clicked()),SLOT(addCal()));
241 addBut->setMaximumWidth( addBut->sizeHint().height() ); 241 addBut->setMaximumWidth( addBut->sizeHint().height() );
242 242
243 addBut = new QPushButton ( mw ); 243 addBut = new QPushButton ( mw );
244 addBut->setFocusPolicy(NoFocus); 244 addBut->setFocusPolicy(NoFocus);
245 mainLayout->addWidget( addBut,0,1 ); 245 mainLayout->addWidget( addBut,0,1 );
246 addBut->setPixmap ( SmallIcon("eye")); 246 addBut->setPixmap ( SmallIcon("eye"));
247 connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); 247 connect(addBut,SIGNAL(clicked()),SLOT(enableAll()));
248 addBut->setMaximumWidth( addBut->sizeHint().height() ); 248 addBut->setMaximumWidth( addBut->sizeHint().height() );
249 249
250 QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); 250 QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw );
251 mainLayout->addWidget( lab,0,2 ); 251 mainLayout->addWidget( lab,0,2 );
252 lab = new QLabel ( i18n(" "), mw ); 252 lab = new QLabel ( i18n(" "), mw );
253 mainLayout->addWidget( lab,0,3 ); 253 mainLayout->addWidget( lab,0,3 );
254 lab->setFixedWidth( 6 ); 254 lab->setFixedWidth( 6 );
255 addBut = new QPushButton ( mw ); 255 addBut = new QPushButton ( mw );
256 addBut->setFocusPolicy(NoFocus); 256 addBut->setFocusPolicy(NoFocus);
257 mainLayout->addWidget( addBut,0,4 ); 257 mainLayout->addWidget( addBut,0,4 );
258 addBut->setPixmap ( SmallIcon("bell")); 258 addBut->setPixmap ( SmallIcon("bell"));
259 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); 259 connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm()));
260 addBut->setMaximumWidth( addBut->sizeHint().height() ); 260 addBut->setMaximumWidth( addBut->sizeHint().height() );
261 261
262 addBut = new QPushButton ( mw ); 262 addBut = new QPushButton ( mw );
263 addBut->setFocusPolicy(NoFocus); 263 addBut->setFocusPolicy(NoFocus);
264 mainLayout->addWidget( addBut,0,5 ); 264 mainLayout->addWidget( addBut,0,5 );
265 addBut->setPixmap ( SmallIcon("pencil")); 265 addBut->setPixmap ( SmallIcon("pencil"));
266 connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); 266 connect(addBut,SIGNAL(clicked()),SLOT(disableRO()));
267 addBut->setMaximumWidth( addBut->sizeHint().height() ); 267 addBut->setMaximumWidth( addBut->sizeHint().height() );
268 268
269 lab = new QLabel ( i18n(" Color "), mw ); 269 lab = new QLabel ( i18n(" Color "), mw );
270 mainLayout->addWidget( lab,0,6 ); 270 mainLayout->addWidget( lab,0,6 );
271#if 0 271#if 0
272 addBut = new QPushButton ( mw ); 272 addBut = new QPushButton ( mw );
273 mainLayout->addWidget( addBut,0,6 ); 273 mainLayout->addWidget( addBut,0,6 );
274 addBut->setPixmap ( SmallIcon("minus")); 274 addBut->setPixmap ( SmallIcon("minus"));
275 connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); 275 connect(addBut,SIGNAL(clicked()),SLOT(deleteAll()));
276 addBut->setMaximumWidth( addBut->sizeHint().height() ); 276 addBut->setMaximumWidth( addBut->sizeHint().height() );
277#endif 277#endif
278 278
279 279
280 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 280 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
281 int row = 1; 281 int row = 1;
282 while ( kkf ) { 282 while ( kkf ) {
283 int iii = 0; 283 int iii = 0;
284 KOCalCheckButton* cb = new KOCalCheckButton( mw ); 284 KOCalCheckButton* cb = new KOCalCheckButton( mw );
285 mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); 285 mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb );
286 cb->setChecked( kkf->isStandard ); 286 cb->setChecked( kkf->isStandard );
287 cb->setNum( kkf->mCalNumber ); 287 cb->setNum( kkf->mCalNumber );
288 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); 288 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) );
289 if ( kkf->mErrorOnLoad || kkf->isReadOnly ) 289 if ( kkf->mErrorOnLoad || kkf->isReadOnly )
290 cb->setEnabled( false ); 290 cb->setEnabled( false );
291 cb = new KOCalCheckButton( mw ); 291 cb = new KOCalCheckButton( mw );
292 mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); 292 mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb );
293 cb->setChecked( kkf->isEnabled ); 293 cb->setChecked( kkf->isEnabled );
294 cb->setNum( kkf->mCalNumber ); 294 cb->setNum( kkf->mCalNumber );
295 if ( kkf->mErrorOnLoad ) 295 if ( kkf->mErrorOnLoad )
296 cb->setEnabled( false ); 296 cb->setEnabled( false );
297 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); 297 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) );
298 KOCalButton* name = new KOCalButton( mw ); 298 KOCalButton* name = new KOCalButton( mw );
299 name->setNum( kkf->mCalNumber ); 299 name->setNum( kkf->mCalNumber );
300 name->setText( kkf->mName ); 300 name->setText( kkf->mName );
301 mainLayout->addWidget( name,row,++iii ); 301 mainLayout->addWidget( name,row,++iii );
302 connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); 302 connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) );
303 lab = new QLabel ( i18n(" "), mw ); 303 lab = new QLabel ( i18n(" "), mw );
304 mainLayout->addWidget( lab,row,++iii ); 304 mainLayout->addWidget( lab,row,++iii );
305 cb = new KOCalCheckButton( mw ); 305 cb = new KOCalCheckButton( mw );
306 mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb ); 306 mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb );
307 cb->setChecked( kkf->isAlarmEnabled ); 307 cb->setChecked( kkf->isAlarmEnabled );
308 cb->setNum( kkf->mCalNumber ); 308 cb->setNum( kkf->mCalNumber );
309 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); 309 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) );
310 if ( kkf->mErrorOnLoad ) 310 if ( kkf->mErrorOnLoad )
311 cb->setEnabled( false ); 311 cb->setEnabled( false );
312 cb = new KOCalCheckButton( mw ); 312 cb = new KOCalCheckButton( mw );
313 mainLayout->addWidget( cb,row,++iii );mROB.append( cb ); 313 mainLayout->addWidget( cb,row,++iii );mROB.append( cb );
314 cb->setChecked( kkf->isReadOnly ); 314 cb->setChecked( kkf->isReadOnly );
315 cb->setNum( kkf->mCalNumber ); 315 cb->setNum( kkf->mCalNumber );
316 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); 316 connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) );
317 if ( kkf->mErrorOnLoad ) 317 if ( kkf->mErrorOnLoad )
318 cb->setEnabled( false ); 318 cb->setEnabled( false );
319 if ( row > 1) { 319 if ( row > 1) {
320 KColorButton *colb = new KColorButton( mw ); 320 KColorButton *colb = new KColorButton( mw );
321 mainLayout->addWidget( colb,row,++iii ); 321 mainLayout->addWidget( colb,row,++iii );
322 colb->setID( kkf->mCalNumber ); 322 colb->setID( kkf->mCalNumber );
323 colb->setColor( kkf->mDefaultColor ); 323 colb->setColor( kkf->mDefaultColor );
324 connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); 324 connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) );
325 KOCalButton* calb = new KOCalButton( mw ); 325 KOCalButton* calb = new KOCalButton( mw );
326 mainLayout->addWidget( calb,row,++iii ); 326 mainLayout->addWidget( calb,row,++iii );
327 calb->setNum( kkf->mCalNumber ); 327 calb->setNum( kkf->mCalNumber );
328 calb->setPixmap ( SmallIcon("minus")); 328 calb->setPixmap ( SmallIcon("minus"));
329 connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); 329 connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) );
330 int hei = calb->sizeHint().height(); 330 int hei = calb->sizeHint().height();
331 //calb->setMaximumSize( hei*9/10, hei*9/10 ); 331 //calb->setMaximumSize( hei*9/10, hei*9/10 );
332 } 332 }
333 ++row; 333 ++row;
334 kkf = KOPrefs::instance()->mCalendars.next(); 334 kkf = KOPrefs::instance()->mCalendars.next();
335 } 335 }
336 lab = new QLabel ( "", mw ); 336 lab = new QLabel ( "", mw );
337 mainLayout->addWidget( lab,row,0 ); 337 mainLayout->addWidget( lab,row,0 );
338 mw->show(); 338 mw->show();
339 339
340} 340}
341void KOCalEditView::addCal() 341void KOCalEditView::addCal()
342{ 342{
343 bool tryagain = true; 343 bool tryagain = true;
344 QString name, file; 344 QString name, file;
345 while ( tryagain ) { 345 while ( tryagain ) {
346 KONewCalPrefs prefs ( this ); 346 KONewCalPrefs prefs ( this );
347 prefs.nameE->setText( name ); 347 prefs.nameE->setText( name );
348 prefs.url->setURL( file ); 348 prefs.url->setURL( file );
349 if ( ! prefs.exec() ) 349 if ( ! prefs.exec() )
350 return; 350 return;
351 name = prefs.calName(); 351 name = prefs.calName();
352 file = prefs.calFileName(); 352 file = prefs.calFileName();
353 tryagain = false; 353 tryagain = false;
354 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); 354 KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
355 while ( kkf ) { 355 while ( kkf ) {
356 if ( kkf->mName == name ) { 356 if ( kkf->mName == name ) {
357 KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) ); 357 KMessageBox::information( this, i18n("Sorry, the calendar name \n%1\nalready exists!\nPlease choose another name!").arg( name ) );
358 name = ""; 358 name = "";
359 tryagain = true; 359 tryagain = true;
360 break; 360 break;
361 } 361 }
362 if ( kkf->mFileName == file ) { 362 if ( kkf->mFileName == file ) {
363 KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( file) ); 363 KMessageBox::information( this, i18n("Sorry, the file \n%1\nis already loaded!\nPlease choose another file!").arg( KGlobal::formatMessage (file, 0 )) );
364 tryagain = true; 364 tryagain = true;
365 file = ""; 365 file = "";
366 break; 366 break;
367 } 367 }
368 kkf = KOPrefs::instance()->mCalendars.next(); 368 kkf = KOPrefs::instance()->mCalendars.next();
369 } 369 }
370 } 370 }
371 QFileInfo fi ( file ); 371 QFileInfo fi ( file );
372 if (!fi.exists() ) { 372 if (!fi.exists() ) {
373 if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No ) 373 if ( KMessageBox::questionYesNo(this, i18n("The file\n%1\ndoes not exist!\nShall I create it for you?").arg( file ) )== KMessageBox::No )
374 return; 374 return;
375 QFile fileIn( file ); 375 QFile fileIn( file );
376 if (!fileIn.open( IO_WriteOnly ) ) { 376 if (!fileIn.open( IO_WriteOnly ) ) {
377 KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) ); 377 KMessageBox::sorry( this, i18n("Sorry, cannot create the file\n%1!\nNo calendar added!").arg( file ) );
378 return; 378 return;
379 } 379 }
380 QTextStream tsIn( &fileIn ); 380 QTextStream tsIn( &fileIn );
381 tsIn.setCodec( QTextCodec::codecForName("utf8") ); 381 tsIn.setCodec( QTextCodec::codecForName("utf8") );
382 tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n"; 382 tsIn << "BEGIN:VCALENDAR\nPRODID:-//KDE-Pim//Platform-independent 2.1.0\nVERSION:2.0\nEND:VCALENDAR\n";
383 fileIn.close(); 383 fileIn.close();
384 } 384 }
385 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar(); 385 KopiCalendarFile * kkf = KOPrefs::instance()->getNewCalendar();
386 kkf->mName = name; 386 kkf->mName = name;
387 kkf->mFileName = file; 387 kkf->mFileName = file;
388 emit calendarAdded( kkf->mCalNumber ); 388 emit calendarAdded( kkf->mCalNumber );
389 emit needsUpdate(); 389 emit needsUpdate();
390 QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); 390 QTimer::singleShot( 0, this, SLOT ( readConfig() ) );
391} 391}
392void KOCalEditView::enableAll() 392void KOCalEditView::enableAll()
393{ 393{
394 toggleList( mEnabledB ); 394 toggleList( mEnabledB );
395} 395}
396void KOCalEditView::enableAlarm() 396void KOCalEditView::enableAlarm()
397{ 397{
398 toggleList( mAlarmB ); 398 toggleList( mAlarmB );
399} 399}
400void KOCalEditView::disableRO() 400void KOCalEditView::disableRO()
401{ 401{
402 toggleList( mROB ); 402 toggleList( mROB );
403} 403}
404void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list ) 404void KOCalEditView::toggleList ( QPtrList<KOCalCheckButton> list )
405{ 405{
406 bool dis = false; 406 bool dis = false;
407 KOCalCheckButton* it = list.first(); 407 KOCalCheckButton* it = list.first();
408 while ( it ) { 408 while ( it ) {
409 if ( !it->isChecked() ) { 409 if ( !it->isChecked() ) {
410 dis = true; 410 dis = true;
411 break; 411 break;
412 } 412 }
413 it = list.next(); 413 it = list.next();
414 } 414 }
415 it = list.first(); 415 it = list.first();
416 while ( it ) { 416 while ( it ) {
417 it->setChecked(dis); 417 it->setChecked(dis);
418 it = list.next(); 418 it = list.next();
419 } 419 }
420} 420}
421void KOCalEditView::deleteAll() 421void KOCalEditView::deleteAll()
422{ 422{
423 qDebug("delteAll"); 423 qDebug("delteAll");
424} 424}
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 13e88ef..926a136 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -3,192 +3,193 @@
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qheader.h> 25#include <qheader.h>
26#include <qcursor.h> 26#include <qcursor.h>
27#include <qwhatsthis.h> 27#include <qwhatsthis.h>
28#include <qdialog.h> 28#include <qdialog.h>
29#include <qlabel.h> 29#include <qlabel.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31 31
32#include <qinputdialog.h> 32#include <qinputdialog.h>
33 33
34#include <qvbox.h> 34#include <qvbox.h>
35#include <kdebug.h> 35#include <kdebug.h>
36#include "koprefs.h" 36#include "koprefs.h"
37#include <klocale.h> 37#include <klocale.h>
38#include <kglobal.h> 38#include <kglobal.h>
39#include <kdateedit.h> 39#include <kdateedit.h>
40#include "ktimeedit.h" 40#include "ktimeedit.h"
41#include <kiconloader.h> 41#include <kiconloader.h>
42#include <kmessagebox.h> 42#include <kmessagebox.h>
43 43
44#include <libkcal/icaldrag.h> 44#include <libkcal/icaldrag.h>
45#include <libkcal/vcaldrag.h> 45#include <libkcal/vcaldrag.h>
46#include <libkcal/calfilter.h> 46#include <libkcal/calfilter.h>
47#include <libkcal/dndfactory.h> 47#include <libkcal/dndfactory.h>
48#include <libkcal/calendarresources.h> 48#include <libkcal/calendarresources.h>
49#include <libkcal/resourcecalendar.h> 49#include <libkcal/resourcecalendar.h>
50#include <kresources/resourceselectdialog.h> 50#include <kresources/resourceselectdialog.h>
51#include <libkcal/kincidenceformatter.h> 51#include <libkcal/kincidenceformatter.h>
52#ifndef DESKTOP_VERSION 52#ifndef DESKTOP_VERSION
53#include <qpe/qpeapplication.h> 53#include <qpe/qpeapplication.h>
54#else 54#else
55#include <qapplication.h> 55#include <qapplication.h>
56#endif 56#endif
57#ifndef KORG_NOPRINTER 57#ifndef KORG_NOPRINTER
58#include "calprinter.h" 58#include "calprinter.h"
59#endif 59#endif
60#include "docprefs.h" 60#include "docprefs.h"
61 61
62#include "kotodoview.h" 62#include "kotodoview.h"
63using namespace KOrg; 63using namespace KOrg;
64 64
65 65
66KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : 66KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) :
67 QDialog( parent, name, true ) 67 QDialog( parent, name, true )
68{ 68{
69 mTodo = todo; 69 mTodo = todo;
70 setCaption( i18n("Stop todo") ); 70 setCaption( i18n("Stop todo") );
71 QVBoxLayout* lay = new QVBoxLayout( this ); 71 QVBoxLayout* lay = new QVBoxLayout( this );
72 lay->setSpacing( 3 ); 72 lay->setSpacing( 3 );
73 lay->setMargin( 3 ); 73 lay->setMargin( 3 );
74 QLabel * lab = new QLabel( i18n("%1\nis running!").arg( todo->summary() ), this ); 74 QLabel * lab = new QLabel( i18n("%1\nis running!").arg( todo->summary() ), this );
75 lay->addWidget( lab ); 75 lay->addWidget( lab );
76 lab->setAlignment( AlignHCenter ); 76 lab->setAlignment( AlignHCenter );
77 lab = new QLabel( i18n("Additional Comment:"), this ); 77 lab = new QLabel( i18n("Additional Comment:"), this );
78 lay->addWidget( lab ); 78 lay->addWidget( lab );
79 mComment = new QLineEdit( this ); 79 mComment = new QLineEdit( this );
80 lay->addWidget( mComment ); 80 lay->addWidget( mComment );
81 QHBox * start = new QHBox ( this ); 81 QHBox * start = new QHBox ( this );
82 lay->addWidget( start ); 82 lay->addWidget( start );
83 lab = new QLabel( i18n("Start:"), start ); 83 lab = new QLabel( i18n("Start:"), start );
84 QHBox * end = new QHBox ( this ); 84 QHBox * end = new QHBox ( this );
85 lay->addWidget( end ); 85 lay->addWidget( end );
86 lab = new QLabel( i18n("End:"), end ); 86 lab = new QLabel( i18n("End:"), end );
87 sde = new KDateEdit( start ); 87 sde = new KDateEdit( start );
88 ste = new KOTimeEdit( start ); 88 ste = new KOTimeEdit( start );
89 connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); 89 connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) );
90 ede = new KDateEdit( end ); 90 ede = new KDateEdit( end );
91 ete = new KOTimeEdit(end ); 91 ete = new KOTimeEdit(end );
92 connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); 92 connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) );
93 sde->setDate( mTodo->runStart().date() ); 93 sde->setDate( mTodo->runStart().date() );
94 ste->setTime( mTodo->runStart().time() ); 94 ste->setTime( mTodo->runStart().time() );
95 ede->setDate( QDate::currentDate()); 95 ede->setDate( QDate::currentDate());
96 ete->setTime( QTime::currentTime() ); 96 ete->setTime( QTime::currentTime() );
97 QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); 97 QPushButton * ok = new QPushButton( i18n("Stop and save"), this );
98 lay->addWidget( ok ); 98 lay->addWidget( ok );
99 ok->setDefault( true );
99 QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); 100 QPushButton * cancel = new QPushButton( i18n("Continue running"), this );
100 lay->addWidget( cancel ); 101 lay->addWidget( cancel );
101 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 102 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
102 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 103 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
103 ok = new QPushButton( i18n("Stop - do not save"), this ); 104 ok = new QPushButton( i18n("Stop - do not save"), this );
104 connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); 105 connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) );
105 lay->addWidget( ok ); 106 lay->addWidget( ok );
106 if (QApplication::desktop()->width() < 320 ) 107 if (QApplication::desktop()->width() < 320 )
107 resize( 240, 200 ); 108 resize( 240, 200 );
108 else 109 else
109 resize( 320, 200 ); 110 resize( 320, 200 );
110 111
111} 112}
112 113
113void KOStopTodoPrefs::accept() 114void KOStopTodoPrefs::accept()
114{ 115{
115 QDateTime start = QDateTime( sde->date(), ste->getTime() ); 116 QDateTime start = QDateTime( sde->date(), ste->getTime() );
116 QDateTime stop = QDateTime( ede->date(), ete->getTime() ); 117 QDateTime stop = QDateTime( ede->date(), ete->getTime() );
117 if ( start > stop ) { 118 if ( start > stop ) {
118 KMessageBox::sorry(this, 119 KMessageBox::sorry(this,
119 i18n("The start time is\nafter the end time!"), 120 i18n("The start time is\nafter the end time!"),
120 i18n("Time mismatch!")); 121 i18n("Time mismatch!"));
121 return; 122 return;
122 } 123 }
123 mTodo->saveRunningInfo( mComment->text(), start, stop ); 124 mTodo->saveRunningInfo( mComment->text(), start, stop );
124 QDialog::accept(); 125 QDialog::accept();
125} 126}
126void KOStopTodoPrefs::doNotSave() 127void KOStopTodoPrefs::doNotSave()
127{ 128{
128 int result = KMessageBox::warningContinueCancel(this, 129 int result = KMessageBox::warningContinueCancel(this,
129 i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary() ); 130 i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary() );
130 if (result != KMessageBox::Continue) return; 131 if (result != KMessageBox::Continue) return;
131 mTodo->stopRunning(); 132 mTodo->stopRunning();
132 QDialog::accept(); 133 QDialog::accept();
133} 134}
134 135
135 136
136class KOTodoViewWhatsThis :public QWhatsThis 137class KOTodoViewWhatsThis :public QWhatsThis
137{ 138{
138public: 139public:
139 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; 140 KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { };
140 141
141protected: 142protected:
142 virtual QString text( const QPoint& p) 143 virtual QString text( const QPoint& p)
143 { 144 {
144 return _view->getWhatsThisText(p) ; 145 return _view->getWhatsThisText(p) ;
145 } 146 }
146private: 147private:
147 QWidget* _wid; 148 QWidget* _wid;
148 KOTodoView * _view; 149 KOTodoView * _view;
149}; 150};
150 151
151KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, 152KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent,
152 const char *name) : 153 const char *name) :
153 KListView(parent,name) 154 KListView(parent,name)
154{ 155{
155 mName = QString ( name ); 156 mName = QString ( name );
156 mCalendar = calendar; 157 mCalendar = calendar;
157#ifndef DESKTOP_VERSION 158#ifndef DESKTOP_VERSION
158 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 159 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
159#endif 160#endif
160 mOldCurrent = 0; 161 mOldCurrent = 0;
161 mMousePressed = false; 162 mMousePressed = false;
162 163
163 setAcceptDrops(true); 164 setAcceptDrops(true);
164 viewport()->setAcceptDrops(true); 165 viewport()->setAcceptDrops(true);
165 int size = 16; 166 int size = 16;
166 if (qApp->desktop()->width() < 300 ) 167 if (qApp->desktop()->width() < 300 )
167 size = 12; 168 size = 12;
168 setTreeStepSize( size + 6 ); 169 setTreeStepSize( size + 6 );
169 170
170} 171}
171 172
172void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e) 173void KOTodoListView::contentsDragEnterEvent(QDragEnterEvent *e)
173{ 174{
174#ifndef KORG_NODND 175#ifndef KORG_NODND
175// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl; 176// kdDebug() << "KOTodoListView::contentsDragEnterEvent" << endl;
176 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 177 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
177 !QTextDrag::canDecode( e ) ) { 178 !QTextDrag::canDecode( e ) ) {
178 e->ignore(); 179 e->ignore();
179 return; 180 return;
180 } 181 }
181 182
182 mOldCurrent = currentItem(); 183 mOldCurrent = currentItem();
183#endif 184#endif
184} 185}
185 186
186 187
187void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e) 188void KOTodoListView::contentsDragMoveEvent(QDragMoveEvent *e)
188{ 189{
189#ifndef KORG_NODND 190#ifndef KORG_NODND
190// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl; 191// kdDebug() << "KOTodoListView::contentsDragMoveEvent" << endl;
191 192
192 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) && 193 if ( !ICalDrag::canDecode( e ) && !VCalDrag::canDecode( e ) &&
193 !QTextDrag::canDecode( e ) ) { 194 !QTextDrag::canDecode( e ) ) {
194 e->ignore(); 195 e->ignore();
@@ -1109,212 +1110,195 @@ void KOTodoView::setNewPercentage(int index)
1109 return; 1110 return;
1110 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) { 1111 } else if ( mPercentage[index] != 100 && mActiveItem->isOn() ) {
1111 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent())); 1112 KOTodoViewItem* par = (static_cast<KOTodoViewItem*>(mActiveItem->parent()));
1112 if ( par && par->isOn() ) 1113 if ( par && par->isOn() )
1113 par->setOn( false ); 1114 par->setOn( false );
1114 } 1115 }
1115 if (mPercentage[index] == 100) { 1116 if (mPercentage[index] == 100) {
1116 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime()); 1117 mActiveItem->todo()->setCompleted(QDateTime::currentDateTime());
1117 } else { 1118 } else {
1118 mActiveItem->todo()->setCompleted(false); 1119 mActiveItem->todo()->setCompleted(false);
1119 } 1120 }
1120 mActiveItem->todo()->setPercentComplete(mPercentage[index]); 1121 mActiveItem->todo()->setPercentComplete(mPercentage[index]);
1121 mActiveItem->construct(); 1122 mActiveItem->construct();
1122 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED); 1123 todoModified (mActiveItem->todo (), KOGlobals::COMPLETION_MODIFIED);
1123 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1124 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1124 } 1125 }
1125} 1126}
1126 1127
1127 1128
1128QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem) 1129QPopupMenu * KOTodoView::getCategoryPopupMenu (KOTodoViewItem *todoItem)
1129{ 1130{
1130 QPopupMenu* tempMenu = new QPopupMenu (this); 1131 QPopupMenu* tempMenu = new QPopupMenu (this);
1131 QStringList checkedCategories = todoItem->todo()->categories (); 1132 QStringList checkedCategories = todoItem->todo()->categories ();
1132 1133
1133 tempMenu->setCheckable (true); 1134 tempMenu->setCheckable (true);
1134 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 1135 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
1135 it != KOPrefs::instance()->mCustomCategories.end (); 1136 it != KOPrefs::instance()->mCustomCategories.end ();
1136 ++it) { 1137 ++it) {
1137 int index = tempMenu->insertItem (*it); 1138 int index = tempMenu->insertItem (*it);
1138 mCategory[index] = *it; 1139 mCategory[index] = *it;
1139 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true); 1140 if (checkedCategories.find (*it) != checkedCategories.end ()) tempMenu->setItemChecked (index, true);
1140 } 1141 }
1141 1142
1142 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int))); 1143 connect (tempMenu, SIGNAL (activated (int)), SLOT (changedCategories (int)));
1143 return tempMenu; 1144 return tempMenu;
1144 1145
1145 1146
1146} 1147}
1147void KOTodoView::changedCategories(int index) 1148void KOTodoView::changedCategories(int index)
1148{ 1149{
1149 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) { 1150 if (mActiveItem && !mActiveItem->todo()->isReadOnly ()) {
1150 QStringList categories = mActiveItem->todo()->categories (); 1151 QStringList categories = mActiveItem->todo()->categories ();
1151 QString colcat = categories.first(); 1152 QString colcat = categories.first();
1152 if (categories.find (mCategory[index]) != categories.end ()) 1153 if (categories.find (mCategory[index]) != categories.end ())
1153 categories.remove (mCategory[index]); 1154 categories.remove (mCategory[index]);
1154 else 1155 else
1155 categories.insert (categories.end(), mCategory[index]); 1156 categories.insert (categories.end(), mCategory[index]);
1156 categories.sort (); 1157 categories.sort ();
1157 if ( !colcat.isEmpty() ) { 1158 if ( !colcat.isEmpty() ) {
1158 if ( categories.find ( colcat ) != categories.end () ) { 1159 if ( categories.find ( colcat ) != categories.end () ) {
1159 categories.remove( colcat ); 1160 categories.remove( colcat );
1160 categories.prepend( colcat ); 1161 categories.prepend( colcat );
1161 } 1162 }
1162 } 1163 }
1163 mActiveItem->todo()->setCategories (categories); 1164 mActiveItem->todo()->setCategories (categories);
1164 mActiveItem->construct(); 1165 mActiveItem->construct();
1165 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 ); 1166 mActiveItem->todo()->setRevision( mActiveItem->todo()->revision()+1 );
1166 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED); 1167 todoModified (mActiveItem->todo (), KOGlobals::CATEGORY_MODIFIED);
1167 } 1168 }
1168} 1169}
1169void KOTodoView::itemDoubleClicked(QListViewItem *item) 1170void KOTodoView::itemDoubleClicked(QListViewItem *item)
1170{ 1171{
1171 if ( pendingSubtodo != 0 ) { 1172 if ( pendingSubtodo != 0 ) {
1172 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1173 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1173 } 1174 }
1174 pendingSubtodo = 0; 1175 pendingSubtodo = 0;
1175 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() ); 1176 //int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
1176 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() ); 1177 int row = mTodoListView->header()->sectionAt ( mTodoListView->viewportToContents(mTodoListView->viewport()->mapFromGlobal( QCursor::pos())) .x() );
1177 //qDebug("ROW %d ", row); 1178 //qDebug("ROW %d ", row);
1178 if (!item) { 1179 if (!item) {
1179 newTodo(); 1180 newTodo();
1180 return; 1181 return;
1181 } else { 1182 } else {
1182 if ( row == 2 || row == 1 ) { 1183 if ( row == 2 || row == 1 ) {
1183 mActiveItem = (KOTodoViewItem *) item; 1184 mActiveItem = (KOTodoViewItem *) item;
1184 newSubTodo(); 1185 newSubTodo();
1185 return; 1186 return;
1186 } 1187 }
1187 if ( row == 5 || row == 6 ) { 1188 if ( row == 5 || row == 6 ) {
1188 mActiveItem = (KOTodoViewItem *) item; 1189 mActiveItem = (KOTodoViewItem *) item;
1189 toggleRunningItem(); 1190 toggleRunningItem();
1190 return; 1191 return;
1191 } 1192 }
1192 } 1193 }
1193 if ( KOPrefs::instance()->mEditOnDoubleClick ) 1194 if ( KOPrefs::instance()->mEditOnDoubleClick )
1194 editItem( item ); 1195 editItem( item );
1195 else 1196 else
1196 showItem( item , QPoint(), 0 ); 1197 showItem( item , QPoint(), 0 );
1197} 1198}
1198void KOTodoView::toggleRunningItem() 1199void KOTodoView::toggleRunningItem()
1199{ 1200{
1200 // qDebug("KOTodoView::toggleRunning() "); 1201 // qDebug("KOTodoView::toggleRunning() ");
1201 if ( ! mActiveItem ) 1202 if ( ! mActiveItem )
1202 return; 1203 return;
1203 Todo * t = mActiveItem->todo(); 1204 Todo * t = mActiveItem->todo();
1204 if ( t->isRunning() ) { 1205 if ( t->isRunning() ) {
1205
1206
1207 KOStopTodoPrefs tp ( t, this ); 1206 KOStopTodoPrefs tp ( t, this );
1208 tp.exec(); 1207 tp.exec();
1209
1210
1211#if 0
1212 int result = KMessageBox::warningYesNoCancel(this,
1213 i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop"),i18n("Stop+note"));
1214 if (result == KMessageBox::Cancel) return;
1215 if ( result == KMessageBox::No ) {
1216 QString comment = QInputDialog::getText(mActiveItem->text(0).left( 25 ),i18n("Comment for todo:") );
1217 t->setRunningFalse( comment );
1218 } else {
1219 t->setRunning( false );
1220 }
1221 mActiveItem->construct(); 1208 mActiveItem->construct();
1222
1223
1224#endif
1225 } else { 1209 } else {
1226 int result = KMessageBox::warningContinueCancel(this, 1210 int result = KMessageBox::warningContinueCancel(this,
1227 i18n("<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>").arg(mActiveItem->text(0).left( 25 ) ),i18n("Start todo"),i18n("Start todo"),i18n("Cancel"), true); 1211 i18n("<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>").arg(mActiveItem->text(0).left( 25 ) ),i18n("Start todo"),i18n("Start todo"),i18n("Cancel"), true);
1228 if (result != KMessageBox::Continue) return; 1212 if (result != KMessageBox::Continue) return;
1229 t->setRunning( true ); 1213 t->setRunning( true );
1230 mActiveItem->construct(); 1214 mActiveItem->construct();
1231 } 1215 }
1232} 1216}
1233 1217
1234void KOTodoView::itemClicked(QListViewItem *item) 1218void KOTodoView::itemClicked(QListViewItem *item)
1235{ 1219{
1236 //qDebug("KOTodoView::itemClicked %d", item); 1220 //qDebug("KOTodoView::itemClicked %d", item);
1237 if (!item) { 1221 if (!item) {
1238 if ( pendingSubtodo != 0 ) { 1222 if ( pendingSubtodo != 0 ) {
1239 topLevelWidget()->setCaption(i18n("Reparenting aborted!")); 1223 topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
1240 } 1224 }
1241 pendingSubtodo = 0; 1225 pendingSubtodo = 0;
1242 return; 1226 return;
1243 } 1227 }
1244 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1228 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1245 if ( pendingSubtodo != 0 ) { 1229 if ( pendingSubtodo != 0 ) {
1246 bool allowReparent = true; 1230 bool allowReparent = true;
1247 QListViewItem *par = item; 1231 QListViewItem *par = item;
1248 while ( par ) { 1232 while ( par ) {
1249 if ( par == pendingSubtodo ) { 1233 if ( par == pendingSubtodo ) {
1250 allowReparent = false; 1234 allowReparent = false;
1251 break; 1235 break;
1252 } 1236 }
1253 par = par->parent(); 1237 par = par->parent();
1254 } 1238 }
1255 if ( !allowReparent ) { 1239 if ( !allowReparent ) {
1256 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!")); 1240 topLevelWidget()->setCaption(i18n("Recursive reparenting not possible!"));
1257 pendingSubtodo = 0; 1241 pendingSubtodo = 0;
1258 } else { 1242 } else {
1259 Todo* newParent = todoItem->todo(); 1243 Todo* newParent = todoItem->todo();
1260 Todo* newSub = pendingSubtodo->todo(); 1244 Todo* newSub = pendingSubtodo->todo();
1261 pendingSubtodo = 0; 1245 pendingSubtodo = 0;
1262 emit reparentTodoSignal( newParent,newSub ); 1246 emit reparentTodoSignal( newParent,newSub );
1263 return; 1247 return;
1264 } 1248 }
1265 } 1249 }
1266 1250
1267} 1251}
1268 1252
1269void KOTodoView::setDocumentId( const QString &id ) 1253void KOTodoView::setDocumentId( const QString &id )
1270{ 1254{
1271 1255
1272 mDocPrefs->setDoc( id ); 1256 mDocPrefs->setDoc( id );
1273} 1257}
1274 1258
1275void KOTodoView::itemStateChanged( QListViewItem *item ) 1259void KOTodoView::itemStateChanged( QListViewItem *item )
1276{ 1260{
1277 if (!item) return; 1261 if (!item) return;
1278 1262
1279 KOTodoViewItem *todoItem = (KOTodoViewItem *)item; 1263 KOTodoViewItem *todoItem = (KOTodoViewItem *)item;
1280 1264
1281// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl; 1265// kdDebug() << "KOTodoView::itemStateChanged(): " << todoItem->todo()->summary() << endl;
1282 1266
1283 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() ); 1267 if( mDocPrefs ) mDocPrefs->writeEntry( todoItem->todo()->uid(), todoItem->isOpen() );
1284} 1268}
1285 1269
1286void KOTodoView::saveLayout(KConfig *config, const QString &group) const 1270void KOTodoView::saveLayout(KConfig *config, const QString &group) const
1287{ 1271{
1288 mTodoListView->saveLayout(config,group); 1272 mTodoListView->saveLayout(config,group);
1289} 1273}
1290 1274
1291void KOTodoView::restoreLayout(KConfig *config, const QString &group) 1275void KOTodoView::restoreLayout(KConfig *config, const QString &group)
1292{ 1276{
1293 mTodoListView->restoreLayout(config,group); 1277 mTodoListView->restoreLayout(config,group);
1294} 1278}
1295 1279
1296void KOTodoView::processSelectionChange() 1280void KOTodoView::processSelectionChange()
1297{ 1281{
1298// kdDebug() << "KOTodoView::processSelectionChange()" << endl; 1282// kdDebug() << "KOTodoView::processSelectionChange()" << endl;
1299 1283
1300 KOTodoViewItem *item = 1284 KOTodoViewItem *item =
1301 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() ); 1285 static_cast<KOTodoViewItem *>( mTodoListView->selectedItem() );
1302 1286
1303 if ( !item ) { 1287 if ( !item ) {
1304 emit incidenceSelected( 0 ); 1288 emit incidenceSelected( 0 );
1305 } else { 1289 } else {
1306 emit incidenceSelected( item->todo() ); 1290 emit incidenceSelected( item->todo() );
1307 } 1291 }
1308} 1292}
1309 1293
1310void KOTodoView::modified(bool b) 1294void KOTodoView::modified(bool b)
1311{ 1295{
1312 emit isModified(b); 1296 emit isModified(b);
1313} 1297}
1314void KOTodoView::setTodoModified( Todo* todo ) 1298void KOTodoView::setTodoModified( Todo* todo )
1315{ 1299{
1316 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED ); 1300 todoModified( todo, KOGlobals::UNKNOWN_MODIFIED );
1317} 1301}
1318void KOTodoView::clearSelection() 1302void KOTodoView::clearSelection()
1319{ 1303{
1320 mTodoListView->selectAll( false ); 1304 mTodoListView->selectAll( false );
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 13e186d..f945383 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -685,220 +685,221 @@ void MainWindow::initActions()
685 int fontWid = f.width( "30" ); 685 int fontWid = f.width( "30" );
686 while ( fontWid > pixWid ) { 686 while ( fontWid > pixWid ) {
687 --fontPoint; 687 --fontPoint;
688 mWeekFont.setPointSize( fontPoint ); 688 mWeekFont.setPointSize( fontPoint );
689 QFontMetrics f( mWeekFont ); 689 QFontMetrics f( mWeekFont );
690 fontWid = f.width( "30" ); 690 fontWid = f.width( "30" );
691 //qDebug("dec-- "); 691 //qDebug("dec-- ");
692 } 692 }
693 693
694 connect( mWeekAction, SIGNAL( activated() ), 694 connect( mWeekAction, SIGNAL( activated() ),
695 this, SLOT( weekAction() ) ); 695 this, SLOT( weekAction() ) );
696 696
697 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 697 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
698 if ( p->mShowIconFilterview ) { 698 if ( p->mShowIconFilterview ) {
699 icon = loadPixmap( pathString + "filter" ); 699 icon = loadPixmap( pathString + "filter" );
700 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 700 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
701 connect( actionFilterMenuTB, SIGNAL( activated() ), 701 connect( actionFilterMenuTB, SIGNAL( activated() ),
702 this, SLOT( fillFilterMenuTB() ) ); 702 this, SLOT( fillFilterMenuTB() ) );
703 actionFilterMenuTB->addTo( iconToolBar ); 703 actionFilterMenuTB->addTo( iconToolBar );
704 selectFilterMenuTB = new QPopupMenu( this ); 704 selectFilterMenuTB = new QPopupMenu( this );
705 selectFilterMenuTB->setCheckable( true ); 705 selectFilterMenuTB->setCheckable( true );
706 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 706 connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
707 } 707 }
708 708
709 //#endif 709 //#endif
710 // ****************** 710 // ******************
711 QAction *action; 711 QAction *action;
712 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 712 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
713 configureToolBarMenu->setCheckable( true ); 713 configureToolBarMenu->setCheckable( true );
714 714
715 715
716 configureAgendaMenu->setCheckable( true ); 716 configureAgendaMenu->setCheckable( true );
717 int iii ; 717 int iii ;
718 for ( iii = 1;iii<= 10 ;++iii ){ 718 for ( iii = 1;iii<= 10 ;++iii ){
719 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 719 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
720 } 720 }
721 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 721 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
722 722
723 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 723 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
724 this, SLOT( showConfigureAgenda( ) ) ); 724 this, SLOT( showConfigureAgenda( ) ) );
725 725
726 icon = loadPixmap( pathString + "configure" ); 726 icon = loadPixmap( pathString + "configure" );
727 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this ); 727 action = new QAction( i18n("Configure"),icon, i18n("Configure KO/Pi..."), 0, this );
728 action->addTo( actionMenu ); 728 action->addTo( actionMenu );
729 connect( action, SIGNAL( activated() ), 729 connect( action, SIGNAL( activated() ),
730 mView, SLOT( edit_options() ) ); 730 mView, SLOT( edit_options() ) );
731 icon = loadPixmap( pathString + "configure" ); 731 icon = loadPixmap( pathString + "configure" );
732 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this ); 732 action = new QAction( i18n("Configure"),icon, i18n("Global Settings..."), 0, this );
733 action->addTo( actionMenu ); 733 action->addTo( actionMenu );
734 connect( action, SIGNAL( activated() ), 734 connect( action, SIGNAL( activated() ),
735 mView, SLOT( edit_global_options() ) ); 735 mView, SLOT( edit_global_options() ) );
736 actionMenu->insertSeparator(); 736 actionMenu->insertSeparator();
737 737
738 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 738 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
739 action->addTo( actionMenu ); 739 action->addTo( actionMenu );
740 connect( action, SIGNAL( activated() ), 740 connect( action, SIGNAL( activated() ),
741 mView, SLOT( undo_delete() ) ); 741 mView, SLOT( undo_delete() ) );
742 actionMenu->insertSeparator(); 742 actionMenu->insertSeparator();
743 743
744 icon = loadPixmap( pathString + "newevent" ); 744 icon = loadPixmap( pathString + "newevent" );
745 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 745 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
746 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); 746 configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 );
747 configureToolBarMenu->insertSeparator(); 747 configureToolBarMenu->insertSeparator();
748 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); 748 configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 );
749 configureToolBarMenu->insertSeparator(); 749 configureToolBarMenu->insertSeparator();
750 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 750 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
751 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 751 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
752 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 752 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
753 ne_action->addTo( actionMenu ); 753 ne_action->addTo( actionMenu );
754 connect( ne_action, SIGNAL( activated() ), 754 connect( ne_action, SIGNAL( activated() ),
755 mView, SLOT( newEvent() ) ); 755 mView, SLOT( newEvent() ) );
756 icon = loadPixmap( pathString + "newtodo" ); 756 icon = loadPixmap( pathString + "newtodo" );
757 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 757 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
758 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 758 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
759 nt_action->addTo( actionMenu ); 759 nt_action->addTo( actionMenu );
760 connect( nt_action, SIGNAL( activated() ), 760 connect( nt_action, SIGNAL( activated() ),
761 mView, SLOT( newTodo() ) ); 761 mView, SLOT( newTodo() ) );
762 762
763 icon = loadPixmap( pathString + "today" ); 763 icon = loadPixmap( pathString + "today" );
764 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 764 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
765 today_action->addTo( viewMenu ); 765 today_action->addTo( viewMenu );
766 connect( today_action, SIGNAL( activated() ), 766 connect( today_action, SIGNAL( activated() ),
767 mView, SLOT( goToday() ) ); 767 mView, SLOT( goToday() ) );
768 viewMenu->insertSeparator(); 768 viewMenu->insertSeparator();
769 769
770 // *********************** 770 // ***********************
771 if ( KOPrefs::instance()->mVerticalScreen ) { 771 if ( KOPrefs::instance()->mVerticalScreen ) {
772 icon = SmallIcon( "1updownarrow" ); 772 icon = SmallIcon( "1updownarrow" );
773 } else { 773 } else {
774 icon = SmallIcon("1leftrightarrow" ); 774 icon = SmallIcon("1leftrightarrow" );
775 } 775 }
776 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); 776 configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 );
777 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); 777 QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this );
778 FSaction->addTo( viewMenu ); 778 FSaction->addTo( viewMenu );
779 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); 779 connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() ));
780 780
781 icon = loadPixmap( pathString + "navi" ); 781
782 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
783 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
784 action->addTo( viewMenu );
785 connect( action, SIGNAL( activated() ),
786 mView, SLOT( toggleDateNavigatorWidget() ) );
787 mToggleNav = action ;
788 icon = loadPixmap( pathString + "filter" ); 782 icon = loadPixmap( pathString + "filter" );
789 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); 783 configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 );
790 icon = loadPixmap( pathString + "configure" ); 784 icon = loadPixmap( pathString + "configure" );
791 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this ); 785 action = new QAction( i18n("Toggle Resource View"), icon, i18n("Toggle Resource View"), 0, this );
792 action->addTo( viewMenu ); 786 action->addTo( viewMenu );
793 connect( action, SIGNAL( activated() ), 787 connect( action, SIGNAL( activated() ),
794 mView, SLOT( toggleFilter() ) ); 788 mView, SLOT( toggleFilter() ) );
795 mToggleFilter = action; 789 mToggleFilter = action;
790 icon = loadPixmap( pathString + "navi" );
791 configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 );
792 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
793 action->addTo( viewMenu );
794 connect( action, SIGNAL( activated() ),
795 mView, SLOT( toggleDateNavigatorWidget() ) );
796 mToggleNav = action ;
796 icon = loadPixmap( pathString + "allday" ); 797 icon = loadPixmap( pathString + "allday" );
797 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); 798 configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 );
798 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 799 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
799 action->addTo( viewMenu ); 800 action->addTo( viewMenu );
800 connect( action, SIGNAL( activated() ), 801 connect( action, SIGNAL( activated() ),
801 mView, SLOT( toggleAllDaySize() ) ); 802 mView, SLOT( toggleAllDaySize() ) );
802 mToggleAllday = action; 803 mToggleAllday = action;
803 804
804 805
805 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 806 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
806 mToggleNav, SLOT( setEnabled ( bool ) ) ); 807 mToggleNav, SLOT( setEnabled ( bool ) ) );
807 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 808 //connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
808 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 809 // mToggleFilter, SLOT( setEnabled ( bool ) ) );
809 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 810 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
810 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 811 mToggleAllday, SLOT( setEnabled ( bool ) ) );
811 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 812 // connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
812 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) ); 813 // configureAgendaMenu, SLOT( setEnabled ( bool ) ) );
813 814
814 viewMenu->insertSeparator(); 815 viewMenu->insertSeparator();
815 icon = loadPixmap( pathString + "picker" ); 816 icon = loadPixmap( pathString + "picker" );
816 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 817 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
817 action->addTo( viewMenu ); 818 action->addTo( viewMenu );
818 connect( action, SIGNAL( activated() ), 819 connect( action, SIGNAL( activated() ),
819 mView, SLOT( showDatePicker() ) ); 820 mView, SLOT( showDatePicker() ) );
820 action->addTo( iconToolBar ); 821 action->addTo( iconToolBar );
821 viewMenu->insertSeparator(); 822 viewMenu->insertSeparator();
822 823
823 if ( p-> mShowIconToggleFull ) 824 if ( p-> mShowIconToggleFull )
824 FSaction->addTo( iconToolBar ); 825 FSaction->addTo( iconToolBar );
825 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); 826 if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar );
826 827
827 //******************** 828 //********************
828 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); 829 if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar );
829 830
830 831
831 icon = loadPixmap( pathString + "whatsnext" ); 832 icon = loadPixmap( pathString + "whatsnext" );
832 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); 833 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
833 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 834 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
834 whatsnext_action->addTo( viewMenu ); 835 whatsnext_action->addTo( viewMenu );
835 connect( whatsnext_action, SIGNAL( activated() ), 836 connect( whatsnext_action, SIGNAL( activated() ),
836 mView->viewManager(), SLOT( showWhatsNextView() ) ); 837 mView->viewManager(), SLOT( showWhatsNextView() ) );
837 838
838 icon = loadPixmap( pathString + "xdays" ); 839 icon = loadPixmap( pathString + "xdays" );
839 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); 840 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
840 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 841 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
841 xdays_action->addTo( viewMenu ); 842 xdays_action->addTo( viewMenu );
842 connect( xdays_action, SIGNAL( activated() ), 843 connect( xdays_action, SIGNAL( activated() ),
843 mView->viewManager(), SLOT( showNextXView() ) ); 844 mView->viewManager(), SLOT( showNextXView() ) );
844 845
845 846
846 icon = loadPixmap( pathString + "journal" ); 847 icon = loadPixmap( pathString + "journal" );
847 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 848 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
848 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 849 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
849 viewjournal_action->addTo( viewMenu ); 850 viewjournal_action->addTo( viewMenu );
850 connect( viewjournal_action, SIGNAL( activated() ), 851 connect( viewjournal_action, SIGNAL( activated() ),
851 mView->viewManager(), SLOT( showJournalView() ) ); 852 mView->viewManager(), SLOT( showJournalView() ) );
852 853
853 854
854 icon = loadPixmap( pathString + "day" ); 855 icon = loadPixmap( pathString + "day" );
855 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 856 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
856 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 857 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
857 day1_action->addTo( viewMenu ); 858 day1_action->addTo( viewMenu );
858 // action->addTo( toolBar ); 859 // action->addTo( toolBar );
859 connect( day1_action, SIGNAL( activated() ), 860 connect( day1_action, SIGNAL( activated() ),
860 mView->viewManager(), SLOT( showDayView() ) ); 861 mView->viewManager(), SLOT( showDayView() ) );
861 862
862 icon = loadPixmap( pathString + "workweek" ); 863 icon = loadPixmap( pathString + "workweek" );
863 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 864 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
864 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 865 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
865 day5_action->addTo( viewMenu ); 866 day5_action->addTo( viewMenu );
866 connect( day5_action, SIGNAL( activated() ), 867 connect( day5_action, SIGNAL( activated() ),
867 mView->viewManager(), SLOT( showWorkWeekView() ) ); 868 mView->viewManager(), SLOT( showWorkWeekView() ) );
868 869
869 icon = loadPixmap( pathString + "week" ); 870 icon = loadPixmap( pathString + "week" );
870 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 871 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
871 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 872 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
872 day7_action->addTo( viewMenu ); 873 day7_action->addTo( viewMenu );
873 connect( day7_action, SIGNAL( activated() ), 874 connect( day7_action, SIGNAL( activated() ),
874 mView->viewManager(), SLOT( showWeekView() ) ); 875 mView->viewManager(), SLOT( showWeekView() ) );
875 876
876 icon = loadPixmap( pathString + "workweek2" ); 877 icon = loadPixmap( pathString + "workweek2" );
877 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 878 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
878 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 879 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
879 day6_action->addTo( viewMenu ); 880 day6_action->addTo( viewMenu );
880 connect( day6_action, SIGNAL( activated() ), 881 connect( day6_action, SIGNAL( activated() ),
881 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 882 mView->viewManager(), SLOT( showMonthViewWeek() ) );
882 883
883 icon = loadPixmap( pathString + "month" ); 884 icon = loadPixmap( pathString + "month" );
884 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 885 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
885 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 886 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
886 month_action->addTo( viewMenu ); 887 month_action->addTo( viewMenu );
887 connect( month_action, SIGNAL( activated() ), 888 connect( month_action, SIGNAL( activated() ),
888 mView->viewManager(), SLOT( showMonthView() ) ); 889 mView->viewManager(), SLOT( showMonthView() ) );
889 890
890 icon = loadPixmap( pathString + "list" ); 891 icon = loadPixmap( pathString + "list" );
891 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 892 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
892 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 893 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
893 showlist_action->addTo( viewMenu ); 894 showlist_action->addTo( viewMenu );
894 connect( showlist_action, SIGNAL( activated() ), 895 connect( showlist_action, SIGNAL( activated() ),
895 mView->viewManager(), SLOT( showListView() ) ); 896 mView->viewManager(), SLOT( showListView() ) );
896 897
897 icon = loadPixmap( pathString + "todo" ); 898 icon = loadPixmap( pathString + "todo" );
898 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 899 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
899 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 900 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
900 todoview_action->addTo( viewMenu ); 901 todoview_action->addTo( viewMenu );
901 connect( todoview_action, SIGNAL( activated() ), 902 connect( todoview_action, SIGNAL( activated() ),
902 mView->viewManager(), SLOT( showTodoView() ) ); 903 mView->viewManager(), SLOT( showTodoView() ) );
903 904
904 905