summaryrefslogtreecommitdiffabout
path: root/korganizer/journalentry.cpp
authorzautrix <zautrix>2005-06-30 06:35:25 (UTC)
committer zautrix <zautrix>2005-06-30 06:35:25 (UTC)
commit0fc571a7eadda739fd1a93d627e7129b9956c9f6 (patch) (side-by-side diff)
tree60336a1e91259ab654e292dbe9938af4ecdf7a72 /korganizer/journalentry.cpp
parentda264cf19c0183d6ea4e8dab6eabd40994e351c8 (diff)
downloadkdepimpi-0fc571a7eadda739fd1a93d627e7129b9956c9f6.zip
kdepimpi-0fc571a7eadda739fd1a93d627e7129b9956c9f6.tar.gz
kdepimpi-0fc571a7eadda739fd1a93d627e7129b9956c9f6.tar.bz2
fixes
Diffstat (limited to 'korganizer/journalentry.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/journalentry.cpp19
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
@@ -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;
}