summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-08-06 15:59:14 (UTC)
committer zautrix <zautrix>2004-08-06 15:59:14 (UTC)
commitf3307379ea27ad1394c9107c0129ecd3efd6bca6 (patch) (side-by-side diff)
treefdfebbebf84b2e86812165fac2bec09f95008ee2
parentfc862590cffbef8429bb8804dadfa61a21a52c7b (diff)
downloadkdepimpi-f3307379ea27ad1394c9107c0129ecd3efd6bca6.zip
kdepimpi-f3307379ea27ad1394c9107c0129ecd3efd6bca6.tar.gz
kdepimpi-f3307379ea27ad1394c9107c0129ecd3efd6bca6.tar.bz2
Added qick filter selection to kopi menu
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp9
-rw-r--r--korganizer/calendarview.h3
-rw-r--r--korganizer/mainwindow.cpp47
-rw-r--r--korganizer/mainwindow.h3
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
@@ -3158,6 +3158,11 @@ void CalendarView::showDates(const DateList &selectedDates)
}
+QPtrList<CalFilter> CalendarView::filters()
+{
+ return mFilters;
+
+}
void CalendarView::editFilters()
{
// kdDebug() << "CalendarView::editFilters()" << endl;
@@ -3175,6 +3180,10 @@ void CalendarView::toggleFilter()
showFilter(! mFilterView->isVisible());
}
+KOFilterView *CalendarView::filterView()
+{
+ return mFilterView;
+}
void CalendarView::selectFilter( int fil )
{
mFilterView->setSelectedFilter( fil );
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index f7a1213..d564473 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -377,12 +377,13 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
void editFilters();
void toggleFilerEnabled();
-
+ QPtrList<CalFilter> filters();
void toggleFilter();
void showFilter(bool visible);
void updateFilter();
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
@@ -42,6 +42,7 @@
#include "kodialogmanager.h"
#include "kdialogbase.h"
#include "kapplication.h"
+#include "kofilterview.h"
#include "kstandarddirs.h"
#include "koprefs.h"
#include "kfiledialog.h"
@@ -349,7 +350,8 @@ void MainWindow::initActions()
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 );
@@ -363,6 +365,7 @@ void MainWindow::initActions()
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;
@@ -374,12 +377,16 @@ void MainWindow::initActions()
menuBar->insertItem( i18n("Actions"), actionMenu );
menuBar->insertItem( i18n("Synchronize"), syncMenu );
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 );
//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;
@@ -1515,6 +1522,42 @@ 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
@@ -68,6 +68,8 @@ class MainWindow : public QMainWindow
void saveCalendar();
void loadCalendar();
void exportVCalendar();
+ void fillFilterMenu();
+ void selectFilter( int );
void slotSyncMenu( int );
void syncSSH();
@@ -97,6 +99,7 @@ class MainWindow : public QMainWindow
void keyPressEvent ( QKeyEvent * ) ;
void keyReleaseEvent ( QKeyEvent * ) ;
QPopupMenu *configureToolBarMenu;
+ QPopupMenu *selectFilterMenu;
QPopupMenu *configureAgendaMenu, *syncMenu;
CalendarLocal *mCalendar;
CalendarView *mView;