-rw-r--r-- | korganizer/calendarview.cpp | 28 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 27 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 8 |
3 files changed, 43 insertions, 20 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 73aa733..a330414 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -4071,7 +4071,29 @@ void CalendarView::showNextAlarms() | |||
4071 | QString message; | 4071 | QString message; |
4072 | if ( mNextAlarmDateTime > QDateTime::currentDateTime() ) { | 4072 | QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); |
4073 | if ( nextAl.isValid() && mNextAlarmDateTime > QDateTime::currentDateTime() ) { | ||
4073 | QString sum = mCalendar->nextSummary(); | 4074 | QString sum = mCalendar->nextSummary(); |
4074 | QDateTime nextA = mNextAlarmDateTime; | 4075 | QDateTime nextA = mNextAlarmDateTime; |
4075 | QDateTime nextAl = mCalendar->nextAlarmEventDateTime(); | 4076 | QDateTime cur = QDateTime::currentDateTime(); |
4076 | 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)) ; | 4077 | int secs = cur.secsTo( nextA ); |
4078 | int min = secs /60; | ||
4079 | int hours = min /60; | ||
4080 | min = min % 60; | ||
4081 | int days = hours /24; | ||
4082 | hours = hours % 24; | ||
4083 | |||
4084 | message = i18n("The next alarm is in:\n"); | ||
4085 | if ( days > 1 ) | ||
4086 | message += i18n("%1 days\n").arg( days ); | ||
4087 | else if ( days == 1 ) | ||
4088 | message += i18n("1 day\n"); | ||
4089 | if ( hours > 1 ) | ||
4090 | message += i18n("%1 hours\n").arg( hours ); | ||
4091 | else if ( hours == 1 ) | ||
4092 | message += i18n("1 hour\n"); | ||
4093 | if ( min > 1 ) | ||
4094 | message += i18n("%1 minutes\n").arg( min ); | ||
4095 | else if ( min == 1 ) | ||
4096 | message += i18n("1 minute\n"); | ||
4097 | |||
4098 | message += i18n("\n(%1)\n\n%2\n(%3)\n").arg( KGlobal::locale()->formatDateTime(nextA , false)).arg(sum ).arg( KGlobal::locale()->formatDateTime(nextAl , false)) ; | ||
4077 | } else { | 4099 | } else { |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 18f242c..f6f390b 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -127,3 +127,2 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) | |||
127 | QString suffix; | 127 | QString suffix; |
128 | QString fullTime; | ||
129 | int tW = fm.width("24:00i"); | 128 | int tW = fm.width("24:00i"); |
@@ -157,3 +156,4 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) | |||
157 | int sHei = fmS.height(); | 156 | int sHei = fmS.height(); |
158 | 157 | sHei -= (sHei/4-2); | |
158 | int startW = this->width() - frameWidth(); | ||
159 | while (y < cy + ch) { | 159 | while (y < cy + ch) { |
@@ -171,13 +171,10 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) | |||
171 | 171 | ||
172 | // create string in format of "XX:XX" or "XXpm/am" | ||
173 | fullTime = hour;// + suffix; | ||
174 | |||
175 | // center and draw the time label | 172 | // center and draw the time label |
176 | int timeWidth = fm.width(fullTime+"i"); | 173 | int timeWidth = fm.width(hour+"i"); |
177 | int tw2 = fm.width(suffix); | 174 | int tw2 = fm.width(suffix); |
178 | int offset = this->width() - timeWidth - tw2; | 175 | int offset = startW - timeWidth - tw2 ; |
179 | p->setFont( nFont ); | 176 | p->setFont( nFont ); |
180 | p->drawText(cx - borderWidth + offset, y+ timeHeight, fullTime); | 177 | p->drawText(cx - borderWidth + offset, y+ timeHeight, hour); |
181 | p->setFont( sFont ); | 178 | p->setFont( sFont ); |
182 | offset += timeWidth; | 179 | offset = startW - tw2-1; |
183 | p->drawText(cx - borderWidth + offset, y+ sHei, suffix); | 180 | p->drawText(cx - borderWidth + offset, y+ sHei, suffix); |
@@ -205,3 +202,6 @@ void TimeLabels::updateConfig() | |||
205 | setFont(KOPrefs::instance()->mTimeBarFont); | 202 | setFont(KOPrefs::instance()->mTimeBarFont); |
206 | mMiniWidth = fontMetrics().width("88:88") + 2 ; | 203 | QString test = "88:88"; |
204 | if (KGlobal::locale()->use12Clock()) | ||
205 | test += "i"; | ||
206 | mMiniWidth = fontMetrics().width(test) + frameWidth()*2 +1 ; | ||
207 | // update geometry restrictions based on new settings | 207 | // update geometry restrictions based on new settings |
@@ -838,7 +838,4 @@ void KOAgendaView::createDayLabels() | |||
838 | } | 838 | } |
839 | //mDayLabelsFrame->show(); | 839 | |
840 | //mDayLabels->show(); | 840 | mDayLabelsFrame->setFixedHeight( newHight + 4 ); |
841 | //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight); | ||
842 | //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight ); | ||
843 | mDayLabelsFrame->setFixedHeight( newHight ); | ||
844 | } | 841 | } |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 7a4275b..ca0d542 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1725,4 +1725,8 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) | |||
1725 | case Qt::Key_N: | 1725 | case Qt::Key_N: |
1726 | mView->viewManager()->showNextXView(); | 1726 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1727 | showSelectedDates = true; | 1727 | mView->viewManager()->showNextView(); |
1728 | else { | ||
1729 | mView->viewManager()->showNextXView(); | ||
1730 | showSelectedDates = true; | ||
1731 | } | ||
1728 | break; | 1732 | break; |