-rw-r--r-- | korganizer/journalentry.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index add874f..395392c 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp @@ -63,3 +63,3 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : mJournal = 0; - + visibleMode = true; QHBox * vb = new QHBox ( this ); @@ -173,2 +173,3 @@ void JournalEntry::toggleShowJournal() { + if (!mEditor->text().isEmpty() || !mTitle->text().isEmpty()) flushEntry(); @@ -176,5 +177,8 @@ void JournalEntry::toggleShowJournal() emit showJournalOnly( 0 ); - else + else { + // we have to protect mJournal from deleting if mJournal has empty text + visibleMode = false; // set to true via :setShowOnly() emit showJournalOnly( mJournal ); } +} void JournalEntry::setShowOnly() @@ -183,2 +187,3 @@ void JournalEntry::setShowOnly() mEditor->setFocus(); + visibleMode = true; } @@ -213,2 +218,3 @@ void JournalEntry::clear() mEditor->setText(""); + mTitle->setText(""); } @@ -235,10 +241,11 @@ void JournalEntry::writeJournal() { - + if ( !visibleMode ) return; if (mEditor->text().isEmpty() && mTitle->text().isEmpty()) { if ( mJournal ) { + Journal* j = mJournal; + mJournal = 0; bool conf = KOPrefs::instance()->mConfirm; KOPrefs::instance()->mConfirm = false; - emit deleteJournal(mJournal); + emit deleteJournal(j); KOPrefs::instance()->mConfirm = conf; - mJournal = 0; } |