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 @@ -60,9 +60,9 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : heiHint = QApplication::desktop()->height() / 5 ; showOnlyMode = false; mCalendar = calendar; mJournal = 0; - + visibleMode = true; QHBox * vb = new QHBox ( this ); QPixmap iconp; QPushButton * toggleJournal = new QPushButton( vb ); @@ -170,18 +170,23 @@ 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) { writeJournal(); @@ -210,8 +215,9 @@ Journal *JournalEntry::journal() const void JournalEntry::clear() { mJournal = 0; mEditor->setText(""); + mTitle->setText(""); } bool JournalEntry::eventFilter( QObject *o, QEvent *e ) { @@ -232,16 +238,17 @@ 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; } |