summaryrefslogtreecommitdiffabout
path: root/korganizer/journalentry.cpp
authorzautrix <zautrix>2005-06-29 10:36:31 (UTC)
committer zautrix <zautrix>2005-06-29 10:36:31 (UTC)
commitb7044dfc9516d546683973985555c481d59fc677 (patch) (side-by-side diff)
treeb521090cfc8eb6c8c6a6f6f8167c83058ea1361b /korganizer/journalentry.cpp
parentf226b4cd2ce06a6948811fe04d80fe3ffa44f695 (diff)
downloadkdepimpi-b7044dfc9516d546683973985555c481d59fc677.zip
kdepimpi-b7044dfc9516d546683973985555c481d59fc677.tar.gz
kdepimpi-b7044dfc9516d546683973985555c481d59fc677.tar.bz2
journal fixxx
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
@@ -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;
}