summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/journalentry.cpp11
-rw-r--r--korganizer/journalentry.h1
-rw-r--r--korganizer/kojournalview.cpp10
3 files changed, 15 insertions, 7 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index 9e2c902..ca8d5f7 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -157,40 +157,47 @@ void JournalEntry::slotLoadTemplate()
int line, col;
mEditor->getCursorPosition (& line, & col );
mEditor-> insertAt ( text, line, col, true );
//mEditor->setIgnoreMark( true );
}
void JournalEntry::setDate(const QDate &date)
{
showOnlyMode = false;
- mDate = date;
writeJournal();
+ mDate = date;
int id = mCalendar->defaultCalendar();
QString calname = KOPrefs::instance()->getCalendar( id )->mName;
mTitleLabel->setText( " (" + calname +")");
}
void JournalEntry::toggleShowJournal()
{
if (!mEditor->text().isEmpty() || !mTitle->text().isEmpty())
flushEntry();
if ( showOnlyMode )
emit showJournalOnly( 0 );
else {
// we have to protect mJournal from deleting if mJournal has empty text
visibleMode = false; // set to true via :setShowOnly()
emit showJournalOnly( mJournal );
+ //QTimer::singleShot( 0, this, SLOT( setVisibleOn() ) );
}
}
+void JournalEntry::setVisibleOn()
+{
+ visibleMode = true;
+}
void JournalEntry::setShowOnly()
{
showOnlyMode = true;
+ if ( mTitle->text().isEmpty() )
+ mTitle->setFocus();
+ else
mEditor->setFocus();
- visibleMode = true;
}
void JournalEntry::setJournal(Journal *journal)
{
writeJournal();
mJournal = journal;
if ( journal->isReadOnly() )
mTitle->setText(mJournal->summary()+" ("+i18n("readonly")+")");
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h
index e98d018..cc9b5ef 100644
--- a/korganizer/journalentry.h
+++ b/korganizer/journalentry.h
@@ -52,16 +52,17 @@ class JournalEntry : public QFrame {
void setShowOnly();
QSize sizeHint() const;
void setVisibleMode( bool b ) { visibleMode = b;}
protected slots:
void slotSaveTemplate();
void slotLoadTemplate();
void toggleShowJournal();
+ void setVisibleOn();
signals:
void deleteJournal(Journal *);
void newJournal();
void showJournalOnly( Journal * );
protected:
bool eventFilter( QObject *o, QEvent *e );
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index 7a96aa5..6fa9b23 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -150,48 +150,48 @@ void KOJournalView::newJournal()
Journal* mJournal = new Journal;
mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0)));
mCalendar->addJournal(mJournal);
showDates( mDate, QDate() );
}
void KOJournalView::showOnly ( Journal* j )
{
- //qDebug("showOnly %x ", j);
+ qDebug("showOnly %x ", j);
flushView();
if ( j == 0 ) {
showDates( mDate, QDate() );
return;
}
QPtrList<Journal> jl;
jl.append ( j );
showList( jl );
JournalEntry* mEntry = jEntries.first();
mEntry->setShowOnly();
}
void KOJournalView::showList(QPtrList<Journal> jl)
{
- //qDebug("KOJournalView::showList %d",jl.count() );
+ qDebug("KOJournalView::showList %d",jl.count() );
JournalEntry* mEntry = jEntries.first();
JournalEntry* firstEntry = mEntry;
int count = jl.count();
int iii = 0;
while ( iii < count ) {
if ( !mEntry ) {
mEntry = getNewEntry();
- mEntry->show();
- mEntry->setVisibleMode( true );
mEntry->setDate(mDate);
mEntry->setJournal(jl.at(iii));
+ mEntry->setVisibleMode( true );
+ mEntry->show();
mEntry = 0;
} else {
mEntry->setDate(mDate);
mEntry->setJournal(jl.at(iii));
- mEntry->show();
mEntry->setVisibleMode( true );
+ mEntry->show();
mEntry = jEntries.next();
}
++iii;
}
while ( mEntry ) {
mEntry->setDate(mDate);
mEntry->clear();
if ( mEntry != firstEntry ) {