-rw-r--r-- | korganizer/calendarview.cpp | 4 | ||||
-rw-r--r-- | korganizer/kofilterview.cpp | 2 | ||||
-rw-r--r-- | korganizer/kofilterview.h | 50 |
3 files changed, 54 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index ea100d1..8d992b9 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -426,96 +426,97 @@ void CalendarView::init() mLeftFrame = mLeftSplitter; #else //QWidget *mainBox = new QWidget( this ); //QWidget *leftFrame = new QWidget( mainBox ); //QBoxLayout * mainBoxLayout; if ( KOPrefs::instance()->mVerticalScreen ) { //mainBoxLayout = new QVBoxLayout(mainBox); //leftFrameLayout = new QHBoxLayout(leftFrame ); mMainFrame = new KDGanttMinimizeSplitter( Qt::Vertical, this ); mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); mLeftFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, mMainFrame);; mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); } else { //mainBoxLayout = new QHBoxLayout(mainBox); //leftFrameLayout = new QVBoxLayout(leftFrame ); mMainFrame = new KDGanttMinimizeSplitter( Qt::Horizontal, this); mMainFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Left); mLeftFrame = new KDGanttMinimizeSplitter( Qt::Vertical, mMainFrame); mLeftFrame->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); } mMainFrame->setSizePolicy( QSizePolicy (QSizePolicy::Expanding,QSizePolicy::Expanding) ); //QBoxLayout * leftFrameLayout; topLayout->addWidget( mMainFrame ); //mainBoxLayout->addWidget (mLeftFrame); mDateNavigator = new DateNavigatorContainer( mLeftFrame, "CalendarView::DateNavigator" ); #if 0 // FIXME mDateNavigator = new KDateNavigator(mLeftFrame, mCalendar, TRUE, "CalendarView::DateNavigator", QDate::currentDate()); #endif // mDateNavigator->blockSignals( true ); //leftFrameLayout->addWidget( mDateNavigator ); mTodoList = new KOTodoView(mCalendar, mLeftFrame, "todolistsmall"); mFilterView = new KOFilterView(&mFilters,mLeftFrame,"CalendarView::FilterView"); mCalEditView = new KOCalEditView(mLeftFrame,"CalendarView::CaleditView"); mTodoList->setNavigator( mNavigator ); #if 0 if ( QApplication::desktop()->width() < 480 ) { leftFrameLayout->addWidget(mFilterView); leftFrameLayout->addWidget(mTodoList, 2 ); } else { leftFrameLayout->addWidget(mTodoList,2 ); leftFrameLayout->addWidget(mFilterView ); } #endif mFilterView->hide(); + mCalEditView->hide(); QWidget *rightBox = new QWidget( mMainFrame ); //mainBoxLayout->addWidget ( rightBox, 10 ); QBoxLayout *rightLayout = new QVBoxLayout( rightBox ); mRightFrame = new QWidgetStack( rightBox ); rightLayout->addWidget( mRightFrame, 10 ); //mLeftFrame = (QWidget *)leftFrame; if ( KOPrefs::instance()->mVerticalScreen ) { //mDateNavigator->setFixedHeight( mDateNavigator->sizeHint().height() ); //mDateNavigator->setMinimumWidth( mDateNavigator->sizeHint().width() ); //mTodoList->setFixedHeight( mDateNavigator->sizeHint().height() ); //leftFrame->setFixedHeight( mDateNavigator->sizeHint().height() ); } else { //mDateNavigator->setFixedWidth( mDateNavigator->sizeHint().width() ); //mTodoList->setFixedWidth( mDateNavigator->sizeHint().width() ); //leftFrame->setFixedWidth( mDateNavigator->sizeHint().width() ); } if ( !KOPrefs::instance()->mShowDateNavigator) mDateNavigator->hide(); //qDebug("Calendarview Size %d %d ", width(), height()); #endif connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), SLOT( showDates( const KCal::DateList & ) ) ); connect( mNavigator, SIGNAL( datesSelected( const KCal::DateList & ) ), mDateNavigator, SLOT( selectDates( const KCal::DateList & ) ) ); connect( mDateNavigator, SIGNAL( showMonth( const QDate & ) ), mViewManager, SLOT( showMonth( const QDate & ) ) ); connect( mDateNavigator, SIGNAL( weekClicked( const QDate & ) ), mNavigator, SLOT( selectWeek( const QDate & ) ) ); connect( mDateNavigator, SIGNAL( goPrevYear() ), mNavigator, SLOT( selectPreviousYear() ) ); connect( mDateNavigator, SIGNAL( goNextYear() ), mNavigator, SLOT( selectNextYear() ) ); connect( mDateNavigator, SIGNAL( goPrevMonth() ), mNavigator, SLOT( selectPreviousMonth() ) ); connect( mDateNavigator, SIGNAL( goNextMonth() ), mNavigator, SLOT( selectNextMonth() ) ); connect( mDateNavigator, SIGNAL( goPrevious() ), mNavigator, SLOT( selectPrevious() ) ); connect( mDateNavigator, SIGNAL( goNext() ), @@ -3864,99 +3865,100 @@ void CalendarView::showDates(const DateList &selectedDates) addString = i18n("Tomorrow"); else if ( date == QDateTime::currentDateTime().date().addDays(-1) ) addString = i18n("Yesterday"); else if ( date == QDateTime::currentDateTime().date().addDays(-2) ) addString = i18n("Day before yesterday"); else if ( date == QDateTime::currentDateTime().date().addDays(2) ) addString = i18n("Day after tomorrow"); if ( !addString.isEmpty() ) { topLevelWidget()->setCaption( addString+", " + selDates ); return; } } topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); } QPtrList<CalFilter> CalendarView::filters() { return mFilters; } void CalendarView::editFilters() { // kdDebug() << "CalendarView::editFilters()" << endl; CalFilter *filter = mFilters.first(); while(filter) { kdDebug() << " Filter: " << filter->name() << endl; filter = mFilters.next(); } mDialogManager->showFilterEditDialog(&mFilters); } void CalendarView::toggleFilter() { showFilter(! mFilterView->isVisible()); } KOFilterView *CalendarView::filterView() { return mFilterView; } void CalendarView::selectFilter( int fil ) { mFilterView->setSelectedFilter( fil ); } void CalendarView::showFilter(bool visible) { +#if 0 if (visible) mCalEditView->show(); else mCalEditView->hide(); -#if 0 +#else if (visible) mFilterView->show(); else mFilterView->hide(); #endif } void CalendarView::toggleFilerEnabled( ) { mFilterView->setFiltersEnabled ( !mFilterView->filtersEnabled() ); if ( !mFilterView->filtersEnabled() ) topLevelWidget()->setCaption( i18n("Filter disabled ") ); } void CalendarView::updateFilter() { CalFilter *filter = mFilterView->selectedFilter(); if (filter) { QString mess; if (mFilterView->filtersEnabled()) { mess = i18n("Filter selected: ")+filter->name(); filter->setEnabled(true); } else filter->setEnabled(false); mCalendar->setFilter(filter); updateView(); if ( !mess.isEmpty() ) topLevelWidget()->setCaption( mess ); } } void CalendarView::filterEdited() { mFilterView->updateFilters(); updateFilter(); writeSettings(); } void CalendarView::takeOverEvent() { Incidence *incidence = currentSelection(); if (!incidence) return; incidence->setOrganizer(KOPrefs::instance()->email()); incidence->recreate(); incidence->setReadOnly(false); updateView(); diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index 1bfe4dd..dc6237b 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp @@ -93,84 +93,84 @@ void KOFilterView::setSelectedFilter( int fil ) { if ( fil >= mSelectionCombo->count() ) return; mSelectionCombo->setCurrentItem( fil ); emit filterChanged(); } KOCalEditView::KOCalEditView(QWidget* parent, const char* name ) : QWidget(parent,name) { /* connect(mSelectionCombo,SIGNAL(activated(int)),SIGNAL(filterChanged())); connect(mEnabledCheck,SIGNAL(clicked()),SIGNAL(filterChanged())); connect(mEditButton,SIGNAL(clicked()),SIGNAL(editCalEdits())); */ QGridLayout* mainLayout = new QGridLayout ( this , 2, 6 ); QPushButton * addBut = new QPushButton ( this ); mainLayout->addWidget( addBut,0,0 ); addBut->setPixmap ( SmallIcon("plus")); connect(addBut,SIGNAL(clicked()),SLOT(addCal())); addBut->setMaximumWidth( addBut->sizeHint().height() ); addBut = new QPushButton ( this ); mainLayout->addWidget( addBut,0,1 ); addBut->setPixmap ( SmallIcon("eye")); connect(addBut,SIGNAL(clicked()),SLOT(enableAll())); addBut->setMaximumWidth( addBut->sizeHint().height() ); QLabel* lab = new QLabel ( " "+i18n("Calendar")+" ", this ); mainLayout->addWidget( lab,0,2 ); addBut = new QPushButton ( this ); mainLayout->addWidget( addBut,0,3 ); addBut->setPixmap ( SmallIcon("bell")); connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); addBut->setMaximumWidth( addBut->sizeHint().height() ); addBut = new QPushButton ( this ); mainLayout->addWidget( addBut,0,4 ); addBut->setPixmap ( SmallIcon("pencil")); connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); addBut->setMaximumWidth( addBut->sizeHint().height() ); addBut = new QPushButton ( this ); mainLayout->addWidget( addBut,0,5 ); - addBut->setPixmap ( SmallIcon("trash")); + addBut->setPixmap ( SmallIcon("minus")); connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); addBut->setMaximumWidth( addBut->sizeHint().height() ); } KOCalEditView::~KOCalEditView() { // no need to delete child widgets, Qt does it all for us } void KOCalEditView::readConfig( KConfig *) { } void KOCalEditView::addCal() { qDebug("addcal "); } void KOCalEditView::enableAll() { qDebug("enableAll"); } void KOCalEditView::enableAlarm() { qDebug("enableAlarm"); } void KOCalEditView::disableRO() { qDebug("OCalEditView::disableRO() "); } void KOCalEditView::deleteAll() { qDebug("delteAll"); } diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h index d434c52..060108f 100644 --- a/korganizer/kofilterview.h +++ b/korganizer/kofilterview.h @@ -1,83 +1,133 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #ifndef KOFILTERVIEW_H #define KOFILTERVIEW_H #include <qstring.h> +#include <qcheckbox.h> +#include <qpushbutton.h> #include <kconfig.h> #include "kofilterview_base.h" #include <libkcal/calfilter.h> using namespace KCal; class KOFilterView : public KOFilterView_base { Q_OBJECT public: KOFilterView(QPtrList<CalFilter> *filterList,QWidget* parent=0,const char* name=0, WFlags fl=0); ~KOFilterView(); void updateFilters(); bool filtersEnabled(); void setFiltersEnabled(bool); CalFilter *selectedFilter(); void setSelectedFilter(QString); void setSelectedFilter( int ); signals: void filterChanged(); void editFilters(); private: QPtrList<CalFilter> *mFilters; }; class KOCalEditView : public QWidget { Q_OBJECT public: KOCalEditView( QWidget* parent=0,const char* name=0); ~KOCalEditView(); void readConfig( KConfig *); public slots: void addCal(); void enableAll(); void enableAlarm(); void disableRO(); void deleteAll(); signals: void alarmEnabled ( int cal, bool enable ); void calendarEnabled ( int cal, bool enable ); void calendarReadonly ( int cal, bool readonly ); void setCalendarDefault ( int cal ); void removeCalendar ( int cal ); private: }; +class KOCalButton : public QPushButton +{ + Q_OBJECT + public: + KOCalButton( QWidget *parent=0, const char *name=0 ) : + QPushButton( parent, name) + { + connect( this, SIGNAL( clicked() ), + SLOT( bottonClicked() )); + mNumber = -1; + } + void setNum ( int num ) {mNumber = num; } + signals: + void selectNum ( int ); +private: + int mNumber; + void keyPressEvent ( QKeyEvent * e ) + { + e->ignore(); + } + +private slots : + void bottonClicked() { if ( mNumber > 0 ) emit selectNum ( mNumber ); } +}; +class KOCalCheckButton : public QCheckBox +{ + Q_OBJECT + public: + KOCalCheckButton( QWidget *parent=0, const char *name=0 ) : + QCheckBox( parent, name) + { + connect( this, SIGNAL( toggled ( bool ) ), + SLOT( bottonClicked( bool ) )); + mNumber = -1; + } + void setNum ( int num ) {mNumber = num; } + signals: + void selectNum ( int, bool ); +private: + int mNumber; + void keyPressEvent ( QKeyEvent * e ) + { + e->ignore(); + } + +private slots : + void bottonClicked( bool b) { if ( mNumber > 0 ) emit selectNum ( mNumber , b); } +}; #endif // KOFILTERVIEW_H |