summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
Unidiff
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp62
1 files changed, 61 insertions, 1 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 9e32c18..1c74307 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -239,97 +239,99 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
239 SLOT( processIncidenceSelection( Incidence * ) ) ); 239 SLOT( processIncidenceSelection( Incidence * ) ) );
240 connect( mView, SIGNAL( modifiedChanged( bool ) ), 240 connect( mView, SIGNAL( modifiedChanged( bool ) ),
241 SLOT( slotModifiedChanged( bool ) ) ); 241 SLOT( slotModifiedChanged( bool ) ) );
242 242
243 243
244 connect( mView, SIGNAL( tempDisableBR(bool) ), 244 connect( mView, SIGNAL( tempDisableBR(bool) ),
245 SLOT( disableBR(bool) ) ); 245 SLOT( disableBR(bool) ) );
246 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 246 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
247 mView->setModified( false ); 247 mView->setModified( false );
248 mBlockAtStartup = false; 248 mBlockAtStartup = false;
249 mView->setModified( false ); 249 mView->setModified( false );
250 setCentralWidget( mView ); 250 setCentralWidget( mView );
251 globalFlagBlockStartup = 0; 251 globalFlagBlockStartup = 0;
252 mView->show(); 252 mView->show();
253 delete splash; 253 delete splash;
254 if ( newFile ) 254 if ( newFile )
255 mView->updateConfig(); 255 mView->updateConfig();
256 // qApp->processEvents(); 256 // qApp->processEvents();
257 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 257 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
258 //fillSyncMenu(); 258 //fillSyncMenu();
259 259
260 260
261 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 261 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
262 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 262 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
263 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 263 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
264 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 264 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
265 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 265 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
266 mSyncManager->setDefaultFileName( defaultFileName()); 266 mSyncManager->setDefaultFileName( defaultFileName());
267 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 267 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
268 mSyncManager->fillSyncMenu(); 268 mSyncManager->fillSyncMenu();
269 269
270 270
271 271
272 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 272 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
273 if ( showWarning ) { 273 if ( showWarning ) {
274 KMessageBox::information( this, 274 KMessageBox::information( this,
275 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); 275 "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information");
276 qApp->processEvents(); 276 qApp->processEvents();
277 mView->dialogManager()->showSyncOptions(); 277 mView->dialogManager()->showSyncOptions();
278 } 278 }
279 279
280 //US listen for result adressed from Ka/Pi 280 //US listen for result adressed from Ka/Pi
281#ifndef DESKTOP_VERSION 281#ifndef DESKTOP_VERSION
282 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 282 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
283#endif 283#endif
284#ifndef DESKTOP_VERSION 284#ifndef DESKTOP_VERSION
285 infrared = 0; 285 infrared = 0;
286#endif 286#endif
287 287 updateWeek( mView->startDate() );
288 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
289 SLOT( updateWeekNum( const KCal::DateList & ) ) );
288 mBRdisabled = false; 290 mBRdisabled = false;
289 //toggleBeamReceive(); 291 //toggleBeamReceive();
290} 292}
291MainWindow::~MainWindow() 293MainWindow::~MainWindow()
292{ 294{
293 //qDebug("MainWindow::~MainWindow() "); 295 //qDebug("MainWindow::~MainWindow() ");
294 //save toolbar location 296 //save toolbar location
295 delete mCalendar; 297 delete mCalendar;
296 delete mSyncManager; 298 delete mSyncManager;
297#ifndef DESKTOP_VERSION 299#ifndef DESKTOP_VERSION
298 if ( infrared ) 300 if ( infrared )
299 delete infrared; 301 delete infrared;
300#endif 302#endif
301 303
302 304
303} 305}
304 306
305void MainWindow::disableBR(bool b) 307void MainWindow::disableBR(bool b)
306{ 308{
307#ifndef DESKTOP_VERSION 309#ifndef DESKTOP_VERSION
308 if ( b ) { 310 if ( b ) {
309 if ( infrared ) { 311 if ( infrared ) {
310 toggleBeamReceive(); 312 toggleBeamReceive();
311 mBRdisabled = true; 313 mBRdisabled = true;
312 } 314 }
313 mBRdisabled = true; 315 mBRdisabled = true;
314 } else { 316 } else {
315 if ( mBRdisabled ) { 317 if ( mBRdisabled ) {
316 mBRdisabled = false; 318 mBRdisabled = false;
317 //makes no sense,because other cal ap is probably running 319 //makes no sense,because other cal ap is probably running
318 // toggleBeamReceive(); 320 // toggleBeamReceive();
319 } 321 }
320 } 322 }
321#endif 323#endif
322 324
323} 325}
324bool MainWindow::beamReceiveEnabled() 326bool MainWindow::beamReceiveEnabled()
325{ 327{
326#ifndef DESKTOP_VERSION 328#ifndef DESKTOP_VERSION
327 return ( infrared != 0 ); 329 return ( infrared != 0 );
328#endif 330#endif
329 return false; 331 return false;
330} 332}
331 333
332void MainWindow::toggleBeamReceive() 334void MainWindow::toggleBeamReceive()
333{ 335{
334 if ( mBRdisabled ) 336 if ( mBRdisabled )
335 return; 337 return;
@@ -509,96 +511,120 @@ void MainWindow::initActions()
509 iconToolBar->clear(); 511 iconToolBar->clear();
510 KOPrefs *p = KOPrefs::instance(); 512 KOPrefs *p = KOPrefs::instance();
511 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 513 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
512 514
513 QPopupMenu *viewMenu = new QPopupMenu( this ); 515 QPopupMenu *viewMenu = new QPopupMenu( this );
514 QPopupMenu *actionMenu = new QPopupMenu( this ); 516 QPopupMenu *actionMenu = new QPopupMenu( this );
515 QPopupMenu *importMenu = new QPopupMenu( this ); 517 QPopupMenu *importMenu = new QPopupMenu( this );
516 selectFilterMenu = new QPopupMenu( this ); 518 selectFilterMenu = new QPopupMenu( this );
517 selectFilterMenu->setCheckable( true ); 519 selectFilterMenu->setCheckable( true );
518 syncMenu = new QPopupMenu( this ); 520 syncMenu = new QPopupMenu( this );
519 configureAgendaMenu = new QPopupMenu( this ); 521 configureAgendaMenu = new QPopupMenu( this );
520 configureToolBarMenu = new QPopupMenu( this ); 522 configureToolBarMenu = new QPopupMenu( this );
521 QPopupMenu *helpMenu = new QPopupMenu( this ); 523 QPopupMenu *helpMenu = new QPopupMenu( this );
522 if ( KOPrefs::instance()->mShowFullMenu ) { 524 if ( KOPrefs::instance()->mShowFullMenu ) {
523 QMenuBar *menuBar1; 525 QMenuBar *menuBar1;
524 menuBar1 = menuBar(); 526 menuBar1 = menuBar();
525 menuBar1->insertItem( i18n("File"), importMenu ); 527 menuBar1->insertItem( i18n("File"), importMenu );
526 menuBar1->insertItem( i18n("View"), viewMenu ); 528 menuBar1->insertItem( i18n("View"), viewMenu );
527 menuBar1->insertItem( i18n("Actions"), actionMenu ); 529 menuBar1->insertItem( i18n("Actions"), actionMenu );
528#ifdef DESKTOP_VERSION 530#ifdef DESKTOP_VERSION
529 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 531 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
530 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 532 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
531#else 533#else
532 menuBar1->insertItem( i18n("Sync"), syncMenu ); 534 menuBar1->insertItem( i18n("Sync"), syncMenu );
533 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 535 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
534#endif 536#endif
535 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 537 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
536 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 538 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
537 menuBar1->insertItem( i18n("Help"), helpMenu ); 539 menuBar1->insertItem( i18n("Help"), helpMenu );
538 } else { 540 } else {
539 QPEMenuBar *menuBar1; 541 QPEMenuBar *menuBar1;
540 menuBar1 = new QPEMenuBar( iconToolBar ); 542 menuBar1 = new QPEMenuBar( iconToolBar );
541 QPopupMenu *menuBar = new QPopupMenu( this ); 543 QPopupMenu *menuBar = new QPopupMenu( this );
542 menuBar1->insertItem( i18n("ME"), menuBar); 544 menuBar1->insertItem( i18n("ME"), menuBar);
543 menuBar->insertItem( i18n("File"), importMenu ); 545 menuBar->insertItem( i18n("File"), importMenu );
544 menuBar->insertItem( i18n("View"), viewMenu ); 546 menuBar->insertItem( i18n("View"), viewMenu );
545 menuBar->insertItem( i18n("Actions"), actionMenu ); 547 menuBar->insertItem( i18n("Actions"), actionMenu );
546 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 548 menuBar->insertItem( i18n("Synchronize"), syncMenu );
547 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 549 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
548 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 550 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
549 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 551 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
550 menuBar->insertItem( i18n("Help"), helpMenu ); 552 menuBar->insertItem( i18n("Help"), helpMenu );
551 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 553 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
552 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 554 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
553 } 555 }
554 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 556 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
555 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 557 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
556 558
559 menuBarWeek = new QPEMenuBar( iconToolBar );
560 QPopupMenu * wpo = new QPopupMenu (this);
561 QPopupMenu * all = new QPopupMenu (this);
562 //wpo->insertItem( i18n("W#"), 0 );
563 int first = 1;
564 int i;
565 for ( i = 1; i < 50; ++i ) {
566 if ( !(i%10) ) {
567 all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo );
568 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) );
569 first = i;
570 wpo = new QPopupMenu (this);
571 }
572 wpo->insertItem( QString::number(i), i );
573 }
574 for ( i = 50; i < 53; ++i ) {
575 wpo->insertItem( QString::number(i), i);
576 }
577 all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo );
578 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) );
579 menuBarWeek->insertItem( "00",all,1);
580 menuBarWeek->setMaximumSize( menuBarWeek->sizeHint( ));
581
582 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
557 // ****************** 583 // ******************
558 QAction *action; 584 QAction *action;
559 QIconSet icon; 585 QIconSet icon;
560 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 586 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
561 configureToolBarMenu->setCheckable( true ); 587 configureToolBarMenu->setCheckable( true );
562 588
563 QString pathString = ""; 589 QString pathString = "";
564 if ( !p->mToolBarMiniIcons ) { 590 if ( !p->mToolBarMiniIcons ) {
565 if ( QApplication::desktop()->width() < 480 ) 591 if ( QApplication::desktop()->width() < 480 )
566 pathString += "icons16/"; 592 pathString += "icons16/";
567 } else 593 } else
568 pathString += "iconsmini/"; 594 pathString += "iconsmini/";
569 configureAgendaMenu->setCheckable( true ); 595 configureAgendaMenu->setCheckable( true );
570 int iii ; 596 int iii ;
571 for ( iii = 1;iii<= 10 ;++iii ){ 597 for ( iii = 1;iii<= 10 ;++iii ){
572 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 598 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
573 } 599 }
574 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 600 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
575 601
576 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 602 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
577 this, SLOT( showConfigureAgenda( ) ) ); 603 this, SLOT( showConfigureAgenda( ) ) );
578 604
579 icon = loadPixmap( pathString + "configure" ); 605 icon = loadPixmap( pathString + "configure" );
580 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 606 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
581 action->addTo( actionMenu ); 607 action->addTo( actionMenu );
582 connect( action, SIGNAL( activated() ), 608 connect( action, SIGNAL( activated() ),
583 mView, SLOT( edit_options() ) ); 609 mView, SLOT( edit_options() ) );
584 actionMenu->insertSeparator(); 610 actionMenu->insertSeparator();
585 611
586 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 612 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
587 action->addTo( actionMenu ); 613 action->addTo( actionMenu );
588 connect( action, SIGNAL( activated() ), 614 connect( action, SIGNAL( activated() ),
589 mView, SLOT( undo_delete() ) ); 615 mView, SLOT( undo_delete() ) );
590 actionMenu->insertSeparator(); 616 actionMenu->insertSeparator();
591 617
592 icon = loadPixmap( pathString + "newevent" ); 618 icon = loadPixmap( pathString + "newevent" );
593 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 619 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
594 configureToolBarMenu->insertSeparator(); 620 configureToolBarMenu->insertSeparator();
595 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 621 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
596 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 622 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
597 ne_action->addTo( actionMenu ); 623 ne_action->addTo( actionMenu );
598 connect( ne_action, SIGNAL( activated() ), 624 connect( ne_action, SIGNAL( activated() ),
599 mView, SLOT( newEvent() ) ); 625 mView, SLOT( newEvent() ) );
600 icon = loadPixmap( pathString + "newtodo" ); 626 icon = loadPixmap( pathString + "newtodo" );
601 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 627 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
602 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 628 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
603 nt_action->addTo( actionMenu ); 629 nt_action->addTo( actionMenu );
604 connect( nt_action, SIGNAL( activated() ), 630 connect( nt_action, SIGNAL( activated() ),
@@ -1271,99 +1297,133 @@ void MainWindow::keyBindings()
1271 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1297 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1272 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1298 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1273 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1299 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1274 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1300 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1275 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1301 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1276 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1302 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1277 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1303 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1278 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1304 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1279 i18n("<p><b>White</b>: Item readonly</p>\n"); 1305 i18n("<p><b>White</b>: Item readonly</p>\n");
1280 displayText( text, cap); 1306 displayText( text, cap);
1281} 1307}
1282void MainWindow::aboutAutoSaving() 1308void MainWindow::aboutAutoSaving()
1283{ 1309{
1284 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); 1310 QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n");
1285 1311
1286 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1312 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1287 1313
1288} 1314}
1289void MainWindow::aboutKnownBugs() 1315void MainWindow::aboutKnownBugs()
1290{ 1316{
1291 QMessageBox* msg; 1317 QMessageBox* msg;
1292 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1318 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1293 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1319 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1294 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1320 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1295 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1321 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1296 i18n("\nor report them in the bugtracker on\n") + 1322 i18n("\nor report them in the bugtracker on\n") +
1297 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1323 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1298 QMessageBox::NoIcon, 1324 QMessageBox::NoIcon,
1299 QMessageBox::Ok, 1325 QMessageBox::Ok,
1300 QMessageBox::NoButton, 1326 QMessageBox::NoButton,
1301 QMessageBox::NoButton); 1327 QMessageBox::NoButton);
1302 msg->exec(); 1328 msg->exec();
1303 delete msg; 1329 delete msg;
1304 1330
1305} 1331}
1306 1332
1307QString MainWindow::defaultFileName() 1333QString MainWindow::defaultFileName()
1308{ 1334{
1309 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1335 return locateLocal( "data", "korganizer/mycalendar.ics" );
1310} 1336}
1311QString MainWindow::syncFileName() 1337QString MainWindow::syncFileName()
1312{ 1338{
1313#ifdef DESKTOP_VERSION 1339#ifdef DESKTOP_VERSION
1314 return locateLocal( "tmp", "synccalendar.ics" ); 1340 return locateLocal( "tmp", "synccalendar.ics" );
1315#else 1341#else
1316 return QString( "/tmp/synccalendar.ics" ); 1342 return QString( "/tmp/synccalendar.ics" );
1317#endif 1343#endif
1318} 1344}
1345void MainWindow::updateWeek(QDate seda)
1346{
1347 int weekNum = 0;
1348 QDate d = QDate ( seda.year(), 1,1);
1349 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday
1350 if ( seda.addDays(6).year() != seda.year() ) {
1351 if ( seda.year() != d.year() ) {
1352 if ( d.dayOfWeek() > 4 )
1353 d = QDate ( seda.year(), 1,1);
1354 else
1355 weekNum = 1;
1356 } else {
1357 QDate dd( seda.year()+1, 1,1);
1358 if ( dd.dayOfWeek() <= 4 )
1359 weekNum = 1;
1360 }
1361 }
1362 if ( weekNum == 0 ){
1363 int dow = d.dayOfWeek();
1364 if ( dow <= 4 )
1365 d = d.addDays( 1-dow );
1366 else // 5,6,7
1367 d = d.addDays( 8-dow );
1368 // we have the first week of the year.we are on monday
1369 weekNum = d.daysTo( seda ) / 7 +1;
1370 }
1371 //qDebug("weeknum %s ", QString::number( weekNum).latin1());
1372 menuBarWeek-> changeItem(1, QString::number( weekNum) );
1319 1373
1374}
1375void MainWindow::updateWeekNum(const DateList &selectedDates)
1376{
1377 updateWeek( selectedDates.first() );
1378}
1320void MainWindow::processIncidenceSelection( Incidence *incidence ) 1379void MainWindow::processIncidenceSelection( Incidence *incidence )
1321{ 1380{
1381
1322 if ( !incidence ) { 1382 if ( !incidence ) {
1323 enableIncidenceActions( false ); 1383 enableIncidenceActions( false );
1324 1384
1325 mNewSubTodoAction->setEnabled( false ); 1385 mNewSubTodoAction->setEnabled( false );
1326 setCaptionToDates(); 1386 setCaptionToDates();
1327 return; 1387 return;
1328 1388
1329 } 1389 }
1330 1390
1331 //KGlobal::locale()->formatDateTime(nextA, true); 1391 //KGlobal::locale()->formatDateTime(nextA, true);
1332 QString startString = ""; 1392 QString startString = "";
1333 if ( incidence->type() != "Todo" ) { 1393 if ( incidence->type() != "Todo" ) {
1334 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1394 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1335 if ( incidence->doesFloat() ) { 1395 if ( incidence->doesFloat() ) {
1336 startString += ": "+incidence->dtStartDateStr( true ); 1396 startString += ": "+incidence->dtStartDateStr( true );
1337 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1397 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1338 1398
1339 } else { 1399 } else {
1340 startString = ": "+incidence->dtStartStr(true); 1400 startString = ": "+incidence->dtStartStr(true);
1341 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1401 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1342 1402
1343 } 1403 }
1344 1404
1345 } else { 1405 } else {
1346 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1406 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1347 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1407 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1348 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1408 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1349 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { 1409 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) {
1350 bool ok; 1410 bool ok;
1351 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1411 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1352 if ( ok ) { 1412 if ( ok ) {
1353 int years = noc.date().year() - incidence->dtStart().date().year(); 1413 int years = noc.date().year() - incidence->dtStart().date().year();
1354 startString += i18n(" (%1 y.)"). arg( years ); 1414 startString += i18n(" (%1 y.)"). arg( years );
1355 } 1415 }
1356 } 1416 }
1357 else 1417 else
1358 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1418 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1359 } 1419 }
1360 1420
1361 } 1421 }
1362 else 1422 else
1363 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1423 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1364 if ( !incidence->location().isEmpty() ) 1424 if ( !incidence->location().isEmpty() )
1365 startString += " (" +incidence->location()+")"; 1425 startString += " (" +incidence->location()+")";
1366 setCaption( incidence->summary()+startString); 1426 setCaption( incidence->summary()+startString);
1367 1427
1368 enableIncidenceActions( true ); 1428 enableIncidenceActions( true );
1369 1429