summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 7faf675..7d5cf72 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -142,5 +142,5 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
mBlockAtStartup = true;
mFlagKeyPressed = false;
- setCaption("KOrganizer/Pi");
+ setCaption("KO/Pi");
KOPrefs *p = KOPrefs::instance();
KPimGlobalPrefs::instance()->setGlobalConfig();
@@ -1853,16 +1853,29 @@ void MainWindow::configureToolBar( int item )
// initActions();
}
-
+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()
{
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() )
selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
else {
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");
if ( !addString.isEmpty() )