Diffstat (limited to 'korganizer/koeventviewerdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeventviewerdialog.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp index 23e62d3..8bada3b 100644 --- a/korganizer/koeventviewerdialog.cpp +++ b/korganizer/koeventviewerdialog.cpp | |||
@@ -7,52 +7,53 @@ | |||
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
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 | 19 | ||
20 | #include <klocale.h> | 20 | #include <klocale.h> |
21 | 21 | ||
22 | #include <libkcal/event.h> | 22 | #include <libkcal/event.h> |
23 | #include <qtimer.h> | ||
23 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
24 | 25 | ||
25 | #include "koeventviewer.h" | 26 | #include "koeventviewer.h" |
26 | #include "koprefs.h" | 27 | #include "koprefs.h" |
27 | #include <libkcal/todo.h> | 28 | #include <libkcal/todo.h> |
28 | #include "qapp.h" | 29 | #include "qapp.h" |
29 | 30 | ||
30 | #include "koeventviewerdialog.h" | 31 | #include "koeventviewerdialog.h" |
31 | extern int globalFlagBlockAgenda; | 32 | extern int globalFlagBlockAgenda; |
32 | 33 | ||
33 | KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) | 34 | KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) |
34 | : KDialogBase(parent,name, | 35 | : KDialogBase(parent,name, |
35 | #ifndef DESKTOP_VERSION | 36 | #ifndef DESKTOP_VERSION |
36 | true , | 37 | true , |
37 | #else | 38 | #else |
38 | false, | 39 | false, |
39 | #endif | 40 | #endif |
40 | i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) | 41 | i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) |
41 | { | 42 | { |
42 | 43 | sendSignalViewerClosed = true; | |
43 | mEventViewer = new KOEventViewer(this); | 44 | mEventViewer = new KOEventViewer(this); |
44 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); | 45 | mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); |
45 | setMainWidget(mEventViewer); | 46 | setMainWidget(mEventViewer); |
46 | setButtonText(Ok, i18n("Edit") ); | 47 | setButtonText(Ok, i18n("Edit") ); |
47 | 48 | ||
48 | QObject::connect(findButton( Ok ),SIGNAL(clicked()), | 49 | QObject::connect(findButton( Ok ),SIGNAL(clicked()), |
49 | SLOT(editIncidence())); | 50 | SLOT(editIncidence())); |
50 | QObject::connect(this,SIGNAL(user1Clicked()), | 51 | QObject::connect(this,SIGNAL(user1Clicked()), |
51 | SLOT(showIncidence())); | 52 | SLOT(showIncidence())); |
52 | mIncidence = 0; | 53 | mIncidence = 0; |
53 | // TODO: Set a sensible size (based on the content?). | 54 | // TODO: Set a sensible size (based on the content?). |
54 | //showMaximized(); | 55 | //showMaximized(); |
55 | //qDebug("++++++++++++KOEventViewerDialog() "); | 56 | //qDebug("++++++++++++KOEventViewerDialog() "); |
56 | // if ( KOPrefs::instance()->mCompactDialogs ) { | 57 | // if ( KOPrefs::instance()->mCompactDialogs ) { |
57 | // setFixedSize( 240,284 ); | 58 | // setFixedSize( 240,284 ); |
58 | // move( 0, 15 ); | 59 | // move( 0, 15 ); |
@@ -176,47 +177,48 @@ void KOEventViewerDialog::setJournal(Journal *j) | |||
176 | mIncidence = (Incidence*)j; | 177 | mIncidence = (Incidence*)j; |
177 | mEventViewer->setFocus(); | 178 | mEventViewer->setFocus(); |
178 | //findButton( Close )->setFocus(); | 179 | //findButton( Close )->setFocus(); |
179 | if ( !mSyncMode ) { | 180 | if ( !mSyncMode ) { |
180 | findButton( User1 )->setText( i18n("Agenda")); | 181 | findButton( User1 )->setText( i18n("Agenda")); |
181 | } | 182 | } |
182 | } | 183 | } |
183 | 184 | ||
184 | void KOEventViewerDialog::addText(QString text) | 185 | void KOEventViewerDialog::addText(QString text) |
185 | { | 186 | { |
186 | mEventViewer->addText(text); | 187 | mEventViewer->addText(text); |
187 | mEventViewer->setFocus(); | 188 | mEventViewer->setFocus(); |
188 | //findButton( Close )->setFocus(); | 189 | //findButton( Close )->setFocus(); |
189 | } | 190 | } |
190 | void KOEventViewerDialog::editIncidence() | 191 | void KOEventViewerDialog::editIncidence() |
191 | { | 192 | { |
193 | sendSignalViewerClosed = false; | ||
192 | if ( mSyncMode ) { | 194 | if ( mSyncMode ) { |
193 | mSyncResult = 2; | 195 | mSyncResult = 2; |
194 | accept(); | 196 | accept(); |
195 | return; | 197 | return; |
196 | } | 198 | } |
197 | if ( mIncidence ){ | 199 | if ( mIncidence ){ |
198 | #ifndef DESKTOP_VERSION | 200 | #ifndef DESKTOP_VERSION |
199 | hide(); | 201 | hide(); |
200 | #endif | 202 | #endif |
201 | emit editIncidence( mIncidence ); | 203 | emit editIncidence( mIncidence ); |
202 | } | 204 | } |
203 | } | 205 | } |
204 | void KOEventViewerDialog::showIncidence() | 206 | void KOEventViewerDialog::showIncidence() |
205 | { | 207 | { |
206 | 208 | sendSignalViewerClosed = false; | |
207 | if ( mSyncMode ) { | 209 | if ( mSyncMode ) { |
208 | mSyncResult = 1; | 210 | mSyncResult = 1; |
209 | accept(); | 211 | accept(); |
210 | return; | 212 | return; |
211 | } | 213 | } |
212 | 214 | ||
213 | if ( mIncidence ){ | 215 | if ( mIncidence ){ |
214 | #ifndef DESKTOP_VERSION | 216 | #ifndef DESKTOP_VERSION |
215 | hide(); | 217 | hide(); |
216 | #endif | 218 | #endif |
217 | QDate date; | 219 | QDate date; |
218 | if ( mIncidence->type() == "Todo" ) { | 220 | if ( mIncidence->type() == "Todo" ) { |
219 | /* | 221 | /* |
220 | if ( ((Todo*)mIncidence)->hasDueDate() ) | 222 | if ( ((Todo*)mIncidence)->hasDueDate() ) |
221 | date = ((Todo*)mIncidence)->dtDue().date(); | 223 | date = ((Todo*)mIncidence)->dtDue().date(); |
222 | else { | 224 | else { |
@@ -251,16 +253,31 @@ void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) | |||
251 | case Qt::Key_R : | 253 | case Qt::Key_R : |
252 | editIncidence(); | 254 | editIncidence(); |
253 | break; | 255 | break; |
254 | case Qt::Key_C: | 256 | case Qt::Key_C: |
255 | case Qt::Key_Escape: | 257 | case Qt::Key_Escape: |
256 | close(); | 258 | close(); |
257 | break; | 259 | break; |
258 | case Qt::Key_I: | 260 | case Qt::Key_I: |
259 | accept(); | 261 | accept(); |
260 | break; | 262 | break; |
261 | default: | 263 | default: |
262 | KDialogBase::keyPressEvent ( e ); | 264 | KDialogBase::keyPressEvent ( e ); |
263 | break; | 265 | break; |
264 | } | 266 | } |
265 | 267 | ||
266 | } | 268 | } |
269 | void KOEventViewerDialog::hideEvent ( QHideEvent * e ) | ||
270 | { | ||
271 | KDialogBase::hideEvent ( e ); | ||
272 | QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) ); | ||
273 | } | ||
274 | |||
275 | void KOEventViewerDialog::slotViewerClosed() | ||
276 | { | ||
277 | if ( sendSignalViewerClosed ) { | ||
278 | //qDebug("KOEventViewerDialog::hideEvent "); | ||
279 | emit signalViewerClosed(); | ||
280 | } | ||
281 | sendSignalViewerClosed = true; | ||
282 | } | ||
283 | |||