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
@@ -3597,39 +3597,45 @@ void CalendarView::showDates(const DateList &selectedDates)
{
// kdDebug() << "CalendarView::selectDates()" << endl;
if ( !mBlockShowDates ) {
if ( mViewManager->currentView() ) {
updateView( selectedDates.first(), selectedDates.last() );
} else {
mViewManager->showAgendaView();
}
}
+ 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 );
return;
}
}
topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
}
QPtrList<CalFilter> CalendarView::filters()
{
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 7faf675..7d5cf72 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -132,25 +132,25 @@ int globalFlagBlockStartup;
MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
QMainWindow( parent, name )
{
mClosed = false;
//QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
QString confFile = locateLocal("config","korganizerrc");
QFileInfo finf ( confFile );
bool showWarning = !finf.exists();
setIcon(SmallIcon( "ko24" ) );
mBlockAtStartup = true;
mFlagKeyPressed = false;
- setCaption("KOrganizer/Pi");
+ setCaption("KO/Pi");
KOPrefs *p = KOPrefs::instance();
KPimGlobalPrefs::instance()->setGlobalConfig();
if ( p->mHourSize > 22 )
p->mHourSize = 22;
QMainWindow::ToolBarDock tbd;
if ( p->mToolBarHor ) {
if ( p->mToolBarUp )
tbd = Bottom;
else
tbd = Top;
}
else {
@@ -1843,36 +1843,49 @@ void MainWindow::configureToolBar( int item )
p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
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 ;
}
setCaption( i18n("Dates: ") + selDates );
}
void MainWindow::showConfigureAgenda( )
{
int iii;
for ( iii = 1;iii<= 10 ;++iii ){
configureAgendaMenu->setItemChecked( (iii+1)*2, false );
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 5808700..7604529 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -41,24 +41,25 @@ using namespace KCal;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
~MainWindow();
bool beamReceiveEnabled();
static QString defaultFileName();
static QString syncFileName();
static QString resourcePath();
public slots:
+ void setCaption ( const QString & );
void updateWeekNum(const KCal::DateList &);
void updateWeek(QDate);
virtual void showMaximized ();
void configureAgenda( int );
void recieve( const QCString& msg, const QByteArray& data );
protected slots:
void setCaptionToDates();
void weekAction();
void about();
void licence();
void faq();
void usertrans();