From 9e3e43aaca0986ae224c752d2d3a760661be61b6 Mon Sep 17 00:00:00 2001 From: zautrix Date: Sun, 27 Mar 2005 13:04:11 +0000 Subject: fixes --- diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index ce55780..5ef60be 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt @@ -1306,11 +1306,20 @@ { "Please select at least one\nof the types to search for:\n\nEvents\nTodos\nJournals","Bitte wählen Sie mindestens\neinen dieser Typen\num darin zu suchen:\n\nTermine\nTodos\nJournale" }, { "There is no next alarm.","Es gibt keinen nächsten Alarm." }, { "%1 %2 - %3 (next event/todo with alarm)","%1 %2 - %3 (nächster Termin/Todo mit Alarm)" }, -{ "The next alarm is on:\n%1\nat: %2\n\n%3\n(%4)","Der nächste Alarm in am:\n%1\num: %2\n\n%3\n(%4)" }, +{ "The next alarm is in:\n","Der nächste Alarm ist in:\n" }, +{ "%1 days\n","%1 Tagen\n" }, +{ "1 day\n","1 Tag\n" }, +{ "%1 hours\n","%1 Stunden\n" }, +{ "1 hour\n","1 Stunde\n" }, +{ "%1 minutes\n","%1 Minuten\n" }, +{ "1 minute\n","1 Minute\n" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, - \ No newline at end of file +{ "","" }, +{ "","" }, +{ "","" }, +{ "","" }, \ No newline at end of file diff --git a/kalarmd/alarmdialog.cpp b/kalarmd/alarmdialog.cpp index 7ead3b9..7b888ab 100644 --- a/kalarmd/alarmdialog.cpp +++ b/kalarmd/alarmdialog.cpp @@ -32,9 +32,13 @@ #include #include #include +#ifndef DESKTOP_VERSION #define protected public #include #undef protected +#else +#include +#endif #include #ifndef _WIN32_ #include diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 73aa733..a330414 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -4069,11 +4069,33 @@ void CalendarView::resetFocus() void CalendarView::showNextAlarms() { QString message; - if ( mNextAlarmDateTime > QDateTime::currentDateTime() ) { + QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); + if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { QString sum = mCalendar->nextSummary(); QDateTime nextA = mNextAlarmDateTime; - QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); - message = i18n("The next alarm is on:\n%1\nat: %2\n\n%3\n(%4)").arg( KGlobal::locale()->formatDate(nextA.date() , false)).arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; + QDateTime cur = QDateTime::currentDateTime(); + int secs = cur.secsTo( nextA ); + int min = secs /60; + int hours = min /60; + min = min % 60; + int days = hours /24; + hours = hours % 24; + + message = i18n("The next alarm is in:\n"); + if ( days > 1 ) + message += i18n("%1 days\n").arg( days ); + else if ( days == 1 ) + message += i18n("1 day\n"); + if ( hours > 1 ) + message += i18n("%1 hours\n").arg( hours ); + else if ( hours == 1 ) + message += i18n("1 hour\n"); + if ( min > 1 ) + message += i18n("%1 minutes\n").arg( min ); + else if ( min == 1 ) + message += i18n("1 minute\n"); + + message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; } else { message = i18n("There is no next alarm."); diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 18f242c..f6f390b 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -125,7 +125,6 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) QFontMetrics fm = fontMetrics(); QString hour; QString suffix; - QString fullTime; int tW = fm.width("24:00i"); int timeHeight = fm.height(); //timeHeight -= (timeHeight/4-2); @@ -155,7 +154,8 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) sFont.setPointSize( sFont.pointSize()/2+2 ); QFontMetrics fmS( sFont ); int sHei = fmS.height(); - + sHei -= (sHei/4-2); + int startW = this->width() - frameWidth(); while (y < cy + ch) { p->drawLine(cx,y,cx+tW,y); hour.setNum(cell); @@ -169,17 +169,14 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) if (cell > 12) hour.setNum(cell - 12); } - // create string in format of "XX:XX" or "XXpm/am" - fullTime = hour;// + suffix; - // center and draw the time label - int timeWidth = fm.width(fullTime+"i"); + int timeWidth = fm.width(hour+"i"); int tw2 = fm.width(suffix); - int offset = this->width() - timeWidth - tw2; + int offset = startW - timeWidth - tw2 ; p->setFont( nFont ); - p->drawText(cx - borderWidth + offset, y+ timeHeight, fullTime); + p->drawText(cx - borderWidth + offset, y+ timeHeight, hour); p->setFont( sFont ); - offset += timeWidth; + offset = startW - tw2-1; p->drawText(cx - borderWidth + offset, y+ sHei, suffix); // increment indices @@ -203,7 +200,10 @@ void TimeLabels::updateConfig() // config->setGroup("Fonts"); // QFont font = config->readFontEntry("TimeBar Font"); setFont(KOPrefs::instance()->mTimeBarFont); - mMiniWidth = fontMetrics().width("88:88") + 2 ; + QString test = "88:88"; + if (KGlobal::locale()->use12Clock()) + test += "i"; + mMiniWidth = fontMetrics().width(test) + frameWidth()*2 +1 ; // update geometry restrictions based on new settings setFixedWidth(minimumWidth()); @@ -836,11 +836,8 @@ void KOAgendaView::createDayLabels() dayLabel = mDayLabelsList.next(); } } - //mDayLabelsFrame->show(); - //mDayLabels->show(); - //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight); - //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight ); - mDayLabelsFrame->setFixedHeight( newHight ); + + mDayLabelsFrame->setFixedHeight( newHight + 4 ); } int KOAgendaView::maxDatesHint() diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 7a4275b..ca0d542 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -1723,8 +1723,12 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) mView->viewManager()->showListView(); break; case Qt::Key_N: - mView->viewManager()->showNextXView(); - showSelectedDates = true; + if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) + mView->viewManager()->showNextView(); + else { + mView->viewManager()->showNextXView(); + showSelectedDates = true; + } break; case Qt::Key_V: mView->viewManager()->showTodoView(); diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 52c298b..5c889c3 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -298,6 +298,7 @@ void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted QDateTime nextA; // QString nextSum; //QDateTime nextEvent; + mNextAlarmEventDateTime = QDateTime(); if ( mNextAlarmIncidence == 0 || incidence == 0 ) { computeNextAlarm = true; } else { -- cgit v0.9.0.2