author | zautrix <zautrix> | 2005-06-30 06:35:25 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-30 06:35:25 (UTC) |
commit | 0fc571a7eadda739fd1a93d627e7129b9956c9f6 (patch) (unidiff) | |
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) : | |||
62 | mCalendar = calendar; | 62 | mCalendar = calendar; |
63 | mJournal = 0; | 63 | mJournal = 0; |
64 | 64 | visibleMode = true; | |
65 | QHBox * vb = new QHBox ( this ); | 65 | QHBox * vb = new QHBox ( this ); |
66 | QPixmap iconp; | 66 | QPixmap iconp; |
@@ -172,9 +172,13 @@ void JournalEntry::setDate(const QDate &date) | |||
172 | void JournalEntry::toggleShowJournal() | 172 | void JournalEntry::toggleShowJournal() |
173 | { | 173 | { |
174 | flushEntry(); | 174 | if (!mEditor->text().isEmpty() || !mTitle->text().isEmpty()) |
175 | flushEntry(); | ||
175 | if ( showOnlyMode ) | 176 | if ( showOnlyMode ) |
176 | emit showJournalOnly( 0 ); | 177 | emit showJournalOnly( 0 ); |
177 | else | 178 | else { |
179 | // we have to protect mJournal from deleting if mJournal has empty text | ||
180 | visibleMode = false; // set to true via :setShowOnly() | ||
178 | emit showJournalOnly( mJournal ); | 181 | emit showJournalOnly( mJournal ); |
182 | } | ||
179 | } | 183 | } |
180 | void JournalEntry::setShowOnly() | 184 | void JournalEntry::setShowOnly() |
@@ -182,4 +186,5 @@ void JournalEntry::setShowOnly() | |||
182 | showOnlyMode = true; | 186 | showOnlyMode = true; |
183 | mEditor->setFocus(); | 187 | mEditor->setFocus(); |
188 | visibleMode = true; | ||
184 | } | 189 | } |
185 | void JournalEntry::setJournal(Journal *journal) | 190 | void JournalEntry::setJournal(Journal *journal) |
@@ -212,4 +217,5 @@ void JournalEntry::clear() | |||
212 | mJournal = 0; | 217 | mJournal = 0; |
213 | mEditor->setText(""); | 218 | mEditor->setText(""); |
219 | mTitle->setText(""); | ||
214 | } | 220 | } |
215 | 221 | ||
@@ -234,12 +240,13 @@ bool JournalEntry::eventFilter( QObject *o, QEvent *e ) | |||
234 | void JournalEntry::writeJournal() | 240 | void JournalEntry::writeJournal() |
235 | { | 241 | { |
236 | 242 | if ( !visibleMode ) return; | |
237 | if (mEditor->text().isEmpty() && mTitle->text().isEmpty()) { | 243 | if (mEditor->text().isEmpty() && mTitle->text().isEmpty()) { |
238 | if ( mJournal ) { | 244 | if ( mJournal ) { |
245 | Journal* j = mJournal; | ||
246 | mJournal = 0; | ||
239 | bool conf = KOPrefs::instance()->mConfirm; | 247 | bool conf = KOPrefs::instance()->mConfirm; |
240 | KOPrefs::instance()->mConfirm = false; | 248 | KOPrefs::instance()->mConfirm = false; |
241 | emit deleteJournal(mJournal); | 249 | emit deleteJournal(j); |
242 | KOPrefs::instance()->mConfirm = conf; | 250 | KOPrefs::instance()->mConfirm = conf; |
243 | mJournal = 0; | ||
244 | } | 251 | } |
245 | return; | 252 | return; |