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
@@ -275,25 +275,27 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
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;
@@ -545,24 +547,48 @@ void MainWindow::initActions()
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/";
@@ -1307,27 +1333,61 @@ void MainWindow::aboutKnownBugs()
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" ) {