-rw-r--r-- | korganizer/journalentry.cpp | 13 | ||||
-rw-r--r-- | korganizer/journalentry.h | 1 | ||||
-rw-r--r-- | korganizer/kojournalview.cpp | 12 |
3 files changed, 17 insertions, 9 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index 9e2c902..ca8d5f7 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp @@ -159,14 +159,14 @@ void JournalEntry::slotLoadTemplate() mEditor-> insertAt ( text, line, col, true ); //mEditor->setIgnoreMark( true ); } void JournalEntry::setDate(const QDate &date) { showOnlyMode = false; - mDate = date; writeJournal(); + mDate = date; int id = mCalendar->defaultCalendar(); QString calname = KOPrefs::instance()->getCalendar( id )->mName; mTitleLabel->setText( " (" + calname +")"); } void JournalEntry::toggleShowJournal() @@ -176,19 +176,26 @@ void JournalEntry::toggleShowJournal() if ( showOnlyMode ) emit showJournalOnly( 0 ); else { // we have to protect mJournal from deleting if mJournal has empty text visibleMode = false; // set to true via :setShowOnly() emit showJournalOnly( mJournal ); + //QTimer::singleShot( 0, this, SLOT( setVisibleOn() ) ); } } +void JournalEntry::setVisibleOn() +{ + visibleMode = true; +} void JournalEntry::setShowOnly() { showOnlyMode = true; - mEditor->setFocus(); - visibleMode = true; + if ( mTitle->text().isEmpty() ) + mTitle->setFocus(); + else + mEditor->setFocus(); } void JournalEntry::setJournal(Journal *journal) { writeJournal(); mJournal = journal; diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h index e98d018..cc9b5ef 100644 --- a/korganizer/journalentry.h +++ b/korganizer/journalentry.h @@ -54,12 +54,13 @@ class JournalEntry : public QFrame { void setVisibleMode( bool b ) { visibleMode = b;} protected slots: void slotSaveTemplate(); void slotLoadTemplate(); void toggleShowJournal(); + void setVisibleOn(); signals: void deleteJournal(Journal *); void newJournal(); void showJournalOnly( Journal * ); protected: diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp index 7a96aa5..6fa9b23 100644 --- a/korganizer/kojournalview.cpp +++ b/korganizer/kojournalview.cpp @@ -152,13 +152,13 @@ void KOJournalView::newJournal() mCalendar->addJournal(mJournal); showDates( mDate, QDate() ); } void KOJournalView::showOnly ( Journal* j ) { - //qDebug("showOnly %x ", j); + qDebug("showOnly %x ", j); flushView(); if ( j == 0 ) { showDates( mDate, QDate() ); return; } QPtrList<Journal> jl; @@ -166,30 +166,30 @@ void KOJournalView::showOnly ( Journal* j ) showList( jl ); JournalEntry* mEntry = jEntries.first(); mEntry->setShowOnly(); } void KOJournalView::showList(QPtrList<Journal> jl) { - //qDebug("KOJournalView::showList %d",jl.count() ); + qDebug("KOJournalView::showList %d",jl.count() ); JournalEntry* mEntry = jEntries.first(); JournalEntry* firstEntry = mEntry; int count = jl.count(); int iii = 0; while ( iii < count ) { if ( !mEntry ) { mEntry = getNewEntry(); - mEntry->show(); - mEntry->setVisibleMode( true ); mEntry->setDate(mDate); mEntry->setJournal(jl.at(iii)); + mEntry->setVisibleMode( true ); + mEntry->show(); mEntry = 0; } else { mEntry->setDate(mDate); mEntry->setJournal(jl.at(iii)); - mEntry->show(); mEntry->setVisibleMode( true ); + mEntry->show(); mEntry = jEntries.next(); } ++iii; } while ( mEntry ) { mEntry->setDate(mDate); @@ -206,13 +206,13 @@ void KOJournalView::showList(QPtrList<Journal> jl) } } void KOJournalView::showDates(const QDate &start, const QDate &) { mDate = start; - mDateLabel-> setText(KGlobal::locale()->formatDate(mDate)); + mDateLabel->setText(KGlobal::locale()->formatDate(mDate)); QPtrList<Journal> jl = calendar()->journals4Date( start ); showList( jl ); } void KOJournalView::showEvents(QPtrList<Event>) { |