author | zautrix <zautrix> | 2005-07-05 11:01:38 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-05 11:01:38 (UTC) |
commit | 68016257abe13019610cb7bb230f8d754179abfb (patch) (unidiff) | |
tree | eb89374fe7aa4ef591388a49ce6ba7eddd43a10f | |
parent | ea75d46072630883fae6ededd4af1d3c427ff59f (diff) | |
download | kdepimpi-68016257abe13019610cb7bb230f8d754179abfb.zip kdepimpi-68016257abe13019610cb7bb230f8d754179abfb.tar.gz kdepimpi-68016257abe13019610cb7bb230f8d754179abfb.tar.bz2 |
nf
-rw-r--r-- | korganizer/journalentry.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index 902e96f..b8a4cf2 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp | |||
@@ -13,300 +13,295 @@ | |||
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | // | 24 | // |
25 | // Journal Entry | 25 | // Journal Entry |
26 | 26 | ||
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qvbox.h> | 29 | #include <qvbox.h> |
30 | #include <qfile.h> | 30 | #include <qfile.h> |
31 | #include <qdir.h> | 31 | #include <qdir.h> |
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qtextcodec.h> | 33 | #include <qtextcodec.h> |
34 | #include <qpixmap.h> | 34 | #include <qpixmap.h> |
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qapplication.h> | 36 | #include <qapplication.h> |
37 | 37 | ||
38 | #include <kdebug.h> | 38 | #include <kdebug.h> |
39 | #include <kglobal.h> | 39 | #include <kglobal.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <ktextedit.h> | 41 | #include <ktextedit.h> |
42 | #include <kfiledialog.h> | 42 | #include <kfiledialog.h> |
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> | 46 | #include <kdialog.h> |
47 | #include "kolocationbox.h" | 47 | #include "kolocationbox.h" |
48 | 48 | ||
49 | #include <libkcal/journal.h> | 49 | #include <libkcal/journal.h> |
50 | #include <libkcal/calendarresources.h> | 50 | #include <libkcal/calendarresources.h> |
51 | #include <libkcal/resourcecalendar.h> | 51 | #include <libkcal/resourcecalendar.h> |
52 | #include <kresources/resourceselectdialog.h> | 52 | #include <kresources/resourceselectdialog.h> |
53 | 53 | ||
54 | #include "journalentry.h" | 54 | #include "journalentry.h" |
55 | //#include "journalentry.moc" | 55 | //#include "journalentry.moc" |
56 | #ifndef DESKTOP_VERSION | 56 | #ifndef DESKTOP_VERSION |
57 | #include <qpe/qpeapplication.h> | 57 | #include <qpe/qpeapplication.h> |
58 | #endif | 58 | #endif |
59 | JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | 59 | JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : |
60 | QFrame(parent) | 60 | QFrame(parent) |
61 | { | 61 | { |
62 | 62 | ||
63 | int fac = 5; | 63 | int fac = 5; |
64 | heiHint = QApplication::desktop()->height(); | 64 | heiHint = QApplication::desktop()->height(); |
65 | if ( heiHint > 800 ) | 65 | if ( heiHint > 800 ) |
66 | fac += 2; | 66 | fac += 2; |
67 | heiHint = heiHint / fac; | 67 | heiHint = heiHint / fac; |
68 | 68 | ||
69 | showOnlyMode = false; | 69 | showOnlyMode = false; |
70 | mCalendar = calendar; | 70 | mCalendar = calendar; |
71 | mJournal = 0; | 71 | mJournal = 0; |
72 | visibleMode = true; | 72 | visibleMode = true; |
73 | QHBox * vb = new QHBox ( this ); | 73 | QHBox * vb = new QHBox ( this ); |
74 | QPixmap iconp; | 74 | QPixmap iconp; |
75 | vb->setMargin ( KDialog::marginHint()-1 ); | 75 | vb->setMargin ( KDialog::marginHint()-1 ); |
76 | QPushButton * toggleJournal = new QPushButton( vb ); | 76 | QPushButton * toggleJournal = new QPushButton( vb ); |
77 | iconp = SmallIcon("1updownarrow"); | 77 | iconp = SmallIcon("1updownarrow"); |
78 | toggleJournal->setPixmap (iconp ) ; | 78 | toggleJournal->setPixmap (iconp ) ; |
79 | vb->setStretchFactor (new QLabel(" "+i18n("Title: "),vb),1); | 79 | vb->setStretchFactor (new QLabel(" "+i18n("Title: "),vb),1); |
80 | vb->setStretchFactor( toggleJournal, 1 ); | 80 | vb->setStretchFactor( toggleJournal, 1 ); |
81 | mTitle = new KOLocationBox(TRUE, vb, 30); | 81 | mTitle = new KOLocationBox(TRUE, vb, 30); |
82 | mTitle->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); | 82 | mTitle->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); |
83 | mCalendarBox = new QComboBox(vb); | 83 | mCalendarBox = new QComboBox(vb); |
84 | mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); | 84 | mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); |
85 | #ifndef DESKTOP_VERSION | 85 | #ifndef DESKTOP_VERSION |
86 | mTitle->setSizeLimit( 8 ); | 86 | mTitle->setSizeLimit( 8 ); |
87 | mCalendarBox->setSizeLimit( 8 ); | 87 | mCalendarBox->setSizeLimit( 8 ); |
88 | #endif | 88 | #endif |
89 | vb->setStretchFactor ( mTitle, 8 ); | 89 | vb->setStretchFactor ( mTitle, 8 ); |
90 | vb->setStretchFactor ( mCalendarBox, 3 ); | 90 | vb->setStretchFactor ( mCalendarBox, 3 ); |
91 | //mTitleLabel->setMargin(0); | 91 | //mTitleLabel->setMargin(0); |
92 | //mTitleLabel->setAlignment(AlignCenter); | 92 | //mTitleLabel->setAlignment(AlignCenter); |
93 | QPushButton * loadTemplate = new QPushButton( vb ); | 93 | QPushButton * loadTemplate = new QPushButton( vb ); |
94 | QPushButton * saveTemplate = new QPushButton( vb ); | 94 | QPushButton * saveTemplate = new QPushButton( vb ); |
95 | if ( QApplication::desktop()->width() < 321 ) | 95 | if ( QApplication::desktop()->width() < 321 ) |
96 | iconp = SmallIcon("fileexport16"); | 96 | iconp = SmallIcon("fileexport16"); |
97 | else | 97 | else |
98 | iconp = SmallIcon("fileexport"); | 98 | iconp = SmallIcon("fileexport"); |
99 | saveTemplate->setPixmap (iconp ) ; | 99 | saveTemplate->setPixmap (iconp ) ; |
100 | int size = saveTemplate->sizeHint().height(); | 100 | int size = saveTemplate->sizeHint().height(); |
101 | if ( QApplication::desktop()->width() < 321 ) | 101 | if ( QApplication::desktop()->width() < 321 ) |
102 | iconp = SmallIcon("fileimport16"); | 102 | iconp = SmallIcon("fileimport16"); |
103 | else | 103 | else |
104 | iconp = SmallIcon("fileimport"); | 104 | iconp = SmallIcon("fileimport"); |
105 | loadTemplate->setPixmap (iconp ) ; | 105 | loadTemplate->setPixmap (iconp ) ; |
106 | loadTemplate->setFixedSize( size, size ); | 106 | loadTemplate->setFixedSize( size, size ); |
107 | saveTemplate->setFixedSize( size, size ); | 107 | saveTemplate->setFixedSize( size, size ); |
108 | toggleJournal->setFixedSize( size , size ); | 108 | toggleJournal->setFixedSize( size , size ); |
109 | mTitle->setMaximumHeight( size+4); | 109 | mTitle->setFixedHeight( size+4); |
110 | mCalendarBox->setMaximumHeight( size+4); | 110 | mCalendarBox->setFixedHeight( size+4); |
111 | mEditor = new KTextEdit(this); | 111 | mEditor = new KTextEdit(this); |
112 | #ifndef DESKTOP_VERSION | 112 | #ifndef DESKTOP_VERSION |
113 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); | 113 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); |
114 | #endif | 114 | #endif |
115 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); | 115 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); |
116 | QBoxLayout *topLayout = new QVBoxLayout(this); | 116 | QBoxLayout *topLayout = new QVBoxLayout(this); |
117 | topLayout->addWidget(vb); | 117 | topLayout->addWidget(vb); |
118 | topLayout->addWidget(mEditor); | 118 | topLayout->addWidget(mEditor); |
119 | mEditor->installEventFilter(this); | 119 | mEditor->installEventFilter(this); |
120 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); | 120 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); |
121 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); | 121 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); |
122 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); | 122 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); |
123 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); | 123 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); |
124 | mTitle->lineEdit ()->setText(""); | 124 | mTitle->lineEdit ()->setText(""); |
125 | } | 125 | } |
126 | 126 | ||
127 | JournalEntry::~JournalEntry() | 127 | JournalEntry::~JournalEntry() |
128 | { | 128 | { |
129 | //qDebug("JournalEntry::~JournalEntry() "); | 129 | //qDebug("JournalEntry::~JournalEntry() "); |
130 | } | 130 | } |
131 | QSize JournalEntry::sizeHint() const | 131 | QSize JournalEntry::sizeHint() const |
132 | { | 132 | { |
133 | return QSize ( 240, heiHint ); | 133 | return QSize ( 240, heiHint ); |
134 | } | 134 | } |
135 | void JournalEntry::slotSaveTemplate() | 135 | void JournalEntry::slotSaveTemplate() |
136 | { | 136 | { |
137 | QString fileName =locateLocal( "templates", "journals" ); | 137 | QString fileName =locateLocal( "templates", "journals" ); |
138 | QDir t_dir; | 138 | QDir t_dir; |
139 | if ( !t_dir.exists(fileName) ) | 139 | if ( !t_dir.exists(fileName) ) |
140 | t_dir.mkdir ( fileName ); | 140 | t_dir.mkdir ( fileName ); |
141 | fileName += "/journal"; | 141 | fileName += "/journal"; |
142 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); | 142 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); |
143 | if ( fileName.length() == 0 ) | 143 | if ( fileName.length() == 0 ) |
144 | return; | 144 | return; |
145 | 145 | ||
146 | QFile fileIn( fileName ); | 146 | QFile fileIn( fileName ); |
147 | if (!fileIn.open( IO_WriteOnly ) ) { | 147 | if (!fileIn.open( IO_WriteOnly ) ) { |
148 | KMessageBox::error( this, i18n("Error saving template file\n '%1'.") | 148 | KMessageBox::error( this, i18n("Error saving template file\n '%1'.") |
149 | .arg( fileName ) ); | 149 | .arg( fileName ) ); |
150 | return; | 150 | return; |
151 | } | 151 | } |
152 | // QString text; | 152 | // QString text; |
153 | QTextStream tsIn( &fileIn ); | 153 | QTextStream tsIn( &fileIn ); |
154 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 154 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
155 | tsIn << mEditor->text(); | 155 | tsIn << mEditor->text(); |
156 | fileIn.close(); | 156 | fileIn.close(); |
157 | } | 157 | } |
158 | void JournalEntry::slotLoadTemplate() | 158 | void JournalEntry::slotLoadTemplate() |
159 | { | 159 | { |
160 | QString fileName =locateLocal( "templates", "journals" ); | 160 | QString fileName =locateLocal( "templates", "journals" ); |
161 | QDir t_dir; | 161 | QDir t_dir; |
162 | if ( !t_dir.exists(fileName) ) | 162 | if ( !t_dir.exists(fileName) ) |
163 | t_dir.mkdir ( fileName ); | 163 | t_dir.mkdir ( fileName ); |
164 | fileName += "/journal"; | 164 | fileName += "/journal"; |
165 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); | 165 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); |
166 | if ( fileName.length() == 0 ) | 166 | if ( fileName.length() == 0 ) |
167 | return; | 167 | return; |
168 | QFile fileIn( fileName ); | 168 | QFile fileIn( fileName ); |
169 | if (!fileIn.open( IO_ReadOnly ) ) { | 169 | if (!fileIn.open( IO_ReadOnly ) ) { |
170 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") | 170 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") |
171 | .arg( fileName ) ); | 171 | .arg( fileName ) ); |
172 | return; | 172 | return; |
173 | } | 173 | } |
174 | QTextStream tsIn( &fileIn ); | 174 | QTextStream tsIn( &fileIn ); |
175 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 175 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
176 | QString text = tsIn.read(); | 176 | QString text = tsIn.read(); |
177 | fileIn.close(); | 177 | fileIn.close(); |
178 | int line, col; | 178 | int line, col; |
179 | mEditor->getCursorPosition (& line, & col ); | 179 | mEditor->getCursorPosition (& line, & col ); |
180 | mEditor-> insertAt ( text, line, col, true ); | 180 | mEditor-> insertAt ( text, line, col, true ); |
181 | //mEditor->setIgnoreMark( true ); | 181 | //mEditor->setIgnoreMark( true ); |
182 | } | 182 | } |
183 | void JournalEntry::setDate(const QDate &date) | 183 | void JournalEntry::setDate(const QDate &date) |
184 | { | 184 | { |
185 | showOnlyMode = false; | 185 | showOnlyMode = false; |
186 | writeJournal(); | 186 | writeJournal(); |
187 | mDate = date; | 187 | mDate = date; |
188 | fillCalendar( mCalendar->defaultCalendar() ); | 188 | fillCalendar( mCalendar->defaultCalendar() ); |
189 | } | 189 | } |
190 | void JournalEntry::fillCalendar( int setToID ) | 190 | void JournalEntry::fillCalendar( int setToID ) |
191 | { | 191 | { |
192 | mCalendarBox->clear(); | 192 | mCalendarBox->clear(); |
193 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 193 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
194 | int std = 0; | 194 | int std = 0; |
195 | int count = 0; | 195 | int count = 0; |
196 | while ( kkf ) { | 196 | while ( kkf ) { |
197 | if ( (!kkf->mErrorOnLoad &&! kkf->isReadOnly) || setToID == kkf->mCalNumber ) { | 197 | if ( (!kkf->mErrorOnLoad &&! kkf->isReadOnly) || setToID == kkf->mCalNumber ) { |
198 | if ( setToID ) { | 198 | if ( setToID ) { |
199 | if ( kkf->mCalNumber == setToID ) | 199 | if ( kkf->mCalNumber == setToID ) |
200 | std = count; | 200 | std = count; |
201 | } else { | 201 | } else { |
202 | if ( kkf->isStandard ) { | 202 | if ( kkf->isStandard ) { |
203 | std = count; | 203 | std = count; |
204 | } | 204 | } |
205 | } | 205 | } |
206 | ++count; | 206 | ++count; |
207 | mCalendarBox->insertItem( kkf->mName ); | 207 | mCalendarBox->insertItem( kkf->mName ); |
208 | } | 208 | } |
209 | kkf = KOPrefs::instance()->mCalendars.next(); | 209 | kkf = KOPrefs::instance()->mCalendars.next(); |
210 | } | 210 | } |
211 | mCalendarBox->setCurrentItem( std ); | 211 | mCalendarBox->setCurrentItem( std ); |
212 | if ( KOPrefs::instance()->mCalendars.count() == 1 ) | ||
213 | mCalendarBox->hide(); | ||
214 | else { | ||
215 | mCalendarBox->show(); | ||
216 | } | ||
217 | } | 212 | } |
218 | 213 | ||
219 | void JournalEntry::toggleShowJournal() | 214 | void JournalEntry::toggleShowJournal() |
220 | { | 215 | { |
221 | if (!mEditor->text().isEmpty() || !mTitle->currentText ().isEmpty()) | 216 | if (!mEditor->text().isEmpty() || !mTitle->currentText ().isEmpty()) |
222 | flushEntry(); | 217 | flushEntry(); |
223 | if ( showOnlyMode ) | 218 | if ( showOnlyMode ) |
224 | emit showJournalOnly( 0 ); | 219 | emit showJournalOnly( 0 ); |
225 | else { | 220 | else { |
226 | // we have to protect mJournal from deleting if mJournal has empty text | 221 | // we have to protect mJournal from deleting if mJournal has empty text |
227 | visibleMode = false; // set to true via :setShowOnly() | 222 | visibleMode = false; // set to true via :setShowOnly() |
228 | emit showJournalOnly( mJournal ); | 223 | emit showJournalOnly( mJournal ); |
229 | //QTimer::singleShot( 0, this, SLOT( setVisibleOn() ) ); | 224 | //QTimer::singleShot( 0, this, SLOT( setVisibleOn() ) ); |
230 | } | 225 | } |
231 | } | 226 | } |
232 | void JournalEntry::setVisibleOn() | 227 | void JournalEntry::setVisibleOn() |
233 | { | 228 | { |
234 | visibleMode = true; | 229 | visibleMode = true; |
235 | } | 230 | } |
236 | void JournalEntry::setShowOnly() | 231 | void JournalEntry::setShowOnly() |
237 | { | 232 | { |
238 | showOnlyMode = true; | 233 | showOnlyMode = true; |
239 | if ( mTitle->currentText().isEmpty() ) | 234 | if ( mTitle->currentText().isEmpty() ) |
240 | mTitle->setFocus(); | 235 | mTitle->setFocus(); |
241 | else | 236 | else |
242 | mEditor->setFocus(); | 237 | mEditor->setFocus(); |
243 | } | 238 | } |
244 | void JournalEntry::setJournal(Journal *journal, bool saveJournal ) | 239 | void JournalEntry::setJournal(Journal *journal, bool saveJournal ) |
245 | { | 240 | { |
246 | if ( saveJournal ) | 241 | if ( saveJournal ) |
247 | writeJournal(); | 242 | writeJournal(); |
248 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); | 243 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); |
249 | 244 | ||
250 | mJournal = journal; | 245 | mJournal = journal; |
251 | if ( journal->isReadOnly() ) | 246 | if ( journal->isReadOnly() ) |
252 | mTitle->lineEdit ()->setText(mJournal->summary()+" ("+i18n("readonly")+")"); | 247 | mTitle->lineEdit ()->setText(mJournal->summary()+" ("+i18n("readonly")+")"); |
253 | else | 248 | else |
254 | mTitle->lineEdit ()->setText(mJournal->summary()); | 249 | mTitle->lineEdit ()->setText(mJournal->summary()); |
255 | mEditor->setText(mJournal->description()); | 250 | mEditor->setText(mJournal->description()); |
256 | mTitle->setEnabled (!journal->isReadOnly() ); | 251 | mTitle->setEnabled (!journal->isReadOnly() ); |
257 | mEditor->setReadOnly ( journal->isReadOnly() ); | 252 | mEditor->setReadOnly ( journal->isReadOnly() ); |
258 | mCalendarBox->setEnabled (!journal->isReadOnly() ); | 253 | mCalendarBox->setEnabled (!journal->isReadOnly() ); |
259 | fillCalendar( mJournal->calID() ); | 254 | fillCalendar( mJournal->calID() ); |
260 | } | 255 | } |
261 | 256 | ||
262 | Journal *JournalEntry::journal() const | 257 | Journal *JournalEntry::journal() const |
263 | { | 258 | { |
264 | return mJournal; | 259 | return mJournal; |
265 | } | 260 | } |
266 | 261 | ||
267 | 262 | ||
268 | void JournalEntry::clear() | 263 | void JournalEntry::clear() |
269 | { | 264 | { |
270 | mJournal = 0; | 265 | mJournal = 0; |
271 | mEditor->setText(""); | 266 | mEditor->setText(""); |
272 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); | 267 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); |
273 | mTitle->lineEdit ()->setText(""); | 268 | mTitle->lineEdit ()->setText(""); |
274 | } | 269 | } |
275 | 270 | ||
276 | bool JournalEntry::eventFilter( QObject *o, QEvent *e ) | 271 | bool JournalEntry::eventFilter( QObject *o, QEvent *e ) |
277 | { | 272 | { |
278 | // kdDebug() << "JournalEntry::event received " << e->type() << endl; | 273 | // kdDebug() << "JournalEntry::event received " << e->type() << endl; |
279 | 274 | ||
280 | if ( e->type() == QEvent::FocusOut ) { | 275 | if ( e->type() == QEvent::FocusOut ) { |
281 | writeJournal(); | 276 | writeJournal(); |
282 | } | 277 | } |
283 | if ( e->type() == QEvent::KeyPress ) { | 278 | if ( e->type() == QEvent::KeyPress ) { |
284 | QKeyEvent * k = (QKeyEvent *) e; | 279 | QKeyEvent * k = (QKeyEvent *) e; |
285 | if ( k->state() == Qt::ControlButton ) { | 280 | if ( k->state() == Qt::ControlButton ) { |
286 | k->ignore(); | 281 | k->ignore(); |
287 | //return true; | 282 | //return true; |
288 | } | 283 | } |
289 | } | 284 | } |
290 | 285 | ||
291 | return QFrame::eventFilter( o, e ); // standard event processing | 286 | return QFrame::eventFilter( o, e ); // standard event processing |
292 | } | 287 | } |
293 | 288 | ||
294 | void JournalEntry::writeJournal() | 289 | void JournalEntry::writeJournal() |
295 | { | 290 | { |
296 | if ( !visibleMode ) return; | 291 | if ( !visibleMode ) return; |
297 | if ( !mTitle->isEnabled() ) return; | 292 | if ( !mTitle->isEnabled() ) return; |
298 | if (mEditor->text().isEmpty() && mTitle->currentText().isEmpty()) { | 293 | if (mEditor->text().isEmpty() && mTitle->currentText().isEmpty()) { |
299 | if ( mJournal ) { | 294 | if ( mJournal ) { |
300 | Journal* j = mJournal; | 295 | Journal* j = mJournal; |
301 | mJournal = 0; | 296 | mJournal = 0; |
302 | bool conf = KOPrefs::instance()->mConfirm; | 297 | bool conf = KOPrefs::instance()->mConfirm; |
303 | KOPrefs::instance()->mConfirm = false; | 298 | KOPrefs::instance()->mConfirm = false; |
304 | emit deleteJournal(j); | 299 | emit deleteJournal(j); |
305 | KOPrefs::instance()->mConfirm = conf; | 300 | KOPrefs::instance()->mConfirm = conf; |
306 | } | 301 | } |
307 | return; | 302 | return; |
308 | } | 303 | } |
309 | 304 | ||
310 | // kdDebug() << "JournalEntry::writeJournal()..." << endl; | 305 | // kdDebug() << "JournalEntry::writeJournal()..." << endl; |
311 | 306 | ||
312 | if (!mJournal) { | 307 | if (!mJournal) { |