summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp12
-rw-r--r--korganizer/koeventviewer.h1
-rw-r--r--korganizer/koeventviewerdialog.cpp18
-rw-r--r--korganizer/searchdialog.cpp2
4 files changed, 26 insertions, 7 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 417d89c..44da058 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -600,96 +600,108 @@ void KOEventViewer::formatAttendees(Incidence *event)
600 mText += "<a href=\"mailto:RSVP\">"; 600 mText += "<a href=\"mailto:RSVP\">";
601 mText += i18n( "Mail to selected" ); 601 mText += i18n( "Mail to selected" );
602 mText += "</a> ( "; 602 mText += "</a> ( ";
603 mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); 603 mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath );
604 mText += "<br>\n"; 604 mText += "<br>\n";
605 } 605 }
606 } 606 }
607 607
608} 608}
609void KOEventViewer::appendJournal(Journal *jour, int mode ) 609void KOEventViewer::appendJournal(Journal *jour, int mode )
610{ 610{
611 bool shortDate = KOPrefs::instance()->mShortDateInViewer; 611 bool shortDate = KOPrefs::instance()->mShortDateInViewer;
612 if (mode == 0 ) { 612 if (mode == 0 ) {
613 addTag("h2",i18n("Journal from: ")); 613 addTag("h2",i18n("Journal from: "));
614 } 614 }
615 else { 615 else {
616 if ( mode == 1 ) { 616 if ( mode == 1 ) {
617 addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); 617 addTag("h2",i18n( "Local: " ) +i18n("Journal from: "));
618 } else { 618 } else {
619 addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); 619 addTag("h2",i18n( "Remote: " ) +i18n("Journal from: "));
620 } 620 }
621 } 621 }
622 topLevelWidget()->setCaption("Journal Viewer"); 622 topLevelWidget()->setCaption("Journal Viewer");
623 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); 623 mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer)));
624 addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); 624 addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) );
625 if (!jour->description().isEmpty()) { 625 if (!jour->description().isEmpty()) {
626 addTag("p",jour->description()); 626 addTag("p",jour->description());
627 } 627 }
628 setText(mText); 628 setText(mText);
629} 629}
630 630
631void KOEventViewer::formatReadOnly(Incidence *event) 631void KOEventViewer::formatReadOnly(Incidence *event)
632{ 632{
633 if (event->isReadOnly()) { 633 if (event->isReadOnly()) {
634 addTag("p","<em>(" + i18n("read-only") + ")</em>"); 634 addTag("p","<em>(" + i18n("read-only") + ")</em>");
635 } 635 }
636} 636}
637void KOEventViewer::setSyncMode( bool b ) 637void KOEventViewer::setSyncMode( bool b )
638{ 638{
639 mSyncMode = b; 639 mSyncMode = b;
640} 640}
641 641
642 642
643void KOEventViewer::setTodo(Todo *event, bool clearV ) 643void KOEventViewer::setTodo(Todo *event, bool clearV )
644{ 644{
645 if ( clearV ) 645 if ( clearV )
646 clearEvents(); 646 clearEvents();
647 if ( mSyncMode ) { 647 if ( mSyncMode ) {
648 if ( clearV ) 648 if ( clearV )
649 appendTodo(event,1 ); 649 appendTodo(event,1 );
650 else 650 else
651 appendTodo(event,2); 651 appendTodo(event,2);
652 } else 652 } else
653 appendTodo(event); 653 appendTodo(event);
654} 654}
655void KOEventViewer::setJournal(Journal *event, bool clearV ) 655void KOEventViewer::setJournal(Journal *event, bool clearV )
656{ 656{
657 if ( clearV ) 657 if ( clearV )
658 clearEvents(); 658 clearEvents();
659 if ( mSyncMode ) { 659 if ( mSyncMode ) {
660 if ( clearV ) 660 if ( clearV )
661 appendJournal(event, 1); 661 appendJournal(event, 1);
662 else 662 else
663 appendJournal(event, 2); 663 appendJournal(event, 2);
664 } else 664 } else
665 appendJournal(event); 665 appendJournal(event);
666} 666}
667 667
668void KOEventViewer::setEvent(Event *event) 668void KOEventViewer::setEvent(Event *event)
669{ 669{
670 clearEvents(); 670 clearEvents();
671 if ( mSyncMode ) 671 if ( mSyncMode )
672 appendEvent(event, 1); 672 appendEvent(event, 1);
673 else 673 else
674 appendEvent(event); 674 appendEvent(event);
675} 675}
676 676
677void KOEventViewer::addEvent(Event *event) 677void KOEventViewer::addEvent(Event *event)
678{ 678{
679 if ( mSyncMode ) 679 if ( mSyncMode )
680 appendEvent(event, 2); 680 appendEvent(event, 2);
681 else 681 else
682 appendEvent(event); 682 appendEvent(event);
683} 683}
684 684
685void KOEventViewer::clearEvents(bool now) 685void KOEventViewer::clearEvents(bool now)
686{ 686{
687 mText = ""; 687 mText = "";
688 if (now) setText(mText); 688 if (now) setText(mText);
689} 689}
690 690
691void KOEventViewer::addText(QString text) 691void KOEventViewer::addText(QString text)
692{ 692{
693 mText.append(text); 693 mText.append(text);
694 setText(mText); 694 setText(mText);
695} 695}
696void KOEventViewer::keyPressEvent ( QKeyEvent * e )
697{
698 switch ( e->key() ) {
699 case Qt::Key_Return:
700 case Qt::Key_Enter :
701 e->ignore();
702 break;
703 default:
704 QTextBrowser::keyPressEvent ( e );
705 break;
706 }
707}
diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h
index cf44284..d8142ca 100644
--- a/korganizer/koeventviewer.h
+++ b/korganizer/koeventviewer.h
@@ -1,75 +1,76 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
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#ifndef KOEVENTVIEWER_H 19#ifndef KOEVENTVIEWER_H
20#define KOEVENTVIEWER_H 20#define KOEVENTVIEWER_H
21// 21//
22// Viewer widget for events. 22// Viewer widget for events.
23// 23//
24 24
25#include <qtextbrowser.h> 25#include <qtextbrowser.h>
26 26
27#include <libkcal/event.h> 27#include <libkcal/event.h>
28#include <libkcal/journal.h> 28#include <libkcal/journal.h>
29 29
30 30
31using namespace KCal; 31using namespace KCal;
32 32
33class KOEventViewer : public QTextBrowser { 33class KOEventViewer : public QTextBrowser {
34 Q_OBJECT 34 Q_OBJECT
35 public: 35 public:
36 KOEventViewer(QWidget *parent=0,const char *name=0); 36 KOEventViewer(QWidget *parent=0,const char *name=0);
37 virtual ~KOEventViewer(); 37 virtual ~KOEventViewer();
38 38
39 void setSource(const QString &); 39 void setSource(const QString &);
40 void setEvent(Event *event); 40 void setEvent(Event *event);
41 void addEvent(Event *event); 41 void addEvent(Event *event);
42 void setTodo(Todo *event, bool clearV = true ); 42 void setTodo(Todo *event, bool clearV = true );
43 void setJournal(Journal *jour, bool clearV = true ); 43 void setJournal(Journal *jour, bool clearV = true );
44 44
45 void appendEvent(Event *event, int mode = 0 ); 45 void appendEvent(Event *event, int mode = 0 );
46 void appendTodo(Todo *event, int mode = 0 ); 46 void appendTodo(Todo *event, int mode = 0 );
47 void appendJournal(Journal *jour, int mode = 0 ); 47 void appendJournal(Journal *jour, int mode = 0 );
48 48
49 void clearEvents(bool now=false); 49 void clearEvents(bool now=false);
50 50
51 void addText(QString text); 51 void addText(QString text);
52 void setSyncMode( bool ); 52 void setSyncMode( bool );
53 void setColorMode( int ); 53 void setColorMode( int );
54 void mailToAttendees( bool all ); 54 void mailToAttendees( bool all );
55 55
56 protected: 56 protected:
57 int mColorMode; 57 int mColorMode;
58 void addTag(const QString & tag,const QString & text); 58 void addTag(const QString & tag,const QString & text);
59 59
60 void formatCategories(Incidence *event); 60 void formatCategories(Incidence *event);
61 void formatAttendees(Incidence *event); 61 void formatAttendees(Incidence *event);
62 void formatReadOnly(Incidence *event); 62 void formatReadOnly(Incidence *event);
63 void keyPressEvent ( QKeyEvent * e );
63 64
64 private: 65 private:
65 QTextBrowser *mEventTextView; 66 QTextBrowser *mEventTextView;
66 bool mSyncMode; 67 bool mSyncMode;
67 68
68 QString mText; 69 QString mText;
69 QString mMailSubject; 70 QString mMailSubject;
70 Incidence* mCurrentIncidence; 71 Incidence* mCurrentIncidence;
71 signals: 72 signals:
72 void launchaddressbook(QString uid); 73 void launchaddressbook(QString uid);
73}; 74};
74 75
75#endif 76#endif
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp
index f6f7258..23e62d3 100644
--- a/korganizer/koeventviewerdialog.cpp
+++ b/korganizer/koeventviewerdialog.cpp
@@ -1,260 +1,266 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
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 <qpushbutton.h> 23#include <qpushbutton.h>
24 24
25#include "koeventviewer.h" 25#include "koeventviewer.h"
26#include "koprefs.h" 26#include "koprefs.h"
27#include <libkcal/todo.h> 27#include <libkcal/todo.h>
28#include "qapp.h" 28#include "qapp.h"
29 29
30#include "koeventviewerdialog.h" 30#include "koeventviewerdialog.h"
31extern int globalFlagBlockAgenda; 31extern int globalFlagBlockAgenda;
32 32
33KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) 33KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name)
34 : KDialogBase(parent,name, 34 : KDialogBase(parent,name,
35#ifndef DESKTOP_VERSION 35#ifndef DESKTOP_VERSION
36 true , 36 true ,
37#else 37#else
38 false, 38 false,
39#endif 39#endif
40 i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) 40 i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda"))
41{ 41{
42 42
43 mEventViewer = new KOEventViewer(this); 43 mEventViewer = new KOEventViewer(this);
44 mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); 44 mEventViewer->setFont( KOPrefs::instance()->mEventViewFont );
45 setMainWidget(mEventViewer); 45 setMainWidget(mEventViewer);
46 setButtonText(Ok, i18n("Edit") ); 46 setButtonText(Ok, i18n("Edit") );
47 47
48 QObject::connect(findButton( Ok ),SIGNAL(clicked()), 48 QObject::connect(findButton( Ok ),SIGNAL(clicked()),
49 SLOT(editIncidence())); 49 SLOT(editIncidence()));
50 QObject::connect(this,SIGNAL(user1Clicked()), 50 QObject::connect(this,SIGNAL(user1Clicked()),
51 SLOT(showIncidence())); 51 SLOT(showIncidence()));
52 mIncidence = 0; 52 mIncidence = 0;
53 // TODO: Set a sensible size (based on the content?). 53 // TODO: Set a sensible size (based on the content?).
54 //showMaximized(); 54 //showMaximized();
55 //qDebug("++++++++++++KOEventViewerDialog() "); 55 //qDebug("++++++++++++KOEventViewerDialog() ");
56 // if ( KOPrefs::instance()->mCompactDialogs ) { 56 // if ( KOPrefs::instance()->mCompactDialogs ) {
57// setFixedSize( 240,284 ); 57// setFixedSize( 240,284 );
58// move( 0, 15 ); 58// move( 0, 15 );
59// } else { 59// } else {
60// setMinimumSize(300,200); 60// setMinimumSize(300,200);
61// resize(320,300); 61// resize(320,300);
62// } 62// }
63 mSyncMode = false; 63 mSyncMode = false;
64 mSyncResult = 0; 64 mSyncResult = 0;
65 65
66} 66}
67 67
68KOEventViewerDialog::~KOEventViewerDialog() 68KOEventViewerDialog::~KOEventViewerDialog()
69{ 69{
70 //qDebug("-------~KOEventViewerDialog() "); 70 //qDebug("-------~KOEventViewerDialog() ");
71} 71}
72void KOEventViewerDialog::showMe() 72void KOEventViewerDialog::showMe()
73{ 73{
74 74
75#ifdef DESKTOP_VERSION 75#ifdef DESKTOP_VERSION
76 show(); 76 show();
77#else 77#else
78 showMaximized(); 78 showMaximized();
79#endif 79#endif
80 setFocus();
81 setActiveWindow(); 80 setActiveWindow();
81 mEventViewer->setFocus();
82 82
83} 83}
84void KOEventViewerDialog::setSyncMode( bool b ) 84void KOEventViewerDialog::setSyncMode( bool b )
85{ 85{
86 mSyncMode = b; 86 mSyncMode = b;
87 //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode ); 87 //qDebug("KOEventViewerDialog::setSyncMode %d ",mSyncMode );
88 if ( mSyncMode ) { 88 if ( mSyncMode ) {
89 findButton( Close )->setText( i18n("Cancel Sync")); 89 findButton( Close )->setText( i18n("Cancel Sync"));
90 findButton( Ok )->setText( i18n("Remote")); 90 findButton( Ok )->setText( i18n("Remote"));
91 findButton( User1 )->setText( i18n("Local")); 91 findButton( User1 )->setText( i18n("Local"));
92 } else { 92 } else {
93 findButton( Close )->setText( i18n("Close")); 93 findButton( Close )->setText( i18n("Close"));
94 findButton( Ok )->setText( i18n("Edit")); 94 findButton( Ok )->setText( i18n("Edit"));
95 findButton( User1 )->setText( i18n("Agenda")); 95 findButton( User1 )->setText( i18n("Agenda"));
96 } 96 }
97 mEventViewer->setSyncMode( b ); 97 mEventViewer->setSyncMode( b );
98} 98}
99void KOEventViewerDialog::setColorMode( int m ) 99void KOEventViewerDialog::setColorMode( int m )
100{ 100{
101 mEventViewer->setColorMode( m ); 101 mEventViewer->setColorMode( m );
102} 102}
103int KOEventViewerDialog::executeS( bool local ) 103int KOEventViewerDialog::executeS( bool local )
104{ 104{
105 mSyncResult = 3; 105 mSyncResult = 3;
106 if ( local ) 106 if ( local )
107 findButton( User1 )->setFocus(); 107 findButton( User1 )->setFocus();
108 else 108 else
109 findButton( Ok )->setFocus(); 109 findButton( Ok )->setFocus();
110 exec(); 110 exec();
111 return mSyncResult; 111 return mSyncResult;
112} 112}
113 113
114void KOEventViewerDialog::updateConfig() 114void KOEventViewerDialog::updateConfig()
115{ 115{
116 mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); 116 mEventViewer->setFont( KOPrefs::instance()->mEventViewFont );
117 117
118} 118}
119void KOEventViewerDialog::setEvent(Event *event) 119void KOEventViewerDialog::setEvent(Event *event)
120{ 120{
121 mEventViewer->setEvent(event); 121 mEventViewer->setEvent(event);
122 mIncidence = event; 122 mIncidence = event;
123 findButton( Close )->setFocus(); 123 mEventViewer->setFocus();
124 //findButton( Close )->setFocus();
124 if ( !mSyncMode ) { 125 if ( !mSyncMode ) {
125 findButton( User1 )->setText( i18n("Agenda")); 126 findButton( User1 )->setText( i18n("Agenda"));
126 } 127 }
127} 128}
128void KOEventViewerDialog::setIncidence(Incidence *in ) 129void KOEventViewerDialog::setIncidence(Incidence *in )
129{ 130{
130 if ( in->type() == "Event" ) 131 if ( in->type() == "Event" )
131 setEvent( (Event*) in ); 132 setEvent( (Event*) in );
132 else if ( in->type() =="Todo" ) 133 else if ( in->type() =="Todo" )
133 setTodo( (Todo*) in ); 134 setTodo( (Todo*) in );
134 else if ( in->type() =="Journal" ) 135 else if ( in->type() =="Journal" )
135 setJournal( (Journal*) in ); 136 setJournal( (Journal*) in );
136} 137}
137void KOEventViewerDialog::addIncidence(Incidence *in) 138void KOEventViewerDialog::addIncidence(Incidence *in)
138{ 139{
139 if ( in->type() == "Event" ) 140 if ( in->type() == "Event" )
140 addEvent( (Event*) in ); 141 addEvent( (Event*) in );
141 else if ( in->type() =="Todo" ) 142 else if ( in->type() =="Todo" )
142 mEventViewer->setTodo( (Todo*) in, false ); 143 mEventViewer->setTodo( (Todo*) in, false );
143 else if ( in->type() =="Journal" ) 144 else if ( in->type() =="Journal" )
144 mEventViewer->setJournal( (Journal*) in, false ); 145 mEventViewer->setJournal( (Journal*) in, false );
145 if ( mSyncMode ) { 146 if ( mSyncMode ) {
146 findButton( User1 )->setFocus(); 147 findButton( User1 )->setFocus();
147 setCaption(i18n("Conflict! Please choose entry")); 148 setCaption(i18n("Conflict! Please choose entry"));
148 } 149 }
149} 150}
150 151
151void KOEventViewerDialog::addEvent(Event *event) 152void KOEventViewerDialog::addEvent(Event *event)
152{ 153{
153 mEventViewer->addEvent(event); 154 mEventViewer->addEvent(event);
154 mIncidence = event; 155 mIncidence = event;
155 findButton( Close )->setFocus(); 156 mEventViewer->setFocus();
157 //findButton( Close )->setFocus();
156 if ( !mSyncMode ) { 158 if ( !mSyncMode ) {
157 findButton( User1 )->setText( i18n("Agenda")); 159 findButton( User1 )->setText( i18n("Agenda"));
158 } 160 }
159} 161}
160 162
161void KOEventViewerDialog::setTodo(Todo *event) 163void KOEventViewerDialog::setTodo(Todo *event)
162{ 164{
163 mEventViewer->setTodo(event); 165 mEventViewer->setTodo(event);
164 mIncidence = (Incidence*)event; 166 mIncidence = (Incidence*)event;
165 findButton( Close )->setFocus(); 167 mEventViewer->setFocus();
168 //findButton( Close )->setFocus();
166 if ( !mSyncMode ) { 169 if ( !mSyncMode ) {
167 findButton( User1 )->setText( i18n("Set complete")); 170 findButton( User1 )->setText( i18n("Set complete"));
168 } 171 }
169} 172}
170void KOEventViewerDialog::setJournal(Journal *j) 173void KOEventViewerDialog::setJournal(Journal *j)
171{ 174{
172 mEventViewer->setJournal(j); 175 mEventViewer->setJournal(j);
173 mIncidence = (Incidence*)j; 176 mIncidence = (Incidence*)j;
174 findButton( Close )->setFocus(); 177 mEventViewer->setFocus();
178 //findButton( Close )->setFocus();
175 if ( !mSyncMode ) { 179 if ( !mSyncMode ) {
176 findButton( User1 )->setText( i18n("Agenda")); 180 findButton( User1 )->setText( i18n("Agenda"));
177 } 181 }
178} 182}
179 183
180void KOEventViewerDialog::addText(QString text) 184void KOEventViewerDialog::addText(QString text)
181{ 185{
182 mEventViewer->addText(text); 186 mEventViewer->addText(text);
183 findButton( Close )->setFocus(); 187 mEventViewer->setFocus();
188 //findButton( Close )->setFocus();
184} 189}
185void KOEventViewerDialog::editIncidence() 190void KOEventViewerDialog::editIncidence()
186{ 191{
187 if ( mSyncMode ) { 192 if ( mSyncMode ) {
188 mSyncResult = 2; 193 mSyncResult = 2;
189 accept(); 194 accept();
190 return; 195 return;
191 } 196 }
192 if ( mIncidence ){ 197 if ( mIncidence ){
193#ifndef DESKTOP_VERSION 198#ifndef DESKTOP_VERSION
194 hide(); 199 hide();
195#endif 200#endif
196 emit editIncidence( mIncidence ); 201 emit editIncidence( mIncidence );
197 } 202 }
198} 203}
199void KOEventViewerDialog::showIncidence() 204void KOEventViewerDialog::showIncidence()
200{ 205{
201 206
202 if ( mSyncMode ) { 207 if ( mSyncMode ) {
203 mSyncResult = 1; 208 mSyncResult = 1;
204 accept(); 209 accept();
205 return; 210 return;
206 } 211 }
207 212
208 if ( mIncidence ){ 213 if ( mIncidence ){
209#ifndef DESKTOP_VERSION 214#ifndef DESKTOP_VERSION
210 hide(); 215 hide();
211#endif 216#endif
212 QDate date; 217 QDate date;
213 if ( mIncidence->type() == "Todo" ) { 218 if ( mIncidence->type() == "Todo" ) {
214 /* 219 /*
215 if ( ((Todo*)mIncidence)->hasDueDate() ) 220 if ( ((Todo*)mIncidence)->hasDueDate() )
216 date = ((Todo*)mIncidence)->dtDue().date(); 221 date = ((Todo*)mIncidence)->dtDue().date();
217 else { 222 else {
218 globalFlagBlockAgenda = 2; 223 globalFlagBlockAgenda = 2;
219 emit showAgendaView( false ); 224 emit showAgendaView( false );
220 return; 225 return;
221 } 226 }
222 */ 227 */
223 ((Todo*)mIncidence)->setCompleted( true ); 228 ((Todo*)mIncidence)->setCompleted( true );
224 ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() ); 229 ((Todo*)mIncidence)->setCompleted(QDateTime::currentDateTime() );
225 hide(); 230 hide();
226 emit todoCompleted(((Todo*)mIncidence)); 231 emit todoCompleted(((Todo*)mIncidence));
227 return; 232 return;
228 233
229 } else 234 } else
230 date = mIncidence->dtStart().date(); 235 date = mIncidence->dtStart().date();
231 globalFlagBlockAgenda = 1; 236 globalFlagBlockAgenda = 1;
232 emit showAgendaView( false ); 237 emit showAgendaView( false );
233 globalFlagBlockAgenda = 2; 238 globalFlagBlockAgenda = 2;
234 emit jumpToTime( date ); 239 emit jumpToTime( date );
235 } 240 }
236} 241}
237void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) 242void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e )
238{ 243{
239 switch ( e->key() ) { 244 switch ( e->key() ) {
240 245
241 case Qt::Key_A : 246 case Qt::Key_A :
242 case Qt::Key_L : 247 case Qt::Key_L :
243 showIncidence(); 248 showIncidence();
244 break; 249 break;
245 case Qt::Key_E : 250 case Qt::Key_E :
246 case Qt::Key_R : 251 case Qt::Key_R :
247 editIncidence(); 252 editIncidence();
248 break; 253 break;
249 case Qt::Key_C: 254 case Qt::Key_C:
250 case Qt::Key_Escape: 255 case Qt::Key_Escape:
251 close(); 256 close();
252 break; 257 break;
253 case Qt::Key_I: 258 case Qt::Key_I:
254 accept(); 259 accept();
255 break; 260 break;
256 default: 261 default:
262 KDialogBase::keyPressEvent ( e );
257 break; 263 break;
258 } 264 }
259 265
260} 266}
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index aa1b244..cef59a2 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -1,183 +1,183 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1998 Preston Brown 3 Copyright (c) 1998 Preston Brown
4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qcheckbox.h> 26#include <qcheckbox.h>
27#include <qgroupbox.h> 27#include <qgroupbox.h>
28#include <qlabel.h> 28#include <qlabel.h>
29#include <qwhatsthis.h> 29#include <qwhatsthis.h>
30#include <qlineedit.h> 30#include <qlineedit.h>
31#include <qpushbutton.h> 31#include <qpushbutton.h>
32 32
33#include <klocale.h> 33#include <klocale.h>
34#include <kmessagebox.h> 34#include <kmessagebox.h>
35 35
36#include <libkdepim/kdateedit.h> 36#include <libkdepim/kdateedit.h>
37 37
38#include "koglobals.h" 38#include "koglobals.h"
39#include "koprefs.h" 39#include "koprefs.h"
40 40
41#include "calendarview.h" 41#include "calendarview.h"
42#include "koviewmanager.h" 42#include "koviewmanager.h"
43#include "searchdialog.h" 43#include "searchdialog.h"
44 44
45SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent) 45SearchDialog::SearchDialog(Calendar *calendar,CalendarView *parent)
46 : QVBox( 0 ) 46 : QVBox( 0 )
47 47
48{ 48{
49 mCalendar = calendar; 49 mCalendar = calendar;
50 QFrame *topFrame = new QFrame( this ) ;//plainPage(); 50 QFrame *topFrame = new QFrame( this ) ;//plainPage();
51 QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint()); 51 QVBoxLayout *layout = new QVBoxLayout(topFrame,KDialog::marginHint(),KDialog::spacingHint());
52 52
53 // Search expression 53 // Search expression
54 QHBoxLayout *subLayout = new QHBoxLayout(); 54 QHBoxLayout *subLayout = new QHBoxLayout();
55 layout->addLayout(subLayout); 55 layout->addLayout(subLayout);
56 searchLabel = new QLabel(topFrame); 56 searchLabel = new QLabel(topFrame);
57 searchLabel->setText(i18n("Search for:")); 57 searchLabel->setText(i18n("Search for:"));
58 subLayout->addWidget(searchLabel); 58 subLayout->addWidget(searchLabel);
59 59
60 searchEdit = new QLineEdit(topFrame); 60 searchEdit = new QLineEdit(topFrame);
61 subLayout->addWidget(searchEdit); 61 subLayout->addWidget(searchEdit);
62 QPushButton *OkButton = new QPushButton( i18n("&Find"), topFrame ); 62 QPushButton *OkButton = new QPushButton( i18n("&Find"), topFrame );
63 //OkButton->setDefault( true ); 63 //OkButton->setDefault( true );
64 connect(OkButton,SIGNAL(clicked()),SLOT(doSearch())); 64 connect(OkButton,SIGNAL(clicked()),SLOT(doSearch()));
65 subLayout->addWidget(OkButton); 65 subLayout->addWidget(OkButton);
66 searchEdit->setText("*"); // Find all events by default 66 searchEdit->setText("*"); // Find all events by default
67 searchEdit->setFocus(); 67 searchEdit->setFocus();
68 connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & ))); 68 connect(searchEdit, SIGNAL(textChanged ( const QString & )),this,SLOT(searchTextChanged( const QString & )));
69 connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch())); 69 connect(searchEdit, SIGNAL( returnPressed () ),this,SLOT(doSearch()));
70 // Subjects to search 70 // Subjects to search
71 // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"), 71 // QGroupBox *subjectGroup = new QGroupBox(1,Vertical,i18n("Search In"),
72 // topFrame); 72 // topFrame);
73 73
74 QHBox *incidenceGroup = new QHBox( topFrame ); 74 QHBox *incidenceGroup = new QHBox( topFrame );
75 layout->addWidget(incidenceGroup); 75 layout->addWidget(incidenceGroup);
76 76
77 mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup); 77 mSearchEvent = new QCheckBox(i18n("Events"),incidenceGroup);
78 mSearchEvent->setChecked(true); 78 mSearchEvent->setChecked(true);
79 mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup); 79 mSearchTodo = new QCheckBox(i18n("Todos"),incidenceGroup);
80 mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup); 80 mSearchJournal = new QCheckBox(i18n("Journals"),incidenceGroup);
81 81
82 QHBox *subjectGroup = new QHBox( topFrame ); 82 QHBox *subjectGroup = new QHBox( topFrame );
83 layout->addWidget(subjectGroup); 83 layout->addWidget(subjectGroup);
84 84
85 mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup); 85 mSummaryCheck = new QCheckBox(i18n("Summary/Loc."),subjectGroup);
86 mSummaryCheck->setChecked(true); 86 mSummaryCheck->setChecked(true);
87 mDescriptionCheck = new QCheckBox(i18n("Descriptions"),subjectGroup); 87 mDescriptionCheck = new QCheckBox(i18n("Details"),subjectGroup);
88 mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup); 88 mCategoryCheck = new QCheckBox(i18n("Categories"),subjectGroup);
89 89
90 QHBox *attendeeGroup = new QHBox( topFrame ); 90 QHBox *attendeeGroup = new QHBox( topFrame );
91 layout->addWidget(attendeeGroup ); 91 layout->addWidget(attendeeGroup );
92 new QLabel( i18n("Attendee:"),attendeeGroup ); 92 new QLabel( i18n("Attendee:"),attendeeGroup );
93 mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup ); 93 mSearchAName = new QCheckBox(i18n("Name"),attendeeGroup );
94 mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup ); 94 mSearchAEmail = new QCheckBox(i18n("Email"), attendeeGroup );
95 // Date range 95 // Date range
96 // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"), 96 // QGroupBox *rangeGroup = new QGroupBox(1,Horizontal,i18n("Date Range"),
97 // topFrame); 97 // topFrame);
98 // layout->addWidget(rangeGroup); 98 // layout->addWidget(rangeGroup);
99 99
100 QWidget *rangeWidget = new QWidget(topFrame); 100 QWidget *rangeWidget = new QWidget(topFrame);
101 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint()); 101 QHBoxLayout *rangeLayout = new QHBoxLayout(rangeWidget,0,KDialog::spacingHint());
102 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget)); 102 rangeLayout->addWidget(new QLabel(i18n("From:"),rangeWidget));
103 mStartDate = new KDateEdit(rangeWidget); 103 mStartDate = new KDateEdit(rangeWidget);
104 rangeLayout->addWidget(mStartDate); 104 rangeLayout->addWidget(mStartDate);
105 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget)); 105 rangeLayout->addWidget(new QLabel(i18n("To:"),rangeWidget));
106 mEndDate = new KDateEdit(rangeWidget); 106 mEndDate = new KDateEdit(rangeWidget);
107 mEndDate->setDate(QDate::currentDate().addDays(365)); 107 mEndDate->setDate(QDate::currentDate().addDays(365));
108 rangeLayout->addWidget(mEndDate); 108 rangeLayout->addWidget(mEndDate);
109 QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget ); 109 QToolButton *wt = QWhatsThis::whatsThisButton ( rangeWidget );
110 rangeLayout->addWidget( (QWidget*)wt ); 110 rangeLayout->addWidget( (QWidget*)wt );
111 layout->addWidget(rangeWidget); 111 layout->addWidget(rangeWidget);
112 // Results list view 112 // Results list view
113 listView = new KOListView(mCalendar,topFrame); 113 listView = new KOListView(mCalendar,topFrame);
114 layout->addWidget(listView); 114 layout->addWidget(listView);
115 115
116 listView->readSettings(KOGlobals::config(),"SearchListView Layout"); 116 listView->readSettings(KOGlobals::config(),"SearchListView Layout");
117 117
118 setCaption( i18n("KO/Pi Find: ")); 118 setCaption( i18n("KO/Pi Find: "));
119#ifdef DESKTOP_VERSION 119#ifdef DESKTOP_VERSION
120 OkButton = new QPushButton( i18n("Close"), this ); 120 OkButton = new QPushButton( i18n("Close"), this );
121 connect(OkButton,SIGNAL(clicked()),SLOT(hide())); 121 connect(OkButton,SIGNAL(clicked()),SLOT(hide()));
122#endif 122#endif
123} 123}
124 124
125SearchDialog::~SearchDialog() 125SearchDialog::~SearchDialog()
126{ 126{
127 127
128} 128}
129void SearchDialog::accept() 129void SearchDialog::accept()
130{ 130{
131 doSearch(); 131 doSearch();
132} 132}
133void SearchDialog::updateList() 133void SearchDialog::updateList()
134{ 134{
135 //listView->updateList(); 135 //listView->updateList();
136 if ( isVisible() ) { 136 if ( isVisible() ) {
137 updateView(); 137 updateView();
138 //qDebug("SearchDialog::updated "); 138 //qDebug("SearchDialog::updated ");
139 } 139 }
140 else { 140 else {
141 listView->clear(); 141 listView->clear();
142 //qDebug("SearchDialog::cleared "); 142 //qDebug("SearchDialog::cleared ");
143 143
144 } 144 }
145} 145}
146void SearchDialog::searchTextChanged( const QString &_text ) 146void SearchDialog::searchTextChanged( const QString &_text )
147{ 147{
148#if 0 148#if 0
149 enableButton( KDialogBase::User1, !_text.isEmpty() ); 149 enableButton( KDialogBase::User1, !_text.isEmpty() );
150#endif 150#endif
151} 151}
152 152
153void SearchDialog::doSearch() 153void SearchDialog::doSearch()
154{ 154{
155 QRegExp re; 155 QRegExp re;
156 156
157 re.setWildcard(true); // most people understand these better. 157 re.setWildcard(true); // most people understand these better.
158 re.setCaseSensitive(false); 158 re.setCaseSensitive(false);
159 re.setPattern(searchEdit->text()); 159 re.setPattern(searchEdit->text());
160 if (!re.isValid() ) { 160 if (!re.isValid() ) {
161 KMessageBox::sorry(this, 161 KMessageBox::sorry(this,
162 i18n("Invalid search expression,\ncannot perform " 162 i18n("Invalid search expression,\ncannot perform "
163 "the search.\nPlease enter a search expression\n" 163 "the search.\nPlease enter a search expression\n"
164 "using the wildcard characters\n '*' and '?'" 164 "using the wildcard characters\n '*' and '?'"
165 "where needed.")); 165 "where needed."));
166 return; 166 return;
167 } 167 }
168 168
169 search(re); 169 search(re);
170 170
171 listView->setStartDate( mStartDate->date() ); 171 listView->setStartDate( mStartDate->date() );
172 listView->showEvents(mMatchedEvents); 172 listView->showEvents(mMatchedEvents);
173 listView->addTodos(mMatchedTodos); 173 listView->addTodos(mMatchedTodos);
174 listView->addJournals(mMatchedJournals); 174 listView->addJournals(mMatchedJournals);
175 175
176 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) { 176 if (mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() == 0) {
177 setCaption(i18n("No items found. Use '*' and '?' where needed.")); 177 setCaption(i18n("No items found. Use '*' and '?' where needed."));
178 } else { 178 } else {
179 QString mess; 179 QString mess;
180 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() ); 180 mess = mess.sprintf( i18n("%d item(s) found."), mMatchedEvents.count()+ mMatchedJournals.count() + mMatchedTodos.count() );
181 setCaption( i18n("KO/Pi Find: ") + mess); 181 setCaption( i18n("KO/Pi Find: ") + mess);
182 182
183 } 183 }