-rw-r--r-- | korganizer/mainwindow.cpp | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 57b299f..a93d8e5 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -42,6 +42,7 @@ | |||
42 | #include "kodialogmanager.h" | 42 | #include "kodialogmanager.h" |
43 | #include "kdialogbase.h" | 43 | #include "kdialogbase.h" |
44 | #include "kapplication.h" | 44 | #include "kapplication.h" |
45 | #include "kofilterview.h" | ||
45 | #include "kstandarddirs.h" | 46 | #include "kstandarddirs.h" |
46 | #include "koprefs.h" | 47 | #include "koprefs.h" |
47 | #include "kfiledialog.h" | 48 | #include "kfiledialog.h" |
@@ -349,7 +350,8 @@ void MainWindow::initActions() | |||
349 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 350 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
350 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 351 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
351 | QPopupMenu *importMenu = new QPopupMenu( this ); | 352 | QPopupMenu *importMenu = new QPopupMenu( this ); |
352 | 353 | selectFilterMenu = new QPopupMenu( this ); | |
354 | selectFilterMenu->setCheckable( true ); | ||
353 | syncMenu = new QPopupMenu( this ); | 355 | syncMenu = new QPopupMenu( this ); |
354 | configureAgendaMenu = new QPopupMenu( this ); | 356 | configureAgendaMenu = new QPopupMenu( this ); |
355 | configureToolBarMenu = new QPopupMenu( this ); | 357 | configureToolBarMenu = new QPopupMenu( this ); |
@@ -363,6 +365,7 @@ void MainWindow::initActions() | |||
363 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 365 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
364 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 366 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
365 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 367 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
368 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | ||
366 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 369 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
367 | } else { | 370 | } else { |
368 | QPEMenuBar *menuBar1; | 371 | QPEMenuBar *menuBar1; |
@@ -374,12 +377,16 @@ void MainWindow::initActions() | |||
374 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 377 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
375 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 378 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
376 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 379 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
377 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 380 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
381 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | ||
378 | menuBar->insertItem( i18n("Help"), helpMenu ); | 382 | menuBar->insertItem( i18n("Help"), helpMenu ); |
379 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 383 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
380 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 384 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
381 | } | 385 | } |
382 | connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); | 386 | connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); |
387 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | ||
388 | connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); | ||
389 | |||
383 | // ****************** | 390 | // ****************** |
384 | QAction *action; | 391 | QAction *action; |
385 | QIconSet icon; | 392 | QIconSet icon; |
@@ -1515,6 +1522,42 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) | |||
1515 | 1522 | ||
1516 | } | 1523 | } |
1517 | 1524 | ||
1525 | void MainWindow::fillFilterMenu() | ||
1526 | { | ||
1527 | selectFilterMenu->clear(); | ||
1528 | bool disable = false; | ||
1529 | if ( mView->filterView()->filtersEnabled() ) { | ||
1530 | selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); | ||
1531 | } | ||
1532 | else { | ||
1533 | selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); | ||
1534 | disable = true; | ||
1535 | } | ||
1536 | selectFilterMenu->insertSeparator(); | ||
1537 | QPtrList<CalFilter> fili = mView->filters(); | ||
1538 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | ||
1539 | CalFilter *filter = fili.first(); | ||
1540 | int iii = 1; | ||
1541 | while(filter) { | ||
1542 | selectFilterMenu->insertItem( filter->name(), iii ); | ||
1543 | if ( filter == curfilter) | ||
1544 | selectFilterMenu->setItemChecked( iii, true ); | ||
1545 | if ( disable ) | ||
1546 | selectFilterMenu->setItemEnabled( iii, false ); | ||
1547 | filter = fili.next(); | ||
1548 | ++iii; | ||
1549 | } | ||
1550 | qDebug("rettich "); | ||
1551 | } | ||
1552 | void MainWindow::selectFilter( int fil ) | ||
1553 | { | ||
1554 | qDebug("selectFilter %d ", fil); | ||
1555 | if ( fil == 0 ) { | ||
1556 | mView->toggleFilerEnabled( ); | ||
1557 | } else { | ||
1558 | mView->selectFilter( fil-1 ); | ||
1559 | } | ||
1560 | } | ||
1518 | void MainWindow::configureToolBar( int item ) | 1561 | void MainWindow::configureToolBar( int item ) |
1519 | { | 1562 | { |
1520 | 1563 | ||