From 0fc571a7eadda739fd1a93d627e7129b9956c9f6 Mon Sep 17 00:00:00 2001 From: zautrix Date: Thu, 30 Jun 2005 06:35:25 +0000 Subject: fixes --- (limited to 'korganizer/journalentry.cpp') diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index add874f..395392c 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp @@ -61,7 +61,7 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : showOnlyMode = false; mCalendar = calendar; mJournal = 0; - + visibleMode = true; QHBox * vb = new QHBox ( this ); QPixmap iconp; @@ -171,16 +171,21 @@ void JournalEntry::setDate(const QDate &date) void JournalEntry::toggleShowJournal() { - flushEntry(); + if (!mEditor->text().isEmpty() || !mTitle->text().isEmpty()) + flushEntry(); if ( showOnlyMode ) 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() { showOnlyMode = true; mEditor->setFocus(); + visibleMode = true; } void JournalEntry::setJournal(Journal *journal) { @@ -211,6 +216,7 @@ void JournalEntry::clear() { mJournal = 0; mEditor->setText(""); + mTitle->setText(""); } bool JournalEntry::eventFilter( QObject *o, QEvent *e ) @@ -233,14 +239,15 @@ bool JournalEntry::eventFilter( QObject *o, QEvent *e ) 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; } return; } -- cgit v0.9.0.2