summaryrefslogtreecommitdiffabout
path: root/korganizer/journalentry.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/journalentry.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/journalentry.cpp61
1 files changed, 49 insertions, 12 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index c19a5ca..7274849 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -55,34 +55,51 @@
#endif
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");
else
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
QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold );
@@ -93,8 +110,10 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
topLayout->addWidget(mEditor);
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()
{
@@ -150,14 +169,26 @@ void JournalEntry::slotLoadTemplate()
setDirty();
}
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)
{
@@ -165,9 +196,15 @@ 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;
}
Journal *JournalEntry::journal() const