From c692f6870157f428aebf1dfdab4fbb6e88699c31 Mon Sep 17 00:00:00 2001 From: zautrix Date: Sat, 26 Mar 2005 17:06:57 +0000 Subject: layout fixes --- diff --git a/kmicromail/koprefsdialog.cpp b/kmicromail/koprefsdialog.cpp index 4af4a8c..40347cc 100644 --- a/kmicromail/koprefsdialog.cpp +++ b/kmicromail/koprefsdialog.cpp @@ -73,6 +73,10 @@ KOPrefsDialog::KOPrefsDialog(QWidget *parent, char *name, bool modal) : setupMailTab();; setupFontsTab(); readConfig(); +#ifndef DESKTOP_VERSION + if ( QApplication::desktop()->height() == 480 ) + hideButtons(); +#endif #if 0 diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 92fd59c..3a16fe6 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -3606,21 +3606,27 @@ 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() ) selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); else { 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"); if ( !addString.isEmpty() ) { topLevelWidget()->setCaption( addString+", " + selDates ); diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 7faf675..7d5cf72 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -141,7 +141,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : setIcon(SmallIcon( "ko24" ) ); mBlockAtStartup = true; mFlagKeyPressed = false; - setCaption("KOrganizer/Pi"); + setCaption("KO/Pi"); KOPrefs *p = KOPrefs::instance(); KPimGlobalPrefs::instance()->setGlobalConfig(); if ( p->mHourSize > 22 ) @@ -1852,18 +1852,31 @@ void MainWindow::configureToolBar( int item ) p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); // 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() ) selDates = addString+", "+selDates ; diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 5808700..7604529 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h @@ -50,6 +50,7 @@ class MainWindow : public QMainWindow static QString syncFileName(); static QString resourcePath(); public slots: + void setCaption ( const QString & ); void updateWeekNum(const KCal::DateList &); void updateWeek(QDate); virtual void showMaximized (); -- cgit v0.9.0.2