summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp18
-rw-r--r--korganizer/mainwindow.cpp23
-rw-r--r--korganizer/mainwindow.h1
3 files changed, 31 insertions, 11 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 92fd59c..3a16fe6 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -3608,4 +3608,10 @@ void CalendarView::showDates(const DateList &selectedDates)
+ QDate date = selectedDates.first();
+ if ( ! date.isValid() ) {
+ topLevelWidget()->setCaption("");
+ return;
+ }
+
QString selDates;
- selDates = KGlobal::locale()->formatDate( selectedDates.first(), true);
+ selDates = KGlobal::locale()->formatDate( date, true);
if (selectedDates.first() < selectedDates.last() )
@@ -3614,11 +3620,11 @@ void CalendarView::showDates(const DateList &selectedDates)
QString addString;
- if ( selectedDates.first() == QDateTime::currentDateTime().date() )
+ if ( date == QDateTime::currentDateTime().date() )
addString = i18n("Today");
- else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(1) )
+ else if ( date == QDateTime::currentDateTime().date().addDays(1) )
addString = i18n("Tomorrow");
- else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) )
+ else if ( date == QDateTime::currentDateTime().date().addDays(-1) )
addString = i18n("Yesterday");
- else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) )
+ else if ( date == QDateTime::currentDateTime().date().addDays(-2) )
addString = i18n("Day before yesterday");
- else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(2) )
+ else if ( date == QDateTime::currentDateTime().date().addDays(2) )
addString = i18n("Day after tomorrow");
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 7faf675..7d5cf72 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -143,3 +143,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
mFlagKeyPressed = false;
- setCaption("KOrganizer/Pi");
+ setCaption("KO/Pi");
KOPrefs *p = KOPrefs::instance();
@@ -1854,3 +1854,11 @@ void MainWindow::configureToolBar( int item )
}
-
+void MainWindow::setCaption ( const QString & c )
+{
+ QString cap = c;
+ cap.replace( QRegExp("\n"), " " );
+ cap = cap.stripWhiteSpace();
+ if ( cap.isEmpty() )
+ cap = "KO/Pi";
+ QWidget::setCaption( cap );
+}
void MainWindow::setCaptionToDates()
@@ -1858,3 +1866,8 @@ void MainWindow::setCaptionToDates()
QString selDates;
- selDates = KGlobal::locale()->formatDate(mView->startDate(), true);
+ QDate date = mView->startDate();
+ if ( ! date.isValid() ) {
+ setCaption("");
+ return;
+ }
+ selDates = KGlobal::locale()->formatDate( date, true);
if (mView->startDate() < mView->endDate() )
@@ -1863,5 +1876,5 @@ void MainWindow::setCaptionToDates()
QString addString;
- if ( mView->startDate() == QDateTime::currentDateTime().date() )
+ if ( date == QDateTime::currentDateTime().date() )
addString = i18n("Today");
- else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) )
+ else if ( date == QDateTime::currentDateTime().date().addDays(1) )
addString = i18n("Tomorrow");
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 5808700..7604529 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -52,2 +52,3 @@ class MainWindow : public QMainWindow
public slots:
+ void setCaption ( const QString & );
void updateWeekNum(const KCal::DateList &);