-rw-r--r-- | korganizer/calendarview.cpp | 9 | ||||
-rw-r--r-- | korganizer/calendarview.h | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 45 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 3 |
4 files changed, 58 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 53c079c..fab4540 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -3159,4 +3159,9 @@ void CalendarView::showDates(const DateList &selectedDates) } +QPtrList<CalFilter> CalendarView::filters() +{ + return mFilters; + +} void CalendarView::editFilters() { @@ -3176,4 +3181,8 @@ void CalendarView::toggleFilter() } +KOFilterView *CalendarView::filterView() +{ + return mFilterView; +} 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 @@ -378,5 +378,5 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser void editFilters(); void toggleFilerEnabled(); - + QPtrList<CalFilter> filters(); void toggleFilter(); void showFilter(bool visible); @@ -384,4 +384,5 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser void filterEdited(); void selectFilter( int ); + KOFilterView *filterView(); void showIntro(); diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 57b299f..a93d8e5 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -43,4 +43,5 @@ #include "kdialogbase.h" #include "kapplication.h" +#include "kofilterview.h" #include "kstandarddirs.h" #include "koprefs.h" @@ -350,5 +351,6 @@ void MainWindow::initActions() QPopupMenu *actionMenu = new QPopupMenu( this ); QPopupMenu *importMenu = new QPopupMenu( this ); - + selectFilterMenu = new QPopupMenu( this ); + selectFilterMenu->setCheckable( true ); syncMenu = new QPopupMenu( this ); configureAgendaMenu = new QPopupMenu( this ); @@ -364,4 +366,5 @@ void MainWindow::initActions() menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); + menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); menuBar1->insertItem( i18n("Help"), helpMenu ); } else { @@ -376,4 +379,5 @@ void MainWindow::initActions() menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); + menuBar->insertItem( i18n("Filter"),selectFilterMenu ); menuBar->insertItem( i18n("Help"), helpMenu ); //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); @@ -381,4 +385,7 @@ void MainWindow::initActions() } connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); + connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); + connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); + // ****************** QAction *action; @@ -1516,4 +1523,40 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) } +void MainWindow::fillFilterMenu() +{ + selectFilterMenu->clear(); + bool disable = false; + if ( mView->filterView()->filtersEnabled() ) { + selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 0 ); + } + else { + selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); + disable = true; + } + selectFilterMenu->insertSeparator(); + QPtrList<CalFilter> fili = mView->filters(); + CalFilter *curfilter = mView->filterView()->selectedFilter(); + CalFilter *filter = fili.first(); + int iii = 1; + while(filter) { + selectFilterMenu->insertItem( filter->name(), iii ); + if ( filter == curfilter) + selectFilterMenu->setItemChecked( iii, true ); + if ( disable ) + selectFilterMenu->setItemEnabled( iii, false ); + filter = fili.next(); + ++iii; + } + qDebug("rettich "); +} +void MainWindow::selectFilter( int fil ) +{ + qDebug("selectFilter %d ", fil); + if ( fil == 0 ) { + mView->toggleFilerEnabled( ); + } else { + mView->selectFilter( fil-1 ); + } +} 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 @@ -69,4 +69,6 @@ class MainWindow : public QMainWindow void loadCalendar(); void exportVCalendar(); + void fillFilterMenu(); + void selectFilter( int ); void slotSyncMenu( int ); @@ -98,4 +100,5 @@ class MainWindow : public QMainWindow void keyReleaseEvent ( QKeyEvent * ) ; QPopupMenu *configureToolBarMenu; + QPopupMenu *selectFilterMenu; QPopupMenu *configureAgendaMenu, *syncMenu; CalendarLocal *mCalendar; |