summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp47
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
@@ -44,2 +44,3 @@
#include "kapplication.h"
+#include "kofilterview.h"
#include "kstandarddirs.h"
@@ -351,3 +352,4 @@ void MainWindow::initActions()
QPopupMenu *importMenu = new QPopupMenu( this );
-
+ selectFilterMenu = new QPopupMenu( this );
+ selectFilterMenu->setCheckable( true );
syncMenu = new QPopupMenu( this );
@@ -365,2 +367,3 @@ void MainWindow::initActions()
//menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
+ menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
menuBar1->insertItem( i18n("Help"), helpMenu );
@@ -376,3 +379,4 @@ void MainWindow::initActions()
menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
- menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
+ menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
+ menuBar->insertItem( i18n("Filter"),selectFilterMenu );
menuBar->insertItem( i18n("Help"), helpMenu );
@@ -382,2 +386,5 @@ 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() ) );
+
// ******************
@@ -1517,2 +1524,38 @@ 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 )