-rw-r--r-- | korganizer/journalentry.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index 9e2c902..ca8d5f7 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp | |||
@@ -153,48 +153,55 @@ void JournalEntry::slotLoadTemplate() | |||
153 | QTextStream tsIn( &fileIn ); | 153 | QTextStream tsIn( &fileIn ); |
154 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 154 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
155 | QString text = tsIn.read(); | 155 | QString text = tsIn.read(); |
156 | fileIn.close(); | 156 | fileIn.close(); |
157 | int line, col; | 157 | int line, col; |
158 | mEditor->getCursorPosition (& line, & col ); | 158 | mEditor->getCursorPosition (& line, & col ); |
159 | mEditor-> insertAt ( text, line, col, true ); | 159 | mEditor-> insertAt ( text, line, col, true ); |
160 | //mEditor->setIgnoreMark( true ); | 160 | //mEditor->setIgnoreMark( true ); |
161 | } | 161 | } |
162 | void JournalEntry::setDate(const QDate &date) | 162 | void JournalEntry::setDate(const QDate &date) |
163 | { | 163 | { |
164 | showOnlyMode = false; | 164 | showOnlyMode = false; |
165 | mDate = date; | ||
166 | writeJournal(); | 165 | writeJournal(); |
166 | mDate = date; | ||
167 | int id = mCalendar->defaultCalendar(); | 167 | int id = mCalendar->defaultCalendar(); |
168 | QString calname = KOPrefs::instance()->getCalendar( id )->mName; | 168 | QString calname = KOPrefs::instance()->getCalendar( id )->mName; |
169 | mTitleLabel->setText( " (" + calname +")"); | 169 | mTitleLabel->setText( " (" + calname +")"); |
170 | } | 170 | } |
171 | 171 | ||
172 | void JournalEntry::toggleShowJournal() | 172 | void JournalEntry::toggleShowJournal() |
173 | { | 173 | { |
174 | if (!mEditor->text().isEmpty() || !mTitle->text().isEmpty()) | 174 | if (!mEditor->text().isEmpty() || !mTitle->text().isEmpty()) |
175 | flushEntry(); | 175 | flushEntry(); |
176 | if ( showOnlyMode ) | 176 | if ( showOnlyMode ) |
177 | emit showJournalOnly( 0 ); | 177 | emit showJournalOnly( 0 ); |
178 | else { | 178 | else { |
179 | // we have to protect mJournal from deleting if mJournal has empty text | 179 | // we have to protect mJournal from deleting if mJournal has empty text |
180 | visibleMode = false; // set to true via :setShowOnly() | 180 | visibleMode = false; // set to true via :setShowOnly() |
181 | emit showJournalOnly( mJournal ); | 181 | emit showJournalOnly( mJournal ); |
182 | //QTimer::singleShot( 0, this, SLOT( setVisibleOn() ) ); | ||
182 | } | 183 | } |
183 | } | 184 | } |
185 | void JournalEntry::setVisibleOn() | ||
186 | { | ||
187 | visibleMode = true; | ||
188 | } | ||
184 | void JournalEntry::setShowOnly() | 189 | void JournalEntry::setShowOnly() |
185 | { | 190 | { |
186 | showOnlyMode = true; | 191 | showOnlyMode = true; |
192 | if ( mTitle->text().isEmpty() ) | ||
193 | mTitle->setFocus(); | ||
194 | else | ||
187 | mEditor->setFocus(); | 195 | mEditor->setFocus(); |
188 | visibleMode = true; | ||
189 | } | 196 | } |
190 | void JournalEntry::setJournal(Journal *journal) | 197 | void JournalEntry::setJournal(Journal *journal) |
191 | { | 198 | { |
192 | writeJournal(); | 199 | writeJournal(); |
193 | 200 | ||
194 | mJournal = journal; | 201 | mJournal = journal; |
195 | if ( journal->isReadOnly() ) | 202 | if ( journal->isReadOnly() ) |
196 | mTitle->setText(mJournal->summary()+" ("+i18n("readonly")+")"); | 203 | mTitle->setText(mJournal->summary()+" ("+i18n("readonly")+")"); |
197 | else | 204 | else |
198 | mTitle->setText(mJournal->summary()); | 205 | mTitle->setText(mJournal->summary()); |
199 | mEditor->setText(mJournal->description()); | 206 | mEditor->setText(mJournal->description()); |
200 | mTitle->setReadOnly (journal->isReadOnly() ); | 207 | mTitle->setReadOnly (journal->isReadOnly() ); |