summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaitem.cpp8
-rw-r--r--korganizer/kodaymatrix.cpp2
-rw-r--r--korganizer/kolistview.cpp8
-rw-r--r--korganizer/kolistview.h3
-rw-r--r--korganizer/komonthview.cpp6
-rw-r--r--korganizer/kotodoview.cpp8
-rw-r--r--korganizer/mainwindow.cpp6
-rw-r--r--korganizer/mainwindow.h1
8 files changed, 35 insertions, 7 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp
index 1801d7e..df2e478 100644
--- a/korganizer/koagendaitem.cpp
+++ b/korganizer/koagendaitem.cpp
@@ -62,194 +62,198 @@ class KOAgendaItemWhatsThis :public QWhatsThis
62public: 62public:
63 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; 63 KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { };
64 64
65protected: 65protected:
66 virtual QString text( const QPoint& ) 66 virtual QString text( const QPoint& )
67 { 67 {
68 return _view->getWhatsThisText() ; 68 return _view->getWhatsThisText() ;
69 } 69 }
70private: 70private:
71 KOAgendaItem * _view; 71 KOAgendaItem * _view;
72}; 72};
73 73
74KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, 74KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday,
75 const char *name,WFlags) : 75 const char *name,WFlags) :
76 QWidget(parent, name), mIncidence(incidence), mDate(qd) 76 QWidget(parent, name), mIncidence(incidence), mDate(qd)
77{ 77{
78#ifndef DESKTOP_VERSION 78#ifndef DESKTOP_VERSION
79 //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); 79 //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
80#endif 80#endif
81 mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); 81 mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this);
82 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase 82 int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase
83 setWFlags ( wflags); 83 setWFlags ( wflags);
84 mAllDay = allday; 84 mAllDay = allday;
85 init ( incidence, qd ); 85 init ( incidence, qd );
86 //setMouseTracking(true); 86 //setMouseTracking(true);
87 //setAcceptDrops(true); 87 //setAcceptDrops(true);
88 xPaintCoord = -1; 88 xPaintCoord = -1;
89 yPaintCoord = -1; 89 yPaintCoord = -1;
90} 90}
91QString KOAgendaItem::getWhatsThisText() 91QString KOAgendaItem::getWhatsThisText()
92{ 92{
93 if ( mIncidence ) 93 if ( mIncidence )
94 return KIncidenceFormatter::instance()->getFormattedText( mIncidence, 94 return KIncidenceFormatter::instance()->getFormattedText( mIncidence,
95 KOPrefs::instance()->mWTshowDetails, 95 KOPrefs::instance()->mWTshowDetails,
96 KOPrefs::instance()->mWTshowCreated, 96 KOPrefs::instance()->mWTshowCreated,
97 KOPrefs::instance()->mWTshowChanged); 97 KOPrefs::instance()->mWTshowChanged);
98 return "KOAgendaItem::getWhatsThisText()::internal error"; 98 return "KOAgendaItem::getWhatsThisText()::internal error";
99} 99}
100void KOAgendaItem::init ( Incidence *incidence, QDate qd ) 100void KOAgendaItem::init ( Incidence *incidence, QDate qd )
101{ 101{
102 mIncidence = incidence; 102 mIncidence = incidence;
103 mDate = qd; 103 mDate = qd;
104 mFirstMultiItem = 0; 104 mFirstMultiItem = 0;
105 mNextMultiItem = 0; 105 mNextMultiItem = 0;
106 mLastMultiItem = 0; 106 mLastMultiItem = 0;
107 computeText(); 107 computeText();
108 108
109 if ( (incidence->type() == "Todo") && 109 if ( (incidence->type() == "Todo") &&
110 ( !((static_cast<Todo*>(incidence))->isCompleted()) && 110 ( !((static_cast<Todo*>(incidence))->isCompleted()) &&
111 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { 111 ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) {
112 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) 112 if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date())
113 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; 113 mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ;
114 else 114 else
115 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; 115 mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor;
116 } 116 }
117 else { 117 else {
118 QStringList categories = mIncidence->categories(); 118 QStringList categories = mIncidence->categories();
119 QString cat = categories.first(); 119 QString cat = categories.first();
120 if (cat.isEmpty()) { 120 if (cat.isEmpty()) {
121 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) 121 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) )
122 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 122 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
123 else 123 else
124 mBackgroundColor =KOPrefs::instance()->mEventColor; 124 mBackgroundColor =KOPrefs::instance()->mEventColor;
125 } else { 125 } else {
126 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); 126 mBackgroundColor = *KOPrefs::instance()->categoryColor(cat);
127 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { 127 if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) {
128 if ( mBackgroundColor == KOPrefs::instance()->mEventColor ) 128 if ( mBackgroundColor == KOPrefs::instance()->mEventColor )
129 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; 129 mBackgroundColor =KOPrefs::instance()->mTodoDoneColor;
130 } 130 }
131 } 131 }
132 132
133 } 133 }
134 mColorGroup = QColorGroup( mBackgroundColor.light(), 134 mColorGroup = QColorGroup( mBackgroundColor.light(),
135 mBackgroundColor.dark(),mBackgroundColor.light(), 135 mBackgroundColor.dark(),mBackgroundColor.light(),
136 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; 136 mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ;
137 setBackgroundColor( mBackgroundColor ); 137 setBackgroundColor( mBackgroundColor );
138 138
139 mConflictItems.clear(); 139 mConflictItems.clear();
140 setCellXY(0,0,1); 140 setCellXY(0,0,1);
141 setCellXWidth(0); 141 setCellXWidth(0);
142 setSubCell(0); 142 setSubCell(0);
143 setSubCells(1); 143 setSubCells(1);
144 setMultiItem(0,0,0); 144 setMultiItem(0,0,0);
145 startMove(); 145 startMove();
146 mSelected = true; 146 mSelected = true;
147 select(false); 147 select(false);
148 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); 148 QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont);
149 mFontPixelSize = fontinf.height();; 149 mFontPixelSize = fontinf.height();;
150 hide(); 150 hide();
151 xPaintCoord = -1; 151 xPaintCoord = -1;
152 yPaintCoord = -1; 152 yPaintCoord = -1;
153} 153}
154 154
155 155
156KOAgendaItem::~KOAgendaItem() 156KOAgendaItem::~KOAgendaItem()
157{ 157{
158 // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); 158#if QT_VERSION >= 0x030000
159 // delete mKOAgendaItemWhatsThis; 159
160#else
161 delete mKOAgendaItemWhatsThis;
162#endif
163
160} 164}
161 165
162void KOAgendaItem::recreateIncidence() 166void KOAgendaItem::recreateIncidence()
163{ 167{
164#if 0 168#if 0
165 Incidence* newInc = mIncidence->clone(); 169 Incidence* newInc = mIncidence->clone();
166 newInc->recreate(); 170 newInc->recreate();
167 if ( mIncidence->doesRecur() ) { 171 if ( mIncidence->doesRecur() ) {
168 mIncidence->addExDate( mDate ); 172 mIncidence->addExDate( mDate );
169 newInc->recurrence()->unsetRecurs(); 173 newInc->recurrence()->unsetRecurs();
170 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); 174 int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd());
171 QTime tim = mIncidence->dtStart().time(); 175 QTime tim = mIncidence->dtStart().time();
172 newInc->setDtStart( QDateTime(mDate, tim) ); 176 newInc->setDtStart( QDateTime(mDate, tim) );
173 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); 177 ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) );
174 } 178 }
175#endif 179#endif
176 mIncidence = mIncidence->recreateCloneException( mDate ); 180 mIncidence = mIncidence->recreateCloneException( mDate );
177} 181}
178bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) 182bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout)
179{ 183{
180 int size = AGENDA_ICON_SIZE; 184 int size = AGENDA_ICON_SIZE;
181 185
182 int yOff = 0; 186 int yOff = 0;
183 int xOff = 0; 187 int xOff = 0;
184 int x = pos().x() +3; 188 int x = pos().x() +3;
185 int y; 189 int y;
186 if ( mAllDay ) 190 if ( mAllDay )
187 y = pos().y()+3; 191 y = pos().y()+3;
188 else 192 else
189 y = mCellYTop * ( height() / cellHeight() ) +3; 193 y = mCellYTop * ( height() / cellHeight() ) +3;
190 if (mIncidence->cancelled()) { 194 if (mIncidence->cancelled()) {
191 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; 195 int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x;
192 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; 196 int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y;
193 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); 197 p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 );
194 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); 198 p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos );
195 if ( horLayout ) 199 if ( horLayout )
196 ++xOff; 200 ++xOff;
197 else 201 else
198 ++yOff; 202 ++yOff;
199 } 203 }
200 if (mIncidence->isAlarmEnabled()) { 204 if (mIncidence->isAlarmEnabled()) {
201 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); 205 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red );
202 if ( horLayout ) 206 if ( horLayout )
203 ++xOff; 207 ++xOff;
204 else 208 else
205 ++yOff; 209 ++yOff;
206 } 210 }
207 if (mIncidence->recurrence()->doesRecur()) { 211 if (mIncidence->recurrence()->doesRecur()) {
208 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); 212 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue );
209 if ( horLayout ) 213 if ( horLayout )
210 ++xOff; 214 ++xOff;
211 else 215 else
212 ++yOff; 216 ++yOff;
213 } 217 }
214 if (mIncidence->description().length() > 0) { 218 if (mIncidence->description().length() > 0) {
215 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); 219 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen );
216 if ( horLayout ) 220 if ( horLayout )
217 ++xOff; 221 ++xOff;
218 else 222 else
219 ++yOff; 223 ++yOff;
220 } 224 }
221 if (mIncidence->isReadOnly()) { 225 if (mIncidence->isReadOnly()) {
222 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); 226 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white );
223 if ( horLayout ) 227 if ( horLayout )
224 ++xOff; 228 ++xOff;
225 else 229 else
226 ++yOff; 230 ++yOff;
227 } 231 }
228 232
229 if (mIncidence->attendeeCount()>0) { 233 if (mIncidence->attendeeCount()>0) {
230 234
231 if (mIncidence->organizer() == KOPrefs::instance()->email()) { 235 if (mIncidence->organizer() == KOPrefs::instance()->email()) {
232 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); 236 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black );
233 if ( horLayout ) 237 if ( horLayout )
234 ++xOff; 238 ++xOff;
235 else 239 else
236 ++yOff; 240 ++yOff;
237 } else { 241 } else {
238 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 242 Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
239 if (me!=0) { 243 if (me!=0) {
240 244
241 245
242 } else { 246 } else {
243 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); 247 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow );
244 if ( horLayout ) 248 if ( horLayout )
245 ++xOff; 249 ++xOff;
246 else 250 else
247 ++yOff; 251 ++yOff;
248 252
249 } 253 }
250 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); 254 p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow );
251 if ( horLayout ) 255 if ( horLayout )
252 ++xOff; 256 ++xOff;
253 else 257 else
254 ++yOff; 258 ++yOff;
255 259
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index c32a2a4..53ebdb2 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -1,162 +1,162 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at> 3 Copyright (c) 2001 Eitzenberger Thomas <thomas.eitzenberger@siemens.at>
4 Parts of the source code have been copied from kdpdatebutton.cpp 4 Parts of the source code have been copied from kdpdatebutton.cpp
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 ode for Qt in the source distribution. 22 without including the source ode for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qevent.h> 25#include <qevent.h>
26#include <qpainter.h> 26#include <qpainter.h>
27#include <qptrlist.h> 27#include <qptrlist.h>
28#include <qtimer.h> 28#include <qtimer.h>
29#include <qwhatsthis.h> 29#include <qwhatsthis.h>
30 30
31#include <kglobal.h> 31#include <kglobal.h>
32#include <kdebug.h> 32#include <kdebug.h>
33#include <klocale.h> 33#include <klocale.h>
34 34
35#include <libkcal/vcaldrag.h> 35#include <libkcal/vcaldrag.h>
36#include <libkcal/icaldrag.h> 36#include <libkcal/icaldrag.h>
37#include <libkcal/dndfactory.h> 37#include <libkcal/dndfactory.h>
38#include <libkcal/calendarresources.h> 38#include <libkcal/calendarresources.h>
39#include <libkcal/resourcecalendar.h> 39#include <libkcal/resourcecalendar.h>
40#include <kresources/resourceselectdialog.h> 40#include <kresources/resourceselectdialog.h>
41 41
42#include <kcalendarsystem.h> 42#include <kcalendarsystem.h>
43 43
44#ifndef KORG_NOPLUGINS 44#ifndef KORG_NOPLUGINS
45#include "kocore.h" 45#include "kocore.h"
46#endif 46#endif
47#include "koprefs.h" 47#include "koprefs.h"
48#include "koglobals.h" 48#include "koglobals.h"
49 49
50#include "kodaymatrix.h" 50#include "kodaymatrix.h"
51 51
52// ============================================================================ 52// ============================================================================
53// D Y N A M I C T I P 53// D Y N A M I C T I P
54// ============================================================================ 54// ============================================================================
55 55
56DynamicTip::DynamicTip( QWidget * parent ) 56DynamicTip::DynamicTip( QWidget * parent )
57 : QToolTip( parent ) 57 : QToolTip( parent )
58{ 58{
59 matrix = (KODayMatrix*)parent; 59 matrix = (KODayMatrix*)parent;
60} 60}
61 61
62class KODaymatrixWhatsThis :public QWhatsThis 62class KODaymatrixWhatsThis :public QWhatsThis
63{ 63{
64public: 64public:
65 KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { ;}; 65 KODaymatrixWhatsThis( KODayMatrix* view ) : QWhatsThis( view ),_view (view) { ;};
66 ~KODaymatrixWhatsThis() { qDebug("DELETE KODaymatrixWhatsThis "); }; 66 ~KODaymatrixWhatsThis() { ; };
67 67
68protected: 68protected:
69 virtual QString text( const QPoint& p ) 69 virtual QString text( const QPoint& p )
70 { 70 {
71 return _view->getWhatsThisText( p ) ; 71 return _view->getWhatsThisText( p ) ;
72 } 72 }
73private: 73private:
74 KODayMatrix * _view; 74 KODayMatrix * _view;
75}; 75};
76 76
77void DynamicTip::maybeTip( const QPoint &pos ) 77void DynamicTip::maybeTip( const QPoint &pos )
78{ 78{
79 //calculate which cell of the matrix the mouse is in 79 //calculate which cell of the matrix the mouse is in
80 QRect sz = matrix->frameRect(); 80 QRect sz = matrix->frameRect();
81 int dheight = sz.height()*7 / 42; 81 int dheight = sz.height()*7 / 42;
82 int dwidth = sz.width() / 7; 82 int dwidth = sz.width() / 7;
83 int row = pos.y()/dheight; 83 int row = pos.y()/dheight;
84 int col = pos.x()/dwidth; 84 int col = pos.x()/dwidth;
85 85
86 QRect rct(col*dwidth, row*dheight, dwidth, dheight); 86 QRect rct(col*dwidth, row*dheight, dwidth, dheight);
87 87
88// kdDebug() << "DynamicTip::maybeTip matrix cell index [" << 88// kdDebug() << "DynamicTip::maybeTip matrix cell index [" <<
89// col << "][" << row << "] => " <<(col+row*7) << endl; 89// col << "][" << row << "] => " <<(col+row*7) << endl;
90 90
91 //show holiday names only 91 //show holiday names only
92 QString str = matrix->getHolidayLabel(col+row*7); 92 QString str = matrix->getHolidayLabel(col+row*7);
93 if (str.isEmpty()) return; 93 if (str.isEmpty()) return;
94 tip(rct, str); 94 tip(rct, str);
95} 95}
96 96
97 97
98// ============================================================================ 98// ============================================================================
99// K O D A Y M A T R I X 99// K O D A Y M A T R I X
100// ============================================================================ 100// ============================================================================
101 101
102const int KODayMatrix::NOSELECTION = -1000; 102const int KODayMatrix::NOSELECTION = -1000;
103const int KODayMatrix::NUMDAYS = 42; 103const int KODayMatrix::NUMDAYS = 42;
104 104
105KODayMatrix::KODayMatrix( QWidget *parent, const char *name ) 105KODayMatrix::KODayMatrix( QWidget *parent, const char *name )
106 : QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 ) 106 : QFrame( parent, name , Qt::WRepaintNoErase ), mCalendar( 0 )
107 107
108 108
109{ 109{
110 mLastView = -1; 110 mLastView = -1;
111 oldW = 0; 111 oldW = 0;
112 oldH = 0; 112 oldH = 0;
113 myPix.resize( 150, 120 ); 113 myPix.resize( 150, 120 );
114 mRedrawNeeded = true; 114 mRedrawNeeded = true;
115 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); 115 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this);
116 mPendingUpdateBeforeRepaint = false; 116 mPendingUpdateBeforeRepaint = false;
117 mouseDown = false; 117 mouseDown = false;
118 // initialize dynamic arrays 118 // initialize dynamic arrays
119 bDays.resize ( NUMDAYS ); 119 bDays.resize ( NUMDAYS );
120 pDays.resize ( NUMDAYS ); 120 pDays.resize ( NUMDAYS );
121 hDays.resize ( NUMDAYS ); 121 hDays.resize ( NUMDAYS );
122 eDays.resize ( NUMDAYS ); 122 eDays.resize ( NUMDAYS );
123 days = new QDate[NUMDAYS]; 123 days = new QDate[NUMDAYS];
124 daylbls = new QString[NUMDAYS]; 124 daylbls = new QString[NUMDAYS];
125 //events = new int[NUMDAYS]; 125 //events = new int[NUMDAYS];
126 mToolTip = new DynamicTip(this); 126 mToolTip = new DynamicTip(this);
127 127
128 // set default values used for drawing the matrix 128 // set default values used for drawing the matrix
129 mDefaultBackColor = palette().active().base(); 129 mDefaultBackColor = palette().active().base();
130 mDefaultTextColor = palette().active().foreground(); 130 mDefaultTextColor = palette().active().foreground();
131 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); 131 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor);
132 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); 132 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor);
133 mSelectedDaysColor = QColor("white"); 133 mSelectedDaysColor = QColor("white");
134 mTodayMarginWidth = 2; 134 mTodayMarginWidth = 2;
135 mSelEnd = mSelStart = NOSELECTION; 135 mSelEnd = mSelStart = NOSELECTION;
136 136
137 setAcceptDrops(true); 137 setAcceptDrops(true);
138 //setFont( QFont("Arial", 10) ); 138 //setFont( QFont("Arial", 10) );
139 139
140 mUpdateTimer = new QTimer( this ); 140 mUpdateTimer = new QTimer( this );
141 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); 141 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() ));
142 mRepaintTimer = new QTimer( this ); 142 mRepaintTimer = new QTimer( this );
143 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); 143 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() ));
144 mDayChanged = false; 144 mDayChanged = false;
145 updateView(); 145 updateView();
146} 146}
147QString KODayMatrix::getWhatsThisText( QPoint p ) 147QString KODayMatrix::getWhatsThisText( QPoint p )
148{ 148{
149 149
150 int tmp = getDayIndexFrom(p.x(), p.y()); 150 int tmp = getDayIndexFrom(p.x(), p.y());
151 if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar ) 151 if ( tmp < 0 || tmp > NUMDAYS-1 || !mCalendar )
152 return QString(); 152 return QString();
153 QDate mDate = days[tmp]; 153 QDate mDate = days[tmp];
154 QPtrList<Event> eventlist = mCalendar->events(mDate); 154 QPtrList<Event> eventlist = mCalendar->events(mDate);
155 Event *event; 155 Event *event;
156 QStringList mToolTip; 156 QStringList mToolTip;
157 for(event=eventlist.first();event != 0;event=eventlist.next()) { 157 for(event=eventlist.first();event != 0;event=eventlist.next()) {
158 QString mToolTipText; 158 QString mToolTipText;
159 QString text; 159 QString text;
160 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day 160 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
161 if (event->isMultiDay()) { 161 if (event->isMultiDay()) {
162 QString prefix = "<->";multiday = 2; 162 QString prefix = "<->";multiday = 2;
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index fd86095..b94916a 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -168,269 +168,274 @@ bool ListItemVisitor::visit(Todo *t)
168 if ( t->isAlarmEnabled() ) { 168 if ( t->isAlarmEnabled() ) {
169 mItem->setText(5,t->alarms().first()->offsetText() ); 169 mItem->setText(5,t->alarms().first()->offsetText() );
170 } else { 170 } else {
171 mItem->setText(5, i18n("No")); 171 mItem->setText(5, i18n("No"));
172 } 172 }
173 mItem->setText(6, t->recurrence()->recurrenceText()); 173 mItem->setText(6, t->recurrence()->recurrenceText());
174 if( ! t->doesRecur() ) 174 if( ! t->doesRecur() )
175 mItem->setSortKey( 6, "-" ); 175 mItem->setSortKey( 6, "-" );
176 if (t->hasDueDate()) { 176 if (t->hasDueDate()) {
177 mItem->setText(7,t->dtDueDateStr()); 177 mItem->setText(7,t->dtDueDateStr());
178 if (t->doesFloat()) { 178 if (t->doesFloat()) {
179 mItem->setText(8,"---"); 179 mItem->setText(8,"---");
180 } else { 180 } else {
181 mItem->setText(8,t->dtDueTimeStr()); 181 mItem->setText(8,t->dtDueTimeStr());
182 } 182 }
183 } else { 183 } else {
184 mItem->setText(7,"---"); 184 mItem->setText(7,"---");
185 mItem->setText(8,"---"); 185 mItem->setText(8,"---");
186 } 186 }
187 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); 187 mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No"));
188 mItem->setText(10,t->categoriesStr()); 188 mItem->setText(10,t->categoriesStr());
189 189
190 QString key; 190 QString key;
191 QDate d; 191 QDate d;
192 if (t->hasDueDate()) { 192 if (t->hasDueDate()) {
193 d = t->dtDue().date(); 193 d = t->dtDue().date();
194 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); 194 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time();
195 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 195 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
196 mItem->setSortKey(7,key); 196 mItem->setSortKey(7,key);
197 } 197 }
198 if ( t->hasStartDate() ) { 198 if ( t->hasStartDate() ) {
199 d = t->dtStart().date(); 199 d = t->dtStart().date();
200 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); 200 QTime tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time();
201 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); 201 key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute());
202 mItem->setSortKey(1,key); 202 mItem->setSortKey(1,key);
203 } 203 }
204 return true; 204 return true;
205} 205}
206 206
207bool ListItemVisitor::visit(Journal * j) 207bool ListItemVisitor::visit(Journal * j)
208{ 208{
209 QString des = j->description().left(30); 209 QString des = j->description().left(30);
210 des = des.simplifyWhiteSpace (); 210 des = des.simplifyWhiteSpace ();
211 des.replace (QRegExp ("\\n"),"" ); 211 des.replace (QRegExp ("\\n"),"" );
212 des.replace (QRegExp ("\\r"),"" ); 212 des.replace (QRegExp ("\\r"),"" );
213 mItem->setText(0,i18n("Journal: ")+des.left(25)); 213 mItem->setText(0,i18n("Journal: ")+des.left(25));
214 mItem->setText(1,j->dtStartDateStr()); 214 mItem->setText(1,j->dtStartDateStr());
215 mItem->setText(2,"---"); 215 mItem->setText(2,"---");
216 mItem->setText(3,"---"); 216 mItem->setText(3,"---");
217 mItem->setText(4,"---"); 217 mItem->setText(4,"---");
218 mItem->setText(5,"---"); 218 mItem->setText(5,"---");
219 mItem->setText(6,"---"); 219 mItem->setText(6,"---");
220 mItem->setText(7,j->dtStartDateStr()); 220 mItem->setText(7,j->dtStartDateStr());
221 mItem->setText(8,"---"); 221 mItem->setText(8,"---");
222 mItem->setText(9,"---"); 222 mItem->setText(9,"---");
223 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) ); 223 mItem->setText(10,i18n("Last Modified: ")+ KGlobal::locale()->formatDateTime( j->lastModified() , true) );
224 224
225 QString key; 225 QString key;
226 QDate d = j->dtStart().date(); 226 QDate d = j->dtStart().date();
227 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day()); 227 key.sprintf("%04d%02d%02d",d.year(),d.month(),d.day());
228 mItem->setSortKey(1,key); 228 mItem->setSortKey(1,key);
229 mItem->setSortKey(7,key); 229 mItem->setSortKey(7,key);
230 230
231 return true; 231 return true;
232} 232}
233 233
234KOListView::KOListView(Calendar *calendar, QWidget *parent, 234KOListView::KOListView(Calendar *calendar, QWidget *parent,
235 const char *name) 235 const char *name)
236 : KOEventView(calendar, parent, name) 236 : KOEventView(calendar, parent, name)
237{ 237{
238 mActiveItem = 0; 238 mActiveItem = 0;
239 mListView = new KOListViewListView(this); 239 mListView = new KOListViewListView(this);
240 mListView->addColumn(i18n("Summary")); 240 mListView->addColumn(i18n("Summary"));
241 mListView->addColumn(i18n("Start Date")); 241 mListView->addColumn(i18n("Start Date"));
242 mListView->addColumn(i18n("Start Time")); 242 mListView->addColumn(i18n("Start Time"));
243 mListView->addColumn(i18n("End Date")); 243 mListView->addColumn(i18n("End Date"));
244 mListView->addColumn(i18n("End Time")); 244 mListView->addColumn(i18n("End Time"));
245 mListView->addColumn(i18n("Alarm")); // alarm set? 245 mListView->addColumn(i18n("Alarm")); // alarm set?
246 mListView->addColumn(i18n("Recurs")); // recurs? 246 mListView->addColumn(i18n("Recurs")); // recurs?
247 mListView->addColumn(i18n("Due Date")); 247 mListView->addColumn(i18n("Due Date"));
248 mListView->addColumn(i18n("Due Time")); 248 mListView->addColumn(i18n("Due Time"));
249 mListView->addColumn(i18n("Cancelled")); 249 mListView->addColumn(i18n("Cancelled"));
250 mListView->addColumn(i18n("Categories")); 250 mListView->addColumn(i18n("Categories"));
251 251
252 mListView->setColumnAlignment(0,AlignLeft); 252 mListView->setColumnAlignment(0,AlignLeft);
253 mListView->setColumnAlignment(1,AlignLeft); 253 mListView->setColumnAlignment(1,AlignLeft);
254 mListView->setColumnAlignment(2,AlignHCenter); 254 mListView->setColumnAlignment(2,AlignHCenter);
255 mListView->setColumnAlignment(3,AlignLeft); 255 mListView->setColumnAlignment(3,AlignLeft);
256 mListView->setColumnAlignment(4,AlignHCenter); 256 mListView->setColumnAlignment(4,AlignHCenter);
257 mListView->setColumnAlignment(5,AlignLeft); 257 mListView->setColumnAlignment(5,AlignLeft);
258 mListView->setColumnAlignment(6,AlignLeft); 258 mListView->setColumnAlignment(6,AlignLeft);
259 mListView->setColumnAlignment(7,AlignLeft); 259 mListView->setColumnAlignment(7,AlignLeft);
260 mListView->setColumnAlignment(8,AlignLeft); 260 mListView->setColumnAlignment(8,AlignLeft);
261 mListView->setColumnAlignment(9,AlignLeft); 261 mListView->setColumnAlignment(9,AlignLeft);
262 mListView->setColumnAlignment(10,AlignLeft); 262 mListView->setColumnAlignment(10,AlignLeft);
263 mListView->setColumnWidthMode(10, QListView::Manual); 263 mListView->setColumnWidthMode(10, QListView::Manual);
264 new KOListViewWhatsThis(mListView->viewport(),this); 264 mKOListViewWhatsThis = new KOListViewWhatsThis(mListView->viewport(),this);
265 265
266 int iii = 0; 266 int iii = 0;
267 for ( iii = 0; iii< 10 ; ++iii ) 267 for ( iii = 0; iii< 10 ; ++iii )
268 mListView->setColumnWidthMode( iii, QListView::Manual ); 268 mListView->setColumnWidthMode( iii, QListView::Manual );
269 269
270 QBoxLayout *layoutTop = new QVBoxLayout(this); 270 QBoxLayout *layoutTop = new QVBoxLayout(this);
271 layoutTop->addWidget(mListView); 271 layoutTop->addWidget(mListView);
272 mListView->setFont ( KOPrefs::instance()->mListViewFont ); 272 mListView->setFont ( KOPrefs::instance()->mListViewFont );
273 mPopupMenu = eventPopup(); 273 mPopupMenu = eventPopup();
274 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 274 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
275 i18n("Select all"),this, 275 i18n("Select all"),this,
276 SLOT(allSelection()),true); 276 SLOT(allSelection()),true);
277 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 277 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
278 i18n("Deselect all"),this, 278 i18n("Deselect all"),this,
279 SLOT(clearSelection()),true); 279 SLOT(clearSelection()),true);
280 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 280 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
281 i18n("Delete all selected"),this, 281 i18n("Delete all selected"),this,
282 SLOT(deleteAll()),true); 282 SLOT(deleteAll()),true);
283 mPopupMenu->insertSeparator(); 283 mPopupMenu->insertSeparator();
284 QPopupMenu * exportPO = new QPopupMenu ( this ); 284 QPopupMenu * exportPO = new QPopupMenu ( this );
285 mPopupMenu->insertItem( i18n("Export selected"), exportPO ); 285 mPopupMenu->insertItem( i18n("Export selected"), exportPO );
286 exportPO->insertItem( i18n("As iCal (ics) file..."),this, 286 exportPO->insertItem( i18n("As iCal (ics) file..."),this,
287 SLOT(saveToFile())); 287 SLOT(saveToFile()));
288 exportPO->insertItem( i18n("As vCal (vcs) file..."),this, 288 exportPO->insertItem( i18n("As vCal (vcs) file..."),this,
289 SLOT(saveToFileVCS())); 289 SLOT(saveToFileVCS()));
290 exportPO->insertItem( i18n("Journal/Details..."),this, 290 exportPO->insertItem( i18n("Journal/Details..."),this,
291 SLOT(saveDescriptionToFile())); 291 SLOT(saveDescriptionToFile()));
292 // mPopupMenu->insertSeparator(); 292 // mPopupMenu->insertSeparator();
293 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 293 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
294 i18n("Add Categ. to selected..."),this, 294 i18n("Add Categ. to selected..."),this,
295 SLOT(addCat()),true); 295 SLOT(addCat()),true);
296 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 296 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
297 i18n("Set Categ. for selected..."),this, 297 i18n("Set Categ. for selected..."),this,
298 SLOT(setCat()),true); 298 SLOT(setCat()),true);
299 //mPopupMenu->insertSeparator(); 299 //mPopupMenu->insertSeparator();
300 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 300 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
301 i18n("Set alarm for selected..."),this, 301 i18n("Set alarm for selected..."),this,
302 SLOT(setAlarm()),true); 302 SLOT(setAlarm()),true);
303 303
304 304
305#ifndef DESKTOP_VERSION 305#ifndef DESKTOP_VERSION
306 mPopupMenu->insertSeparator(); 306 mPopupMenu->insertSeparator();
307 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 307 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
308 i18n("Beam selected via IR"),this, 308 i18n("Beam selected via IR"),this,
309 SLOT(beamSelected()),true); 309 SLOT(beamSelected()),true);
310#endif 310#endif
311 /* 311 /*
312 mPopupMenu = new QPopupMenu; 312 mPopupMenu = new QPopupMenu;
313 mPopupMenu->insertItem(i18n("Edit Event"), this, 313 mPopupMenu->insertItem(i18n("Edit Event"), this,
314 SLOT (editEvent())); 314 SLOT (editEvent()));
315 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 315 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
316 SLOT (deleteEvent())); 316 SLOT (deleteEvent()));
317 mPopupMenu->insertSeparator(); 317 mPopupMenu->insertSeparator();
318 mPopupMenu->insertItem(i18n("Show Dates"), this, 318 mPopupMenu->insertItem(i18n("Show Dates"), this,
319 SLOT(showDates())); 319 SLOT(showDates()));
320 mPopupMenu->insertItem(i18n("Hide Dates"), this, 320 mPopupMenu->insertItem(i18n("Hide Dates"), this,
321 SLOT(hideDates())); 321 SLOT(hideDates()));
322 */ 322 */
323 QObject::connect(mListView,SIGNAL( newEvent()), 323 QObject::connect(mListView,SIGNAL( newEvent()),
324 this,SIGNAL(signalNewEvent())); 324 this,SIGNAL(signalNewEvent()));
325 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 325 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
326 this,SLOT(defaultItemAction(QListViewItem *))); 326 this,SLOT(defaultItemAction(QListViewItem *)));
327 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *, 327 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *,
328 const QPoint &, int )), 328 const QPoint &, int )),
329 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 329 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
330 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 330 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
331 SLOT(processSelectionChange(QListViewItem *))); 331 SLOT(processSelectionChange(QListViewItem *)));
332 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 332 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
333 SIGNAL(showIncidenceSignal(Incidence *)) ); 333 SIGNAL(showIncidenceSignal(Incidence *)) );
334 334
335 readSettings(KOGlobals::config(),"KOListView Layout"); 335 readSettings(KOGlobals::config(),"KOListView Layout");
336} 336}
337 337
338KOListView::~KOListView() 338KOListView::~KOListView()
339{ 339{
340 delete mPopupMenu; 340 delete mPopupMenu;
341#if QT_VERSION >= 0x030000
342
343#else
344 delete mKOListViewWhatsThis;
345#endif
341} 346}
342 347
343QString KOListView::getWhatsThisText(QPoint p) 348QString KOListView::getWhatsThisText(QPoint p)
344{ 349{
345 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 350 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
346 if ( item ) 351 if ( item )
347 return KIncidenceFormatter::instance()->getFormattedText( item->data(), 352 return KIncidenceFormatter::instance()->getFormattedText( item->data(),
348 KOPrefs::instance()->mWTshowDetails, 353 KOPrefs::instance()->mWTshowDetails,
349 KOPrefs::instance()->mWTshowCreated, 354 KOPrefs::instance()->mWTshowCreated,
350 KOPrefs::instance()->mWTshowChanged); 355 KOPrefs::instance()->mWTshowChanged);
351 return i18n("That is the list view" ); 356 return i18n("That is the list view" );
352 357
353} 358}
354 359
355void KOListView::updateList() 360void KOListView::updateList()
356{ 361{
357 // qDebug(" KOListView::updateList() "); 362 // qDebug(" KOListView::updateList() ");
358 363
359} 364}
360 365
361void KOListView::addCat( ) 366void KOListView::addCat( )
362{ 367{
363 setCategories( false ); 368 setCategories( false );
364} 369}
365void KOListView::setCat() 370void KOListView::setCat()
366{ 371{
367 setCategories( true ); 372 setCategories( true );
368} 373}
369void KOListView::setAlarm() 374void KOListView::setAlarm()
370{ 375{
371 KOAlarmPrefs kap( this); 376 KOAlarmPrefs kap( this);
372 if ( !kap.exec() ) 377 if ( !kap.exec() )
373 return; 378 return;
374 QStringList itemList; 379 QStringList itemList;
375 QPtrList<KOListViewItem> sel ; 380 QPtrList<KOListViewItem> sel ;
376 QListViewItem *qitem = mListView->firstChild (); 381 QListViewItem *qitem = mListView->firstChild ();
377 while ( qitem ) { 382 while ( qitem ) {
378 if ( qitem->isSelected() ) { 383 if ( qitem->isSelected() ) {
379 Incidence* inc = ((KOListViewItem *) qitem)->data(); 384 Incidence* inc = ((KOListViewItem *) qitem)->data();
380 if ( inc->type() != "Journal" ) { 385 if ( inc->type() != "Journal" ) {
381 if ( inc->type() == "Todo" ) { 386 if ( inc->type() == "Todo" ) {
382 if ( ((Todo*)inc)->hasDueDate() ) 387 if ( ((Todo*)inc)->hasDueDate() )
383 sel.append(((KOListViewItem *)qitem)); 388 sel.append(((KOListViewItem *)qitem));
384 } else 389 } else
385 sel.append(((KOListViewItem *)qitem)); 390 sel.append(((KOListViewItem *)qitem));
386 } 391 }
387 } 392 }
388 qitem = qitem->nextSibling(); 393 qitem = qitem->nextSibling();
389 } 394 }
390 int count = 0; 395 int count = 0;
391 KOListViewItem * item, *temp; 396 KOListViewItem * item, *temp;
392 item = sel.first(); 397 item = sel.first();
393 Incidence* inc; 398 Incidence* inc;
394 while ( item ) { 399 while ( item ) {
395 inc = item->data(); 400 inc = item->data();
396 ++count; 401 ++count;
397 if (kap.mAlarmButton->isChecked()) { 402 if (kap.mAlarmButton->isChecked()) {
398 if (inc->alarms().count() == 0) 403 if (inc->alarms().count() == 0)
399 inc->newAlarm(); 404 inc->newAlarm();
400 QPtrList<Alarm> alarms = inc->alarms(); 405 QPtrList<Alarm> alarms = inc->alarms();
401 Alarm *alarm; 406 Alarm *alarm;
402 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) { 407 for (alarm = alarms.first(); alarm; alarm = alarms.next() ) {
403 alarm->setEnabled(true); 408 alarm->setEnabled(true);
404 int j = kap.mAlarmTimeEdit->value()* -60; 409 int j = kap.mAlarmTimeEdit->value()* -60;
405 if (kap.mAlarmIncrCombo->currentItem() == 1) 410 if (kap.mAlarmIncrCombo->currentItem() == 1)
406 j = j * 60; 411 j = j * 60;
407 else if (kap.mAlarmIncrCombo->currentItem() == 2) 412 else if (kap.mAlarmIncrCombo->currentItem() == 2)
408 j = j * (60 * 24); 413 j = j * (60 * 24);
409 alarm->setStartOffset( j ); 414 alarm->setStartOffset( j );
410 415
411 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) { 416 if (!kap.mAlarmProgram.isEmpty() && kap.mAlarmProgramButton->isOn()) {
412 alarm->setProcedureAlarm(kap.mAlarmProgram); 417 alarm->setProcedureAlarm(kap.mAlarmProgram);
413 } 418 }
414 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn()) 419 else if (!kap.mAlarmSound.isEmpty() && kap.mAlarmSoundButton->isOn())
415 alarm->setAudioAlarm(kap.mAlarmSound); 420 alarm->setAudioAlarm(kap.mAlarmSound);
416 else 421 else
417 alarm->setType(Alarm::Invalid); 422 alarm->setType(Alarm::Invalid);
418 //alarm->setAudioAlarm("default"); 423 //alarm->setAudioAlarm("default");
419 // TODO: Deal with multiple alarms 424 // TODO: Deal with multiple alarms
420 break; // For now, stop after the first alarm 425 break; // For now, stop after the first alarm
421 } 426 }
422 } else { 427 } else {
423 Alarm* alarm = inc->alarms().first(); 428 Alarm* alarm = inc->alarms().first();
424 if ( alarm ) { 429 if ( alarm ) {
425 alarm->setEnabled(false); 430 alarm->setEnabled(false);
426 alarm->setType(Alarm::Invalid); 431 alarm->setType(Alarm::Invalid);
427 } 432 }
428 } 433 }
429 ListItemVisitor v(item, mStartDate ); 434 ListItemVisitor v(item, mStartDate );
430 inc->accept(v); 435 inc->accept(v);
431 item = sel.next(); 436 item = sel.next();
432 } 437 }
433 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) ); 438 topLevelWidget()->setCaption( i18n("Canged alarm for %1 items").arg( count ) );
434 qDebug("KO: Set alarm for %d items", count); 439 qDebug("KO: Set alarm for %d items", count);
435 calendar()->reInitAlarmSettings(); 440 calendar()->reInitAlarmSettings();
436 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) ); 441 QTimer::singleShot( 1, this, SLOT ( resetFocus() ) );
@@ -1088,180 +1093,181 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e)
1088 int count = childCount (); 1093 int count = childCount ();
1089 int jump = count / 5; 1094 int jump = count / 5;
1090 QListViewItem* cn; 1095 QListViewItem* cn;
1091 cn = currentItem(); 1096 cn = currentItem();
1092 if ( ! cn ) 1097 if ( ! cn )
1093 return; 1098 return;
1094 if ( jump == 0 ) 1099 if ( jump == 0 )
1095 jump = 1; 1100 jump = 1;
1096 while ( jump && cn->nextSibling() ) { 1101 while ( jump && cn->nextSibling() ) {
1097 cn = cn->nextSibling(); 1102 cn = cn->nextSibling();
1098 --jump; 1103 --jump;
1099 } 1104 }
1100 setCurrentItem ( cn ); 1105 setCurrentItem ( cn );
1101 ensureItemVisible ( cn ); 1106 ensureItemVisible ( cn );
1102 1107
1103 } else 1108 } else
1104 QListView::keyPressEvent ( e ) ; 1109 QListView::keyPressEvent ( e ) ;
1105 e->accept(); 1110 e->accept();
1106 break; 1111 break;
1107 1112
1108 case Qt::Key_Up: 1113 case Qt::Key_Up:
1109 if ( e->state() == ShiftButton ) { 1114 if ( e->state() == ShiftButton ) {
1110 QListViewItem* cn = firstChild(); 1115 QListViewItem* cn = firstChild();
1111 if ( cn ) { 1116 if ( cn ) {
1112 setCurrentItem ( cn ); 1117 setCurrentItem ( cn );
1113 ensureItemVisible ( cn ); 1118 ensureItemVisible ( cn );
1114 } 1119 }
1115 e->accept(); 1120 e->accept();
1116 return; 1121 return;
1117 } 1122 }
1118 if ( e->state() == ControlButton ) { 1123 if ( e->state() == ControlButton ) {
1119 int count = childCount (); 1124 int count = childCount ();
1120 int jump = count / 5; 1125 int jump = count / 5;
1121 QListViewItem* cn; 1126 QListViewItem* cn;
1122 cn = currentItem(); 1127 cn = currentItem();
1123 if ( ! cn ) 1128 if ( ! cn )
1124 return; 1129 return;
1125 if ( jump == 0 ) 1130 if ( jump == 0 )
1126 jump = 1; 1131 jump = 1;
1127 while ( jump && cn->itemAbove ()) { 1132 while ( jump && cn->itemAbove ()) {
1128 cn = cn->itemAbove (); 1133 cn = cn->itemAbove ();
1129 --jump; 1134 --jump;
1130 } 1135 }
1131 setCurrentItem ( cn ); 1136 setCurrentItem ( cn );
1132 ensureItemVisible ( cn ); 1137 ensureItemVisible ( cn );
1133 } else 1138 } else
1134 QListView::keyPressEvent ( e ) ; 1139 QListView::keyPressEvent ( e ) ;
1135 e->accept(); 1140 e->accept();
1136 break; 1141 break;
1137 case Qt::Key_I: { 1142 case Qt::Key_I: {
1138 QListViewItem* cn; 1143 QListViewItem* cn;
1139 cn = currentItem(); 1144 cn = currentItem();
1140 if ( cn ) { 1145 if ( cn ) {
1141 KOListViewItem* ci = (KOListViewItem*)( cn ); 1146 KOListViewItem* ci = (KOListViewItem*)( cn );
1142 if ( ci ){ 1147 if ( ci ){
1143 //emit showIncidence( ci->data()); 1148 //emit showIncidence( ci->data());
1144 cn = cn->nextSibling(); 1149 cn = cn->nextSibling();
1145 if ( cn ) { 1150 if ( cn ) {
1146 setCurrentItem ( cn ); 1151 setCurrentItem ( cn );
1147 ensureItemVisible ( cn ); 1152 ensureItemVisible ( cn );
1148 } 1153 }
1149 emit showIncidence( ci->data()); 1154 emit showIncidence( ci->data());
1150 } 1155 }
1151 } 1156 }
1152 e->accept(); 1157 e->accept();
1153 } 1158 }
1154 break; 1159 break;
1155 case Qt::Key_Return: 1160 case Qt::Key_Return:
1156 case Qt::Key_Enter: 1161 case Qt::Key_Enter:
1157 { 1162 {
1158 QListViewItem* cn; 1163 QListViewItem* cn;
1159 cn = currentItem(); 1164 cn = currentItem();
1160 if ( cn ) { 1165 if ( cn ) {
1161 KOListViewItem* ci = (KOListViewItem*)( cn ); 1166 KOListViewItem* ci = (KOListViewItem*)( cn );
1162 if ( ci ){ 1167 if ( ci ){
1163 if ( e->state() == ShiftButton ) 1168 if ( e->state() == ShiftButton )
1164 ci->setSelected( false ); 1169 ci->setSelected( false );
1165 else 1170 else
1166 ci->setSelected( true ); 1171 ci->setSelected( true );
1167 cn = cn->nextSibling(); 1172 cn = cn->nextSibling();
1168 if ( cn ) { 1173 if ( cn ) {
1169 setCurrentItem ( cn ); 1174 setCurrentItem ( cn );
1170 ensureItemVisible ( cn ); 1175 ensureItemVisible ( cn );
1171 } 1176 }
1172 } 1177 }
1173 } 1178 }
1174 e->accept(); 1179 e->accept();
1175 } 1180 }
1176 break; 1181 break;
1177 default: 1182 default:
1178 e->ignore(); 1183 e->ignore();
1179 } 1184 }
1180} 1185}
1181KOListViewListView::KOListViewListView(KOListView * lv ) 1186KOListViewListView::KOListViewListView(KOListView * lv )
1182 : KListView( lv, "kolistlistview", false ) 1187 : KListView( lv, "kolistlistview", false )
1183{ 1188{
1189 mYMousePos = 0;
1184 mPopupTimer = new QTimer(this); 1190 mPopupTimer = new QTimer(this);
1185 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); 1191 connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu()));
1186#ifndef DESKTOP_VERSION 1192#ifndef DESKTOP_VERSION
1187 //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 1193 //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
1188#endif 1194#endif
1189 setSelectionMode( QListView::Multi ); 1195 setSelectionMode( QListView::Multi );
1190 setMultiSelection( true); 1196 setMultiSelection( true);
1191} 1197}
1192void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 1198void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
1193{ 1199{
1194 if (!e) return; 1200 if (!e) return;
1195 QPoint vp = contentsToViewport(e->pos()); 1201 QPoint vp = contentsToViewport(e->pos());
1196 QListViewItem *item = itemAt(vp); 1202 QListViewItem *item = itemAt(vp);
1197 if (!item) { 1203 if (!item) {
1198 emit newEvent(); 1204 emit newEvent();
1199 return; 1205 return;
1200 } 1206 }
1201 KListView::contentsMouseDoubleClickEvent(e); 1207 KListView::contentsMouseDoubleClickEvent(e);
1202} 1208}
1203#if 0 1209#if 0
1204void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) 1210void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
1205{ 1211{
1206 //qDebug("contentsMousePressEvent++++ "); 1212 //qDebug("contentsMousePressEvent++++ ");
1207 KListView::contentsMousePressEvent( e ); 1213 KListView::contentsMousePressEvent( e );
1208 if ( e->button() == RightButton ) { 1214 if ( e->button() == RightButton ) {
1209 QListViewItem* ci = currentItem(); 1215 QListViewItem* ci = currentItem();
1210 clearSelection () ; 1216 clearSelection () ;
1211 if ( ci ) 1217 if ( ci )
1212 ci->setSelected( true ); 1218 ci->setSelected( true );
1213 } 1219 }
1214} 1220}
1215void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) 1221void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
1216{ 1222{
1217 KListView::contentsMouseReleaseEvent(e); 1223 KListView::contentsMouseReleaseEvent(e);
1218} 1224}
1219void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) 1225void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
1220{ 1226{
1221 KListView::contentsMouseMoveEvent(e); 1227 KListView::contentsMouseMoveEvent(e);
1222} 1228}
1223#endif 1229#endif
1224void KOListViewListView::popupMenu() 1230void KOListViewListView::popupMenu()
1225{ 1231{
1226 mPopupTimer->stop(); 1232 mPopupTimer->stop();
1227 QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); 1233 QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton );
1228 QApplication::postEvent( this->viewport(), e ); 1234 QApplication::postEvent( this->viewport(), e );
1229 1235
1230} 1236}
1231void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) 1237void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
1232{ 1238{
1233 //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y()); 1239 //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y());
1234 mYMousePos = mapToGlobal( (e->pos())).y(); 1240 mYMousePos = mapToGlobal( (e->pos())).y();
1235 if ( e->button() == LeftButton ) { 1241 if ( e->button() == LeftButton ) {
1236 mPopupTimer->start( 600 ); 1242 mPopupTimer->start( 600 );
1237 mEventPos = contentsToViewport(e->pos()); 1243 mEventPos = contentsToViewport(e->pos());
1238 mEventGlobalPos = e->globalPos(); 1244 mEventGlobalPos = e->globalPos();
1239 } 1245 }
1240 KListView::contentsMousePressEvent( e ); 1246 KListView::contentsMousePressEvent( e );
1241 if ( e->button() == RightButton ) { 1247 if ( e->button() == RightButton ) {
1242 QListViewItem* ci = currentItem(); 1248 QListViewItem* ci = currentItem();
1243 //clearSelection(); 1249 //clearSelection();
1244 if ( ci ) 1250 if ( ci )
1245 ci->setSelected( true ); 1251 ci->setSelected( true );
1246 } 1252 }
1247} 1253}
1248void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) 1254void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
1249{ 1255{
1250 mPopupTimer->stop(); 1256 mPopupTimer->stop();
1251 KListView::contentsMouseReleaseEvent(e); 1257 KListView::contentsMouseReleaseEvent(e);
1252} 1258}
1253void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) 1259void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
1254{ 1260{
1255 // qDebug("contentsMouseMoveEv....... "); 1261 // qDebug("contentsMouseMoveEv....... ");
1256 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); 1262 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() );
1257 int diff = mYMousePos - mapToGlobal( (e->pos())).y(); 1263 int diff = mYMousePos - mapToGlobal( (e->pos())).y();
1258 if ( diff < 0 ) diff = -diff; 1264 if ( diff < 0 ) diff = -diff;
1259 if ( diff > 15 ) 1265 if ( diff > 15 )
1260 mPopupTimer->stop(); 1266 mPopupTimer->stop();
1261 else { 1267 else {
1262 mEventPos = contentsToViewport(e->pos()); 1268 mEventPos = contentsToViewport(e->pos());
1263 mEventGlobalPos = e->globalPos(); 1269 mEventGlobalPos = e->globalPos();
1264 } 1270 }
1265 KListView::contentsMouseMoveEvent(e); 1271 KListView::contentsMouseMoveEvent(e);
1266} 1272}
1267 1273
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h
index eb5bb6e..2051d60 100644
--- a/korganizer/kolistview.h
+++ b/korganizer/kolistview.h
@@ -1,141 +1,141 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1999 Preston Brown 3 Copyright (c) 1999 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#ifndef _KOLISTVIEW_H 24#ifndef _KOLISTVIEW_H
25#define _KOLISTVIEW_H 25#define _KOLISTVIEW_H
26 26
27#include <qlistview.h> 27#include <qlistview.h>
28#include <qmap.h> 28#include <qmap.h>
29#include <qdict.h> 29#include <qdict.h>
30 30
31#include <klistview.h> 31#include <klistview.h>
32 32
33#ifndef DESKTOP_VERSION 33#ifndef DESKTOP_VERSION
34#include <qtopia/ir.h> 34#include <qtopia/ir.h>
35#else 35#else
36#define Ir char 36#define Ir char
37#endif 37#endif
38#include <libkcal/incidence.h> 38#include <libkcal/incidence.h>
39 39
40#include "koeventview.h" 40#include "koeventview.h"
41#include "customlistviewitem.h" 41#include "customlistviewitem.h"
42 42
43using namespace KCal; 43using namespace KCal;
44 44
45 45class KOListViewWhatsThis;
46 46
47#include <qpushbutton.h> 47#include <qpushbutton.h>
48#include <qlayout.h> 48#include <qlayout.h>
49#include <qdialog.h> 49#include <qdialog.h>
50#include <qtimer.h> 50#include <qtimer.h>
51#include <qcombobox.h> 51#include <qcombobox.h>
52#include <qspinbox.h> 52#include <qspinbox.h>
53#include <qtooltip.h> 53#include <qtooltip.h>
54#include <qcheckbox.h> 54#include <qcheckbox.h>
55#include <qhbox.h> 55#include <qhbox.h>
56#include <qlabel.h> 56#include <qlabel.h>
57#include <kiconloader.h> 57#include <kiconloader.h>
58#include "kfiledialog.h" 58#include "kfiledialog.h"
59#include "koprefs.h" 59#include "koprefs.h"
60class KOAlarmPrefs : public QDialog 60class KOAlarmPrefs : public QDialog
61{ 61{
62 Q_OBJECT 62 Q_OBJECT
63 public: 63 public:
64 KOAlarmPrefs( QWidget *par=0, const char *name=0 ) : 64 KOAlarmPrefs( QWidget *par=0, const char *name=0 ) :
65 QDialog( par, name, true ) 65 QDialog( par, name, true )
66 { 66 {
67 setCaption( i18n("Alarm Options") ); 67 setCaption( i18n("Alarm Options") );
68 QVBoxLayout* alarmLayout = new QVBoxLayout( this ); 68 QVBoxLayout* alarmLayout = new QVBoxLayout( this );
69 alarmLayout->setSpacing( 3 ); 69 alarmLayout->setSpacing( 3 );
70 alarmLayout->setMargin( 3 ); 70 alarmLayout->setMargin( 3 );
71 QWidget *parent = this; 71 QWidget *parent = this;
72 mAlarmButton = new QCheckBox(i18n("Set reminder ON with offset to:"),parent); 72 mAlarmButton = new QCheckBox(i18n("Set reminder ON with offset to:"),parent);
73 alarmLayout->addWidget(mAlarmButton); 73 alarmLayout->addWidget(mAlarmButton);
74 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; 74 mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ;
75 mAlarmTimeEdit->setValue( 15 ); 75 mAlarmTimeEdit->setValue( 15 );
76 alarmLayout->addWidget(mAlarmTimeEdit); 76 alarmLayout->addWidget(mAlarmTimeEdit);
77 mAlarmIncrCombo = new QComboBox(false, parent); 77 mAlarmIncrCombo = new QComboBox(false, parent);
78 mAlarmIncrCombo->insertItem(i18n("minute(s)")); 78 mAlarmIncrCombo->insertItem(i18n("minute(s)"));
79 mAlarmIncrCombo->insertItem(i18n("hour(s)")); 79 mAlarmIncrCombo->insertItem(i18n("hour(s)"));
80 mAlarmIncrCombo->insertItem(i18n("day(s)")); 80 mAlarmIncrCombo->insertItem(i18n("day(s)"));
81 alarmLayout->addWidget(mAlarmIncrCombo); 81 alarmLayout->addWidget(mAlarmIncrCombo);
82 QHBox * hb = new QHBox ( parent ); 82 QHBox * hb = new QHBox ( parent );
83 alarmLayout->addWidget(hb); 83 alarmLayout->addWidget(hb);
84 mAlarmSoundButton = new QPushButton(hb); 84 mAlarmSoundButton = new QPushButton(hb);
85 mAlarmSoundButton->setPixmap(SmallIcon("playsound")); 85 mAlarmSoundButton->setPixmap(SmallIcon("playsound"));
86 mAlarmSoundButton->setToggleButton(true); 86 mAlarmSoundButton->setToggleButton(true);
87 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); 87 connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound()));
88 mAlarmProgramButton = new QPushButton(hb); 88 mAlarmProgramButton = new QPushButton(hb);
89 mAlarmProgramButton->setPixmap(SmallIcon("run")); 89 mAlarmProgramButton->setPixmap(SmallIcon("run"));
90 mAlarmProgramButton->setToggleButton(true); 90 mAlarmProgramButton->setToggleButton(true);
91 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); 91 connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram()));
92 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); 92 mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 );
93 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); 93 mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 );
94 mAlarmLabel = new QLabel( this ); 94 mAlarmLabel = new QLabel( this );
95 alarmLayout->addWidget( mAlarmLabel ); 95 alarmLayout->addWidget( mAlarmLabel );
96 mAlarmLabel->setText( "..."+KOPrefs::instance()->mDefaultAlarmFile.right( 30 ) ); 96 mAlarmLabel->setText( "..."+KOPrefs::instance()->mDefaultAlarmFile.right( 30 ) );
97 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; 97 mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile;
98 mAlarmSoundButton->setOn( true ); 98 mAlarmSoundButton->setOn( true );
99 QPushButton * ok = new QPushButton( i18n("Set Alarm!"), this ); 99 QPushButton * ok = new QPushButton( i18n("Set Alarm!"), this );
100 alarmLayout->addWidget( ok ); 100 alarmLayout->addWidget( ok );
101 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 101 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
102 alarmLayout->addWidget( cancel ); 102 alarmLayout->addWidget( cancel );
103 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 103 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
104 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 104 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
105 resize( 200, 200 ); 105 resize( 200, 200 );
106 106
107 } 107 }
108 108
109 109
110 110
111 QString mAlarmSound, mAlarmProgram ; 111 QString mAlarmSound, mAlarmProgram ;
112 QCheckBox* mAlarmButton; 112 QCheckBox* mAlarmButton;
113 QSpinBox* mAlarmTimeEdit; 113 QSpinBox* mAlarmTimeEdit;
114 QLabel* mAlarmLabel; 114 QLabel* mAlarmLabel;
115 QComboBox* mAlarmIncrCombo ; 115 QComboBox* mAlarmIncrCombo ;
116 QPushButton* mAlarmSoundButton ,*mAlarmProgramButton; 116 QPushButton* mAlarmSoundButton ,*mAlarmProgramButton;
117private slots: 117private slots:
118 118
119void pickAlarmSound() 119void pickAlarmSound()
120{ 120{
121 //QString prefix = mAlarmSound; 121 //QString prefix = mAlarmSound;
122 if (!mAlarmSoundButton->isOn()) { 122 if (!mAlarmSoundButton->isOn()) {
123 //mAlarmSound = ""; 123 //mAlarmSound = "";
124 QToolTip::remove(mAlarmSoundButton); 124 QToolTip::remove(mAlarmSoundButton);
125 QToolTip::add(mAlarmSoundButton, i18n("No sound set")); 125 QToolTip::add(mAlarmSoundButton, i18n("No sound set"));
126 mAlarmProgramButton->setOn(true); 126 mAlarmProgramButton->setOn(true);
127 mAlarmSoundButton->setOn(false); 127 mAlarmSoundButton->setOn(false);
128 } else { 128 } else {
129 QString fileName(KFileDialog::getOpenFileName(mAlarmSound, 129 QString fileName(KFileDialog::getOpenFileName(mAlarmSound,
130 i18n("*.wav|Wav Files"), 0)); 130 i18n("*.wav|Wav Files"), 0));
131 if (!fileName.isEmpty()) { 131 if (!fileName.isEmpty()) {
132 mAlarmSound = fileName; 132 mAlarmSound = fileName;
133 mAlarmLabel->setText( "..."+fileName.right( 30 ) ); 133 mAlarmLabel->setText( "..."+fileName.right( 30 ) );
134 QToolTip::remove(mAlarmSoundButton); 134 QToolTip::remove(mAlarmSoundButton);
135 QString dispStr = i18n("Playing '%1'").arg(fileName); 135 QString dispStr = i18n("Playing '%1'").arg(fileName);
136 QToolTip::add(mAlarmSoundButton, dispStr); 136 QToolTip::add(mAlarmSoundButton, dispStr);
137 mAlarmProgramButton->setOn(false); 137 mAlarmProgramButton->setOn(false);
138 mAlarmSoundButton->setOn(true); 138 mAlarmSoundButton->setOn(true);
139 } else { 139 } else {
140 mAlarmProgramButton->setOn(true); 140 mAlarmProgramButton->setOn(true);
141 mAlarmSoundButton->setOn(false); 141 mAlarmSoundButton->setOn(false);
@@ -207,105 +207,106 @@ class ListItemVisitor : public Incidence::Visitor
207 @short multi-column list view of various events. 207 @short multi-column list view of various events.
208 @author Preston Brown <pbrown@kde.org> 208 @author Preston Brown <pbrown@kde.org>
209 @see KOBaseView, KODayListView 209 @see KOBaseView, KODayListView
210*/ 210*/
211class KOListView; 211class KOListView;
212 212
213class KOListViewListView : public KListView 213class KOListViewListView : public KListView
214{ 214{
215 Q_OBJECT 215 Q_OBJECT
216 public: 216 public:
217 KOListViewListView(KOListView * lv ); 217 KOListViewListView(KOListView * lv );
218 signals: 218 signals:
219 void newEvent(); 219 void newEvent();
220 void showIncidence( Incidence* ); 220 void showIncidence( Incidence* );
221 public slots: 221 public slots:
222 void popupMenu(); 222 void popupMenu();
223 private: 223 private:
224 QPoint mEventPos; 224 QPoint mEventPos;
225 QPoint mEventGlobalPos; 225 QPoint mEventGlobalPos;
226 QTimer* mPopupTimer; 226 QTimer* mPopupTimer;
227 int mYMousePos; 227 int mYMousePos;
228 void keyPressEvent ( QKeyEvent * ) ; 228 void keyPressEvent ( QKeyEvent * ) ;
229 void contentsMouseDoubleClickEvent(QMouseEvent *e); 229 void contentsMouseDoubleClickEvent(QMouseEvent *e);
230 void contentsMousePressEvent(QMouseEvent *e); 230 void contentsMousePressEvent(QMouseEvent *e);
231 void contentsMouseReleaseEvent(QMouseEvent *e); 231 void contentsMouseReleaseEvent(QMouseEvent *e);
232 void contentsMouseMoveEvent(QMouseEvent *e); 232 void contentsMouseMoveEvent(QMouseEvent *e);
233 bool mMouseDown; 233 bool mMouseDown;
234}; 234};
235 235
236class KOListView : public KOEventView 236class KOListView : public KOEventView
237{ 237{
238 Q_OBJECT 238 Q_OBJECT
239 public: 239 public:
240 KOListView(Calendar *calendar, QWidget *parent = 0, 240 KOListView(Calendar *calendar, QWidget *parent = 0,
241 const char *name = 0); 241 const char *name = 0);
242 ~KOListView(); 242 ~KOListView();
243 243
244 virtual int maxDatesHint(); 244 virtual int maxDatesHint();
245 virtual int currentDateCount(); 245 virtual int currentDateCount();
246 virtual QPtrList<Incidence> selectedIncidences(); 246 virtual QPtrList<Incidence> selectedIncidences();
247 virtual DateList selectedDates(); 247 virtual DateList selectedDates();
248 248
249 void showDates(bool show); 249 void showDates(bool show);
250 Incidence* currentItem(); 250 Incidence* currentItem();
251 void addTodos(QPtrList<Todo> eventList); 251 void addTodos(QPtrList<Todo> eventList);
252 void addJournals(QPtrList<Journal> eventList); 252 void addJournals(QPtrList<Journal> eventList);
253 virtual void printPreview(CalPrinter *calPrinter, 253 virtual void printPreview(CalPrinter *calPrinter,
254 const QDate &, const QDate &); 254 const QDate &, const QDate &);
255 255
256 void readSettings(KConfig *config, QString setting = "KOListView Layout"); 256 void readSettings(KConfig *config, QString setting = "KOListView Layout");
257 void writeSettings(KConfig *config, QString setting = "KOListView Layout"); 257 void writeSettings(KConfig *config, QString setting = "KOListView Layout");
258 void updateList(); 258 void updateList();
259 void setStartDate(const QDate &start); 259 void setStartDate(const QDate &start);
260 int count(); 260 int count();
261 QString getWhatsThisText(QPoint p); 261 QString getWhatsThisText(QPoint p);
262 signals: 262 signals:
263 void signalNewEvent(); 263 void signalNewEvent();
264 void beamIncidenceList(QPtrList<Incidence>); 264 void beamIncidenceList(QPtrList<Incidence>);
265 265
266 public slots: 266 public slots:
267 void resetFocus(); 267 void resetFocus();
268 virtual void updateView(); 268 virtual void updateView();
269 virtual void showDates(const QDate &start, const QDate &end); 269 virtual void showDates(const QDate &start, const QDate &end);
270 virtual void showEvents(QPtrList<Event> eventList); 270 virtual void showEvents(QPtrList<Event> eventList);
271 void clearSelection(); 271 void clearSelection();
272 void allSelection(); 272 void allSelection();
273 273
274 void clear(); 274 void clear();
275 void beamDone( Ir *ir ); 275 void beamDone( Ir *ir );
276 void showDates(); 276 void showDates();
277 void hideDates(); 277 void hideDates();
278 void deleteAll(); 278 void deleteAll();
279 void saveToFile(); 279 void saveToFile();
280 void saveToFileVCS(); 280 void saveToFileVCS();
281 void saveDescriptionToFile(); 281 void saveDescriptionToFile();
282 void beamSelected(); 282 void beamSelected();
283 void updateConfig(); 283 void updateConfig();
284 void addCat(); 284 void addCat();
285 void setCat(); 285 void setCat();
286 void setAlarm(); 286 void setAlarm();
287 void setCategories( bool removeOld ); 287 void setCategories( bool removeOld );
288 void changeEventDisplay(Event *, int); 288 void changeEventDisplay(Event *, int);
289 289
290 void defaultItemAction(QListViewItem *item); 290 void defaultItemAction(QListViewItem *item);
291 void popupMenu(QListViewItem *item,const QPoint &,int); 291 void popupMenu(QListViewItem *item,const QPoint &,int);
292 292
293 protected slots: 293 protected slots:
294 void processSelectionChange(QListViewItem *); 294 void processSelectionChange(QListViewItem *);
295 295
296 protected: 296 protected:
297 void writeToFile( bool iCal ); 297 void writeToFile( bool iCal );
298 void addEvents(QPtrList<Event> eventList); 298 void addEvents(QPtrList<Event> eventList);
299 void addIncidence(Incidence *); 299 void addIncidence(Incidence *);
300 KOListViewItem *getItemForEvent(Event *event); 300 KOListViewItem *getItemForEvent(Event *event);
301 301
302 private: 302 private:
303 KOListViewWhatsThis *mKOListViewWhatsThis;
303 KOListViewListView *mListView; 304 KOListViewListView *mListView;
304 KOEventPopupMenu *mPopupMenu; 305 KOEventPopupMenu *mPopupMenu;
305 KOListViewItem *mActiveItem; 306 KOListViewItem *mActiveItem;
306 QDict<Incidence> mUidDict; 307 QDict<Incidence> mUidDict;
307 QDate mStartDate; 308 QDate mStartDate;
308 void keyPressEvent ( QKeyEvent * ) ; 309 void keyPressEvent ( QKeyEvent * ) ;
309}; 310};
310 311
311#endif 312#endif
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index ae61db6..7927307 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1,188 +1,192 @@
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 <qpopupmenu.h> 20#include <qpopupmenu.h>
21#include <qfont.h> 21#include <qfont.h>
22#include <qfontmetrics.h> 22#include <qfontmetrics.h>
23#include <qkeycode.h> 23#include <qkeycode.h>
24#include <qhbox.h> 24#include <qhbox.h>
25#include <qvbox.h> 25#include <qvbox.h>
26#include <qwidgetstack.h> 26#include <qwidgetstack.h>
27#include <qpushbutton.h> 27#include <qpushbutton.h>
28#include <qtooltip.h> 28#include <qtooltip.h>
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qwhatsthis.h> 31#include <qwhatsthis.h>
32#ifndef DESKTOP_VERSION 32#ifndef DESKTOP_VERSION
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#else 34#else
35#include <qapplication.h> 35#include <qapplication.h>
36#endif 36#endif
37 37
38#include <kdebug.h> 38#include <kdebug.h>
39#include <klocale.h> 39#include <klocale.h>
40#include <kglobal.h> 40#include <kglobal.h>
41#include <kconfig.h> 41#include <kconfig.h>
42#include <kiconloader.h> 42#include <kiconloader.h>
43 43
44#include <kcalendarsystem.h> 44#include <kcalendarsystem.h>
45 45
46#ifndef KORG_NOPRINTER 46#ifndef KORG_NOPRINTER
47#include "calprinter.h" 47#include "calprinter.h"
48#endif 48#endif
49#include "koprefs.h" 49#include "koprefs.h"
50#ifndef KORG_NOPLUGINS 50#ifndef KORG_NOPLUGINS
51#include "kocore.h" 51#include "kocore.h"
52#endif 52#endif
53#include "koglobals.h" 53#include "koglobals.h"
54#include <libkcal/kincidenceformatter.h> 54#include <libkcal/kincidenceformatter.h>
55 55
56#include "komonthview.h" 56#include "komonthview.h"
57 57
58#define PIXMAP_SIZE 5 58#define PIXMAP_SIZE 5
59#ifdef DESKTOP_VERSION 59#ifdef DESKTOP_VERSION
60QToolTipGroup *MonthViewCell::mToolTipGroup = 0; 60QToolTipGroup *MonthViewCell::mToolTipGroup = 0;
61#endif 61#endif
62class KNOWhatsThis :public QWhatsThis 62class KNOWhatsThis :public QWhatsThis
63{ 63{
64public: 64public:
65 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; 65 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { };
66 //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); }; 66 //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); };
67 67
68protected: 68protected:
69 virtual QString text( const QPoint& p) 69 virtual QString text( const QPoint& p)
70 { 70 {
71 return _wid->getWhatsThisText(p) ; 71 return _wid->getWhatsThisText(p) ;
72 }; 72 };
73private: 73private:
74 KNoScrollListBox* _wid; 74 KNoScrollListBox* _wid;
75 75
76}; 76};
77 77
78 78
79KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) 79KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
80 : QListBox(parent, name, WRepaintNoErase) 80 : QListBox(parent, name, WRepaintNoErase)
81{ 81{
82#ifndef DESKTOP_VERSION 82#ifndef DESKTOP_VERSION
83 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 83 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
84#endif 84#endif
85 mWT = new KNOWhatsThis(this); 85 mWT = new KNOWhatsThis(this);
86 resetOnFocusIn = true; 86 resetOnFocusIn = true;
87 setVScrollBarMode(QScrollView::AlwaysOff); 87 setVScrollBarMode(QScrollView::AlwaysOff);
88 setHScrollBarMode(QScrollView::AlwaysOff); 88 setHScrollBarMode(QScrollView::AlwaysOff);
89} 89}
90KNoScrollListBox::~KNoScrollListBox() 90KNoScrollListBox::~KNoScrollListBox()
91{ 91{
92 92#if QT_VERSION >= 0x030000
93
94#else
95 delete mWT;
96#endif
93} 97}
94 98
95 99
96void KNoScrollListBox::focusInEvent ( QFocusEvent * e ) 100void KNoScrollListBox::focusInEvent ( QFocusEvent * e )
97{ 101{
98 QListBox::focusInEvent ( e ); 102 QListBox::focusInEvent ( e );
99 if ( count() ){ 103 if ( count() ){
100 int ci = currentItem(); 104 int ci = currentItem();
101 if ( ci < 0 ) ci = 0; 105 if ( ci < 0 ) ci = 0;
102 106
103 setCurrentItem( ci ); 107 setCurrentItem( ci );
104 setSelected ( ci, true ); 108 setSelected ( ci, true );
105 emit highlighted( item ( ci ) ); 109 emit highlighted( item ( ci ) );
106 110
107 resetOnFocusIn = true; 111 resetOnFocusIn = true;
108 112
109 if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) { 113 if ( KOPrefs::instance()->mEnableMonthScroll || KOPrefs::instance()->mMonthViewWeek ) {
110 QListBoxItem *fi = firstItem (); 114 QListBoxItem *fi = firstItem ();
111 if (fi ) { 115 if (fi ) {
112 int ihei = fi->height( this ); 116 int ihei = fi->height( this );
113 int hei = numRows () * ihei; 117 int hei = numRows () * ihei;
114 if ( hei < height() - horizontalScrollBar()->height () ) { 118 if ( hei < height() - horizontalScrollBar()->height () ) {
115 setVScrollBarMode(QScrollView::AlwaysOff); 119 setVScrollBarMode(QScrollView::AlwaysOff);
116 } 120 }
117 else 121 else
118 setVScrollBarMode(QScrollView::Auto); 122 setVScrollBarMode(QScrollView::Auto);
119 if ( ihei *3 > height() ) { 123 if ( ihei *3 > height() ) {
120 setHScrollBarMode(QScrollView::AlwaysOff); 124 setHScrollBarMode(QScrollView::AlwaysOff);
121 } 125 }
122 else { 126 else {
123 setHScrollBarMode(QScrollView::Auto); 127 setHScrollBarMode(QScrollView::Auto);
124 } 128 }
125 } else { 129 } else {
126 setVScrollBarMode(QScrollView::Auto); 130 setVScrollBarMode(QScrollView::Auto);
127 setHScrollBarMode(QScrollView::Auto); 131 setHScrollBarMode(QScrollView::Auto);
128 } 132 }
129 } 133 }
130 } 134 }
131} 135}
132void KNoScrollListBox::focusOutEvent ( QFocusEvent * e ) 136void KNoScrollListBox::focusOutEvent ( QFocusEvent * e )
133{ 137{
134 int i = currentItem (); 138 int i = currentItem ();
135 if ( i >= 0 ) { 139 if ( i >= 0 ) {
136 setSelected ( i, false ); 140 setSelected ( i, false );
137 } 141 }
138 QListBox::focusOutEvent ( e ); 142 QListBox::focusOutEvent ( e );
139 setVScrollBarMode(QScrollView::AlwaysOff); 143 setVScrollBarMode(QScrollView::AlwaysOff);
140 setHScrollBarMode(QScrollView::AlwaysOff); 144 setHScrollBarMode(QScrollView::AlwaysOff);
141} 145}
142 146
143QString KNoScrollListBox::getWhatsThisText(QPoint p) 147QString KNoScrollListBox::getWhatsThisText(QPoint p)
144{ 148{
145 QListBoxItem* item = itemAt ( p ); 149 QListBoxItem* item = itemAt ( p );
146 if ( ! item ) { 150 if ( ! item ) {
147 return i18n("Click in the cell\nto add an event!"); 151 return i18n("Click in the cell\nto add an event!");
148 } 152 }
149 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(), 153 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence(),
150 KOPrefs::instance()->mWTshowDetails, 154 KOPrefs::instance()->mWTshowDetails,
151 KOPrefs::instance()->mWTshowCreated, 155 KOPrefs::instance()->mWTshowCreated,
152 KOPrefs::instance()->mWTshowChanged); 156 KOPrefs::instance()->mWTshowChanged);
153} 157}
154void KNoScrollListBox::keyPressEvent(QKeyEvent *e) 158void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
155{ 159{
156 //qDebug("KNoScrollListBox::keyPressEvent "); 160 //qDebug("KNoScrollListBox::keyPressEvent ");
157 switch(e->key()) { 161 switch(e->key()) {
158 case Key_Right: 162 case Key_Right:
159 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 163 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
160 { 164 {
161 e->ignore(); 165 e->ignore();
162 return; 166 return;
163 } 167 }
164 scrollBy(10,0); 168 scrollBy(10,0);
165 break; 169 break;
166 case Key_Left: 170 case Key_Left:
167 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 171 if (e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
168 { 172 {
169 e->ignore(); 173 e->ignore();
170 return; 174 return;
171 } 175 }
172 scrollBy(-10,0); 176 scrollBy(-10,0);
173 break; 177 break;
174 case Key_Up: 178 case Key_Up:
175 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) { 179 if( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton) {
176 e->ignore(); 180 e->ignore();
177 break; 181 break;
178 } 182 }
179 if ( count() ) { 183 if ( count() ) {
180 if ( currentItem() == 0 ) { 184 if ( currentItem() == 0 ) {
181 emit prevCell(); 185 emit prevCell();
182 } else { 186 } else {
183 setCurrentItem((currentItem()+count()-1)%count()); 187 setCurrentItem((currentItem()+count()-1)%count());
184 if(!itemVisible(currentItem())) { 188 if(!itemVisible(currentItem())) {
185 if((unsigned int) currentItem() == (count()-1)) { 189 if((unsigned int) currentItem() == (count()-1)) {
186 setTopItem(currentItem()-numItemsVisible()+1); 190 setTopItem(currentItem()-numItemsVisible()+1);
187 } else { 191 } else {
188 setTopItem(topItem()-1); 192 setTopItem(topItem()-1);
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index f26d16d..e95039d 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -495,193 +495,199 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
495 SLOT (reparentTodo()),0,22); 495 SLOT (reparentTodo()),0,22);
496 mItemPopupMenu->insertSeparator(); 496 mItemPopupMenu->insertSeparator();
497#if 0 497#if 0
498 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), 498 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"),
499 this, SLOT( purgeCompleted() ) ); 499 this, SLOT( purgeCompleted() ) );
500 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), 500 mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"),
501 this, SLOT( toggleCompleted() ),0, 33 ); 501 this, SLOT( toggleCompleted() ),0, 33 );
502 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 502 mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
503 this, SLOT( toggleQuickTodo() ),0, 34 ); 503 this, SLOT( toggleQuickTodo() ),0, 34 );
504 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 504 mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
505 this, SLOT( toggleRunning() ),0, 35 ); 505 this, SLOT( toggleRunning() ),0, 35 );
506 506
507#endif 507#endif
508 mPopupMenu = new QPopupMenu(this); 508 mPopupMenu = new QPopupMenu(this);
509 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, 509 mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this,
510 SLOT (newTodo()),0,1); 510 SLOT (newTodo()),0,1);
511 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), 511 mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"),
512 this, SLOT(purgeCompleted()),0,2); 512 this, SLOT(purgeCompleted()),0,2);
513 mPopupMenu->insertItem(i18n("Show Completed"), 513 mPopupMenu->insertItem(i18n("Show Completed"),
514 this, SLOT( toggleCompleted() ),0,3 ); 514 this, SLOT( toggleCompleted() ),0,3 );
515 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), 515 mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"),
516 this, SLOT( toggleRunning() ),0,5 ); 516 this, SLOT( toggleRunning() ),0,5 );
517 mPopupMenu->insertItem(i18n(" set all open","Display all opened"), 517 mPopupMenu->insertItem(i18n(" set all open","Display all opened"),
518 this, SLOT( setAllOpen() ),0,6 ); 518 this, SLOT( setAllOpen() ),0,6 );
519 mPopupMenu->insertItem(i18n(" set all close","Display all closed"), 519 mPopupMenu->insertItem(i18n(" set all close","Display all closed"),
520 this, SLOT( setAllClose() ),0,7 ); 520 this, SLOT( setAllClose() ),0,7 );
521 mPopupMenu->insertItem(i18n(" set all flat","Display all flat"), 521 mPopupMenu->insertItem(i18n(" set all flat","Display all flat"),
522 this, SLOT( setAllFlat() ),0,8 ); 522 this, SLOT( setAllFlat() ),0,8 );
523 mPopupMenu->insertSeparator(); 523 mPopupMenu->insertSeparator();
524 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), 524 mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"),
525 this, SLOT( toggleQuickTodo() ),0,4 ); 525 this, SLOT( toggleQuickTodo() ),0,4 );
526 mDocPrefs = new DocPrefs( name ); 526 mDocPrefs = new DocPrefs( name );
527 527
528 mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu ); 528 mItemPopupMenu->insertItem(i18n("Todo View"),mPopupMenu );
529 mPopupMenu->setCheckable( true ); 529 mPopupMenu->setCheckable( true );
530 mItemPopupMenu->setCheckable( true ); 530 mItemPopupMenu->setCheckable( true );
531 531
532 532
533 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo ); 533 mPopupMenu->setItemChecked( 3,KOPrefs::instance()->mShowCompletedTodo );
534 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo ); 534 mItemPopupMenu->setItemChecked( 33 , KOPrefs::instance()->mShowCompletedTodo );
535 535
536 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo); 536 mPopupMenu->setItemChecked(4,KOPrefs::instance()->mEnableQuickTodo);
537 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo ); 537 mItemPopupMenu->setItemChecked( 34 , KOPrefs::instance()->mEnableQuickTodo );
538 538
539 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos); 539 mPopupMenu->setItemChecked(5,KOPrefs::instance()->mHideNonStartedTodos);
540 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos ); 540 mItemPopupMenu->setItemChecked( 35 , KOPrefs::instance()->mHideNonStartedTodos );
541 541
542 542
543 // Double clicking conflicts with opening/closing the subtree 543 // Double clicking conflicts with opening/closing the subtree
544 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ), 544 connect( mTodoListView, SIGNAL( doubleClicked( QListViewItem *) ),
545 SLOT( editItem( QListViewItem *) ) ); 545 SLOT( editItem( QListViewItem *) ) );
546 /* 546 /*
547 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *, 547 connect( mTodoListView, SIGNAL( rightButtonClicked ( QListViewItem *,
548 const QPoint &,int ) ), 548 const QPoint &,int ) ),
549 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 549 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
550 */ 550 */
551 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *, 551 connect( mTodoListView, SIGNAL( contextRequest ( QListViewItem *,
552 const QPoint &,int ) ), 552 const QPoint &,int ) ),
553 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) ); 553 SLOT( popupMenu( QListViewItem *, const QPoint & ,int) ) );
554 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ), 554 connect( mTodoListView, SIGNAL( clicked( QListViewItem * ) ),
555 SLOT( itemClicked( QListViewItem * ) ) ); 555 SLOT( itemClicked( QListViewItem * ) ) );
556 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ), 556 connect( mTodoListView, SIGNAL( double_Clicked( QListViewItem * ) ),
557 SLOT( itemDoubleClicked( QListViewItem * ) ) ); 557 SLOT( itemDoubleClicked( QListViewItem * ) ) );
558 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 558 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
559 SLOT( updateView() ) ); 559 SLOT( updateView() ) );
560 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ), 560 connect( mTodoListView, SIGNAL( todoDropped( Todo *, int ) ),
561 SLOT( todoModified(Todo *, int) ) ); 561 SLOT( todoModified(Todo *, int) ) );
562 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ), 562 connect( mTodoListView, SIGNAL( expanded( QListViewItem * ) ),
563 SLOT( itemStateChanged( QListViewItem * ) ) ); 563 SLOT( itemStateChanged( QListViewItem * ) ) );
564 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ), 564 connect( mTodoListView, SIGNAL( collapsed( QListViewItem * ) ),
565 SLOT( itemStateChanged( QListViewItem * ) ) ); 565 SLOT( itemStateChanged( QListViewItem * ) ) );
566 connect( mTodoListView, SIGNAL( paintNeeded() ), 566 connect( mTodoListView, SIGNAL( paintNeeded() ),
567 SLOT( paintNeeded()) ); 567 SLOT( paintNeeded()) );
568 568
569#if 0 569#if 0
570 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)), 570 connect(mTodoListView,SIGNAL(selectionChanged(QListViewItem *)),
571 SLOT(selectionChanged(QListViewItem *))); 571 SLOT(selectionChanged(QListViewItem *)));
572 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)), 572 connect(mTodoListView,SIGNAL(clicked(QListViewItem *)),
573 SLOT(selectionChanged(QListViewItem *))); 573 SLOT(selectionChanged(QListViewItem *)));
574 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)), 574 connect(mTodoListView,SIGNAL(pressed(QListViewItem *)),
575 SLOT(selectionChanged(QListViewItem *))); 575 SLOT(selectionChanged(QListViewItem *)));
576#endif 576#endif
577 577
578 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) )); 578 connect( mTodoListView, SIGNAL(reparentTodoSignal( Todo *,Todo * ) ), SIGNAL(reparentTodoSignal( Todo *,Todo * ) ));
579 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) )); 579 connect( mTodoListView, SIGNAL(unparentTodoSignal(Todo *) ), SIGNAL(unparentTodoSignal(Todo *) ));
580 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) )); 580 connect( mTodoListView, SIGNAL( deleteTodo(Todo *) ), SIGNAL(deleteTodoSignal(Todo *) ));
581 581
582 connect( mTodoListView, SIGNAL(selectionChanged() ), 582 connect( mTodoListView, SIGNAL(selectionChanged() ),
583 SLOT( processSelectionChange() ) ); 583 SLOT( processSelectionChange() ) );
584 connect( mQuickAdd, SIGNAL( returnPressed () ), 584 connect( mQuickAdd, SIGNAL( returnPressed () ),
585 SLOT( addQuickTodo() ) ); 585 SLOT( addQuickTodo() ) );
586 586
587} 587}
588 588
589KOTodoView::~KOTodoView() 589KOTodoView::~KOTodoView()
590{ 590{
591 // delete mKOTodoViewWhatsThis; 591
592#if QT_VERSION >= 0x030000
593
594#else
595 delete mKOTodoViewWhatsThis;
596#endif
597
592 delete mDocPrefs; 598 delete mDocPrefs;
593} 599}
594QString KOTodoView::getWhatsThisText(QPoint p) 600QString KOTodoView::getWhatsThisText(QPoint p)
595{ 601{
596 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p ); 602 KOTodoViewItem* item = ( KOTodoViewItem* ) mTodoListView->itemAt( p );
597 if ( item ) 603 if ( item )
598 return KIncidenceFormatter::instance()->getFormattedText( item->todo(), 604 return KIncidenceFormatter::instance()->getFormattedText( item->todo(),
599 KOPrefs::instance()->mWTshowDetails, 605 KOPrefs::instance()->mWTshowDetails,
600 KOPrefs::instance()->mWTshowCreated, 606 KOPrefs::instance()->mWTshowCreated,
601 KOPrefs::instance()->mWTshowChanged); 607 KOPrefs::instance()->mWTshowChanged);
602 return i18n("That is the todo view" ); 608 return i18n("That is the todo view" );
603 609
604} 610}
605 611
606void KOTodoView::jumpToDate () 612void KOTodoView::jumpToDate ()
607{ 613{
608 // if (mActiveItem) { 614 // if (mActiveItem) {
609// mActiveItem->todo()); 615// mActiveItem->todo());
610// if ( mActiveItem->todo()->hasDueDate() ) 616// if ( mActiveItem->todo()->hasDueDate() )
611// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() ); 617// emit mActiveItem->todo()jumpToTime( mTodo->dtDue().date() );
612} 618}
613void KOTodoView::paintNeeded() 619void KOTodoView::paintNeeded()
614{ 620{
615 if ( mPendingUpdateBeforeRepaint ) { 621 if ( mPendingUpdateBeforeRepaint ) {
616 updateView(); 622 updateView();
617 mPendingUpdateBeforeRepaint = false; 623 mPendingUpdateBeforeRepaint = false;
618 } 624 }
619} 625}
620void KOTodoView::paintEvent(QPaintEvent * pevent) 626void KOTodoView::paintEvent(QPaintEvent * pevent)
621{ 627{
622 if ( mPendingUpdateBeforeRepaint ) { 628 if ( mPendingUpdateBeforeRepaint ) {
623 updateView(); 629 updateView();
624 mPendingUpdateBeforeRepaint = false; 630 mPendingUpdateBeforeRepaint = false;
625 } 631 }
626 KOrg::BaseView::paintEvent( pevent); 632 KOrg::BaseView::paintEvent( pevent);
627} 633}
628 634
629void KOTodoView::updateView() 635void KOTodoView::updateView()
630{ 636{
631 pendingSubtodo = 0; 637 pendingSubtodo = 0;
632 if ( mBlockUpdate ) { 638 if ( mBlockUpdate ) {
633 return; 639 return;
634 } 640 }
635 if ( !isVisible() ) { 641 if ( !isVisible() ) {
636 mPendingUpdateBeforeRepaint = true; 642 mPendingUpdateBeforeRepaint = true;
637 return; 643 return;
638 } 644 }
639 storeCurrentItem(); 645 storeCurrentItem();
640 //qDebug("KOTodoView::updateView() %x", this); 646 //qDebug("KOTodoView::updateView() %x", this);
641 if ( isFlatDisplay ) { 647 if ( isFlatDisplay ) {
642 displayAllFlat(); 648 displayAllFlat();
643 resetCurrentItem(); 649 resetCurrentItem();
644 return; 650 return;
645 } 651 }
646 //qDebug("update "); 652 //qDebug("update ");
647// kdDebug() << "KOTodoView::updateView()" << endl; 653// kdDebug() << "KOTodoView::updateView()" << endl;
648 QFont fo = KOPrefs::instance()->mTodoViewFont; 654 QFont fo = KOPrefs::instance()->mTodoViewFont;
649 655
650 656
651 mTodoListView->clear(); 657 mTodoListView->clear();
652 if ( mName == "todolistsmall" ) { 658 if ( mName == "todolistsmall" ) {
653 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) { 659 if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
654 int ps = fo.pointSize() -2; 660 int ps = fo.pointSize() -2;
655 if ( ps > 12 ) 661 if ( ps > 12 )
656 ps -= 2; 662 ps -= 2;
657 fo.setPointSize( ps ); 663 fo.setPointSize( ps );
658 } 664 }
659 } 665 }
660 666
661 mTodoListView->setFont( fo ); 667 mTodoListView->setFont( fo );
662 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont ); 668 // QFontMetrics fm ( KOPrefs::instance()->mTodoViewFont );
663 //mTodoListView->header()->setMaximumHeight(fm.height()); 669 //mTodoListView->header()->setMaximumHeight(fm.height());
664 QPtrList<Todo> todoList = calendar()->todos(); 670 QPtrList<Todo> todoList = calendar()->todos();
665 671
666/* 672/*
667 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl; 673 kdDebug() << "KOTodoView::updateView(): Todo List:" << endl;
668 Event *t; 674 Event *t;
669 for(t = todoList.first(); t; t = todoList.next()) { 675 for(t = todoList.first(); t; t = todoList.next()) {
670 kdDebug() << " " << t->getSummary() << endl; 676 kdDebug() << " " << t->getSummary() << endl;
671 677
672 if (t->getRelatedTo()) { 678 if (t->getRelatedTo()) {
673 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl; 679 kdDebug() << " (related to " << t->getRelatedTo()->getSummary() << ")" << endl;
674 } 680 }
675 681
676 QPtrList<Event> l = t->getRelations(); 682 QPtrList<Event> l = t->getRelations();
677 Event *c; 683 Event *c;
678 for(c=l.first();c;c=l.next()) { 684 for(c=l.first();c;c=l.next()) {
679 kdDebug() << " - relation: " << c->getSummary() << endl; 685 kdDebug() << " - relation: " << c->getSummary() << endl;
680 } 686 }
681 } 687 }
682*/ 688*/
683 689
684 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a 690 // Put for each Event a KOTodoViewItem in the list view. Don't rely on a
685 // specific order of events. That means that we have to generate parent items 691 // specific order of events. That means that we have to generate parent items
686 // recursively for proper hierarchical display of Todos. 692 // recursively for proper hierarchical display of Todos.
687 mTodoMap.clear(); 693 mTodoMap.clear();
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 87cef20..68e5e5a 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -497,192 +497,198 @@ void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
497 497
498 if ( cmsg == "-writeFile" ) { 498 if ( cmsg == "-writeFile" ) {
499 // I made from the "-writeFile" an "-writeAlarm" 499 // I made from the "-writeFile" an "-writeAlarm"
500 mView->viewManager()->showWhatsNextView(); 500 mView->viewManager()->showWhatsNextView();
501 mCalendar->checkAlarmForIncidence( 0, true); 501 mCalendar->checkAlarmForIncidence( 0, true);
502 showMaximized(); 502 showMaximized();
503 raise(); 503 raise();
504 return; 504 return;
505 505
506 } 506 }
507 if ( cmsg == "-writeFileSilent" ) { 507 if ( cmsg == "-writeFileSilent" ) {
508 // I made from the "-writeFile" an "-writeAlarm" 508 // I made from the "-writeFile" an "-writeAlarm"
509 // mView->viewManager()->showWhatsNextView(); 509 // mView->viewManager()->showWhatsNextView();
510 mCalendar->checkAlarmForIncidence( 0, true); 510 mCalendar->checkAlarmForIncidence( 0, true);
511 //showMaximized(); 511 //showMaximized();
512 //raise(); 512 //raise();
513 hide(); 513 hide();
514 return; 514 return;
515 } 515 }
516 if ( cmsg == "-newCountdown" ) { 516 if ( cmsg == "-newCountdown" ) {
517 qDebug("newCountdown "); 517 qDebug("newCountdown ");
518 518
519 } 519 }
520 QString msg ; 520 QString msg ;
521 QString allmsg = cmsg; 521 QString allmsg = cmsg;
522 while ( allmsg.length() > 0 ) { 522 while ( allmsg.length() > 0 ) {
523 int nextC = allmsg.find( "-", 1 ); 523 int nextC = allmsg.find( "-", 1 );
524 if ( nextC == -1 ) { 524 if ( nextC == -1 ) {
525 msg = allmsg; 525 msg = allmsg;
526 allmsg = ""; 526 allmsg = "";
527 } else{ 527 } else{
528 msg = allmsg.left( nextC ); 528 msg = allmsg.left( nextC );
529 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 529 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
530 } 530 }
531 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 531 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
532 if ( msg == "-newEvent" ) { 532 if ( msg == "-newEvent" ) {
533 mView->newEvent(); 533 mView->newEvent();
534 } 534 }
535 if ( msg == "-newTodo" ) { 535 if ( msg == "-newTodo" ) {
536 mView->newTodo(); 536 mView->newTodo();
537 537
538 } 538 }
539 if ( msg == "-showWN" ) { 539 if ( msg == "-showWN" ) {
540 mView->viewManager()->showWhatsNextView(); 540 mView->viewManager()->showWhatsNextView();
541 } 541 }
542 if ( msg == "-showTodo" ) { 542 if ( msg == "-showTodo" ) {
543 mView->viewManager()->showTodoView(); 543 mView->viewManager()->showTodoView();
544 } 544 }
545 if ( msg == "-showList" ) { 545 if ( msg == "-showList" ) {
546 mView->viewManager()->showListView(); 546 mView->viewManager()->showListView();
547 } 547 }
548 else if ( msg == "-showDay" ) { 548 else if ( msg == "-showDay" ) {
549 mView->viewManager()->showDayView(); 549 mView->viewManager()->showDayView();
550 } 550 }
551 else if ( msg == "-showWWeek" ) { 551 else if ( msg == "-showWWeek" ) {
552 mView->viewManager()->showWorkWeekView(); 552 mView->viewManager()->showWorkWeekView();
553 } 553 }
554 else if ( msg == "-ringSync" ) { 554 else if ( msg == "-ringSync" ) {
555 mSyncManager->multiSync( false ); 555 mSyncManager->multiSync( false );
556 } 556 }
557 else if ( msg == "-showWeek" ) { 557 else if ( msg == "-showWeek" ) {
558 mView->viewManager()->showWeekView(); 558 mView->viewManager()->showWeekView();
559 } 559 }
560 else if ( msg == "-showTodo" ) { 560 else if ( msg == "-showTodo" ) {
561 mView->viewManager()->showTodoView(); 561 mView->viewManager()->showTodoView();
562 } 562 }
563 else if ( msg == "-showJournal" ) { 563 else if ( msg == "-showJournal" ) {
564 mView->dateNavigator()->selectDates( 1 ); 564 mView->dateNavigator()->selectDates( 1 );
565 mView->dateNavigator()->selectToday(); 565 mView->dateNavigator()->selectToday();
566 mView->viewManager()->showJournalView(); 566 mView->viewManager()->showJournalView();
567 } 567 }
568 else if ( msg == "-showKO" ) { 568 else if ( msg == "-showKO" ) {
569 mView->viewManager()->showNextXView(); 569 mView->viewManager()->showNextXView();
570 } 570 }
571 else if ( msg == "-showWNext" ) { 571 else if ( msg == "-showWNext" ) {
572 mView->viewManager()->showWhatsNextView(); 572 mView->viewManager()->showWhatsNextView();
573 } 573 }
574 else if ( msg == "nextView()" ) { 574 else if ( msg == "nextView()" ) {
575 mView->viewManager()->showNextView(); 575 mView->viewManager()->showNextView();
576 } 576 }
577 else if ( msg == "-showNextXView" ) { 577 else if ( msg == "-showNextXView" ) {
578 mView->viewManager()->showNextXView(); 578 mView->viewManager()->showNextXView();
579 } 579 }
580 580
581 581
582 } 582 }
583 583
584 showMaximized(); 584 showMaximized();
585 raise(); 585 raise();
586} 586}
587 587
588QPixmap MainWindow::loadPixmap( QString name ) 588QPixmap MainWindow::loadPixmap( QString name )
589{ 589{
590 return SmallIcon( name ); 590 return SmallIcon( name );
591 591
592} 592}
593void MainWindow::setUsesBigPixmaps ( bool b )
594{
595 qDebug("KO: MainWindow::setUsesBigPixmaps %d called", b);
596 if ( b )
597 qDebug("KO: BigPixmaps are not supported ");
598}
593void MainWindow::initActions() 599void MainWindow::initActions()
594{ 600{
595 //KOPrefs::instance()->mShowFullMenu 601 //KOPrefs::instance()->mShowFullMenu
596 iconToolBar->clear(); 602 iconToolBar->clear();
597 KOPrefs *p = KOPrefs::instance(); 603 KOPrefs *p = KOPrefs::instance();
598 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 604 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
599 605
600 QPopupMenu *viewMenu = new QPopupMenu( this ); 606 QPopupMenu *viewMenu = new QPopupMenu( this );
601 QPopupMenu *actionMenu = new QPopupMenu( this ); 607 QPopupMenu *actionMenu = new QPopupMenu( this );
602 QPopupMenu *importMenu = new QPopupMenu( this ); 608 QPopupMenu *importMenu = new QPopupMenu( this );
603 QPopupMenu *importMenu_X = new QPopupMenu( this ); 609 QPopupMenu *importMenu_X = new QPopupMenu( this );
604 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 610 QPopupMenu *exportMenu_X = new QPopupMenu( this );
605 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 611 QPopupMenu *beamMenu_X = new QPopupMenu( this );
606 selectFilterMenu = new QPopupMenu( this ); 612 selectFilterMenu = new QPopupMenu( this );
607 selectFilterMenu->setCheckable( true ); 613 selectFilterMenu->setCheckable( true );
608 syncMenu = new QPopupMenu( this ); 614 syncMenu = new QPopupMenu( this );
609 configureAgendaMenu = new QPopupMenu( this ); 615 configureAgendaMenu = new QPopupMenu( this );
610 configureToolBarMenu = new QPopupMenu( this ); 616 configureToolBarMenu = new QPopupMenu( this );
611 QPopupMenu *helpMenu = new QPopupMenu( this ); 617 QPopupMenu *helpMenu = new QPopupMenu( this );
612 QIconSet icon; 618 QIconSet icon;
613 int pixWid = 22, pixHei = 22; 619 int pixWid = 22, pixHei = 22;
614 QString pathString = ""; 620 QString pathString = "";
615 if ( !p->mToolBarMiniIcons ) { 621 if ( !p->mToolBarMiniIcons ) {
616 if ( QApplication::desktop()->width() < 480 ) { 622 if ( QApplication::desktop()->width() < 480 ) {
617 pathString += "icons16/"; 623 pathString += "icons16/";
618 pixWid = 18; pixHei = 16; 624 pixWid = 18; pixHei = 16;
619 } 625 }
620 } else { 626 } else {
621 pathString += "iconsmini/"; 627 pathString += "iconsmini/";
622 pixWid = 18; pixHei = 16; 628 pixWid = 18; pixHei = 16;
623 } 629 }
624 if ( KOPrefs::instance()->mShowFullMenu ) { 630 if ( KOPrefs::instance()->mShowFullMenu ) {
625 QMenuBar *menuBar1; 631 QMenuBar *menuBar1;
626 menuBar1 = menuBar(); 632 menuBar1 = menuBar();
627 menuBar1->insertItem( i18n("File"), importMenu ); 633 menuBar1->insertItem( i18n("File"), importMenu );
628 menuBar1->insertItem( i18n("View"), viewMenu ); 634 menuBar1->insertItem( i18n("View"), viewMenu );
629 menuBar1->insertItem( i18n("Actions"), actionMenu ); 635 menuBar1->insertItem( i18n("Actions"), actionMenu );
630#ifdef DESKTOP_VERSION 636#ifdef DESKTOP_VERSION
631 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 637 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
632 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 638 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
633#else 639#else
634 menuBar1->insertItem( i18n("Sync"), syncMenu ); 640 menuBar1->insertItem( i18n("Sync"), syncMenu );
635 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 641 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
636#endif 642#endif
637 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 643 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
638 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 644 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
639 menuBar1->insertItem( i18n("Help"), helpMenu ); 645 menuBar1->insertItem( i18n("Help"), helpMenu );
640 } else { 646 } else {
641 QPEMenuBar *menuBar1; 647 QPEMenuBar *menuBar1;
642 menuBar1 = new QPEMenuBar( iconToolBar ); 648 menuBar1 = new QPEMenuBar( iconToolBar );
643 QPopupMenu *menuBar = new QPopupMenu( this ); 649 QPopupMenu *menuBar = new QPopupMenu( this );
644 icon = loadPixmap( pathString + "z_menu" ); 650 icon = loadPixmap( pathString + "z_menu" );
645 menuBar1->insertItem( icon.pixmap(), menuBar); 651 menuBar1->insertItem( icon.pixmap(), menuBar);
646 //menuBar1->insertItem( i18n("ME"), menuBar); 652 //menuBar1->insertItem( i18n("ME"), menuBar);
647 menuBar->insertItem( i18n("File"), importMenu ); 653 menuBar->insertItem( i18n("File"), importMenu );
648 menuBar->insertItem( i18n("View"), viewMenu ); 654 menuBar->insertItem( i18n("View"), viewMenu );
649 menuBar->insertItem( i18n("Actions"), actionMenu ); 655 menuBar->insertItem( i18n("Actions"), actionMenu );
650 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 656 menuBar->insertItem( i18n("Synchronize"), syncMenu );
651 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 657 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
652 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 658 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
653 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 659 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
654 menuBar->insertItem( i18n("Help"), helpMenu ); 660 menuBar->insertItem( i18n("Help"), helpMenu );
655 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 661 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
656 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 662 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
657 } 663 }
658 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 664 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
659 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 665 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
660 666
661 667
662 mWeekBgColor = iconToolBar->backgroundColor(); 668 mWeekBgColor = iconToolBar->backgroundColor();
663 mWeekPixmap.resize( pixWid , pixHei ); 669 mWeekPixmap.resize( pixWid , pixHei );
664 mWeekPixmap.fill( mWeekBgColor ); 670 mWeekPixmap.fill( mWeekBgColor );
665 icon = mWeekPixmap; 671 icon = mWeekPixmap;
666 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 672 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
667 if ( p-> mShowIconWeekNum ) 673 if ( p-> mShowIconWeekNum )
668 mWeekAction->addTo( iconToolBar ); 674 mWeekAction->addTo( iconToolBar );
669 mWeekFont = font(); 675 mWeekFont = font();
670 676
671 int fontPoint = mWeekFont.pointSize(); 677 int fontPoint = mWeekFont.pointSize();
672 QFontMetrics f( mWeekFont ); 678 QFontMetrics f( mWeekFont );
673 int fontWid = f.width( "30" ); 679 int fontWid = f.width( "30" );
674 while ( fontWid > pixWid ) { 680 while ( fontWid > pixWid ) {
675 --fontPoint; 681 --fontPoint;
676 mWeekFont.setPointSize( fontPoint ); 682 mWeekFont.setPointSize( fontPoint );
677 QFontMetrics f( mWeekFont ); 683 QFontMetrics f( mWeekFont );
678 fontWid = f.width( "30" ); 684 fontWid = f.width( "30" );
679 //qDebug("dec-- "); 685 //qDebug("dec-- ");
680 } 686 }
681 687
682 connect( mWeekAction, SIGNAL( activated() ), 688 connect( mWeekAction, SIGNAL( activated() ),
683 this, SLOT( weekAction() ) ); 689 this, SLOT( weekAction() ) );
684 690
685 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 691 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
686 if ( p->mShowIconFilterview ) { 692 if ( p->mShowIconFilterview ) {
687 icon = loadPixmap( pathString + "filter" ); 693 icon = loadPixmap( pathString + "filter" );
688 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); 694 actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this );
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 8fd3d24..6895e36 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,141 +1,142 @@
1#ifndef KORGE_MAINWINDOW_H 1#ifndef KORGE_MAINWINDOW_H
2#define KORGE_MAINWINDOW_H 2#define KORGE_MAINWINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qtimer.h> 5#include <qtimer.h>
6#include <qdict.h> 6#include <qdict.h>
7#include <qfile.h> 7#include <qfile.h>
8#include <qmenubar.h> 8#include <qmenubar.h>
9#include <qtextstream.h> 9#include <qtextstream.h>
10#include <qregexp.h> 10#include <qregexp.h>
11 11
12#include <libkcal/incidence.h> 12#include <libkcal/incidence.h>
13#include <ksyncmanager.h> 13#include <ksyncmanager.h>
14#ifndef DESKTOP_VERSION 14#ifndef DESKTOP_VERSION
15#include <qcopchannel_qws.h> 15#include <qcopchannel_qws.h>
16#endif 16#endif
17class QAction; 17class QAction;
18class CalendarView; 18class CalendarView;
19class KSyncProfile; 19class KSyncProfile;
20#ifdef DESKTOP_VERSION 20#ifdef DESKTOP_VERSION
21 21
22#define QPEToolBar QToolBar 22#define QPEToolBar QToolBar
23#define QPEMenuBar QMenuBar 23#define QPEMenuBar QMenuBar
24#endif 24#endif
25class QPEToolBar; 25class QPEToolBar;
26class QPEMenuBar; 26class QPEMenuBar;
27 27
28 28
29namespace KCal { 29namespace KCal {
30class CalendarLocal; 30class CalendarLocal;
31} 31}
32 32
33using namespace KCal; 33using namespace KCal;
34 34
35class MainWindow : public QMainWindow 35class MainWindow : public QMainWindow
36{ 36{
37 Q_OBJECT 37 Q_OBJECT
38 public: 38 public:
39 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 39 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
40 ~MainWindow(); 40 ~MainWindow();
41 bool beamReceiveEnabled(); 41 bool beamReceiveEnabled();
42 static QString defaultFileName(); 42 static QString defaultFileName();
43 static QString syncFileName(); 43 static QString syncFileName();
44 static QString resourcePath(); 44 static QString resourcePath();
45 public slots: 45 public slots:
46 void setUsesBigPixmaps ( bool );
46 void setCaption ( const QString & ); 47 void setCaption ( const QString & );
47 void updateWeekNum(const KCal::DateList &); 48 void updateWeekNum(const KCal::DateList &);
48 void updateWeek(QDate); 49 void updateWeek(QDate);
49 void updateFilterToolbar(); 50 void updateFilterToolbar();
50 virtual void showMaximized (); 51 virtual void showMaximized ();
51 void configureAgenda( int ); 52 void configureAgenda( int );
52 void recieve( const QCString& msg, const QByteArray& data ); 53 void recieve( const QCString& msg, const QByteArray& data );
53 protected slots: 54 protected slots:
54 void setCaptionToDates(); 55 void setCaptionToDates();
55 void weekAction(); 56 void weekAction();
56 void about(); 57 void about();
57 void licence(); 58 void licence();
58 void faq(); 59 void faq();
59 void usertrans(); 60 void usertrans();
60 void features(); 61 void features();
61 void synchowto(); 62 void synchowto();
62 void storagehowto(); 63 void storagehowto();
63 void timetrackinghowto(); 64 void timetrackinghowto();
64 void kdesynchowto(); 65 void kdesynchowto();
65 void multisynchowto(); 66 void multisynchowto();
66 void whatsNew(); 67 void whatsNew();
67 void keyBindings(); 68 void keyBindings();
68 void aboutAutoSaving();; 69 void aboutAutoSaving();;
69 void aboutKnownBugs(); 70 void aboutKnownBugs();
70 71
71 void processIncidenceSelection( Incidence * ); 72 void processIncidenceSelection( Incidence * );
72 73
73 void importQtopia(); 74 void importQtopia();
74 void importBday(); 75 void importBday();
75 void importOL(); 76 void importOL();
76 void importIcal(); 77 void importIcal();
77 void importFile( QString, bool ); 78 void importFile( QString, bool );
78 void quickImportIcal(); 79 void quickImportIcal();
79 80
80 void slotModifiedChanged( bool ); 81 void slotModifiedChanged( bool );
81 82
82 void save(); 83 void save();
83 void saveStopTimer(); 84 void saveStopTimer();
84 void configureToolBar( int ); 85 void configureToolBar( int );
85 void printSel(); 86 void printSel();
86 void printCal(); 87 void printCal();
87 void saveCalendar(); 88 void saveCalendar();
88 void loadCalendar(); 89 void loadCalendar();
89 void exportVCalendar(); 90 void exportVCalendar();
90 void fillFilterMenu(); 91 void fillFilterMenu();
91 void fillFilterMenuTB(); 92 void fillFilterMenuTB();
92 void selectFilter( int ); 93 void selectFilter( int );
93 void fillFilterMenuPopup(); 94 void fillFilterMenuPopup();
94 void selectFilterPopup( int ); 95 void selectFilterPopup( int );
95 void exportToPhone( int ); 96 void exportToPhone( int );
96 void toggleBeamReceive(); 97 void toggleBeamReceive();
97 void disableBR(bool); 98 void disableBR(bool);
98 signals: 99 signals:
99 void selectWeek ( int ); 100 void selectWeek ( int );
100 private slots: 101 private slots:
101 void showConfigureAgenda(); 102 void showConfigureAgenda();
102 void getFile( bool ); 103 void getFile( bool );
103 void syncFileRequest(); 104 void syncFileRequest();
104 105
105 protected: 106 protected:
106 void hideEvent ( QHideEvent * ); 107 void hideEvent ( QHideEvent * );
107 QString sentSyncFile(); 108 QString sentSyncFile();
108 void displayText( QString, QString); 109 void displayText( QString, QString);
109 void enableIncidenceActions( bool ); 110 void enableIncidenceActions( bool );
110 111
111 private: 112 private:
112 bool mBRdisabled; 113 bool mBRdisabled;
113#ifndef DESKTOP_VERSION 114#ifndef DESKTOP_VERSION
114 QCopChannel* infrared; 115 QCopChannel* infrared;
115#endif 116#endif
116 QAction* brAction; 117 QAction* brAction;
117 KSyncManager* mSyncManager; 118 KSyncManager* mSyncManager;
118 bool mClosed; 119 bool mClosed;
119 void saveOnClose(); 120 void saveOnClose();
120 bool mFlagKeyPressed; 121 bool mFlagKeyPressed;
121 bool mBlockAtStartup; 122 bool mBlockAtStartup;
122 QPEToolBar *iconToolBar; 123 QPEToolBar *iconToolBar;
123 QPEToolBar *viewToolBar; 124 QPEToolBar *viewToolBar;
124 QPEToolBar *navigatorToolBar; 125 QPEToolBar *navigatorToolBar;
125 QPEToolBar *filterToolBar; 126 QPEToolBar *filterToolBar;
126 QMenuBar *filterMenubar; 127 QMenuBar *filterMenubar;
127 QPopupMenu * filterPopupMenu; 128 QPopupMenu * filterPopupMenu;
128 void initActions(); 129 void initActions();
129 void setDefaultPreferences(); 130 void setDefaultPreferences();
130 void resizeEvent( QResizeEvent* e); 131 void resizeEvent( QResizeEvent* e);
131 void keyPressEvent ( QKeyEvent * ) ; 132 void keyPressEvent ( QKeyEvent * ) ;
132 void keyReleaseEvent ( QKeyEvent * ) ; 133 void keyReleaseEvent ( QKeyEvent * ) ;
133 QPopupMenu *configureToolBarMenu; 134 QPopupMenu *configureToolBarMenu;
134 QPopupMenu *selectFilterMenu; 135 QPopupMenu *selectFilterMenu;
135 QPopupMenu *selectFilterMenuTB; 136 QPopupMenu *selectFilterMenuTB;
136 QPopupMenu *configureAgendaMenu, *syncMenu; 137 QPopupMenu *configureAgendaMenu, *syncMenu;
137 CalendarLocal *mCalendar; 138 CalendarLocal *mCalendar;
138 CalendarView *mView; 139 CalendarView *mView;
139 QAction *mNewSubTodoAction; 140 QAction *mNewSubTodoAction;
140 QAction *mWeekAction; 141 QAction *mWeekAction;
141 QFont mWeekFont; 142 QFont mWeekFont;