-rw-r--r-- | korganizer/koagendaview.cpp | 32 | ||||
-rw-r--r-- | korganizer/koeditorgeneral.cpp | 34 |
2 files changed, 31 insertions, 35 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 5508210..f287216 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -124,37 +124,49 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) int y = cell * mCellHeight; QFontMetrics fm = fontMetrics(); QString hour; QString suffix; QString fullTime; int tW = fm.width("24:00i"); + int timeHeight = fm.height(); + if ( timeHeight > mCellHeight ) + timeHeight = mCellHeight-1; + int borderWidth = 5; + QFont nFont = p->font(); + QFont sFont = nFont; + sFont.setPointSize( sFont.pointSize()/2+2 ); + if (!KGlobal::locale()->use12Clock()) + suffix = "00"; + QFontMetrics fmS( sFont ); + int sHei = fmS.height(); while (y < cy + ch) { p->drawLine(cx,y,cx+tW,y); hour.setNum(cell); - suffix = "am"; // handle 24h and am/pm time formats if (KGlobal::locale()->use12Clock()) { if (cell > 11) suffix = "pm"; + else + suffix = "am"; if (cell == 0) hour.setNum(12); if (cell > 12) hour.setNum(cell - 12); - } else { - suffix = ":00"; } // create string in format of "XX:XX" or "XXpm/am" - fullTime = hour + suffix; + fullTime = hour;// + suffix; // center and draw the time label int timeWidth = fm.width(fullTime+"i"); - int offset = this->width() - timeWidth; - int borderWidth = 5; - int timeHeight = fm.height(); - timeHeight = timeHeight + 2 - ( timeHeight / 4 ); - p->drawText(cx -borderWidth + offset, y+ timeHeight, fullTime); + int tw2 = fm.width(suffix); + int offset = this->width() - timeWidth - tw2; + p->setFont( nFont ); + p->drawText(cx - borderWidth + offset, y+ timeHeight, fullTime); + p->setFont( sFont ); + offset += timeWidth; + p->drawText(cx - borderWidth + offset, y+ sHei, suffix); // increment indices y += mCellHeight; cell++; } } @@ -877,14 +889,12 @@ void KOAgendaView::updateView() */ void KOAgendaView::updateConfig() { if ( mBlockUpdating ) return; - - // update config for children mTimeLabels->updateConfig(); mAgenda->storePosition(); mAgenda->updateConfig(); mAllDayAgenda->updateConfig(); // widget synchronization diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index 4ee5292..cf0d4ae 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp @@ -225,18 +225,14 @@ void KOEditorGeneral::initAlarm(QWidget *parent,QBoxLayout *topLayout) void KOEditorGeneral::pickAlarmSound() { qDebug("KOEditorGeneral::pickAlarmSound() %d",mAlarmSoundButton->isOn() ); //QString prefix = mAlarmSound; if (!mAlarmSoundButton->isOn()) { - //mAlarmSound = ""; - QToolTip::remove(mAlarmSoundButton); - QToolTip::add(mAlarmSoundButton, i18n("No sound set")); - mAlarmProgramButton->setOn(true); - mAlarmSoundButton->setOn(false); - pickAlarmProgram(); + mAlarmSoundButton->setOn(true); + ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); } else { QString fileName(KFileDialog::getOpenFileName(mAlarmSound, i18n("*.wav|Wav Files"), 0)); if (!fileName.isEmpty()) { mAlarmSound = fileName; QToolTip::remove(mAlarmSoundButton); @@ -247,28 +243,25 @@ void KOEditorGeneral::pickAlarmSound() } else { mAlarmProgramButton->setOn(true); mAlarmSoundButton->setOn(false); } } - +#if 0 if (mAlarmProgramButton->isOn()) ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); if ( mAlarmSoundButton->isOn()) ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); +#endif } void KOEditorGeneral::pickAlarmProgram() { if (!mAlarmProgramButton->isOn()) { - //mAlarmProgram = ""; - QToolTip::remove(mAlarmProgramButton); - QToolTip::add(mAlarmProgramButton, i18n("No program set")); - mAlarmProgramButton->setOn(false); - mAlarmSoundButton->setOn(true); - pickAlarmSound(); + mAlarmProgramButton->setOn(true); + ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); } else { QString fileName(KFileDialog::getOpenFileName(mAlarmProgram,i18n("Procedure Alarm: ") , 0)); if (!fileName.isEmpty()) { mAlarmProgram = fileName; QToolTip::remove(mAlarmProgramButton); QString dispStr = i18n("Running '%1'").arg(fileName); @@ -277,16 +270,18 @@ void KOEditorGeneral::pickAlarmProgram() mAlarmProgramButton->setOn(true); } else { mAlarmProgramButton->setOn(false); mAlarmSoundButton->setOn(true); } } +#if 0 if (mAlarmProgramButton->isOn()) ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); if ( mAlarmSoundButton->isOn()) ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); +#endif } QString KOEditorGeneral::getFittingPath( const QString s ) { int maxlen = 50; @@ -311,23 +306,14 @@ void KOEditorGeneral::enableAlarmEdit(bool enable) mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; else { if ( ! QFile::exists( mAlarmSound ) ) mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; } } - if (mAlarmProgramButton->isOn()) - ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); - if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) - ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); - } - else { - ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage); - //((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Edit item: ") + mSummaryEdit->currentText()); - - } + ((QWidget*)parent())->topLevelWidget()->setCaption(mAlarmMessage); mAlarmTimeEdit->setEnabled(enable); mAlarmSoundButton->setEnabled(enable); mAlarmProgramButton->setEnabled(enable); mAlarmIncrCombo->setEnabled(enable); } @@ -397,13 +383,13 @@ void KOEditorGeneral::setSecrecy( int num ) { mSecrecyCombo->setCurrentItem(num); } void KOEditorGeneral::readIncidence(Incidence *event) { - mAlarmMessage = i18n("Edit") +" "+event->summary(); + mAlarmMessage = event->summary(); mAlarmIncrCombo->setCurrentItem(0); mSummaryEdit->setEditText(event->summary()); mLocationEdit->setEditText(event->location()); mDescriptionEdit->setText(event->description()); #if 0 |