author | zautrix <zautrix> | 2005-07-04 15:52:09 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-04 15:52:09 (UTC) |
commit | 226171366bc79927988eac10e0bf7fc3f7faea69 (patch) (unidiff) | |
tree | fc2aef43c88d35bb4b59002bdfa25f7c45094f91 | |
parent | 7221ff029af217ae703e8217333bd9b170203181 (diff) | |
download | kdepimpi-226171366bc79927988eac10e0bf7fc3f7faea69.zip kdepimpi-226171366bc79927988eac10e0bf7fc3f7faea69.tar.gz kdepimpi-226171366bc79927988eac10e0bf7fc3f7faea69.tar.bz2 |
fixx
-rw-r--r-- | korganizer/journalentry.cpp | 53 | ||||
-rw-r--r-- | korganizer/journalentry.h | 7 | ||||
-rw-r--r-- | korganizer/koeditorgeneral.cpp | 8 | ||||
-rw-r--r-- | korganizer/kojournalview.cpp | 10 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 10 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 |
6 files changed, 63 insertions, 26 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index 4751d40..56221dc 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp | |||
@@ -80,7 +80,7 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | |||
80 | mTitle = new KOLocationBox(TRUE, vb, 30); | 80 | mTitle = new KOLocationBox(TRUE, vb, 30); |
81 | mTitle->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); | 81 | mTitle->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); |
82 | mTitleLabel = new QLabel(i18n("Title"),vb); | 82 | mCalendarBox = new QComboBox(vb); |
83 | mTitleLabel->setMargin(0); | 83 | //mTitleLabel->setMargin(0); |
84 | mTitleLabel->setAlignment(AlignCenter); | 84 | //mTitleLabel->setAlignment(AlignCenter); |
85 | QPushButton * loadTemplate = new QPushButton( vb ); | 85 | QPushButton * loadTemplate = new QPushButton( vb ); |
86 | QPushButton * saveTemplate = new QPushButton( vb ); | 86 | QPushButton * saveTemplate = new QPushButton( vb ); |
@@ -100,4 +100,5 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | |||
100 | toggleJournal->setFixedSize( size , size ); | 100 | toggleJournal->setFixedSize( size , size ); |
101 | mTitle->setMaximumHeight( size+4); | 101 | mTitle->setMaximumHeight( size+4); |
102 | mCalendarBox->setMaximumHeight( size+4); | ||
102 | mEditor = new KTextEdit(this); | 103 | mEditor = new KTextEdit(this); |
103 | #ifndef DESKTOP_VERSION | 104 | #ifndef DESKTOP_VERSION |
@@ -177,7 +178,32 @@ void JournalEntry::setDate(const QDate &date) | |||
177 | writeJournal(); | 178 | writeJournal(); |
178 | mDate = date; | 179 | mDate = date; |
179 | int id = mCalendar->defaultCalendar(); | 180 | fillCalendar( mCalendar->defaultCalendar() ); |
180 | QString calname = KOPrefs::instance()->getCalendar( id )->mName; | 181 | } |
181 | mTitleLabel->setText( " (" + calname +")"); | 182 | void JournalEntry::fillCalendar( int setToID ) |
183 | { | ||
184 | mCalendarBox->clear(); | ||
185 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | ||
186 | int std = 0; | ||
187 | int count = 0; | ||
188 | while ( kkf ) { | ||
189 | if ( (!kkf->mErrorOnLoad &&! kkf->isReadOnly) || setToID == kkf->mCalNumber ) { | ||
190 | if ( setToID ) { | ||
191 | if ( kkf->mCalNumber == setToID ) | ||
192 | std = count; | ||
193 | } else { | ||
194 | if ( kkf->isStandard ) { | ||
195 | std = count; | ||
196 | } | ||
197 | } | ||
198 | ++count; | ||
199 | mCalendarBox->insertItem( kkf->mName ); | ||
200 | } | ||
201 | kkf = KOPrefs::instance()->mCalendars.next(); | ||
202 | } | ||
203 | mCalendarBox->setCurrentItem( std ); | ||
204 | if ( KOPrefs::instance()->mCalendars.count() == 1 ) | ||
205 | mCalendarBox->hide(); | ||
206 | else | ||
207 | mCalendarBox->show(); | ||
182 | } | 208 | } |
183 | 209 | ||
@@ -207,7 +233,8 @@ void JournalEntry::setShowOnly() | |||
207 | mEditor->setFocus(); | 233 | mEditor->setFocus(); |
208 | } | 234 | } |
209 | void JournalEntry::setJournal(Journal *journal) | 235 | void JournalEntry::setJournal(Journal *journal, bool saveJournal ) |
210 | { | 236 | { |
211 | writeJournal(); | 237 | if ( saveJournal ) |
238 | writeJournal(); | ||
212 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); | 239 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); |
213 | 240 | ||
@@ -220,8 +247,5 @@ void JournalEntry::setJournal(Journal *journal) | |||
220 | mTitle->setEnabled (!journal->isReadOnly() ); | 247 | mTitle->setEnabled (!journal->isReadOnly() ); |
221 | mEditor->setReadOnly ( journal->isReadOnly() ); | 248 | mEditor->setReadOnly ( journal->isReadOnly() ); |
222 | int id = mJournal->calID(); | 249 | fillCalendar( mJournal->calID() ); |
223 | |||
224 | QString calname = KOPrefs::instance()->getCalendar( id )->mName; | ||
225 | mTitleLabel->setText( " (" + calname +")"); | ||
226 | } | 250 | } |
227 | 251 | ||
@@ -261,4 +285,5 @@ void JournalEntry::writeJournal() | |||
261 | { | 285 | { |
262 | if ( !visibleMode ) return; | 286 | if ( !visibleMode ) return; |
287 | if ( !mTitle->isEnabled() ) return; | ||
263 | if (mEditor->text().isEmpty() && mTitle->currentText().isEmpty()) { | 288 | if (mEditor->text().isEmpty() && mTitle->currentText().isEmpty()) { |
264 | if ( mJournal ) { | 289 | if ( mJournal ) { |
@@ -287,4 +312,8 @@ void JournalEntry::writeJournal() | |||
287 | mTitle->save(KOLocationBox::SUMMARYJOURNAL); | 312 | mTitle->save(KOLocationBox::SUMMARYJOURNAL); |
288 | } | 313 | } |
314 | int id = KOPrefs::instance()->getCalendarID( mCalendarBox->currentText() ); | ||
315 | if ( mJournal->calID() != id ) { | ||
316 | mJournal->setCalID( id ); | ||
317 | } | ||
289 | } | 318 | } |
290 | 319 | ||
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h index fb19fb1..ed04b7c 100644 --- a/korganizer/journalentry.h +++ b/korganizer/journalentry.h | |||
@@ -32,4 +32,5 @@ | |||
32 | class QLabel; | 32 | class QLabel; |
33 | class KTextEdit; | 33 | class KTextEdit; |
34 | class QComboBox; | ||
34 | class KLineEdit; | 35 | class KLineEdit; |
35 | class KOLocationBox; | 36 | class KOLocationBox; |
@@ -43,5 +44,5 @@ class JournalEntry : public QFrame { | |||
43 | virtual ~JournalEntry(); | 44 | virtual ~JournalEntry(); |
44 | 45 | ||
45 | void setJournal(Journal *); | 46 | void setJournal(Journal *, bool saveJournal = true ); |
46 | Journal *journal() const; | 47 | Journal *journal() const; |
47 | 48 | ||
@@ -54,5 +55,5 @@ class JournalEntry : public QFrame { | |||
54 | QSize sizeHint() const; | 55 | QSize sizeHint() const; |
55 | void setVisibleMode( bool b ) { visibleMode = b;} | 56 | void setVisibleMode( bool b ) { visibleMode = b;} |
56 | 57 | void fillCalendar( int id = 0 ); | |
57 | protected slots: | 58 | protected slots: |
58 | void slotSaveTemplate(); | 59 | void slotSaveTemplate(); |
@@ -77,5 +78,5 @@ class JournalEntry : public QFrame { | |||
77 | QDate mDate; | 78 | QDate mDate; |
78 | void keyPressEvent ( QKeyEvent * ) ; | 79 | void keyPressEvent ( QKeyEvent * ) ; |
79 | QLabel *mTitleLabel; | 80 | QComboBox *mCalendarBox; |
80 | KOLocationBox * mTitle; | 81 | KOLocationBox * mTitle; |
81 | KTextEdit *mEditor; | 82 | KTextEdit *mEditor; |
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index fd50b05..aa55d82 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp | |||
@@ -484,11 +484,5 @@ void KOEditorGeneral::fillCalCombo( int setToID ) | |||
484 | int KOEditorGeneral::getCalendarID() | 484 | int KOEditorGeneral::getCalendarID() |
485 | { | 485 | { |
486 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 486 | return KOPrefs::instance()->getCalendarID( mCalendarBox->currentText() ); |
487 | while ( kkf ) { | ||
488 | if ( mCalendarBox->currentText() == kkf->mName) | ||
489 | return kkf->mCalNumber; | ||
490 | kkf = KOPrefs::instance()->mCalendars.next(); | ||
491 | } | ||
492 | return 1; | ||
493 | } | 487 | } |
494 | 488 | ||
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp index 9b0e748..0523954 100644 --- a/korganizer/kojournalview.cpp +++ b/korganizer/kojournalview.cpp | |||
@@ -156,5 +156,5 @@ void KOJournalView::newJournal() | |||
156 | void KOJournalView::showOnly ( Journal* j ) | 156 | void KOJournalView::showOnly ( Journal* j ) |
157 | { | 157 | { |
158 | qDebug("showOnly %x ", j); | 158 | //qDebug("showOnly %x ", j); |
159 | flushView(); | 159 | flushView(); |
160 | if ( j == 0 ) { | 160 | if ( j == 0 ) { |
@@ -170,5 +170,5 @@ void KOJournalView::showOnly ( Journal* j ) | |||
170 | void KOJournalView::showList(QPtrList<Journal> jl) | 170 | void KOJournalView::showList(QPtrList<Journal> jl) |
171 | { | 171 | { |
172 | qDebug("KOJournalView::showList %d",jl.count() ); | 172 | //qDebug("KOJournalView::showList %d",jl.count() ); |
173 | JournalEntry* mEntry = jEntries.first(); | 173 | JournalEntry* mEntry = jEntries.first(); |
174 | JournalEntry* firstEntry = mEntry; | 174 | JournalEntry* firstEntry = mEntry; |
@@ -178,12 +178,14 @@ void KOJournalView::showList(QPtrList<Journal> jl) | |||
178 | if ( !mEntry ) { | 178 | if ( !mEntry ) { |
179 | mEntry = getNewEntry(); | 179 | mEntry = getNewEntry(); |
180 | mEntry->setVisibleMode( true ); | ||
180 | mEntry->setDate(mDate); | 181 | mEntry->setDate(mDate); |
181 | mEntry->setJournal(jl.at(iii)); | 182 | mEntry->setJournal(jl.at(iii), false); |
182 | mEntry->setVisibleMode( true ); | 183 | mEntry->setVisibleMode( true ); |
183 | mEntry->show(); | 184 | mEntry->show(); |
184 | mEntry = 0; | 185 | mEntry = 0; |
185 | } else { | 186 | } else { |
187 | mEntry->setVisibleMode( true ); | ||
186 | mEntry->setDate(mDate); | 188 | mEntry->setDate(mDate); |
187 | mEntry->setJournal(jl.at(iii)); | 189 | mEntry->setJournal(jl.at(iii), false); |
188 | mEntry->setVisibleMode( true ); | 190 | mEntry->setVisibleMode( true ); |
189 | mEntry->show(); | 191 | mEntry->show(); |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index bb3d720..a886735 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -502,4 +502,14 @@ void KOPrefs::deleteCalendar( int num ) | |||
502 | } | 502 | } |
503 | } | 503 | } |
504 | int KOPrefs::getCalendarID( const QString & name ) | ||
505 | { | ||
506 | KopiCalendarFile * kkf = mCalendars.first(); | ||
507 | while ( kkf ) { | ||
508 | if ( name == kkf->mName) | ||
509 | return kkf->mCalNumber; | ||
510 | kkf = mCalendars.next(); | ||
511 | } | ||
512 | return 1; | ||
513 | } | ||
504 | QString KOPrefs::calName( int calNum) const | 514 | QString KOPrefs::calName( int calNum) const |
505 | { | 515 | { |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 53d193b..7ec5327 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -101,4 +101,5 @@ class KOPrefs : public KPimPrefs | |||
101 | QColor defaultColor( int ) const; | 101 | QColor defaultColor( int ) const; |
102 | QString calName( int ) const; | 102 | QString calName( int ) const; |
103 | int getCalendarID( const QString & name ); | ||
103 | protected: | 104 | protected: |
104 | void setTimeZoneIdDefault(); | 105 | void setTimeZoneIdDefault(); |