author | zautrix <zautrix> | 2005-06-14 12:58:15 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-14 12:58:15 (UTC) |
commit | d38f601cfdb510fc39dd798af44a50c7958d7be8 (patch) (side-by-side diff) | |
tree | d2a118c01faf4b69806de5d6b8b2bf6f6315ecb9 | |
parent | bd2fd522c0ba5c5a7897df0941032a9af9842dfc (diff) | |
download | kdepimpi-d38f601cfdb510fc39dd798af44a50c7958d7be8.zip kdepimpi-d38f601cfdb510fc39dd798af44a50c7958d7be8.tar.gz kdepimpi-d38f601cfdb510fc39dd798af44a50c7958d7be8.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/kofilterview.cpp | 42 | ||||
-rw-r--r-- | korganizer/kofilterview.h | 4 |
2 files changed, 27 insertions, 19 deletions
diff --git a/korganizer/kofilterview.cpp b/korganizer/kofilterview.cpp index 3333ac2..52bc463 100644 --- a/korganizer/kofilterview.cpp +++ b/korganizer/kofilterview.cpp @@ -123,52 +123,55 @@ CalFilter *KOFilterView::selectedFilter() } void KOFilterView::setSelectedFilter(QString filterName) { int filter_num = mSelectionCombo->count(); int i; for (i=0;i<filter_num;i++) { if (mSelectionCombo->text(i)==filterName) mSelectionCombo->setCurrentItem(i); } emit filterChanged(); } 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) + : QScrollView(parent,name) { mw = 0; - ml = new QVBoxLayout ( this ); + setResizePolicy( AutoOneFit ); + setFrameStyle ( QFrame::Panel | QFrame::Plain ); + setLineWidth ( 1 ); + setMidLineWidth ( 1 ); } KOCalEditView::~KOCalEditView() { // no need to delete child widgets, Qt does it all for us } void KOCalEditView::selectCal(int id ,bool b) { KOPrefs::instance()->getCalendar( id )->isEnabled = b; emit calendarEnabled ( id, b ); emit needsUpdate(); } void KOCalEditView::selectStdCal( int id, bool b ) { if ( !b ) { KOCalCheckButton* it = (KOCalCheckButton*) sender(); if ( it ) { it->blockSignals( true ); it->setChecked( true ); it->blockSignals( false ); return; } @@ -235,136 +238,141 @@ void KOCalEditView::deleteCal( int id ) } void KOCalEditView::infoCal( int id ) { QString name = KOPrefs::instance()->getCalendar( id )->mName; QString file = KOPrefs::instance()->getCalendar( id )->mFileName; if ( KOPrefs::instance()->getCalendar( id )->mErrorOnLoad ) { if ( KMessageBox::Yes == KMessageBox::questionYesNo( this, i18n("The calendar <b>%1</b> is not loaded! Loading of file <b>%2</b> failed! <b>Try again to load the calendar?</b>").arg(name).arg(file) ) ) { emit calendarAdded( id ); emit needsUpdate(); QTimer::singleShot( 0, this, SLOT ( readConfig() ) ); } } else KMessageBox::information( this, i18n("The calendar <b>%1</b> is displaying file <b>%2</b>").arg(name).arg(file) ); } void KOCalEditView::readConfig() { mStdandardB.clear(); mEnabledB.clear(); mAlarmB.clear(); mROB.clear(); if ( mw ) delete mw; - mw = new QWidget ( this ); - ml->addWidget ( mw ); + mw = new QWidget ( viewport() ); + addChild(mw); mainLayout = new QGridLayout ( mw , 2, 8 ); - //mainLayout->setSpacing( 3 ); + mainLayout->setMargin( 3); + mainLayout->setSpacing( 2); QPushButton * addBut = new QPushButton ( mw ); mainLayout->addWidget( addBut,0,0 ); addBut->setPixmap ( SmallIcon("plus")); connect(addBut,SIGNAL(clicked()),SLOT(addCal())); addBut->setMaximumWidth( addBut->sizeHint().height() ); addBut = new QPushButton ( mw ); 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")+" ", mw ); + QLabel* lab = new QLabel (i18n(" Calendar \n Resource "), mw ); mainLayout->addWidget( lab,0,2 ); - + lab = new QLabel ( i18n(" "), mw ); + mainLayout->addWidget( lab,0,3 ); + lab->setFixedWidth( 6 ); addBut = new QPushButton ( mw ); - mainLayout->addWidget( addBut,0,3 ); + mainLayout->addWidget( addBut,0,4 ); addBut->setPixmap ( SmallIcon("bell")); connect(addBut,SIGNAL(clicked()),SLOT(enableAlarm())); addBut->setMaximumWidth( addBut->sizeHint().height() ); addBut = new QPushButton ( mw ); - mainLayout->addWidget( addBut,0,4 ); + mainLayout->addWidget( addBut,0,5 ); addBut->setPixmap ( SmallIcon("pencil")); connect(addBut,SIGNAL(clicked()),SLOT(disableRO())); addBut->setMaximumWidth( addBut->sizeHint().height() ); lab = new QLabel ( i18n(" Color "), mw ); - mainLayout->addWidget( lab,0,5 ); + mainLayout->addWidget( lab,0,6 ); #if 0 addBut = new QPushButton ( mw ); mainLayout->addWidget( addBut,0,6 ); addBut->setPixmap ( SmallIcon("minus")); connect(addBut,SIGNAL(clicked()),SLOT(deleteAll())); addBut->setMaximumWidth( addBut->sizeHint().height() ); #endif KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); int row = 1; while ( kkf ) { - + int iii = 0; KOCalCheckButton* cb = new KOCalCheckButton( mw ); mainLayout->addWidget( cb,row,0 );mStdandardB.append( cb ); cb->setChecked( kkf->isStandard ); cb->setNum( kkf->mCalNumber ); connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectStdCal(int,bool) ) ); if ( kkf->mErrorOnLoad || kkf->isReadOnly ) cb->setEnabled( false ); cb = new KOCalCheckButton( mw ); - mainLayout->addWidget( cb,row,1 );mEnabledB.append( cb ); + mainLayout->addWidget( cb,row,++iii );mEnabledB.append( cb ); cb->setChecked( kkf->isEnabled ); cb->setNum( kkf->mCalNumber ); if ( kkf->mErrorOnLoad ) cb->setEnabled( false ); connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCal(int,bool) ) ); KOCalButton* name = new KOCalButton( mw ); name->setNum( kkf->mCalNumber ); name->setText( kkf->mName ); - mainLayout->addWidget( name,row,2 ); + mainLayout->addWidget( name,row,++iii ); connect (name, SIGNAL (selectNum(int)), SLOT ( infoCal(int) ) ); + lab = new QLabel ( i18n(" "), mw ); + mainLayout->addWidget( lab,row,++iii ); cb = new KOCalCheckButton( mw ); - mainLayout->addWidget( cb,row,3 );mAlarmB.append( cb ); + mainLayout->addWidget( cb,row,++iii );mAlarmB.append( cb ); cb->setChecked( kkf->isAlarmEnabled ); cb->setNum( kkf->mCalNumber ); connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectCalAlarm(int,bool) ) ); if ( kkf->mErrorOnLoad ) cb->setEnabled( false ); cb = new KOCalCheckButton( mw ); - mainLayout->addWidget( cb,row,4 );mROB.append( cb ); + mainLayout->addWidget( cb,row,++iii );mROB.append( cb ); cb->setChecked( kkf->isReadOnly ); cb->setNum( kkf->mCalNumber ); connect (cb, SIGNAL (selectNum(int,bool)), SLOT ( selectReadOnly(int,bool) ) ); if ( kkf->mErrorOnLoad ) cb->setEnabled( false ); KColorButton *colb = new KColorButton( mw ); - mainLayout->addWidget( colb,row,5 ); + mainLayout->addWidget( colb,row,++iii ); colb->setID( kkf->mCalNumber ); colb->setColor( kkf->mDefaultColor ); connect (colb, SIGNAL (changedID(const QColor&, int )), SLOT ( setColor(const QColor&,int) ) ); if ( row > 1) { KOCalButton* calb = new KOCalButton( mw ); - mainLayout->addWidget( calb,row,6 ); + mainLayout->addWidget( calb,row,++iii ); calb->setNum( kkf->mCalNumber ); calb->setPixmap ( SmallIcon("minus")); connect (calb, SIGNAL (selectNum(int)), SLOT ( deleteCal(int) ) ); int hei = calb->sizeHint().height(); //calb->setMaximumSize( hei*9/10, hei*9/10 ); } ++row; kkf = KOPrefs::instance()->mCalendars.next(); } lab = new QLabel ( "", mw ); mainLayout->addWidget( lab,row,0 ); mw->show(); } void KOCalEditView::addCal() { KONewCalPrefs prefs ( this ); if ( ! prefs.exec() ) return; QString name = prefs.calName(); QString file = prefs.calFileName(); QFileInfo fi ( file ); if (!fi.exists() ) { KMessageBox::information( this, i18n("File does not exist!\nNo calendar added!")); diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h index 1849e36..e2ebdd4 100644 --- a/korganizer/kofilterview.h +++ b/korganizer/kofilterview.h @@ -4,48 +4,49 @@ 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 <qscrollview.h> #include <qpushbutton.h> #include <kconfig.h> #include "kofilterview_base.h" #include <libkcal/calfilter.h> class QGridLayout; using namespace KCal; 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: @@ -89,68 +90,67 @@ private slots : 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 +class KOCalEditView : public QScrollView { Q_OBJECT public: KOCalEditView( QWidget* parent=0,const char* name=0); ~KOCalEditView(); public slots: void addCal(); void enableAll(); void enableAlarm(); void disableRO(); void deleteAll(); void selectStdCal(int,bool ); void selectCal(int,bool ); void selectCalAlarm(int,bool ); void selectReadOnly(int,bool ); void setColor(const QColor &,int) ; void deleteCal(int) ; void infoCal(int) ; void readConfig(); 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 ); void calendarAdded( int ); void needsUpdate(); private: - QVBoxLayout* ml; QWidget *mw; void toggleList ( QPtrList<KOCalCheckButton> ); QPtrList<KOCalCheckButton> mStdandardB; QPtrList<KOCalCheckButton> mEnabledB; QPtrList<KOCalCheckButton> mAlarmB; QPtrList<KOCalCheckButton> mROB; QGridLayout* mainLayout; }; #endif // KOFILTERVIEW_H |