-rw-r--r-- | korganizer/journalentry.cpp | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index 3c38f34..4751d40 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp @@ -44,4 +44,6 @@ #include "koprefs.h" #include <klineedit.h> +#include <kdialog.h> +#include "kolocationbox.h" #include <libkcal/journal.h> @@ -71,10 +73,11 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : QHBox * vb = new QHBox ( this ); QPixmap iconp; - + vb->setMargin ( KDialog::marginHint()-1 ); QPushButton * toggleJournal = new QPushButton( vb ); iconp = SmallIcon("1updownarrow"); toggleJournal->setPixmap (iconp ) ; new QLabel(" "+i18n("Title: "),vb); - mTitle = new KLineEdit ( vb ); + mTitle = new KOLocationBox(TRUE, vb, 30); + mTitle->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); mTitleLabel = new QLabel(i18n("Title"),vb); mTitleLabel->setMargin(0); @@ -96,4 +99,5 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : saveTemplate->setFixedSize( size, size ); toggleJournal->setFixedSize( size , size ); + mTitle->setMaximumHeight( size+4); mEditor = new KTextEdit(this); #ifndef DESKTOP_VERSION @@ -108,4 +112,6 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); + mTitle->load( KOLocationBox::SUMMARYJOURNAL ); + mTitle->lineEdit ()->setText(""); } @@ -178,5 +184,5 @@ void JournalEntry::setDate(const QDate &date) void JournalEntry::toggleShowJournal() { - if (!mEditor->text().isEmpty() || !mTitle->text().isEmpty()) + if (!mEditor->text().isEmpty() || !mTitle->currentText ().isEmpty()) flushEntry(); if ( showOnlyMode ) @@ -196,5 +202,5 @@ void JournalEntry::setShowOnly() { showOnlyMode = true; - if ( mTitle->text().isEmpty() ) + if ( mTitle->currentText().isEmpty() ) mTitle->setFocus(); else @@ -204,12 +210,13 @@ void JournalEntry::setJournal(Journal *journal) { writeJournal(); + mTitle->load( KOLocationBox::SUMMARYJOURNAL ); mJournal = journal; if ( journal->isReadOnly() ) - mTitle->setText(mJournal->summary()+" ("+i18n("readonly")+")"); + mTitle->lineEdit ()->setText(mJournal->summary()+" ("+i18n("readonly")+")"); else - mTitle->setText(mJournal->summary()); + mTitle->lineEdit ()->setText(mJournal->summary()); mEditor->setText(mJournal->description()); - mTitle->setReadOnly (journal->isReadOnly() ); + mTitle->setEnabled (!journal->isReadOnly() ); mEditor->setReadOnly ( journal->isReadOnly() ); int id = mJournal->calID(); @@ -217,5 +224,4 @@ void JournalEntry::setJournal(Journal *journal) QString calname = KOPrefs::instance()->getCalendar( id )->mName; mTitleLabel->setText( " (" + calname +")"); - } @@ -230,5 +236,6 @@ void JournalEntry::clear() mJournal = 0; mEditor->setText(""); - mTitle->setText(""); + mTitle->load( KOLocationBox::SUMMARYJOURNAL ); + mTitle->lineEdit ()->setText(""); } @@ -254,5 +261,5 @@ void JournalEntry::writeJournal() { if ( !visibleMode ) return; - if (mEditor->text().isEmpty() && mTitle->text().isEmpty()) { + if (mEditor->text().isEmpty() && mTitle->currentText().isEmpty()) { if ( mJournal ) { Journal* j = mJournal; @@ -273,8 +280,11 @@ void JournalEntry::writeJournal() mCalendar->addJournal(mJournal); } - if ( mJournal->description() != mEditor->text() ) + if ( mJournal->description() != mEditor->text() ) { mJournal->setDescription(mEditor->text()); - if ( mJournal->summary() != mTitle->text() ) - mJournal->setSummary(mTitle->text()); + } + if ( mJournal->summary() != mTitle->currentText() ) { + mJournal->setSummary(mTitle->currentText()); + mTitle->save(KOLocationBox::SUMMARYJOURNAL); + } } |