From e19b410f43c4fcf35d3d62fc312d1b5251068691 Mon Sep 17 00:00:00 2001 From: zautrix Date: Mon, 04 Jul 2005 08:17:48 +0000 Subject: fixes --- (limited to 'korganizer/koeditorgeneral.cpp') diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index 29e68b3..753630b 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp @@ -81,7 +81,7 @@ void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) // 11 on desktop headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 ); QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); - headerLayout->addWidget(summaryLabel,1,0); + headerLayout->addWidget(summaryLabel,0,0); mSummaryEdit = new KOLocationBox(TRUE,parent, 10); mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); @@ -93,14 +93,17 @@ void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } // mSummaryEdit = new QLineEdit(parent); - headerLayout->addWidget(mSummaryEdit,1,1); + if ( QApplication::desktop()->height() < 320 ) + headerLayout->addWidget(mSummaryEdit,0,1); + else + headerLayout->addMultiCellWidget(mSummaryEdit,0,0,1,2); connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); QLabel *locationLabel = new QLabel(i18n("Location:"),parent); if ( QApplication::desktop()->height() < 320 ) - headerLayout->addWidget(locationLabel,1,2); + headerLayout->addWidget(locationLabel,0,2); else - headerLayout->addWidget(locationLabel,2,0); + headerLayout->addWidget(locationLabel,1,0); mLocationEdit = new KOLocationBox(TRUE,parent,10); mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); @@ -109,15 +112,22 @@ void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) // mLocationEdit = new QLineEdit(parent); connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); + + mCalendarBox = new QComboBox ( parent ); + mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); if ( QApplication::desktop()->height() < 320 ) { - headerLayout->addWidget(mLocationEdit,1,3); + headerLayout->addWidget(mLocationEdit,0,3); + headerLayout->addWidget(mCalendarBox,0,4); headerLayout->setColStretch( 1, 10); headerLayout->setColStretch( 3, 10); + mCalendarBox->setMaximumWidth( 64 ); } else { - headerLayout->addWidget(mLocationEdit,2,1); + headerLayout->addWidget(mLocationEdit,1,1); + headerLayout->addWidget(mCalendarBox,1,2); headerLayout->setColStretch( 1, 10); } + } void KOEditorGeneral::setFocusOn( int i ) { @@ -436,14 +446,54 @@ void KOEditorGeneral::setDefaults(bool allDay) mDescriptionEdit->setText(""); mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; setCategories(""); + fillCalCombo(); } void KOEditorGeneral::setSecrecy( int num ) { mSecrecyCombo->setCurrentItem(num); } -void KOEditorGeneral::readIncidence(Incidence *event) +void KOEditorGeneral::fillCalCombo( int setToID ) { + mCalendarBox->clear(); + KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); + int std = 0; + int count = 0; + while ( kkf ) { + if ( !kkf->mErrorOnLoad &&! kkf->isReadOnly ) { + if ( setToID ) { + if ( kkf->mCalNumber == setToID ) + std = count; + } else { + if ( kkf->isStandard ) { + std = count; + } + } + ++count; + mCalendarBox->insertItem( kkf->mName ); + } + kkf = KOPrefs::instance()->mCalendars.next(); + } + mCalendarBox->setCurrentItem( std ); + if ( KOPrefs::instance()->mCalendars.count() == 1 ) + mCalendarBox->hide(); + else + mCalendarBox->show(); + +} +int KOEditorGeneral::getCalendarID() +{ + KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); + while ( kkf ) { + if ( mCalendarBox->currentText() == kkf->mName) + return kkf->mCalNumber; + kkf = KOPrefs::instance()->mCalendars.next(); + } + return 1; +} +void KOEditorGeneral::readIncidence(Incidence *event) +{ + fillCalCombo( event->calID() ); mAlarmMessage = event->summary(); if ( ! event->location().isEmpty() ) mAlarmMessage += " ("+event->location()+")"; @@ -569,4 +619,5 @@ void KOEditorGeneral::writeIncidence(Incidence *event) alarm->setType(Alarm::Invalid); } } + event->setCalID( getCalendarID() ); } -- cgit v0.9.0.2