summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/journalentry.cpp19
-rw-r--r--korganizer/journalentry.h2
-rw-r--r--korganizer/kojournalview.cpp19
3 files changed, 31 insertions, 9 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index add874f..395392c 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -63,3 +63,3 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
mJournal = 0;
-
+ visibleMode = true;
QHBox * vb = new QHBox ( this );
@@ -173,7 +173,11 @@ 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 );
+ }
}
@@ -183,2 +187,3 @@ void JournalEntry::setShowOnly()
mEditor->setFocus();
+ visibleMode = true;
}
@@ -213,2 +218,3 @@ void JournalEntry::clear()
mEditor->setText("");
+ mTitle->setText("");
}
@@ -235,10 +241,11 @@ 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;
}
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h
index f2db785..e98d018 100644
--- a/korganizer/journalentry.h
+++ b/korganizer/journalentry.h
@@ -53,2 +53,3 @@ class JournalEntry : public QFrame {
QSize sizeHint() const;
+ void setVisibleMode( bool b ) { visibleMode = b;}
@@ -69,2 +70,3 @@ class JournalEntry : public QFrame {
private:
+ bool visibleMode;
bool showOnlyMode;
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index cb9a2c0..b659d53 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -123,2 +123,5 @@ void KOJournalView::flushView()
{
+ static bool ff = false;
+ if ( ff ) return;
+ ff = true;
JournalEntry* mEntry = jEntries.first();
@@ -128,2 +131,3 @@ void KOJournalView::flushView()
}
+ ff = false;
}
@@ -140,2 +144,3 @@ void KOJournalView::newJournal()
{
+ //qDebug(" KOJournalView::newJournal()");
flushView();
@@ -149,2 +154,3 @@ void KOJournalView::showOnly ( Journal* j )
{
+ //qDebug("showOnly %x ", j);
flushView();
@@ -162,2 +168,3 @@ void KOJournalView::showList(QPtrList<Journal> jl)
{
+ //qDebug("KOJournalView::showList %d",jl.count() );
JournalEntry* mEntry = jEntries.first();
@@ -170,2 +177,3 @@ void KOJournalView::showList(QPtrList<Journal> jl)
mEntry->show();
+ mEntry->setVisibleMode( true );
mEntry->setDate(mDate);
@@ -173,3 +181,3 @@ void KOJournalView::showList(QPtrList<Journal> jl)
mEntry = 0;
- } else {
+ } else {
mEntry->setDate(mDate);
@@ -177,2 +185,3 @@ void KOJournalView::showList(QPtrList<Journal> jl)
mEntry->show();
+ mEntry->setVisibleMode( true );
mEntry = jEntries.next();
@@ -184,6 +193,10 @@ void KOJournalView::showList(QPtrList<Journal> jl)
mEntry->clear();
- if ( mEntry != firstEntry )
+ if ( mEntry != firstEntry ) {
mEntry->hide();
- else
+ mEntry->setVisibleMode( false );
+ }
+ else {
+ mEntry->setVisibleMode( true );
mEntry->show();
+ }
mEntry = jEntries.next();