summaryrefslogtreecommitdiffabout
path: root/korganizer/journalentry.cpp
authorzautrix <zautrix>2005-07-04 14:29:18 (UTC)
committer zautrix <zautrix>2005-07-04 14:29:18 (UTC)
commit7221ff029af217ae703e8217333bd9b170203181 (patch) (unidiff)
treef294b7f4c0235858868c2a44f70b3014b7c53aab /korganizer/journalentry.cpp
parent172078c08cd183e9f7ec913a9bf42426e3585b78 (diff)
downloadkdepimpi-7221ff029af217ae703e8217333bd9b170203181.zip
kdepimpi-7221ff029af217ae703e8217333bd9b170203181.tar.gz
kdepimpi-7221ff029af217ae703e8217333bd9b170203181.tar.bz2
box
Diffstat (limited to 'korganizer/journalentry.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/journalentry.cpp36
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
@@ -43,6 +43,8 @@
43#include <kmessagebox.h> 43#include <kmessagebox.h>
44#include "koprefs.h" 44#include "koprefs.h"
45#include <klineedit.h> 45#include <klineedit.h>
46#include <kdialog.h>
47#include "kolocationbox.h"
46 48
47#include <libkcal/journal.h> 49#include <libkcal/journal.h>
48#include <libkcal/calendarresources.h> 50#include <libkcal/calendarresources.h>
@@ -70,12 +72,13 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
70 visibleMode = true; 72 visibleMode = true;
71 QHBox * vb = new QHBox ( this ); 73 QHBox * vb = new QHBox ( this );
72 QPixmap iconp; 74 QPixmap iconp;
73 75 vb->setMargin ( KDialog::marginHint()-1 );
74 QPushButton * toggleJournal = new QPushButton( vb ); 76 QPushButton * toggleJournal = new QPushButton( vb );
75 iconp = SmallIcon("1updownarrow"); 77 iconp = SmallIcon("1updownarrow");
76 toggleJournal->setPixmap (iconp ) ; 78 toggleJournal->setPixmap (iconp ) ;
77 new QLabel(" "+i18n("Title: "),vb); 79 new QLabel(" "+i18n("Title: "),vb);
78 mTitle = new KLineEdit ( vb ); 80 mTitle = new KOLocationBox(TRUE, vb, 30);
81 mTitle->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) );
79 mTitleLabel = new QLabel(i18n("Title"),vb); 82 mTitleLabel = new QLabel(i18n("Title"),vb);
80 mTitleLabel->setMargin(0); 83 mTitleLabel->setMargin(0);
81 mTitleLabel->setAlignment(AlignCenter); 84 mTitleLabel->setAlignment(AlignCenter);
@@ -95,6 +98,7 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
95 loadTemplate->setFixedSize( size, size ); 98 loadTemplate->setFixedSize( size, size );
96 saveTemplate->setFixedSize( size, size ); 99 saveTemplate->setFixedSize( size, size );
97 toggleJournal->setFixedSize( size , size ); 100 toggleJournal->setFixedSize( size , size );
101 mTitle->setMaximumHeight( size+4);
98 mEditor = new KTextEdit(this); 102 mEditor = new KTextEdit(this);
99#ifndef DESKTOP_VERSION 103#ifndef DESKTOP_VERSION
100 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); 104 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold );
@@ -107,6 +111,8 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
107 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 111 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
108 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 112 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
109 connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); 113 connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) );
114 mTitle->load( KOLocationBox::SUMMARYJOURNAL );
115 mTitle->lineEdit ()->setText("");
110} 116}
111 117
112JournalEntry::~JournalEntry() 118JournalEntry::~JournalEntry()
@@ -177,7 +183,7 @@ void JournalEntry::setDate(const QDate &date)
177 183
178void JournalEntry::toggleShowJournal() 184void JournalEntry::toggleShowJournal()
179{ 185{
180 if (!mEditor->text().isEmpty() || !mTitle->text().isEmpty()) 186 if (!mEditor->text().isEmpty() || !mTitle->currentText ().isEmpty())
181 flushEntry(); 187 flushEntry();
182 if ( showOnlyMode ) 188 if ( showOnlyMode )
183 emit showJournalOnly( 0 ); 189 emit showJournalOnly( 0 );
@@ -195,7 +201,7 @@ void JournalEntry::setVisibleOn()
195void JournalEntry::setShowOnly() 201void JournalEntry::setShowOnly()
196{ 202{
197 showOnlyMode = true; 203 showOnlyMode = true;
198 if ( mTitle->text().isEmpty() ) 204 if ( mTitle->currentText().isEmpty() )
199 mTitle->setFocus(); 205 mTitle->setFocus();
200 else 206 else
201 mEditor->setFocus(); 207 mEditor->setFocus();
@@ -203,20 +209,20 @@ void JournalEntry::setShowOnly()
203void JournalEntry::setJournal(Journal *journal) 209void JournalEntry::setJournal(Journal *journal)
204{ 210{
205 writeJournal(); 211 writeJournal();
212 mTitle->load( KOLocationBox::SUMMARYJOURNAL );
206 213
207 mJournal = journal; 214 mJournal = journal;
208 if ( journal->isReadOnly() ) 215 if ( journal->isReadOnly() )
209 mTitle->setText(mJournal->summary()+" ("+i18n("readonly")+")"); 216 mTitle->lineEdit ()->setText(mJournal->summary()+" ("+i18n("readonly")+")");
210 else 217 else
211 mTitle->setText(mJournal->summary()); 218 mTitle->lineEdit ()->setText(mJournal->summary());
212 mEditor->setText(mJournal->description()); 219 mEditor->setText(mJournal->description());
213 mTitle->setReadOnly (journal->isReadOnly() ); 220 mTitle->setEnabled (!journal->isReadOnly() );
214 mEditor->setReadOnly ( journal->isReadOnly() ); 221 mEditor->setReadOnly ( journal->isReadOnly() );
215 int id = mJournal->calID(); 222 int id = mJournal->calID();
216 223
217 QString calname = KOPrefs::instance()->getCalendar( id )->mName; 224 QString calname = KOPrefs::instance()->getCalendar( id )->mName;
218 mTitleLabel->setText( " (" + calname +")"); 225 mTitleLabel->setText( " (" + calname +")");
219
220} 226}
221 227
222Journal *JournalEntry::journal() const 228Journal *JournalEntry::journal() const
@@ -229,7 +235,8 @@ void JournalEntry::clear()
229{ 235{
230 mJournal = 0; 236 mJournal = 0;
231 mEditor->setText(""); 237 mEditor->setText("");
232 mTitle->setText(""); 238 mTitle->load( KOLocationBox::SUMMARYJOURNAL );
239 mTitle->lineEdit ()->setText("");
233} 240}
234 241
235bool JournalEntry::eventFilter( QObject *o, QEvent *e ) 242bool JournalEntry::eventFilter( QObject *o, QEvent *e )
@@ -253,7 +260,7 @@ bool JournalEntry::eventFilter( QObject *o, QEvent *e )
253void JournalEntry::writeJournal() 260void JournalEntry::writeJournal()
254{ 261{
255 if ( !visibleMode ) return; 262 if ( !visibleMode ) return;
256 if (mEditor->text().isEmpty() && mTitle->text().isEmpty()) { 263 if (mEditor->text().isEmpty() && mTitle->currentText().isEmpty()) {
257 if ( mJournal ) { 264 if ( mJournal ) {
258 Journal* j = mJournal; 265 Journal* j = mJournal;
259 mJournal = 0; 266 mJournal = 0;
@@ -272,10 +279,13 @@ void JournalEntry::writeJournal()
272 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); 279 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0)));
273 mCalendar->addJournal(mJournal); 280 mCalendar->addJournal(mJournal);
274 } 281 }
275 if ( mJournal->description() != mEditor->text() ) 282 if ( mJournal->description() != mEditor->text() ) {
276 mJournal->setDescription(mEditor->text()); 283 mJournal->setDescription(mEditor->text());
277 if ( mJournal->summary() != mTitle->text() ) 284 }
278 mJournal->setSummary(mTitle->text()); 285 if ( mJournal->summary() != mTitle->currentText() ) {
286 mJournal->setSummary(mTitle->currentText());
287 mTitle->save(KOLocationBox::SUMMARYJOURNAL);
288 }
279} 289}
280 290
281void JournalEntry::flushEntry() 291void JournalEntry::flushEntry()