From 889d2102fcfe2fb0786b3f8f406dc32b42e38c7a Mon Sep 17 00:00:00 2001 From: zautrix Date: Wed, 30 Mar 2005 00:57:42 +0000 Subject: fixes --- (limited to 'korganizer/mainwindow.cpp') diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 6ddced0..ae03a09 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -644,6 +644,8 @@ void MainWindow::initActions() } connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); + + mWeekBgColor = iconToolBar->backgroundColor(); mWeekPixmap.resize( pixWid , pixHei ); mWeekPixmap.fill( mWeekBgColor ); @@ -668,6 +670,16 @@ void MainWindow::initActions() this, SLOT( weekAction() ) ); connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); + if ( p->mShowIconFilterview ) { + icon = loadPixmap( pathString + "filter" ); + actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); + connect( actionFilterMenuTB, SIGNAL( activated() ), + this, SLOT( fillFilterMenuTB() ) ); + actionFilterMenuTB->addTo( iconToolBar ); + selectFilterMenuTB = new QPopupMenu( this ); + selectFilterMenuTB->setCheckable( true ); + connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); + } //#endif // ****************** @@ -778,15 +790,7 @@ void MainWindow::initActions() if ( p-> mShowIconToggleFull ) FSaction->addTo( iconToolBar ); if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); - if ( p->mShowIconFilterview ) { - icon = loadPixmap( pathString + "filter" ); - QPEMenuBar *menuBar111 = new QPEMenuBar( iconToolBar ); - menuBar111->insertItem( icon.pixmap(), selectFilterMenu); - int isi = 24; - if ( QApplication::desktop()->width() < 480 ) - isi = 18; - menuBar111->setFixedSize( QSize( isi, isi )) ; - } + //******************** if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); @@ -1963,7 +1967,51 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) } } +void MainWindow::fillFilterMenuTB() +{ + selectFilterMenuTB->clear(); + selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); + selectFilterMenuTB->insertSeparator(); + selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); + + selectFilterMenuTB->insertSeparator(); + QPtrList fili = mView->filters(); + CalFilter *curfilter = mView->filterView()->selectedFilter(); + CalFilter *filter = fili.first(); + int iii = 2; + bool checkitem = mView->filterView()->filtersEnabled(); + while(filter) { + selectFilterMenuTB->insertItem( filter->name(), iii ); + if ( filter == curfilter) + selectFilterMenuTB->setItemChecked( iii, checkitem ); + filter = fili.next(); + ++iii; + } + if ( !checkitem ) + selectFilterMenuTB->setItemChecked( 1, true ); + int x = 0; + int y = iconToolBar->height(); + int dX = 0; + int dY = 0; + if ( iconToolBar->orientation () == Qt:: Horizontal ) { + if ( iconToolBar->y() > height()/2 ) { + dY = selectFilterMenuTB->sizeHint().height()+8; + y = 0; + } + } else { + if ( iconToolBar->x() > width()/2 ) { // right side + x=0; + dX= selectFilterMenuTB->sizeHint().width()+8; + y = 0; + } else { + x= iconToolBar->width(); + y = 0; + } + } + //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); + selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); +} void MainWindow::fillFilterMenu() { selectFilterMenu->clear(); @@ -2311,6 +2359,7 @@ void MainWindow::printCal() #include "libkdepim/kdatepicker.h" #include + void MainWindow::weekAction() { int month; -- cgit v0.9.0.2