-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 @@ -3155,12 +3155,17 @@ void CalendarView::showDates(const DateList &selectedDates) if (selectedDates.first() < selectedDates.last() ) selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); } +QPtrList<CalFilter> CalendarView::filters() +{ + return mFilters; + +} void CalendarView::editFilters() { // kdDebug() << "CalendarView::editFilters()" << endl; CalFilter *filter = mFilters.first(); while(filter) { @@ -3172,12 +3177,16 @@ void CalendarView::editFilters() } void CalendarView::toggleFilter() { showFilter(! mFilterView->isVisible()); } +KOFilterView *CalendarView::filterView() +{ + return mFilterView; +} void CalendarView::selectFilter( int fil ) { mFilterView->setSelectedFilter( fil ); } void CalendarView::showFilter(bool visible) { diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index f7a1213..d564473 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -374,18 +374,19 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser void schedule_publish_freebusy(int daysToPublish = 30); void openAddressbook(); void editFilters(); void toggleFilerEnabled(); - + QPtrList<CalFilter> filters(); void toggleFilter(); void showFilter(bool visible); void updateFilter(); void filterEdited(); void selectFilter( int ); + KOFilterView *filterView(); void showIntro(); /** Move the curdatepient view date to today */ void goToday(); diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 57b299f..a93d8e5 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -39,12 +39,13 @@ #include "datenavigator.h" #include "koagendaview.h" #include "koagenda.h" #include "kodialogmanager.h" #include "kdialogbase.h" #include "kapplication.h" +#include "kofilterview.h" #include "kstandarddirs.h" #include "koprefs.h" #include "kfiledialog.h" #include "koglobals.h" #include "kglobal.h" #include "klocale.h" @@ -346,13 +347,14 @@ void MainWindow::initActions() KOPrefs *p = KOPrefs::instance(); //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); QPopupMenu *viewMenu = new QPopupMenu( this ); 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 ); configureToolBarMenu = new QPopupMenu( this ); QPopupMenu *helpMenu = new QPopupMenu( this ); if ( KOPrefs::instance()->mShowFullMenu ) { QMenuBar *menuBar1; @@ -360,29 +362,34 @@ void MainWindow::initActions() menuBar1->insertItem( i18n("File"), importMenu ); menuBar1->insertItem( i18n("View"), viewMenu ); menuBar1->insertItem( i18n("Actions"), actionMenu ); menuBar1->insertItem( i18n("Synchronize"), syncMenu ); menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); + menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); menuBar1->insertItem( i18n("Help"), helpMenu ); } else { QPEMenuBar *menuBar1; menuBar1 = new QPEMenuBar( iconToolBar ); QPopupMenu *menuBar = new QPopupMenu( this ); menuBar1->insertItem( i18n("ME"), menuBar); menuBar->insertItem( i18n("File"), importMenu ); menuBar->insertItem( i18n("View"), viewMenu ); menuBar->insertItem( i18n("Actions"), actionMenu ); menuBar->insertItem( i18n("Synchronize"), syncMenu ); 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() ); menuBar1->setMaximumSize( menuBar1->sizeHint( )); } 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; QIconSet icon; // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); configureToolBarMenu->setCheckable( true ); @@ -1512,12 +1519,48 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) if ( showSelectedDates ) { ;// setCaptionToDates(); } } +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 ) { configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); KOPrefs *p = KOPrefs::instance(); p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 8a3f7b3..fba8c52 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h @@ -65,12 +65,14 @@ class MainWindow : public QMainWindow void configureToolBar( int ); void printSel(); void printCal(); void saveCalendar(); void loadCalendar(); void exportVCalendar(); + void fillFilterMenu(); + void selectFilter( int ); void slotSyncMenu( int ); void syncSSH(); void confSync(); void syncSharp(); void syncLocalFile(); @@ -94,12 +96,13 @@ class MainWindow : public QMainWindow QPEToolBar *iconToolBar; void initActions(); void setDefaultPreferences(); void keyPressEvent ( QKeyEvent * ) ; void keyReleaseEvent ( QKeyEvent * ) ; QPopupMenu *configureToolBarMenu; + QPopupMenu *selectFilterMenu; QPopupMenu *configureAgendaMenu, *syncMenu; CalendarLocal *mCalendar; CalendarView *mView; QString getPassword(); QAction *mNewSubTodoAction; |