author | zautrix <zautrix> | 2005-06-30 06:35:25 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-30 06:35:25 (UTC) |
commit | 0fc571a7eadda739fd1a93d627e7129b9956c9f6 (patch) (side-by-side diff) | |
tree | 60336a1e91259ab654e292dbe9938af4ecdf7a72 /korganizer/journalentry.cpp | |
parent | da264cf19c0183d6ea4e8dab6eabd40994e351c8 (diff) | |
download | kdepimpi-0fc571a7eadda739fd1a93d627e7129b9956c9f6.zip kdepimpi-0fc571a7eadda739fd1a93d627e7129b9956c9f6.tar.gz kdepimpi-0fc571a7eadda739fd1a93d627e7129b9956c9f6.tar.bz2 |
fixes
-rw-r--r-- | korganizer/journalentry.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index add874f..395392c 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp @@ -62,5 +62,5 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : mCalendar = calendar; mJournal = 0; - + visibleMode = true; QHBox * vb = new QHBox ( this ); QPixmap iconp; @@ -172,9 +172,13 @@ 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() @@ -182,4 +186,5 @@ void JournalEntry::setShowOnly() showOnlyMode = true; mEditor->setFocus(); + visibleMode = true; } void JournalEntry::setJournal(Journal *journal) @@ -212,4 +217,5 @@ void JournalEntry::clear() mJournal = 0; mEditor->setText(""); + mTitle->setText(""); } @@ -234,12 +240,13 @@ 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; |