From b7044dfc9516d546683973985555c481d59fc677 Mon Sep 17 00:00:00 2001 From: zautrix Date: Wed, 29 Jun 2005 10:36:31 +0000 Subject: journal fixxx --- (limited to 'korganizer/journalentry.cpp') diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index c19a5ca..7274849 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp @@ -56,20 +56,42 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : QFrame(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(); + toggleJournal->setFixedSize( size * 2 /3 , size ); + + + + mTitleLabel = new QLabel(i18n("Title"),vb); + mTitleLabel->setMargin(2); + mTitleLabel->setAlignment(AlignCenter); QPushButton * loadTemplate = new QPushButton( vb ); QPushButton * saveTemplate = new QPushButton( vb ); - QIconSet icon; if ( QApplication::desktop()->width() < 321 ) icon = SmallIcon("fileexport16"); else icon = SmallIcon("fileexport"); saveTemplate->setIconSet (icon ) ; - int size = saveTemplate->sizeHint().height(); + //size = saveTemplate->sizeHint().height(); saveTemplate->setFixedSize( size, size ); if ( QApplication::desktop()->width() < 321 ) icon = SmallIcon("fileimport16"); @@ -77,11 +99,6 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : icon = SmallIcon("fileimport"); loadTemplate->setIconSet (icon ) ; loadTemplate->setFixedSize( size, size ); - - mTitleLabel = new QLabel(i18n("Title"),vb); - mTitleLabel->setMargin(2); - mTitleLabel->setAlignment(AlignCenter); - mEditor = new KTextEdit(this); connect(mEditor,SIGNAL(textChanged()),SLOT(setDirty())); #ifndef DESKTOP_VERSION @@ -94,6 +111,8 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : mEditor->installEventFilter(this); connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); + connect( newJournal, SIGNAL( clicked() ), this , SIGNAL( newJournal() ) ); + connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); } JournalEntry::~JournalEntry() @@ -151,12 +170,24 @@ 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 +")"); + } +} - mTitleLabel->setText(KGlobal::locale()->formatDate(date)); - - - mDate = date; +void JournalEntry::toggleShowJournal() +{ + if ( showOnlyMode ) + emit showJournalOnly( 0 ); + else + emit showJournalOnly( mJournal ); } void JournalEntry::setJournal(Journal *journal) @@ -166,7 +197,13 @@ void JournalEntry::setJournal(Journal *journal) mJournal = journal; 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)); + } mDirty = false; } -- cgit v0.9.0.2