author | zautrix <zautrix> | 2005-06-29 12:29:53 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-29 12:29:53 (UTC) |
commit | 0d4d5898a32f162dca010db329e02310a14629d5 (patch) (side-by-side diff) | |
tree | 2d6e758a8a5ec64995de79a4cd1c02c89f509190 /korganizer/journalentry.cpp | |
parent | 435e68d6ace30fb2121b718226e00be44971c617 (diff) | |
download | kdepimpi-0d4d5898a32f162dca010db329e02310a14629d5.zip kdepimpi-0d4d5898a32f162dca010db329e02310a14629d5.tar.gz kdepimpi-0d4d5898a32f162dca010db329e02310a14629d5.tar.bz2 |
j fixes
-rw-r--r-- | korganizer/journalentry.cpp | 53 |
1 files changed, 21 insertions, 32 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index 0b923ad..05bfd31 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp @@ -39,12 +39,13 @@ #include <kglobal.h> #include <klocale.h> #include <ktextedit.h> #include <kfiledialog.h> #include <kmessagebox.h> #include "koprefs.h" +#include <klineedit.h> #include <libkcal/journal.h> #include <libkcal/calendarresources.h> #include <libkcal/resourcecalendar.h> #include <kresources/resourceselectdialog.h> @@ -60,33 +61,23 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : showOnlyMode = false; mCalendar = calendar; mJournal = 0; mDirty = false; QHBox * vb = new QHBox ( this ); - QPushButton * newJournal = new QPushButton( vb ); QIconSet icon; - if ( QApplication::desktop()->width() < 321 ) - icon = SmallIcon("ko16old"); - else - icon = SmallIcon("ko24old"); - newJournal->setIconSet (icon ) ; - int size = newJournal->sizeHint().height(); - newJournal->setFixedSize( size, size ); - QPushButton * toggleJournal = new QPushButton( vb ); icon = SmallIcon("1updownarrow"); toggleJournal->setIconSet (icon ) ; - //int size = toggleJournal->sizeHint().height(); + int size = toggleJournal->sizeHint().height(); toggleJournal->setFixedSize( size * 2 /3 , size ); - - - + new QLabel(i18n(" Title: "),vb); + mTitle = new KLineEdit ( vb ); mTitleLabel = new QLabel(i18n("Title"),vb); - mTitleLabel->setMargin(2); + mTitleLabel->setMargin(0); mTitleLabel->setAlignment(AlignCenter); QPushButton * loadTemplate = new QPushButton( vb ); QPushButton * saveTemplate = new QPushButton( vb ); if ( QApplication::desktop()->width() < 321 ) icon = SmallIcon("fileexport16"); else @@ -108,20 +99,20 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : mEditor->setWordWrap( KTextEdit::WidgetWidth ); QBoxLayout *topLayout = new QVBoxLayout(this); topLayout->addWidget(vb); topLayout->addWidget(mEditor); mEditor->installEventFilter(this); connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); + connect( mTitle, SIGNAL( textChanged ( const QString & ) ), this , SLOT( setDirty() ) ); connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); - connect( newJournal, SIGNAL( clicked() ), this , SIGNAL( newJournal() ) ); connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); } JournalEntry::~JournalEntry() { - qDebug("JournalEntry::~JournalEntry() "); + //qDebug("JournalEntry::~JournalEntry() "); } QSize JournalEntry::sizeHint() const { return QSize ( 240, heiHint ); } void JournalEntry::slotSaveTemplate() @@ -176,42 +167,41 @@ void JournalEntry::slotLoadTemplate() void JournalEntry::setDate(const QDate &date) { showOnlyMode = false; mDate = date; writeJournal(); int id = mCalendar->defaultCalendar(); - if ( id == 1 ) { - mTitleLabel->setText(KGlobal::locale()->formatDate(date)); - } else { - QString calname = KOPrefs::instance()->getCalendar( id )->mName; - mTitleLabel->setText( KGlobal::locale()->formatDate(mDate,true) + " (" + calname +")"); - } + QString calname = KOPrefs::instance()->getCalendar( id )->mName; + mTitleLabel->setText( " (" + calname +")"); } void JournalEntry::toggleShowJournal() { + flushEntry(); if ( showOnlyMode ) emit showJournalOnly( 0 ); else emit showJournalOnly( mJournal ); } - +void JournalEntry::setShowOnly() +{ + showOnlyMode = true; + mEditor->setFocus(); +} void JournalEntry::setJournal(Journal *journal) { writeJournal(); mJournal = journal; - + mTitle->setText(mJournal->summary()); mEditor->setText(mJournal->description()); int id = mJournal->calID(); - if ( id > 1 ) { - QString calname = KOPrefs::instance()->getCalendar( id )->mName; - mTitleLabel->setText( KGlobal::locale()->formatDate(mDate,true) + " (" + calname +")"); - } else { - mTitleLabel->setText(KGlobal::locale()->formatDate(mDate)); - } + + QString calname = KOPrefs::instance()->getCalendar( id )->mName; + mTitleLabel->setText( " (" + calname +")"); + mDirty = false; } Journal *JournalEntry::journal() const { return mJournal; @@ -271,14 +261,13 @@ void JournalEntry::writeJournal() mJournal = new Journal; mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); mCalendar->addJournal(mJournal); } mJournal->setDescription(mEditor->text()); - //qDebug("tttt%s ", mEditor->text().latin1()); - + mJournal->setSummary(mTitle->text()); mDirty = false; } void JournalEntry::flushEntry() { if (!mDirty) return; |