-rw-r--r-- | korganizer/calendarview.cpp | 9 | ||||
-rw-r--r-- | korganizer/calendarview.h | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 47 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 3 |
4 files changed, 59 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 53c079c..fab4540 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -3160,2 +3160,7 @@ void CalendarView::showDates(const DateList &selectedDates) | |||
3160 | 3160 | ||
3161 | QPtrList<CalFilter> CalendarView::filters() | ||
3162 | { | ||
3163 | return mFilters; | ||
3164 | |||
3165 | } | ||
3161 | void CalendarView::editFilters() | 3166 | void CalendarView::editFilters() |
@@ -3177,2 +3182,6 @@ void CalendarView::toggleFilter() | |||
3177 | 3182 | ||
3183 | KOFilterView *CalendarView::filterView() | ||
3184 | { | ||
3185 | return mFilterView; | ||
3186 | } | ||
3178 | void CalendarView::selectFilter( int fil ) | 3187 | void CalendarView::selectFilter( int fil ) |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index f7a1213..d564473 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -379,3 +379,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
379 | void toggleFilerEnabled(); | 379 | void toggleFilerEnabled(); |
380 | 380 | QPtrList<CalFilter> filters(); | |
381 | void toggleFilter(); | 381 | void toggleFilter(); |
@@ -385,2 +385,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
385 | void selectFilter( int ); | 385 | void selectFilter( int ); |
386 | KOFilterView *filterView(); | ||
386 | 387 | ||
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 57b299f..a93d8e5 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -44,2 +44,3 @@ | |||
44 | #include "kapplication.h" | 44 | #include "kapplication.h" |
45 | #include "kofilterview.h" | ||
45 | #include "kstandarddirs.h" | 46 | #include "kstandarddirs.h" |
@@ -351,3 +352,4 @@ void MainWindow::initActions() | |||
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 ); |
@@ -365,2 +367,3 @@ void MainWindow::initActions() | |||
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 ); |
@@ -376,3 +379,4 @@ void MainWindow::initActions() | |||
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 ); |
@@ -382,2 +386,5 @@ void MainWindow::initActions() | |||
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 | // ****************** |
@@ -1517,2 +1524,38 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) | |||
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 ) |
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 8a3f7b3..fba8c52 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h | |||
@@ -70,2 +70,4 @@ class MainWindow : public QMainWindow | |||
70 | void exportVCalendar(); | 70 | void exportVCalendar(); |
71 | void fillFilterMenu(); | ||
72 | void selectFilter( int ); | ||
71 | 73 | ||
@@ -99,2 +101,3 @@ class MainWindow : public QMainWindow | |||
99 | QPopupMenu *configureToolBarMenu; | 101 | QPopupMenu *configureToolBarMenu; |
102 | QPopupMenu *selectFilterMenu; | ||
100 | QPopupMenu *configureAgendaMenu, *syncMenu; | 103 | QPopupMenu *configureAgendaMenu, *syncMenu; |