-rw-r--r-- | korganizer/journalentry.cpp | 39 | ||||
-rw-r--r-- | korganizer/journalentry.h | 3 | ||||
-rw-r--r-- | korganizer/kojournalview.cpp | 6 |
3 files changed, 15 insertions, 33 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index 58863fe..add874f 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp | |||
@@ -61,14 +61,13 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | |||
61 | showOnlyMode = false; | 61 | showOnlyMode = false; |
62 | mCalendar = calendar; | 62 | mCalendar = calendar; |
63 | mJournal = 0; | 63 | mJournal = 0; |
64 | mDirty = false; | ||
65 | 64 | ||
66 | QHBox * vb = new QHBox ( this ); | 65 | QHBox * vb = new QHBox ( this ); |
67 | QIconSet icon; | 66 | QPixmap iconp; |
68 | 67 | ||
69 | QPushButton * toggleJournal = new QPushButton( vb ); | 68 | QPushButton * toggleJournal = new QPushButton( vb ); |
70 | icon = SmallIcon("1updownarrow"); | 69 | iconp = SmallIcon("1updownarrow"); |
71 | toggleJournal->setIconSet (icon ) ; | 70 | toggleJournal->setPixmap (iconp ) ; |
72 | new QLabel(i18n(" Title: "),vb); | 71 | new QLabel(i18n(" Title: "),vb); |
73 | mTitle = new KLineEdit ( vb ); | 72 | mTitle = new KLineEdit ( vb ); |
74 | mTitleLabel = new QLabel(i18n("Title"),vb); | 73 | mTitleLabel = new QLabel(i18n("Title"),vb); |
@@ -77,21 +76,20 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | |||
77 | QPushButton * loadTemplate = new QPushButton( vb ); | 76 | QPushButton * loadTemplate = new QPushButton( vb ); |
78 | QPushButton * saveTemplate = new QPushButton( vb ); | 77 | QPushButton * saveTemplate = new QPushButton( vb ); |
79 | if ( QApplication::desktop()->width() < 321 ) | 78 | if ( QApplication::desktop()->width() < 321 ) |
80 | icon = SmallIcon("fileexport16"); | 79 | iconp = SmallIcon("fileexport16"); |
81 | else | 80 | else |
82 | icon = SmallIcon("fileexport"); | 81 | iconp = SmallIcon("fileexport"); |
83 | saveTemplate->setIconSet (icon ) ; | 82 | saveTemplate->setPixmap (iconp ) ; |
84 | int size = saveTemplate->sizeHint().height(); | 83 | int size = saveTemplate->sizeHint().height(); |
85 | if ( QApplication::desktop()->width() < 321 ) | 84 | if ( QApplication::desktop()->width() < 321 ) |
86 | icon = SmallIcon("fileimport16"); | 85 | iconp = SmallIcon("fileimport16"); |
87 | else | 86 | else |
88 | icon = SmallIcon("fileimport"); | 87 | iconp = SmallIcon("fileimport"); |
89 | loadTemplate->setIconSet (icon ) ; | 88 | loadTemplate->setPixmap (iconp ) ; |
90 | loadTemplate->setFixedSize( size, size ); | 89 | loadTemplate->setFixedSize( size, size ); |
91 | saveTemplate->setFixedSize( size, size ); | 90 | saveTemplate->setFixedSize( size, size ); |
92 | toggleJournal->setFixedSize( size , size ); | 91 | toggleJournal->setFixedSize( size , size ); |
93 | mEditor = new KTextEdit(this); | 92 | mEditor = new KTextEdit(this); |
94 | connect(mEditor,SIGNAL(textChanged()),SLOT(setDirty())); | ||
95 | #ifndef DESKTOP_VERSION | 93 | #ifndef DESKTOP_VERSION |
96 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); | 94 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); |
97 | #endif | 95 | #endif |
@@ -101,7 +99,6 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | |||
101 | topLayout->addWidget(mEditor); | 99 | topLayout->addWidget(mEditor); |
102 | mEditor->installEventFilter(this); | 100 | mEditor->installEventFilter(this); |
103 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); | 101 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); |
104 | connect( mTitle, SIGNAL( textChanged ( const QString & ) ), this , SLOT( setDirty() ) ); | ||
105 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); | 102 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); |
106 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); | 103 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); |
107 | } | 104 | } |
@@ -161,7 +158,6 @@ void JournalEntry::slotLoadTemplate() | |||
161 | mEditor->getCursorPosition (& line, & col ); | 158 | mEditor->getCursorPosition (& line, & col ); |
162 | mEditor-> insertAt ( text, line, col, true ); | 159 | mEditor-> insertAt ( text, line, col, true ); |
163 | //mEditor->setIgnoreMark( true ); | 160 | //mEditor->setIgnoreMark( true ); |
164 | setDirty(); | ||
165 | } | 161 | } |
166 | void JournalEntry::setDate(const QDate &date) | 162 | void JournalEntry::setDate(const QDate &date) |
167 | { | 163 | { |
@@ -203,7 +199,6 @@ void JournalEntry::setJournal(Journal *journal) | |||
203 | QString calname = KOPrefs::instance()->getCalendar( id )->mName; | 199 | QString calname = KOPrefs::instance()->getCalendar( id )->mName; |
204 | mTitleLabel->setText( " (" + calname +")"); | 200 | mTitleLabel->setText( " (" + calname +")"); |
205 | 201 | ||
206 | mDirty = false; | ||
207 | } | 202 | } |
208 | 203 | ||
209 | Journal *JournalEntry::journal() const | 204 | Journal *JournalEntry::journal() const |
@@ -211,12 +206,6 @@ Journal *JournalEntry::journal() const | |||
211 | return mJournal; | 206 | return mJournal; |
212 | } | 207 | } |
213 | 208 | ||
214 | void JournalEntry::setDirty() | ||
215 | { | ||
216 | mDirty = true; | ||
217 | |||
218 | // kdDebug() << "JournalEntry::setDirty()" << endl; | ||
219 | } | ||
220 | 209 | ||
221 | void JournalEntry::clear() | 210 | void JournalEntry::clear() |
222 | { | 211 | { |
@@ -244,12 +233,9 @@ bool JournalEntry::eventFilter( QObject *o, QEvent *e ) | |||
244 | 233 | ||
245 | void JournalEntry::writeJournal() | 234 | void JournalEntry::writeJournal() |
246 | { | 235 | { |
247 | // kdDebug() << "JournalEntry::writeJournal()" << endl; | ||
248 | if (!mDirty) return; | ||
249 | 236 | ||
250 | if (mEditor->text().isEmpty()) { | 237 | if (mEditor->text().isEmpty() && mTitle->text().isEmpty()) { |
251 | if ( mJournal ) { | 238 | if ( mJournal ) { |
252 | mDirty = false; | ||
253 | bool conf = KOPrefs::instance()->mConfirm; | 239 | bool conf = KOPrefs::instance()->mConfirm; |
254 | KOPrefs::instance()->mConfirm = false; | 240 | KOPrefs::instance()->mConfirm = false; |
255 | emit deleteJournal(mJournal); | 241 | emit deleteJournal(mJournal); |
@@ -269,14 +255,11 @@ void JournalEntry::writeJournal() | |||
269 | 255 | ||
270 | mJournal->setDescription(mEditor->text()); | 256 | mJournal->setDescription(mEditor->text()); |
271 | mJournal->setSummary(mTitle->text()); | 257 | mJournal->setSummary(mTitle->text()); |
272 | mDirty = false; | ||
273 | } | 258 | } |
274 | 259 | ||
275 | void JournalEntry::flushEntry() | 260 | void JournalEntry::flushEntry() |
276 | { | 261 | { |
277 | if (!mDirty) return; | 262 | writeJournal(); |
278 | |||
279 | writeJournal(); | ||
280 | } | 263 | } |
281 | void JournalEntry::keyPressEvent ( QKeyEvent * e ) | 264 | void JournalEntry::keyPressEvent ( QKeyEvent * e ) |
282 | { | 265 | { |
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h index b37cabd..f2db785 100644 --- a/korganizer/journalentry.h +++ b/korganizer/journalentry.h | |||
@@ -55,7 +55,6 @@ class JournalEntry : public QFrame { | |||
55 | protected slots: | 55 | protected slots: |
56 | void slotSaveTemplate(); | 56 | void slotSaveTemplate(); |
57 | void slotLoadTemplate(); | 57 | void slotLoadTemplate(); |
58 | void setDirty(); | ||
59 | void toggleShowJournal(); | 58 | void toggleShowJournal(); |
60 | signals: | 59 | signals: |
61 | void deleteJournal(Journal *); | 60 | void deleteJournal(Journal *); |
@@ -77,8 +76,6 @@ class JournalEntry : public QFrame { | |||
77 | KLineEdit * mTitle; | 76 | KLineEdit * mTitle; |
78 | KTextEdit *mEditor; | 77 | KTextEdit *mEditor; |
79 | int heiHint; | 78 | int heiHint; |
80 | |||
81 | bool mDirty; | ||
82 | }; | 79 | }; |
83 | 80 | ||
84 | #endif | 81 | #endif |
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp index ff87ef4..cb9a2c0 100644 --- a/korganizer/kojournalview.cpp +++ b/korganizer/kojournalview.cpp | |||
@@ -59,12 +59,12 @@ KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, | |||
59 | mTopLayout = new QVBoxLayout(parWid); | 59 | mTopLayout = new QVBoxLayout(parWid); |
60 | QHBox * vb = new QHBox ( parWid ); | 60 | QHBox * vb = new QHBox ( parWid ); |
61 | QPushButton * newJournal = new QPushButton( vb ); | 61 | QPushButton * newJournal = new QPushButton( vb ); |
62 | QIconSet icon; | 62 | QPixmap icon; |
63 | if ( QApplication::desktop()->width() < 321 ) | 63 | if ( QApplication::desktop()->width() < 321 ) |
64 | icon = SmallIcon("ko16old"); | 64 | icon = SmallIcon("ko16old"); |
65 | else | 65 | else |
66 | icon = SmallIcon("ko24old"); | 66 | icon = SmallIcon("ko24old"); |
67 | newJournal->setIconSet (icon ) ; | 67 | newJournal->setPixmap (icon ) ; |
68 | int size = newJournal->sizeHint().height(); | 68 | int size = newJournal->sizeHint().height(); |
69 | newJournal->setFixedSize( size, size ); | 69 | newJournal->setFixedSize( size, size ); |
70 | mDateLabel = new QLabel ( vb ); | 70 | mDateLabel = new QLabel ( vb ); |
@@ -138,6 +138,7 @@ void KOJournalView::clearList() | |||
138 | } | 138 | } |
139 | void KOJournalView::newJournal() | 139 | void KOJournalView::newJournal() |
140 | { | 140 | { |
141 | flushView(); | ||
141 | Journal* mJournal = new Journal; | 142 | Journal* mJournal = new Journal; |
142 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); | 143 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); |
143 | mCalendar->addJournal(mJournal); | 144 | mCalendar->addJournal(mJournal); |
@@ -146,6 +147,7 @@ void KOJournalView::newJournal() | |||
146 | 147 | ||
147 | void KOJournalView::showOnly ( Journal* j ) | 148 | void KOJournalView::showOnly ( Journal* j ) |
148 | { | 149 | { |
150 | flushView(); | ||
149 | if ( j == 0 ) { | 151 | if ( j == 0 ) { |
150 | showDates( mDate, QDate() ); | 152 | showDates( mDate, QDate() ); |
151 | return; | 153 | return; |