summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-07-02 17:31:20 (UTC)
committer zautrix <zautrix>2005-07-02 17:31:20 (UTC)
commit0233482f5f4baf7a0af45229b02c5deaab17a412 (patch) (unidiff)
treef22927da2ae116c53dc87026ce60b56704309e56
parent78866028c185f4227bfb653ee2050d7feb2e2b78 (diff)
downloadkdepimpi-0233482f5f4baf7a0af45229b02c5deaab17a412.zip
kdepimpi-0233482f5f4baf7a0af45229b02c5deaab17a412.tar.gz
kdepimpi-0233482f5f4baf7a0af45229b02c5deaab17a412.tar.bz2
mv warnings removed
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kolistview.cpp10
-rw-r--r--korganizer/kolistview.h1
-rw-r--r--korganizer/komonthview.cpp35
-rw-r--r--korganizer/komonthview.h4
4 files changed, 34 insertions, 16 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 1b4397f..db3f802 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -303,48 +303,50 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
303 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 303 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
304 i18n("Hide all selected"),this, 304 i18n("Hide all selected"),this,
305 SLOT(hideAll()),true); 305 SLOT(hideAll()),true);
306 306
307 mPopupMenu->insertSeparator(); 307 mPopupMenu->insertSeparator();
308#ifdef DESKTOP_VERSION 308#ifdef DESKTOP_VERSION
309 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 309 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
310 i18n("Print complete list"),this, 310 i18n("Print complete list"),this,
311 SLOT(printList()),true); 311 SLOT(printList()),true);
312 mPopupMenu->insertSeparator(); 312 mPopupMenu->insertSeparator();
313#endif 313#endif
314 mCalPopup = new QPopupMenu ( this ); 314 mCalPopup = new QPopupMenu ( this );
315 mPopupMenu->insertItem( i18n("Set Calendar"), mCalPopup ); 315 mPopupMenu->insertItem( i18n("Set Calendar"), mCalPopup );
316 316
317 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 317 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
318 i18n("Set categories")+"...",this, 318 i18n("Set categories")+"...",this,
319 SLOT(setCat()),true); 319 SLOT(setCat()),true);
320 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 320 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
321 i18n("Set alarm..."),this, 321 i18n("Set alarm..."),this,
322 SLOT(setAlarm()),true); 322 SLOT(setAlarm()),true);
323 QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this, 323 QObject::connect(mCalPopup,SIGNAL(aboutToShow()),this,
324 SLOT( populateCalPopup() )); 324 SLOT( populateCalPopup() ));
325 QObject::connect(mCalPopup,SIGNAL(activated( int )),this, 325 QObject::connect(mCalPopup,SIGNAL(activated( int )),this,
326 SLOT( setCalendar( int ) )); 326 SLOT( setCalendar( int ) ));
327 QObject::connect(mPopupMenu,SIGNAL(categoryChanged( Incidence * )),this,
328 SLOT( catChanged( Incidence * ) ));
327 QPopupMenu * exportPO = new QPopupMenu ( this ); 329 QPopupMenu * exportPO = new QPopupMenu ( this );
328 mPopupMenu->insertItem( i18n("Export"), exportPO ); 330 mPopupMenu->insertItem( i18n("Export"), exportPO );
329 exportPO->insertItem( i18n("As iCal (ics) file..."),this, 331 exportPO->insertItem( i18n("As iCal (ics) file..."),this,
330 SLOT(saveToFile())); 332 SLOT(saveToFile()));
331 exportPO->insertItem( i18n("As vCal (vcs) file..."),this, 333 exportPO->insertItem( i18n("As vCal (vcs) file..."),this,
332 SLOT(saveToFileVCS())); 334 SLOT(saveToFileVCS()));
333 exportPO->insertItem( i18n("Journal/Details..."),this, 335 exportPO->insertItem( i18n("Journal/Details..."),this,
334 SLOT(saveDescriptionToFile())); 336 SLOT(saveDescriptionToFile()));
335 // mPopupMenu->insertSeparator(); 337 // mPopupMenu->insertSeparator();
336 // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 338 // mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
337 // i18n("Add Categ. to selected..."),this, 339 // i18n("Add Categ. to selected..."),this,
338 // SLOT(addCat()),true); 340 // SLOT(addCat()),true);
339 //mPopupMenu->insertSeparator(); 341 //mPopupMenu->insertSeparator();
340#ifndef DESKTOP_VERSION 342#ifndef DESKTOP_VERSION
341 mPopupMenu->insertSeparator(); 343 mPopupMenu->insertSeparator();
342 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 344 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
343 i18n("Beam via IR"),this, 345 i18n("Beam via IR"),this,
344 SLOT(beamSelected()),true); 346 SLOT(beamSelected()),true);
345#endif 347#endif
346 /* 348 /*
347 mPopupMenu = new QPopupMenu; 349 mPopupMenu = new QPopupMenu;
348 mPopupMenu->insertItem(i18n("Edit Event"), this, 350 mPopupMenu->insertItem(i18n("Edit Event"), this,
349 SLOT (editEvent())); 351 SLOT (editEvent()));
350 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 352 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
@@ -359,48 +361,56 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
359 this,SIGNAL(signalNewEvent())); 361 this,SIGNAL(signalNewEvent()));
360 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 362 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
361 this,SLOT(defaultItemAction(QListViewItem *))); 363 this,SLOT(defaultItemAction(QListViewItem *)));
362 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, 364 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *,
363 const QPoint &, int )), 365 const QPoint &, int )),
364 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 366 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
365 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 367 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
366 SLOT(processSelectionChange(QListViewItem *))); 368 SLOT(processSelectionChange(QListViewItem *)));
367 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 369 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
368 SIGNAL(showIncidenceSignal(Incidence *)) ); 370 SIGNAL(showIncidenceSignal(Incidence *)) );
369 371
370 readSettings(KOGlobals::config(),"KOListView Layout"); 372 readSettings(KOGlobals::config(),"KOListView Layout");
371} 373}
372 374
373KOListView::~KOListView() 375KOListView::~KOListView()
374{ 376{
375 delete mPopupMenu; 377 delete mPopupMenu;
376#if QT_VERSION >= 0x030000 378#if QT_VERSION >= 0x030000
377 379
378#else 380#else
379 delete mKOListViewWhatsThis; 381 delete mKOListViewWhatsThis;
380#endif 382#endif
381} 383}
382 384
385void KOListView::catChanged( Incidence* inc)
386{
387 KOListViewItem* item = getItemForEvent(inc);
388 if (item) {
389 ListItemVisitor v(item, mStartDate );
390 inc->accept(v);
391 }
392}
383QString KOListView::getWhatsThisText(QPoint p) 393QString KOListView::getWhatsThisText(QPoint p)
384{ 394{
385 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 395 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
386 if ( item ) 396 if ( item )
387 return KIncidenceFormatter::instance()->getFormattedText( item->data(), 397 return KIncidenceFormatter::instance()->getFormattedText( item->data(),
388 KOPrefs::instance()->mWTshowDetails, 398 KOPrefs::instance()->mWTshowDetails,
389 KOPrefs::instance()->mWTshowCreated, 399 KOPrefs::instance()->mWTshowCreated,
390 KOPrefs::instance()->mWTshowChanged); 400 KOPrefs::instance()->mWTshowChanged);
391 return i18n("That is the list view" ); 401 return i18n("That is the list view" );
392 402
393} 403}
394 404
395void KOListView::setCalendar( int c ) 405void KOListView::setCalendar( int c )
396{ 406{
397 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"), 407 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
398 i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ), 408 i18n("This adds the selected\nitems to the calendar\n%1\nand removes them from\ntheir current calendar!").arg( KOPrefs::instance()->calName( c ) ),
399 i18n("Continue"), i18n("Cancel"), 0, 409 i18n("Continue"), i18n("Cancel"), 0,
400 0, 1 ); 410 0, 1 );
401 if ( result != 0 ) { 411 if ( result != 0 ) {
402 return; 412 return;
403 } 413 }
404 414
405 QPtrList<Incidence> delSel = getSelectedIncidences() ; 415 QPtrList<Incidence> delSel = getSelectedIncidences() ;
406 int icount = delSel.count(); 416 int icount = delSel.count();
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index a54b550..99d0561 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -273,44 +273,45 @@ class KOListView : public KOEventView
273 void clearSelection(); 273 void clearSelection();
274 void allSelection(); 274 void allSelection();
275 275
276 void clear(); 276 void clear();
277 void showDates(); 277 void showDates();
278 void hideDates(); 278 void hideDates();
279 void deleteAll(); 279 void deleteAll();
280 void saveToFile(); 280 void saveToFile();
281 void saveToFileVCS(); 281 void saveToFileVCS();
282 void saveDescriptionToFile(); 282 void saveDescriptionToFile();
283 void beamSelected(); 283 void beamSelected();
284 void updateConfig(); 284 void updateConfig();
285 void setCat(); 285 void setCat();
286 void setAlarm(); 286 void setAlarm();
287 void setCategories( bool removeOld ); 287 void setCategories( bool removeOld );
288 void changeEventDisplay(Event *, int); 288 void changeEventDisplay(Event *, int);
289 289
290 void defaultItemAction(QListViewItem *item); 290 void defaultItemAction(QListViewItem *item);
291 void popupMenu(QListViewItem *item,const QPoint &,int); 291 void popupMenu(QListViewItem *item,const QPoint &,int);
292 void setCalendar( int c ); 292 void setCalendar( int c );
293 void populateCalPopup(); 293 void populateCalPopup();
294 294
295 protected slots: 295 protected slots:
296 void processSelectionChange(QListViewItem *); 296 void processSelectionChange(QListViewItem *);
297 void catChanged( Incidence* );
297 298
298 protected: 299 protected:
299 void writeToFile( bool iCal ); 300 void writeToFile( bool iCal );
300 void addEvents(QPtrList<Event> eventList); 301 void addEvents(QPtrList<Event> eventList);
301 void addIncidence(Incidence *); 302 void addIncidence(Incidence *);
302 KOListViewItem *getItemForEvent(Incidence *event); 303 KOListViewItem *getItemForEvent(Incidence *event);
303 304
304 private: 305 private:
305 bool mForceShowCompletedTodos; 306 bool mForceShowCompletedTodos;
306 QPopupMenu* mCalPopup; 307 QPopupMenu* mCalPopup;
307 KOListViewWhatsThis *mKOListViewWhatsThis; 308 KOListViewWhatsThis *mKOListViewWhatsThis;
308 KOListViewListView *mListView; 309 KOListViewListView *mListView;
309 KOEventPopupMenu *mPopupMenu; 310 KOEventPopupMenu *mPopupMenu;
310 KOListViewItem *mActiveItem; 311 KOListViewItem *mActiveItem;
311 QDict<Incidence> mUidDict; 312 QDict<Incidence> mUidDict;
312 QDate mStartDate; 313 QDate mStartDate;
313 void keyPressEvent ( QKeyEvent * ) ; 314 void keyPressEvent ( QKeyEvent * ) ;
314}; 315};
315 316
316#endif 317#endif
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 4fc447e..2289977 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -181,90 +181,90 @@ void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
181 e->ignore(); 181 e->ignore();
182 break; 182 break;
183 } 183 }
184 if ( count() ) { 184 if ( count() ) {
185 if ( currentItem() == 0 ) { 185 if ( currentItem() == 0 ) {
186 emit prevCell(); 186 emit prevCell();
187 } else { 187 } else {
188 setCurrentItem((currentItem()+count()-1)%count()); 188 setCurrentItem((currentItem()+count()-1)%count());
189 if(!itemVisible(currentItem())) { 189 if(!itemVisible(currentItem())) {
190 if((unsigned int) currentItem() == (count()-1)) { 190 if((unsigned int) currentItem() == (count()-1)) {
191 setTopItem(currentItem()-numItemsVisible()+1); 191 setTopItem(currentItem()-numItemsVisible()+1);
192 } else { 192 } else {
193 setTopItem(topItem()-1); 193 setTopItem(topItem()-1);
194 } 194 }
195 } 195 }
196 } 196 }
197 } 197 }
198 break; 198 break;
199 case Key_Down: 199 case Key_Down:
200 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 200 if(e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
201 e->ignore(); 201 e->ignore();
202 break; 202 break;
203 } 203 }
204 if ( count () ) { 204 if ( count () ) {
205 if ( currentItem()+1 == count () ) { 205 if ( ((uint)currentItem()+1) == count () ) {
206 emit nextCell(); 206 emit nextCell();
207 } else { 207 } else {
208 setCurrentItem((currentItem()+1)%count()); 208 setCurrentItem((currentItem()+1)%count());
209 if(!itemVisible(currentItem())) { 209 if(!itemVisible(currentItem())) {
210 if(currentItem() == 0) { 210 if(currentItem() == 0) {
211 setTopItem(0); 211 setTopItem(0);
212 } else { 212 } else {
213 setTopItem(topItem()+1); 213 setTopItem(topItem()+1);
214 } 214 }
215 } 215 }
216 } 216 }
217 } 217 }
218 break; 218 break;
219 case Key_I: 219 case Key_I:
220 QTimer::singleShot( 1, this, SLOT ( oneDown() ) ); 220 QTimer::singleShot( 1, this, SLOT ( oneDown() ) );
221 e->ignore(); 221 e->ignore();
222 break; 222 break;
223 case Key_Return: 223 case Key_Return:
224 case Key_Enter: 224 case Key_Enter:
225 { 225 {
226 if ( currentItem() >= 0 ) { 226 if ( currentItem() >= 0 ) {
227 emit doubleClicked( item( currentItem() ) ); 227 emit doubleClicked( item( currentItem() ) );
228 e->accept(); 228 e->accept();
229 } else { 229 } else {
230 e->ignore(); 230 e->ignore();
231 } 231 }
232 } 232 }
233 break; 233 break;
234 case Key_Shift: 234 case Key_Shift:
235 emit shiftDown(); 235 emit shiftDown();
236 break; 236 break;
237 default: 237 default:
238 e->ignore(); 238 e->ignore();
239 break; 239 break;
240 } 240 }
241} 241}
242 242
243void KNoScrollListBox::oneDown() 243void KNoScrollListBox::oneDown()
244{ 244{
245 if ( count () ) { 245 if ( count () ) {
246 if ( currentItem()+1 == count () ) { 246 if ( ((uint)currentItem()+1) == count () ) {
247 emit nextCell(); 247 emit nextCell();
248 } else { 248 } else {
249 resetOnFocusIn = false; 249 resetOnFocusIn = false;
250 setCurrentItem((currentItem()+1)%count()); 250 setCurrentItem((currentItem()+1)%count());
251 if(!itemVisible(currentItem())) { 251 if(!itemVisible(currentItem())) {
252 if(currentItem() == 0) { 252 if(currentItem() == 0) {
253 setTopItem(0); 253 setTopItem(0);
254 } else { 254 } else {
255 setTopItem(topItem()+1); 255 setTopItem(topItem()+1);
256 } 256 }
257 } 257 }
258 } 258 }
259 } 259 }
260} 260}
261void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) 261void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
262{ 262{
263 switch(e->key()) { 263 switch(e->key()) {
264 case Key_Shift: 264 case Key_Shift:
265 emit shiftUp(); 265 emit shiftUp();
266 break; 266 break;
267 default: 267 default:
268 break; 268 break;
269 } 269 }
270} 270}
@@ -1271,48 +1271,50 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1271 SIGNAL( newEventSignal( QDateTime ) ) ); 1271 SIGNAL( newEventSignal( QDateTime ) ) );
1272 connect( cell, SIGNAL( showDaySignal( QDate ) ), 1272 connect( cell, SIGNAL( showDaySignal( QDate ) ),
1273 SIGNAL( showDaySignal( QDate ) ) ); 1273 SIGNAL( showDaySignal( QDate ) ) );
1274 connect( cell, SIGNAL( nextCell() ), 1274 connect( cell, SIGNAL( nextCell() ),
1275 SLOT( nextCell() ) ); 1275 SLOT( nextCell() ) );
1276 connect( cell, SIGNAL( prevCell() ), 1276 connect( cell, SIGNAL( prevCell() ),
1277 SLOT( prevCell() ) ); 1277 SLOT( prevCell() ) );
1278 connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ), 1278 connect( cell, SIGNAL( highlightIncidence( Incidence * , MonthViewCell *, int ) ),
1279 SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) )); 1279 SLOT( incidenceHighlighted( Incidence *, MonthViewCell *, int ) ));
1280 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); 1280 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont );
1281 } 1281 }
1282 1282
1283 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); 1283 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
1284 mContextMenu = eventPopup(); 1284 mContextMenu = eventPopup();
1285 mContextMenu->addAdditionalItem(QIconSet(QPixmap()), 1285 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1286 i18n("New Event..."),this, 1286 i18n("New Event..."),this,
1287 SLOT(slotNewEvent()),false); 1287 SLOT(slotNewEvent()),false);
1288 mContextMenu->addAdditionalItem(QIconSet(QPixmap()), 1288 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1289 i18n("New Todo..."),this, 1289 i18n("New Todo..."),this,
1290 SLOT(slotNewTodo()),false); 1290 SLOT(slotNewTodo()),false);
1291 mContextMenu->addAdditionalItem(QIconSet(QPixmap()), 1291 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1292 i18n("Journal"),this, 1292 i18n("Journal"),this,
1293 SLOT(slotEditJournal()),false); 1293 SLOT(slotEditJournal()),false);
1294 1294
1295 connect (mContextMenu ,SIGNAL(categoryChanged( Incidence * )),this,
1296 SLOT( catChanged( Incidence * ) ));
1295 1297
1296 1298
1297 QString pathString = ""; 1299 QString pathString = "";
1298 if ( !KOPrefs::instance()->mToolBarMiniIcons ) { 1300 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
1299 if ( QApplication::desktop()->width() < 480 ) 1301 if ( QApplication::desktop()->width() < 480 )
1300 pathString += "icons16/"; 1302 pathString += "icons16/";
1301 } else 1303 } else
1302 pathString += "iconsmini/"; 1304 pathString += "iconsmini/";
1303 mNewItemMenu = new QPopupMenu( this ); 1305 mNewItemMenu = new QPopupMenu( this );
1304 mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent())); 1306 mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent()));
1305 mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false); 1307 mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false);
1306 mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false); 1308 mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false);
1307 1309
1308 // updateConfig(); //useless here... 1310 // updateConfig(); //useless here...
1309 // ... but we need mWidthLongDayLabel computed 1311 // ... but we need mWidthLongDayLabel computed
1310 QFontMetrics fontmetric(mDayLabels[0]->font()); 1312 QFontMetrics fontmetric(mDayLabels[0]->font());
1311 mWidthLongDayLabel = 0; 1313 mWidthLongDayLabel = 0;
1312 for (int i = 0; i < 7; i++) { 1314 for (int i = 0; i < 7; i++) {
1313 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 1315 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
1314 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 1316 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
1315 } 1317 }
1316 1318
1317 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 1319 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
1318 1320
@@ -1327,100 +1329,104 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1327 1329
1328 mComputeLayoutTimer = new QTimer( this ); 1330 mComputeLayoutTimer = new QTimer( this );
1329 connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout())); 1331 connect (mComputeLayoutTimer ,SIGNAL(timeout()), this, SLOT ( slotComputeLayout()));
1330 1332
1331 1333
1332#ifndef DESKTOP_VERSION 1334#ifndef DESKTOP_VERSION
1333 resize( QApplication::desktop()->size() ); 1335 resize( QApplication::desktop()->size() );
1334#else 1336#else
1335 resize(640, 480 ); 1337 resize(640, 480 );
1336 updatePossible = true; 1338 updatePossible = true;
1337#endif 1339#endif
1338 computeLayout(); 1340 computeLayout();
1339 1341
1340 if ( mShowWeekView ) 1342 if ( mShowWeekView )
1341 mWidStack->raiseWidget( mWeekView ); 1343 mWidStack->raiseWidget( mWeekView );
1342 else 1344 else
1343 mWidStack->raiseWidget( mMonthView ); 1345 mWidStack->raiseWidget( mMonthView );
1344} 1346}
1345 1347
1346KOMonthView::~KOMonthView() 1348KOMonthView::~KOMonthView()
1347{ 1349{
1348 delete mContextMenu; 1350 delete mContextMenu;
1349} 1351}
1350 1352
1353void KOMonthView::catChanged( Incidence * )
1354{
1355 updateView();
1356}
1351void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday ) 1357void KOMonthView::incidenceHighlighted( Incidence * inc , MonthViewCell* mc, int mday )
1352{ 1358{
1353 static Incidence * lastInc = 0; 1359 static Incidence * lastInc = 0;
1354 static MonthViewCell * lastCell = 0; 1360 static MonthViewCell * lastCell = 0;
1355 1361
1356 if ( lastInc == inc && lastCell == mc ) 1362 if ( lastInc == inc && lastCell == mc )
1357 return; 1363 return;
1358 lastInc = inc; 1364 lastInc = inc;
1359 lastCell = mc; 1365 lastCell = mc;
1360 //qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday ); 1366 //qDebug("KOMonthView::incidenceHighlighted %d %d %d", inc, mc, mday );
1361 1367
1362 bool weekview = false; 1368 bool weekview = false;
1363 int index = 0; 1369 uint index = 0;
1364 for (uint i = 0; i < mCellsW.count(); ++i) { 1370 for (uint i = 0; i < mCellsW.count(); ++i) {
1365 if ( mCellsW[i] == mc ) { 1371 if ( mCellsW[i] == mc ) {
1366 weekview = true; 1372 weekview = true;
1367 index = i; 1373 index = i;
1368 break; 1374 break;
1369 } 1375 }
1370 } 1376 }
1371 QPtrVector<MonthViewCell> *cells; 1377 QPtrVector<MonthViewCell> *cells;
1372 if ( weekview ) 1378 if ( weekview )
1373 cells = &mCellsW; 1379 cells = &mCellsW;
1374 else { 1380 else {
1375 for (uint i = 0; i < mCells.count(); ++i) { 1381 for (uint i = 0; i < mCells.count(); ++i) {
1376 if ( mCells[i] == mc ) { 1382 if ( mCells[i] == mc ) {
1377 index = i; 1383 index = i;
1378 break; 1384 break;
1379 } 1385 }
1380 } 1386 }
1381 cells = &mCells; 1387 cells = &mCells;
1382 } 1388 }
1383 for (uint i = 0; i < (*cells).count(); ++i) { 1389 for (uint i = 0; i < (*cells).count(); ++i) {
1384 (*cells)[i]->deHighLight(); 1390 (*cells)[i]->deHighLight();
1385 } 1391 }
1386 if ( ! inc ) 1392 if ( ! inc )
1387 return; 1393 return;
1388 1394
1389 int count = (*cells).count(); 1395 uint count = (*cells).count();
1390 bool goLeft = (mday > 1 && index > 0); 1396 bool goLeft = (mday > 1 && index > 0);
1391 bool goRight = (mday < 3 && mday > 0 && index < count -1); 1397 bool goRight = (mday < 3 && mday > 0 && index < count -1);
1392 for (uint iii = 1; iii < count; ++iii) { 1398 for (uint iii = 1; iii < count; ++iii) {
1393 if ( goLeft ) { 1399 if ( goLeft ) {
1394 int left = index - iii; 1400 int left = index - iii;
1395 if ( left >= 0 ) { 1401 if ( left >= 0 ) {
1396 if ( (*cells)[(uint)left]->doHighLight(inc) ) 1402 if ( (*cells)[(uint)left]->doHighLight(inc) )
1397 goLeft = false; 1403 goLeft = false;
1398 } else 1404 } else
1399 goLeft = false; 1405 goLeft = false;
1400 } 1406 }
1401 if ( goRight ) { 1407 if ( goRight ) {
1402 int right = index + iii; 1408 uint right = index + iii;
1403 if ( right < count ) { 1409 if ( right < count ) {
1404 if ( (*cells)[right]->doHighLight(inc) ) 1410 if ( (*cells)[right]->doHighLight(inc) )
1405 goRight = false; 1411 goRight = false;
1406 1412
1407 } else 1413 } else
1408 goRight = false; 1414 goRight = false;
1409 } 1415 }
1410 1416
1411 } 1417 }
1412#if 0 1418#if 0
1413 if ( mday > 1 && index > 0 ) 1419 if ( mday > 1 && index > 0 )
1414 for (int i = index-1; i >= 0; --i) { 1420 for (int i = index-1; i >= 0; --i) {
1415 //qDebug("index %d iii %d ", index, i); 1421 //qDebug("index %d iii %d ", index, i);
1416 if ( (*cells)[(uint)i]->doHighLight(inc) ) 1422 if ( (*cells)[(uint)i]->doHighLight(inc) )
1417 break; 1423 break;
1418 } 1424 }
1419 if ( mday < 3 && mday > 0 && index < (*cells).count()-1) 1425 if ( mday < 3 && mday > 0 && index < (*cells).count()-1)
1420 for (uint i = index+1; i < (*cells).count(); ++i) { 1426 for (uint i = index+1; i < (*cells).count(); ++i) {
1421 if ( (*cells)[i]->doHighLight(inc) ) 1427 if ( (*cells)[i]->doHighLight(inc) )
1422 break; 1428 break;
1423 } 1429 }
1424#endif 1430#endif
1425 1431
1426} 1432}
@@ -1468,57 +1474,57 @@ int KOMonthView::currentDateCount()
1468 1474
1469QPtrList<Incidence> KOMonthView::selectedIncidences() 1475QPtrList<Incidence> KOMonthView::selectedIncidences()
1470{ 1476{
1471 QPtrList<Incidence> selected; 1477 QPtrList<Incidence> selected;
1472 1478
1473 if ( mSelectedCell ) { 1479 if ( mSelectedCell ) {
1474 Incidence *incidence = mSelectedCell->selectedIncidence(); 1480 Incidence *incidence = mSelectedCell->selectedIncidence();
1475 if ( incidence ) selected.append( incidence ); 1481 if ( incidence ) selected.append( incidence );
1476 } 1482 }
1477 1483
1478 return selected; 1484 return selected;
1479} 1485}
1480 1486
1481DateList KOMonthView::selectedDates() 1487DateList KOMonthView::selectedDates()
1482{ 1488{
1483 DateList selected; 1489 DateList selected;
1484 1490
1485 if ( mSelectedCell ) { 1491 if ( mSelectedCell ) {
1486 QDate qd = mSelectedCell->selectedIncidenceDate(); 1492 QDate qd = mSelectedCell->selectedIncidenceDate();
1487 if ( qd.isValid() ) selected.append( qd ); 1493 if ( qd.isValid() ) selected.append( qd );
1488 } 1494 }
1489 1495
1490 return selected; 1496 return selected;
1491} 1497}
1492 1498#if 0
1493void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd, 1499void KOMonthView::printPreview(CalPrinter *calPrinter, const QDate &fd,
1494 const QDate &td) 1500 const QDate &td)
1495{ 1501{
1496#ifndef KORG_NOPRINTER 1502#ifndef KORG_NOPRINTER
1497 calPrinter->preview(CalPrinter::Month, fd, td); 1503 calPrinter->preview(CalPrinter::Month, fd, td);
1498#endif 1504#endif
1499} 1505}
1500 1506#endif
1501void KOMonthView::updateConfig() 1507void KOMonthView::updateConfig()
1502{ 1508{
1503 1509
1504 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 1510 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
1505 1511
1506 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { 1512 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) {
1507 mWeekStartsMonday = true; 1513 mWeekStartsMonday = true;
1508 } 1514 }
1509 QFontMetrics fontmetric(mDayLabels[0]->font()); 1515 QFontMetrics fontmetric(mDayLabels[0]->font());
1510 mWidthLongDayLabel = 0; 1516 mWidthLongDayLabel = 0;
1511 1517
1512 for (int i = 0; i < 7; i++) { 1518 for (int i = 0; i < 7; i++) {
1513 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 1519 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
1514 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width; 1520 if ( width > mWidthLongDayLabel ) mWidthLongDayLabel = width;
1515 } 1521 }
1516 bool temp = mShowSatSunComp ; 1522 bool temp = mShowSatSunComp ;
1517 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 1523 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
1518 if ( ! mShowWeekView ) { 1524 if ( ! mShowWeekView ) {
1519 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog ) 1525 if ( temp != KOPrefs::instance()->mMonthViewSatSunTog )
1520 computeLayout(); 1526 computeLayout();
1521 } 1527 }
1522 updateDayLabels(); 1528 updateDayLabels();
1523 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks); 1529 //qDebug("KOMonthView::updateConfig() %d %d %d ",height(), mDayLabels[0]->sizeHint().height() ,mNumWeeks);
1524 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks; 1530 //int cellHeight = (height() - mDayLabels[0]->sizeHint().height()) /mNumWeeks;
@@ -1562,75 +1568,74 @@ void KOMonthView::updateDayLabels()
1562 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); 1568 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM));
1563 1569
1564 } 1570 }
1565 } 1571 }
1566 1572
1567} 1573}
1568 1574
1569void KOMonthView::clearList() 1575void KOMonthView::clearList()
1570{ 1576{
1571 unsigned int i; 1577 unsigned int i;
1572 for( i = 0; i < mCells.size(); ++i ) { 1578 for( i = 0; i < mCells.size(); ++i ) {
1573 mCells[i]->clear(); 1579 mCells[i]->clear();
1574 } 1580 }
1575 for( i = 0; i < mCellsW.size(); ++i ) { 1581 for( i = 0; i < mCellsW.size(); ++i ) {
1576 mCellsW[i]->clear(); 1582 mCellsW[i]->clear();
1577 } 1583 }
1578} 1584}
1579void KOMonthView::showDates(const QDate &start, const QDate &) 1585void KOMonthView::showDates(const QDate &start, const QDate &)
1580{ 1586{
1581 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; 1587 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl;
1582 1588
1583 QPtrVector<MonthViewCell> *cells; 1589 QPtrVector<MonthViewCell> *cells;
1584 QPtrVector<QLabel> *dayLabels; 1590 QPtrVector<QLabel> *dayLabels;
1585 QPtrVector<KOWeekButton> *weekLabels; 1591 QPtrVector<KOWeekButton> *weekLabels;
1586 int weekNum = 6; 1592 uint weekNum = 6;
1587 mStartDate = start; 1593 mStartDate = start;
1588 if ( mShowWeekView ) { 1594 if ( mShowWeekView ) {
1589 weekNum = 1; 1595 weekNum = 1;
1590 cells = &mCellsW; 1596 cells = &mCellsW;
1591 dayLabels = &mDayLabelsW; 1597 dayLabels = &mDayLabelsW;
1592 weekLabels = &mWeekLabelsW; 1598 weekLabels = &mWeekLabelsW;
1593 if ( !KGlobal::locale()->weekStartsMonday() ) { 1599 if ( !KGlobal::locale()->weekStartsMonday() ) {
1594 mStartDate = mStartDate.addDays( 1 ); 1600 mStartDate = mStartDate.addDays( 1 );
1595 } 1601 }
1596 } else { 1602 } else {
1597 cells = &mCells; 1603 cells = &mCells;
1598 dayLabels = &mDayLabels; 1604 dayLabels = &mDayLabels;
1599 weekLabels = &mWeekLabels; 1605 weekLabels = &mWeekLabels;
1600 } 1606 }
1601 1607
1602 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday(); 1608 int mWeekStartsMonday = KGlobal::locale()->weekStartsMonday();
1603 1609
1604 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) { 1610 if ( mShowWeekView || KOPrefs::instance()->mMonthViewSatSunTog ) {
1605 mWeekStartsMonday = true; 1611 mWeekStartsMonday = true;
1606 } 1612 }
1607 int startWeekDay = mWeekStartsMonday ? 1 : 7; 1613 int startWeekDay = mWeekStartsMonday ? 1 : 7;
1608 1614
1609 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { 1615 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) {
1610 mStartDate = mStartDate.addDays( -1 ); 1616 mStartDate = mStartDate.addDays( -1 );
1611 } 1617 }
1612 bool primary = false;
1613 uint i; 1618 uint i;
1614 for( i = 0; i < (*cells).size(); ++i ) { 1619 for( i = 0; i < (*cells).size(); ++i ) {
1615 QDate date = mStartDate.addDays( i ); 1620 QDate date = mStartDate.addDays( i );
1616 (*cells)[i]->setDate( date ); 1621 (*cells)[i]->setDate( date );
1617 1622
1618#ifndef KORG_NOPLUGINS 1623#ifndef KORG_NOPLUGINS
1619 // add holiday, if present 1624 // add holiday, if present
1620 QString hstring(KOCore::self()->holiday(date)); 1625 QString hstring(KOCore::self()->holiday(date));
1621 (*cells)[i]->setHoliday( hstring ); 1626 (*cells)[i]->setHoliday( hstring );
1622#endif 1627#endif
1623 1628
1624 } 1629 }
1625 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); 1630 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 );
1626 for( i = 0; i < weekNum; ++i ) { 1631 for( i = 0; i < weekNum; ++i ) {
1627 int wno; 1632 int wno;
1628 // remember, according to ISO 8601, the first week of the year is the 1633 // remember, according to ISO 8601, the first week of the year is the
1629 // first week that contains a thursday. Thus we must subtract off 4, 1634 // first week that contains a thursday. Thus we must subtract off 4,
1630 // not just 1. 1635 // not just 1.
1631 int dayOfYear = date.dayOfYear(); 1636 int dayOfYear = date.dayOfYear();
1632 if (dayOfYear % 7 != 0) 1637 if (dayOfYear % 7 != 0)
1633 wno = dayOfYear / 7 + 1; 1638 wno = dayOfYear / 7 + 1;
1634 else 1639 else
1635 wno =dayOfYear / 7; 1640 wno =dayOfYear / 7;
1636 (*weekLabels)[i]->setWeekNum( wno ); 1641 (*weekLabels)[i]->setWeekNum( wno );
@@ -1658,49 +1663,48 @@ void KOMonthView::updateView()
1658 if ( !updatePossible ) 1663 if ( !updatePossible )
1659 return; 1664 return;
1660 //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU "); 1665 //qDebug("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU ");
1661 //QTime ti; 1666 //QTime ti;
1662 //ti.start(); 1667 //ti.start();
1663 clearSelection(); 1668 clearSelection();
1664 QPtrVector<MonthViewCell> *cells; 1669 QPtrVector<MonthViewCell> *cells;
1665 if ( mShowWeekView ) { 1670 if ( mShowWeekView ) {
1666 cells = &mCellsW; 1671 cells = &mCellsW;
1667 } else { 1672 } else {
1668 cells = &mCells; 1673 cells = &mCells;
1669 } 1674 }
1670#if 1 1675#if 1
1671 int i; 1676 int i;
1672 int timeSpan = (*cells).size()-1; 1677 int timeSpan = (*cells).size()-1;
1673 if ( KOPrefs::instance()->mMonthViewWeek ) 1678 if ( KOPrefs::instance()->mMonthViewWeek )
1674 timeSpan = 6; 1679 timeSpan = 6;
1675 for( i = 0; i < timeSpan + 1; ++i ) { 1680 for( i = 0; i < timeSpan + 1; ++i ) {
1676 (*cells)[i]->startUpdateCell(); 1681 (*cells)[i]->startUpdateCell();
1677 } 1682 }
1678 1683
1679 QPtrList<Event> events = calendar()->events(); 1684 QPtrList<Event> events = calendar()->events();
1680 Event *event; 1685 Event *event;
1681 QDateTime dt; 1686 QDateTime dt;
1682 bool ok;
1683 QDate endDate = mStartDate.addDays( timeSpan ); 1687 QDate endDate = mStartDate.addDays( timeSpan );
1684 for( event = events.first(); event; event = events.next() ) { // for event 1688 for( event = events.first(); event; event = events.next() ) { // for event
1685 if ( event->doesRecur() ) { 1689 if ( event->doesRecur() ) {
1686 bool last; 1690 bool last;
1687 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); 1691 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last );
1688 QDateTime incidenceEnd; 1692 QDateTime incidenceEnd;
1689 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); 1693 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() );
1690 bool invalid = false; 1694 bool invalid = false;
1691 while( true ) { 1695 while( true ) {
1692 if ( incidenceStart.isValid() ) { 1696 if ( incidenceStart.isValid() ) {
1693 incidenceEnd = incidenceStart.addDays( eventlen ); 1697 incidenceEnd = incidenceStart.addDays( eventlen );
1694 int st = incidenceStart.date().daysTo( endDate ); 1698 int st = incidenceStart.date().daysTo( endDate );
1695 if ( st >= 0 ) { // start before timeend 1699 if ( st >= 0 ) { // start before timeend
1696 int end = mStartDate.daysTo( incidenceEnd.date() ); 1700 int end = mStartDate.daysTo( incidenceEnd.date() );
1697 if ( end >= 0 ) { // end after timestart --- got one! 1701 if ( end >= 0 ) { // end after timestart --- got one!
1698 //normalize 1702 //normalize
1699 st = timeSpan - st; 1703 st = timeSpan - st;
1700 if ( st < 0 ) st = 0; 1704 if ( st < 0 ) st = 0;
1701 if ( end > timeSpan ) end = timeSpan; 1705 if ( end > timeSpan ) end = timeSpan;
1702 int iii; 1706 int iii;
1703 //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); 1707 //qDebug("found %s %d %d ",event->summary().latin1(), st, end );
1704 for ( iii = st;iii<= end;++iii) 1708 for ( iii = st;iii<= end;++iii)
1705 (*cells)[iii]->insertEvent( event ); 1709 (*cells)[iii]->insertEvent( event );
1706 } 1710 }
@@ -1790,48 +1794,49 @@ void KOMonthView::setKeyBoardFocus()
1790 } 1794 }
1791 else { 1795 else {
1792 shootAgain = !mWeekLabels[mNumWeeks]->hasFocus(); 1796 shootAgain = !mWeekLabels[mNumWeeks]->hasFocus();
1793 mWeekLabels[mNumWeeks]->setFocus(); 1797 mWeekLabels[mNumWeeks]->setFocus();
1794 } 1798 }
1795 --mKBFcounter; 1799 --mKBFcounter;
1796 if ( shootAgain && mKBFcounter > 0 ) { 1800 if ( shootAgain && mKBFcounter > 0 ) {
1797 QTimer::singleShot( 50, this, SLOT ( setKeyBoardFocus() ) ); 1801 QTimer::singleShot( 50, this, SLOT ( setKeyBoardFocus() ) );
1798 } 1802 }
1799} 1803}
1800void KOMonthView::setKeyBFocus() 1804void KOMonthView::setKeyBFocus()
1801{ 1805{
1802 //qDebug("KOMonthView::setKeyBFocus() "); 1806 //qDebug("KOMonthView::setKeyBFocus() ");
1803 mKBFcounter = 10; 1807 mKBFcounter = 10;
1804 QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) ); 1808 QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) );
1805} 1809}
1806void KOMonthView::resizeEvent(QResizeEvent * e) 1810void KOMonthView::resizeEvent(QResizeEvent * e)
1807{ 1811{
1808 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height()); 1812 //qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
1809 if ( isVisible() ) { 1813 if ( isVisible() ) {
1810 //qDebug("KOMonthView::isVisible "); 1814 //qDebug("KOMonthView::isVisible ");
1811 slotComputeLayout(); 1815 slotComputeLayout();
1812 } else 1816 } else
1813 mComputeLayoutTimer->start( 100 ); 1817 mComputeLayoutTimer->start( 100 );
1818 KOEventView::resizeEvent( e );
1814} 1819}
1815 1820
1816void KOMonthView::slotComputeLayout() 1821void KOMonthView::slotComputeLayout()
1817{ 1822{
1818 mComputeLayoutTimer->stop(); 1823 mComputeLayoutTimer->stop();
1819 //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() ); 1824 //qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() );
1820 computeLayout(); 1825 computeLayout();
1821 clPending = true; 1826 clPending = true;
1822 setKeyBFocus(); 1827 setKeyBFocus();
1823} 1828}
1824void KOMonthView::computeLayoutWeek() 1829void KOMonthView::computeLayoutWeek()
1825{ 1830{
1826 static int lastWid = 0; 1831 static int lastWid = 0;
1827 static int lastHei = 0; 1832 static int lastHei = 0;
1828 int daysToShow; 1833 int daysToShow;
1829 bool combinedSatSun = false; 1834 bool combinedSatSun = false;
1830 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { 1835 if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
1831 daysToShow = 6; 1836 daysToShow = 6;
1832 combinedSatSun = true; 1837 combinedSatSun = true;
1833 } 1838 }
1834 int tWid = topLevelWidget()->size().width(); 1839 int tWid = topLevelWidget()->size().width();
1835 int tHei = topLevelWidget()->size().height(); 1840 int tHei = topLevelWidget()->size().height();
1836 1841
1837 int wid = width();//e 1842 int wid = width();//e
@@ -1840,93 +1845,93 @@ void KOMonthView::computeLayoutWeek()
1840 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) 1845 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
1841 return; 1846 return;
1842 1847
1843 if ( lastWid == width() && lastHei == height() ) { 1848 if ( lastWid == width() && lastHei == height() ) {
1844 //qDebug("KOListWeekView::No compute layout needed "); 1849 //qDebug("KOListWeekView::No compute layout needed ");
1845 return; 1850 return;
1846 } 1851 }
1847 lastWid = width(); 1852 lastWid = width();
1848 lastHei = height(); 1853 lastHei = height();
1849 1854
1850 1855
1851 if ( wid < hei ) 1856 if ( wid < hei )
1852 daysToShow = 2; 1857 daysToShow = 2;
1853 else 1858 else
1854 daysToShow = 3; 1859 daysToShow = 3;
1855 mShowSatSunComp = true; 1860 mShowSatSunComp = true;
1856 combinedSatSun = true; 1861 combinedSatSun = true;
1857 1862
1858 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ "); 1863 //qDebug("KOMonthView::computeLayout() WWW ------------------------------------ ");
1859 QFontMetrics fm ( mWeekLabels[0]->font() ); 1864 QFontMetrics fm ( mWeekLabels[0]->font() );
1860 int weeklabelwid = fm.width( "888" ); 1865 int weeklabelwid = fm.width( "888" );
1861 wid -= weeklabelwid; 1866 wid -= weeklabelwid;
1862 1867
1863 int colWid = wid / daysToShow; 1868 int colWid = wid / daysToShow;
1864 int lastCol = wid - ( colWid*6 );
1865 int dayLabelHei = mDayLabelsW[0]->sizeHint().height(); 1869 int dayLabelHei = mDayLabelsW[0]->sizeHint().height();
1866 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow ); 1870 int cellHei = (hei - (5- daysToShow )*dayLabelHei) /(5- daysToShow );
1867 int colModulo = wid % daysToShow; 1871 int colModulo = wid % daysToShow;
1868 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1; 1872 int rowModulo = (hei- (5- daysToShow )*dayLabelHei) % daysToShow-1;
1869 //qDebug("rowmod %d ", rowModulo); 1873 //qDebug("rowmod %d ", rowModulo);
1870 int i; 1874 int i;
1871 int x,y,w,h; 1875 int x,y,w,h;
1872 x= 0; 1876 x= 0;
1873 y= 0; 1877 y= 0;
1874 w = colWid; 1878 w = colWid;
1875 h = dayLabelHei ; 1879 h = dayLabelHei ;
1876 for ( i = 0; i < 7; i++) { 1880 for ( i = 0; i < 7; i++) {
1877 if ( i && !( i % daysToShow) && i < 6) { 1881 if ( i && !( i % daysToShow) && i < 6) {
1878 y += hei/(5-daysToShow); 1882 y += hei/(5-daysToShow);
1879 x = 0; 1883 x = 0;
1880 w = colWid; 1884 w = colWid;
1881 } 1885 }
1882 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1886 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1883 ++w; 1887 ++w;
1884 } 1888 }
1885 if ( i >= 5 ) { 1889 if ( i >= 5 ) {
1886 int wi = width() - x - weeklabelwid; 1890 int wi = width() - x - weeklabelwid;
1887 if ( i == 5 ) { 1891 if ( i == 5 ) {
1888 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi/2+wi%2,h); 1892 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi/2+wi%2,h);
1889 } else { 1893 } else {
1890 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); 1894 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h);
1891 } 1895 }
1892 x = x - w + wi - (wi/2 ); 1896 x = x - w + wi - (wi/2 );
1893 } 1897 }
1894 else { 1898 else {
1895 int wi = w; 1899 int wi = w;
1896 if ( !(( i+1) % daysToShow)) { 1900 if ( !(( i+1) % daysToShow)) {
1897 wi = width() - x - weeklabelwid; 1901 wi = width() - x - weeklabelwid;
1898 } 1902 }
1899 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h); 1903 mDayLabelsW[i]->setGeometry( x+weeklabelwid,y,wi,h);
1900 } 1904 }
1901 x += w; 1905 x += w;
1902 } 1906 }
1903 x= 0; 1907 x= 0;
1904 y= dayLabelHei; 1908 y= dayLabelHei;
1905 w = colWid; 1909 w = colWid;
1906 h = cellHei; 1910 h = cellHei;
1907 int max = 0; 1911 int max = 0;
1908 for ( i = 0; i < mCellsW.count(); ++i) { 1912 int w_count = mCellsW.count();
1913 for ( i = 0; i < w_count; ++i) {
1909 if ( i > 6 ) { 1914 if ( i > 6 ) {
1910 mCellsW[i]->hide(); 1915 mCellsW[i]->hide();
1911 continue; 1916 continue;
1912 } 1917 }
1913 1918
1914 w = colWid; 1919 w = colWid;
1915 if ( ((i) % daysToShow) >= daysToShow-colModulo ) { 1920 if ( ((i) % daysToShow) >= daysToShow-colModulo ) {
1916 ++w; 1921 ++w;
1917 } 1922 }
1918 if ( i == (daysToShow-1-rowModulo)*7) 1923 if ( i == (daysToShow-1-rowModulo)*7)
1919 ++h; 1924 ++h;
1920 1925
1921 if ( i >= 5 ) { 1926 if ( i >= 5 ) {
1922 if ( i ==5 ) { 1927 if ( i ==5 ) {
1923 max = h/2; 1928 max = h/2;
1924 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1929 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max );
1925 x -= w ;y += h/2; 1930 x -= w ;y += h/2;
1926 } else { 1931 } else {
1927 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) { 1932 if ( ((i-1) % daysToShow) >= daysToShow-colModulo ) {
1928 ++w; 1933 ++w;
1929 } 1934 }
1930 max = h-h/2; 1935 max = h-h/2;
1931 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max ); 1936 mCellsW[i]->setGeometry ( x+weeklabelwid,y,w,max );
1932 y -= h/2; 1937 y -= h/2;
@@ -1976,84 +1981,84 @@ void KOMonthView::computeLayout()
1976 combinedSatSun = true; 1981 combinedSatSun = true;
1977 } 1982 }
1978 int tWid = topLevelWidget()->size().width(); 1983 int tWid = topLevelWidget()->size().width();
1979 int tHei = topLevelWidget()->size().height(); 1984 int tHei = topLevelWidget()->size().height();
1980 1985
1981 int wid = width();//e 1986 int wid = width();//e
1982 int hei = height()-1-mNavigatorBar->height(); 1987 int hei = height()-1-mNavigatorBar->height();
1983 1988
1984 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) { 1989 if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei ) {
1985 return; 1990 return;
1986 } 1991 }
1987 if ( lastWid == width() && lastHei == height() ){ 1992 if ( lastWid == width() && lastHei == height() ){
1988 //qDebug("KOMonthview::No compute layout needed "); 1993 //qDebug("KOMonthview::No compute layout needed ");
1989 return; 1994 return;
1990 } 1995 }
1991 1996
1992 lastWid = width(); 1997 lastWid = width();
1993 lastHei = height(); 1998 lastHei = height();
1994 //qDebug("KOMonthView::computeLayout() MMM ------------------- "); 1999 //qDebug("KOMonthView::computeLayout() MMM ------------------- ");
1995 QFontMetrics fm ( mWeekLabels[0]->font() ); 2000 QFontMetrics fm ( mWeekLabels[0]->font() );
1996 int weeklabelwid = fm.width( "888" ); 2001 int weeklabelwid = fm.width( "888" );
1997 wid -= weeklabelwid; 2002 wid -= weeklabelwid;
1998 2003
1999 int colWid = wid / daysToShow; 2004 int colWid = wid / daysToShow;
2000 int lastCol = wid - ( colWid*6 );
2001 int dayLabelHei = mDayLabels[0]->sizeHint().height(); 2005 int dayLabelHei = mDayLabels[0]->sizeHint().height();
2002 int cellHei = (hei - dayLabelHei) /6; 2006 int cellHei = (hei - dayLabelHei) /6;
2003 int colModulo = wid % daysToShow; 2007 int colModulo = wid % daysToShow;
2004 int rowModulo = (hei- dayLabelHei) % 6; 2008 int rowModulo = (hei- dayLabelHei) % 6;
2005 //qDebug("rowmod %d ", rowModulo); 2009 //qDebug("rowmod %d ", rowModulo);
2006 int i; 2010 int i;
2007 int x,y,w,h; 2011 int x,y,w,h;
2008 x= 0; 2012 x= 0;
2009 y= 0; 2013 y= 0;
2010 w = colWid; 2014 w = colWid;
2011 h = dayLabelHei ; 2015 h = dayLabelHei ;
2012 for ( i = 0; i < 7; i++) { 2016 for ( i = 0; i < 7; i++) {
2013 if ( i == daysToShow-colModulo ) 2017 if ( i == daysToShow-colModulo )
2014 ++w; 2018 ++w;
2015 if ( combinedSatSun ) { 2019 if ( combinedSatSun ) {
2016 if ( i >= daysToShow-1 ) { 2020 if ( i >= daysToShow-1 ) {
2017 2021
2018 if ( i == 6 ) 2022 if ( i == 6 )
2019 mDayLabels[i]->setGeometry( x+weeklabelwid,y,width()-x-weeklabelwid,h); 2023 mDayLabels[i]->setGeometry( x+weeklabelwid,y,width()-x-weeklabelwid,h);
2020 else 2024 else
2021 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); 2025 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h);
2022 x -= w/2 ; 2026 x -= w/2 ;
2023 } 2027 }
2024 else 2028 else
2025 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 2029 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
2026 } else 2030 } else
2027 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 2031 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
2028 x += w; 2032 x += w;
2029 } 2033 }
2030 x= 0; 2034 x= 0;
2031 y= dayLabelHei; 2035 y= dayLabelHei;
2032 w = colWid; 2036 w = colWid;
2033 h = cellHei ; 2037 h = cellHei ;
2034 int max = 0; 2038 int max = 0;
2035 for ( i = 0; i < mCells.count(); ++i) { 2039 int mc_count = mCells.count();
2040 for ( i = 0; i < mc_count; ++i) {
2036 //qDebug("iii %d ", i); 2041 //qDebug("iii %d ", i);
2037 w = colWid; 2042 w = colWid;
2038 if ( ((i) % 7) >= 7-colModulo ) { 2043 if ( ((i) % 7) >= 7-colModulo ) {
2039 ++w; 2044 ++w;
2040 } 2045 }
2041 if ( i == (6-rowModulo)*7) 2046 if ( i == (6-rowModulo)*7)
2042 ++h; 2047 ++h;
2043 if ( combinedSatSun ) { 2048 if ( combinedSatSun ) {
2044 if ( (i)%7 >= daysToShow-1 ) { 2049 if ( (i)%7 >= daysToShow-1 ) {
2045 if ( (i)%7 == daysToShow-1 ) { 2050 if ( (i)%7 == daysToShow-1 ) {
2046 w = width()-x-weeklabelwid; 2051 w = width()-x-weeklabelwid;
2047 max = h/2; 2052 max = h/2;
2048 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); 2053 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max );
2049 x -= w ;y += h/2; 2054 x -= w ;y += h/2;
2050 } else { 2055 } else {
2051 w = width()-x-weeklabelwid; 2056 w = width()-x-weeklabelwid;
2052 max = h-h/2; 2057 max = h-h/2;
2053 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max ); 2058 mCells[i]->setGeometry ( x+weeklabelwid,y,w,max );
2054 y -= h/2; 2059 y -= h/2;
2055 } 2060 }
2056 } else { 2061 } else {
2057 max = h; 2062 max = h;
2058 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 2063 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
2059 } 2064 }
@@ -2189,49 +2194,49 @@ void KOMonthView::keyPressEvent ( QKeyEvent * e )
2189 break; 2194 break;
2190 case Key_Return: 2195 case Key_Return:
2191 case Key_Enter: 2196 case Key_Enter:
2192 { 2197 {
2193 selectInternalWeekNum ( currentWeek() ); 2198 selectInternalWeekNum ( currentWeek() );
2194 } 2199 }
2195 e->accept(); 2200 e->accept();
2196 break; 2201 break;
2197 case Key_D: 2202 case Key_D:
2198 if ( mSelectedCell ) { 2203 if ( mSelectedCell ) {
2199 mSelectedCell->showDay(); 2204 mSelectedCell->showDay();
2200 e->accept(); 2205 e->accept();
2201 } else { 2206 } else {
2202 e->ignore(); 2207 e->ignore();
2203 } 2208 }
2204 break; 2209 break;
2205 default: 2210 default:
2206 e->ignore(); 2211 e->ignore();
2207 break; 2212 break;
2208 } 2213 }
2209} 2214}
2210 2215
2211void KOMonthView::nextCell() 2216void KOMonthView::nextCell()
2212{ 2217{
2213 bool res = focusNextPrevChild ( true ); 2218 focusNextPrevChild ( true );
2214} 2219}
2215void KOMonthView::prevCell() 2220void KOMonthView::prevCell()
2216{ 2221{
2217 focusNextPrevChild ( false ); 2222 focusNextPrevChild ( false );
2218} 2223}
2219 2224
2220void KOMonthView::slotNewTodo() 2225void KOMonthView::slotNewTodo()
2221{ 2226{
2222 //qDebug("KOMonthView::slotNewTodo() "); 2227 //qDebug("KOMonthView::slotNewTodo() ");
2223 if ( mPopupCell ){ 2228 if ( mPopupCell ){
2224 QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 2229 QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
2225 emit newTodoSignal(dt,true); 2230 emit newTodoSignal(dt,true);
2226 } 2231 }
2227 mPopupCell = 0; 2232 mPopupCell = 0;
2228} 2233}
2229void KOMonthView::slotNewEvent() 2234void KOMonthView::slotNewEvent()
2230{ 2235{
2231 if ( mPopupCell ) { 2236 if ( mPopupCell ) {
2232 QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 2237 QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
2233 emit newEventSignal( dt ); 2238 emit newEventSignal( dt );
2234 } 2239 }
2235 //qDebug("KOMonthView::slotNewEvent() "); 2240 //qDebug("KOMonthView::slotNewEvent() ");
2236 mPopupCell = 0; 2241 mPopupCell = 0;
2237} 2242}
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index a41eb54..4d62e9b 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -229,79 +229,81 @@ public slots:
229 void setMyPalette(); 229 void setMyPalette();
230 QPalette getPalette (); 230 QPalette getPalette ();
231 231
232}; 232};
233 233
234 234
235class KOMonthView: public KOEventView 235class KOMonthView: public KOEventView
236{ 236{
237 Q_OBJECT 237 Q_OBJECT
238 public: 238 public:
239 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); 239 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 );
240 ~KOMonthView(); 240 ~KOMonthView();
241 241
242 /** Returns maximum number of days supported by the komonthview */ 242 /** Returns maximum number of days supported by the komonthview */
243 virtual int maxDatesHint(); 243 virtual int maxDatesHint();
244 244
245 /** Returns number of currently shown dates. */ 245 /** Returns number of currently shown dates. */
246 virtual int currentDateCount(); 246 virtual int currentDateCount();
247 247
248 /** returns the currently selected events */ 248 /** returns the currently selected events */
249 virtual QPtrList<Incidence> selectedIncidences(); 249 virtual QPtrList<Incidence> selectedIncidences();
250 250
251 /** returns dates of the currently selected events */ 251 /** returns dates of the currently selected events */
252 virtual DateList selectedDates(); 252 virtual DateList selectedDates();
253 253#if 0
254 virtual void printPreview(CalPrinter *calPrinter, 254 virtual void printPreview(CalPrinter *calPrinter,
255 const QDate &, const QDate &); 255 const QDate &, const QDate &);
256#endif
256 bool isMonthView() { return !mShowWeekView; } 257 bool isMonthView() { return !mShowWeekView; }
257 bool isUpdatePossible() { return updatePossible; } 258 bool isUpdatePossible() { return updatePossible; }
258 259
259 MonthViewCell * selectedCell(); 260 MonthViewCell * selectedCell();
260 bool skipResize; 261 bool skipResize;
261 NavigatorBar* navigatorBar() { return mNavigatorBar ;} 262 NavigatorBar* navigatorBar() { return mNavigatorBar ;}
262 void clearList(); 263 void clearList();
263 public slots: 264 public slots:
264 void incidenceHighlighted( Incidence *, MonthViewCell*, int ); 265 void incidenceHighlighted( Incidence *, MonthViewCell*, int );
265 void nextCell(); 266 void nextCell();
266 void prevCell(); 267 void prevCell();
267 virtual void updateView(); 268 virtual void updateView();
268 virtual void updateConfig(); 269 virtual void updateConfig();
269 virtual void showDates(const QDate &start, const QDate &end); 270 virtual void showDates(const QDate &start, const QDate &end);
270 virtual void showEvents(QPtrList<Event> eventList); 271 virtual void showEvents(QPtrList<Event> eventList);
271 272
272 void changeEventDisplay(Event *, int); 273 void changeEventDisplay(Event *, int);
273 274
274 void clearSelection(); 275 void clearSelection();
275 276
276 void showContextMenu( Incidence * ); 277 void showContextMenu( Incidence * );
277 278
278 void setSelectedCell( MonthViewCell * ); 279 void setSelectedCell( MonthViewCell * );
279 void setPopupCell( MonthViewCell * ); 280 void setPopupCell( MonthViewCell * );
280 void switchView(); 281 void switchView();
281 void setKeyBFocus(); 282 void setKeyBFocus();
282 283
283 protected slots: 284 protected slots:
285 void catChanged( Incidence * );
284 void setKeyBoardFocus(); 286 void setKeyBoardFocus();
285 void slotNewTodo(); 287 void slotNewTodo();
286 void slotNewEvent(); 288 void slotNewEvent();
287 void slotEditJournal(); 289 void slotEditJournal();
288 void slotComputeLayout(); 290 void slotComputeLayout();
289 void selectInternalWeekNum ( int ); 291 void selectInternalWeekNum ( int );
290 void processSelectionChange(); 292 void processSelectionChange();
291 signals: 293 signals:
292 void nextMonth(); 294 void nextMonth();
293 void prevMonth(); 295 void prevMonth();
294 void selectWeekNum ( int ); 296 void selectWeekNum ( int );
295 void selectMonth (); 297 void selectMonth ();
296 void showDaySignal( QDate ); 298 void showDaySignal( QDate );
297 void newTodoSignal( QDateTime, bool ); 299 void newTodoSignal( QDateTime, bool );
298 void showJournalSignal( int,QDate ); 300 void showJournalSignal( int,QDate );
299 protected: 301 protected:
300 void resizeEvent(QResizeEvent *); 302 void resizeEvent(QResizeEvent *);
301 void viewChanged(); 303 void viewChanged();
302 void updateDayLabels(); 304 void updateDayLabels();
303 305
304 private: 306 private:
305 int mKBFcounter; 307 int mKBFcounter;
306 QTimer* mComputeLayoutTimer; 308 QTimer* mComputeLayoutTimer;
307 NavigatorBar* mNavigatorBar; 309 NavigatorBar* mNavigatorBar;