summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-22 22:55:32 (UTC)
committer zautrix <zautrix>2005-03-22 22:55:32 (UTC)
commitaa6d19015bc91ae3af021d766d37a473e125278f (patch) (unidiff)
treef7b1d6b45a3997013318107ca02fa63b4b76913e
parent53ac6d1f931c50d89a44d9d46daceb7ed9d4ddc6 (diff)
downloadkdepimpi-aa6d19015bc91ae3af021d766d37a473e125278f.zip
kdepimpi-aa6d19015bc91ae3af021d766d37a473e125278f.tar.gz
kdepimpi-aa6d19015bc91ae3af021d766d37a473e125278f.tar.bz2
fixes
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/opiemail.cpp1
-rw-r--r--kmicromail/viewmailbase.cpp9
-rw-r--r--kmicromail/viewmailbase.h5
-rw-r--r--korganizer/kodaymatrix.cpp28
-rw-r--r--korganizer/kodaymatrix.h4
5 files changed, 35 insertions, 12 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index b701446..4436ad6 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -32,48 +32,49 @@
32#include <qpe/global.h> 32#include <qpe/global.h>
33 33
34#ifdef DESKTOP_VERSION 34#ifdef DESKTOP_VERSION
35#include <qapplication.h> 35#include <qapplication.h>
36#else 36#else
37#include <qpe/qpeapplication.h> 37#include <qpe/qpeapplication.h>
38#endif 38#endif
39#include <libmailwrapper/smtpwrapper.h> 39#include <libmailwrapper/smtpwrapper.h>
40#include <libmailwrapper/mailtypes.h> 40#include <libmailwrapper/mailtypes.h>
41#include <libmailwrapper/abstractmail.h> 41#include <libmailwrapper/abstractmail.h>
42#include "koprefs.h" 42#include "koprefs.h"
43 43
44//using namespace Opie::Core; 44//using namespace Opie::Core;
45 45
46OpieMail::OpieMail( QWidget *parent, const char *name ) 46OpieMail::OpieMail( QWidget *parent, const char *name )
47 : MainWindow( parent, name) //, WStyle_ContextHelp ) 47 : MainWindow( parent, name) //, WStyle_ContextHelp )
48{ 48{
49 mCurrentComposer = 0; 49 mCurrentComposer = 0;
50 settings = new Settings(); 50 settings = new Settings();
51 tb = 0; 51 tb = 0;
52 setIcon(SmallIcon( "kmicromail" ) ); 52 setIcon(SmallIcon( "kmicromail" ) );
53 folderView->populate( settings->getAccounts() ); 53 folderView->populate( settings->getAccounts() );
54 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)), 54 connect(ExternalAppHandler::instance(), SIGNAL(receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)),
55 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&))); 55 this, SLOT(insertAttendees(const QString&, const QStringList&, const QStringList&, const QStringList&)));
56 folderView->setFocus();
56} 57}
57 58
58OpieMail::~OpieMail() 59OpieMail::~OpieMail()
59{ 60{
60 if (settings) delete settings; 61 if (settings) delete settings;
61 if ( tb ) 62 if ( tb )
62 delete tb; 63 delete tb;
63} 64}
64 65
65void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 66void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
66{ 67{
67 68
68} 69}
69#include <stdlib.h> 70#include <stdlib.h>
70void OpieMail::message(const QCString &msg, const QByteArray &data) 71void OpieMail::message(const QCString &msg, const QByteArray &data)
71{ 72{
72 // copied from old mail2 73 // copied from old mail2
73 static int ii = 0; 74 static int ii = 0;
74 //qDebug("QCOP CALL ############################# %d ", ii); 75 //qDebug("QCOP CALL ############################# %d ", ii);
75 //QString mess ( msg ); 76 //QString mess ( msg );
76 //qDebug("Message = %s ",mess.latin1()); 77 //qDebug("Message = %s ",mess.latin1());
77 ++ii; 78 ++ii;
78 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 79 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
79 80
diff --git a/kmicromail/viewmailbase.cpp b/kmicromail/viewmailbase.cpp
index 3a41ba0..3bb964e 100644
--- a/kmicromail/viewmailbase.cpp
+++ b/kmicromail/viewmailbase.cpp
@@ -1,30 +1,31 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2#include <qtextbrowser.h> 2#include <qtextbrowser.h>
3#include <qlistview.h> 3#include <qlistview.h>
4#include <qaction.h> 4#include <qaction.h>
5#include <qlabel.h> 5#include <qlabel.h>
6#include <qvbox.h> 6#include <qvbox.h>
7#include <qapplication.h>
7 8
8#include <qtoolbar.h> 9#include <qtoolbar.h>
9#include <qmenubar.h> 10#include <qmenubar.h>
10#include <kiconloader.h> 11#include <kiconloader.h>
11//#include <qpe/resource.h> 12//#include <qpe/resource.h>
12#include <klocale.h> 13#include <klocale.h>
13 14
14#include "viewmailbase.h" 15#include "viewmailbase.h"
15//#include "opendiag.h" 16//#include "opendiag.h"
16 17
17ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) 18ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
18 : QMainWindow(parent, name, fl) 19 : QMainWindow(parent, name, fl)
19{ 20{
20 21
21 setToolBarsMovable(false); 22 setToolBarsMovable(false);
22 23
23 toolbar = new QToolBar(this); 24 toolbar = new QToolBar(this);
24 menubar = new QMenuBar( toolbar ); 25 menubar = new QMenuBar( toolbar );
25 mailmenu = new QPopupMenu( menubar ); 26 mailmenu = new QPopupMenu( menubar );
26 menubar->insertItem( i18n( "Mail" ), mailmenu ); 27 menubar->insertItem( i18n( "Mail" ), mailmenu );
27 28
28 toolbar->setHorizontalStretchable(true); 29 toolbar->setHorizontalStretchable(true);
29 addToolBar(toolbar); 30 addToolBar(toolbar);
30 31
@@ -51,52 +52,54 @@ ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
51 52
52 showHtml = new QAction( i18n( "Show Html" ), SmallIcon( "html" ), 0, 0, this, 0, true ); 53 showHtml = new QAction( i18n( "Show Html" ), SmallIcon( "html" ), 0, 0, this, 0, true );
53 showHtml->addTo( toolbar ); 54 showHtml->addTo( toolbar );
54 showHtml->addTo( mailmenu ); 55 showHtml->addTo( mailmenu );
55 56
56 deleteMail = new QAction(i18n("Delete Mail"),SmallIcon("trash"), 0, 0, this); 57 deleteMail = new QAction(i18n("Delete Mail"),SmallIcon("trash"), 0, 0, this);
57 deleteMail->addTo(toolbar); 58 deleteMail->addTo(toolbar);
58 deleteMail->addTo(mailmenu); 59 deleteMail->addTo(mailmenu);
59 60
60 nextMail = new QAction(i18n("Show next mail"),SmallIcon("enter"), 0, 0, this); 61 nextMail = new QAction(i18n("Show next mail"),SmallIcon("enter"), 0, 0, this);
61 QLabel *spacer = new QLabel(toolbar); 62 QLabel *spacer = new QLabel(toolbar);
62 nextMail->addTo(toolbar); 63 nextMail->addTo(toolbar);
63 nextMail->addTo(mailmenu); 64 nextMail->addTo(mailmenu);
64 65
65 closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); 66 closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this);
66 //QLabel *spacer = new QLabel(toolbar); 67 //QLabel *spacer = new QLabel(toolbar);
67 spacer->setBackgroundMode(QWidget::PaletteButton); 68 spacer->setBackgroundMode(QWidget::PaletteButton);
68 toolbar->setStretchableWidget(spacer); 69 toolbar->setStretchableWidget(spacer);
69 closeMail->addTo(toolbar); 70 closeMail->addTo(toolbar);
70 closeMail->addTo(mailmenu); 71 closeMail->addTo(mailmenu);
71 QVBox *view = new QVBox(this); 72 QVBox *view = new QVBox(this);
72 setCentralWidget(view); 73 setCentralWidget(view);
73 74
74 attachments = new QListView(view); 75 attachments = new QListView(view);
75 attachments->setMinimumHeight(90); 76 int fixh = 100;
76 attachments->setMaximumHeight(90); 77 if ( QApplication::desktop()->width() > 320 )
78 fixh = 200;
79 attachments->setFixedHeight(fixh);
77 attachments->setAllColumnsShowFocus(true); 80 attachments->setAllColumnsShowFocus(true);
78 attachments->addColumn("Mime Type", 60); 81 attachments->addColumn("Mime Type", fixh-30);
79 attachments->addColumn(i18n("Description"), 100); 82 attachments->addColumn(i18n("Description"), 100);
80 attachments->addColumn(i18n("Filename"), 80); 83 attachments->addColumn(i18n("Filename"), 80);
81 attachments->addColumn(i18n("Size"), 80); 84 attachments->addColumn(i18n("Size"), 80);
82 attachments->setSorting(-1); 85 attachments->setSorting(-1);
83 attachments->hide(); 86 attachments->hide();
84 87
85 browser = new QTextBrowser(view); 88 browser = new QTextBrowser(view);
86 89
87 //openDiag = new OpenDiag(view); 90 //openDiag = new OpenDiag(view);
88 //openDiag->hide(); 91 //openDiag->hide();
89 92
90} 93}
91 94
92void ViewMailBase::slotChangeAttachview(bool state) 95void ViewMailBase::slotChangeAttachview(bool state)
93{ 96{
94 if (state) attachments->show(); 97 if (state) attachments->show();
95 else attachments->hide(); 98 else attachments->hide();
96} 99}
97 100
98void ViewMailBase::keyPressEvent ( QKeyEvent * e ) 101void ViewMailBase::keyPressEvent ( QKeyEvent * e )
99{ 102{
100 if( e->key()==Qt::Key_Escape ) { 103 if( e->key()==Qt::Key_Escape ) {
101 close(); 104 close();
102 e->accept(); 105 e->accept();
diff --git a/kmicromail/viewmailbase.h b/kmicromail/viewmailbase.h
index 7ad1eec..7c075eb 100644
--- a/kmicromail/viewmailbase.h
+++ b/kmicromail/viewmailbase.h
@@ -1,30 +1,35 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2#ifndef VIEWMAILBASE_H 2#ifndef VIEWMAILBASE_H
3#define VIEWMAILBASE_H 3#define VIEWMAILBASE_H
4 4
5#include <qmainwindow.h> 5#include <qmainwindow.h>
6 6
7#ifndef DESKTOP_VERSION
8#include <qpe/qpemenubar.h>
9#define QMenuBar QPEMenuBar
10#endif
11
7class QAction; 12class QAction;
8class OpenDiag; 13class OpenDiag;
9class QListView; 14class QListView;
10class QToolBar; 15class QToolBar;
11class QTextBrowser; 16class QTextBrowser;
12class QMenuBar; 17class QMenuBar;
13class QPopupMenu; 18class QPopupMenu;
14 19
15class ViewMailBase : public QMainWindow 20class ViewMailBase : public QMainWindow
16{ 21{
17 Q_OBJECT 22 Q_OBJECT
18 23
19public: 24public:
20 ViewMailBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0); 25 ViewMailBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
21 26
22protected: 27protected:
23 QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml, *closeMail, *nextMail, *downloadMail, *viewSource; 28 QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml, *closeMail, *nextMail, *downloadMail, *viewSource;
24 QListView *attachments; 29 QListView *attachments;
25 QToolBar *toolbar; 30 QToolBar *toolbar;
26 QTextBrowser *browser; 31 QTextBrowser *browser;
27 OpenDiag *openDiag; 32 OpenDiag *openDiag;
28 QMenuBar *menubar; 33 QMenuBar *menubar;
29 QPopupMenu *mailmenu; 34 QPopupMenu *mailmenu;
30 35
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp
index 59618bf..d543aaf 100644
--- a/korganizer/kodaymatrix.cpp
+++ b/korganizer/kodaymatrix.cpp
@@ -94,51 +94,53 @@ void DynamicTip::maybeTip( const QPoint &pos )
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#if 0 108#if 0
109KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : 109KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) :
110 QFrame(parent, name) 110 QFrame(parent, name)
111#endif 111#endif
112{ 112{
113 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); 113 mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this);
114 mPendingUpdateBeforeRepaint = false; 114 mPendingUpdateBeforeRepaint = false;
115 mouseDown = false; 115 mouseDown = false;
116 // initialize dynamic arrays 116 // initialize dynamic arrays
117 bDays.resize ( NUMDAYS ); 117 bDays.resize ( NUMDAYS );
118 hDays.resize ( NUMDAYS );;
119 eDays.resize ( NUMDAYS );;
118 days = new QDate[NUMDAYS]; 120 days = new QDate[NUMDAYS];
119 daylbls = new QString[NUMDAYS]; 121 daylbls = new QString[NUMDAYS];
120 events = new int[NUMDAYS]; 122 //events = new int[NUMDAYS];
121 mToolTip = new DynamicTip(this); 123 mToolTip = new DynamicTip(this);
122 124
123 // set default values used for drawing the matrix 125 // set default values used for drawing the matrix
124 mDefaultBackColor = palette().active().base(); 126 mDefaultBackColor = palette().active().base();
125 mDefaultTextColor = palette().active().foreground(); 127 mDefaultTextColor = palette().active().foreground();
126 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor); 128 mDefaultTextColorShaded = getShadedColor(mDefaultTextColor);
127 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor); 129 mHolidayColorShaded = getShadedColor(KOPrefs::instance()->mHolidayColor);
128 mSelectedDaysColor = QColor("white"); 130 mSelectedDaysColor = QColor("white");
129 mTodayMarginWidth = 2; 131 mTodayMarginWidth = 2;
130 mSelEnd = mSelStart = NOSELECTION; 132 mSelEnd = mSelStart = NOSELECTION;
131 133
132 setAcceptDrops(true); 134 setAcceptDrops(true);
133 //setFont( QFont("Arial", 10) ); 135 //setFont( QFont("Arial", 10) );
134 136
135 mUpdateTimer = new QTimer( this ); 137 mUpdateTimer = new QTimer( this );
136 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() )); 138 connect (mUpdateTimer ,SIGNAL(timeout()), this, SLOT ( updateViewTimed() ));
137 mRepaintTimer = new QTimer( this ); 139 mRepaintTimer = new QTimer( this );
138 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() )); 140 connect (mRepaintTimer ,SIGNAL(timeout()), this, SLOT ( repaintViewTimed() ));
139 mDayChanged = false; 141 mDayChanged = false;
140 updateView(); 142 updateView();
141} 143}
142QString KODayMatrix::getWhatsThisText( QPoint p ) 144QString KODayMatrix::getWhatsThisText( QPoint p )
143{ 145{
144 146
@@ -219,49 +221,49 @@ void KODayMatrix::setCalendar( Calendar *cal )
219 setAcceptDrops( mCalendar ); 221 setAcceptDrops( mCalendar );
220 222
221 updateEvents(); 223 updateEvents();
222} 224}
223 225
224QColor KODayMatrix::getShadedColor(QColor color) 226QColor KODayMatrix::getShadedColor(QColor color)
225{ 227{
226 QColor shaded; 228 QColor shaded;
227 int h=0; 229 int h=0;
228 int s=0; 230 int s=0;
229 int v=0; 231 int v=0;
230 color.hsv(&h,&s,&v); 232 color.hsv(&h,&s,&v);
231 s = s/4; 233 s = s/4;
232 v = 192+v/4; 234 v = 192+v/4;
233 shaded.setHsv(h,s,v); 235 shaded.setHsv(h,s,v);
234 236
235 return shaded; 237 return shaded;
236} 238}
237 239
238KODayMatrix::~KODayMatrix() 240KODayMatrix::~KODayMatrix()
239{ 241{
240 // delete mKODaymatrixWhatsThis; 242 // delete mKODaymatrixWhatsThis;
241 delete [] days; 243 delete [] days;
242 delete [] daylbls; 244 delete [] daylbls;
243 delete [] events; 245 //delete [] events;
244 delete mToolTip; 246 delete mToolTip;
245} 247}
246 248
247/* 249/*
248void KODayMatrix::setStartDate(QDate start) 250void KODayMatrix::setStartDate(QDate start)
249{ 251{
250 updateView(start); 252 updateView(start);
251} 253}
252*/ 254*/
253 255
254void KODayMatrix::addSelectedDaysTo(DateList& selDays) 256void KODayMatrix::addSelectedDaysTo(DateList& selDays)
255{ 257{
256 258
257 if (mSelStart == NOSELECTION) { 259 if (mSelStart == NOSELECTION) {
258 return; 260 return;
259 } 261 }
260 262
261 //cope with selection being out of matrix limits at top (< 0) 263 //cope with selection being out of matrix limits at top (< 0)
262 int i0 = mSelStart; 264 int i0 = mSelStart;
263 if (i0 < 0) { 265 if (i0 < 0) {
264 for (int i = i0; i < 0; i++) { 266 for (int i = i0; i < 0; i++) {
265 selDays.append(days[0].addDays(i)); 267 selDays.append(days[0].addDays(i));
266 } 268 }
267 i0 = 0; 269 i0 = 0;
@@ -290,109 +292,113 @@ bool KODayMatrix::setSelectedDaysFrom(const QDate& start, const QDate& end)
290 mSelStart = startdate.daysTo(start); 292 mSelStart = startdate.daysTo(start);
291 if ( mSelStart < 0 ) 293 if ( mSelStart < 0 )
292 mSelStart = 0; 294 mSelStart = 0;
293 mSelEnd = startdate.daysTo(end); 295 mSelEnd = startdate.daysTo(end);
294 if ( mSelEnd > NUMDAYS-1 ) 296 if ( mSelEnd > NUMDAYS-1 )
295 mSelEnd = NUMDAYS-1; 297 mSelEnd = NUMDAYS-1;
296 if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) { 298 if ( mSelEnd < 0 || mSelStart > NUMDAYS-1 ) {
297 clearSelection(); 299 clearSelection();
298 if ( noSel ) 300 if ( noSel )
299 return false; 301 return false;
300 } 302 }
301 303
302 return true; 304 return true;
303} 305}
304void KODayMatrix::clearSelection() 306void KODayMatrix::clearSelection()
305{ 307{
306 mSelEnd = mSelStart = NOSELECTION; 308 mSelEnd = mSelStart = NOSELECTION;
307} 309}
308 310
309 311
310void KODayMatrix::recalculateToday() 312void KODayMatrix::recalculateToday()
311{ 313{
312 today = -1; 314 today = -1;
313 for (int i=0; i<NUMDAYS; i++) { 315 for (int i=0; i<NUMDAYS; i++) {
314 events[i] = 0; 316 //events[i] = 0;
315 days[i] = startdate.addDays(i); 317 days[i] = startdate.addDays(i);
316 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] )); 318 daylbls[i] = QString::number( KOGlobals::self()->calendarSystem()->day( days[i] ));
317 319
318 // if today is in the currently displayed month, hilight today 320 // if today is in the currently displayed month, hilight today
319 if (days[i].year() == QDate::currentDate().year() && 321 if (days[i].year() == QDate::currentDate().year() &&
320 days[i].month() == QDate::currentDate().month() && 322 days[i].month() == QDate::currentDate().month() &&
321 days[i].day() == QDate::currentDate().day()) { 323 days[i].day() == QDate::currentDate().day()) {
322 today = i; 324 today = i;
323 } 325 }
324 } 326 }
325 // qDebug(QString("Today is visible at %1.").arg(today)); 327 // qDebug(QString("Today is visible at %1.").arg(today));
326} 328}
327 329
328void KODayMatrix::updateView() 330void KODayMatrix::updateView()
329{ 331{
330 updateView(startdate); 332 updateView(startdate);
331} 333}
332void KODayMatrix::repaintViewTimed() 334void KODayMatrix::repaintViewTimed()
333{ 335{
334 mRepaintTimer->stop(); 336 mRepaintTimer->stop();
335 repaint(false); 337 repaint(false);
336} 338}
337void KODayMatrix::updateViewTimed() 339void KODayMatrix::updateViewTimed()
338{ 340{
339 mUpdateTimer->stop(); 341 mUpdateTimer->stop();
340 if ( !mCalendar ) { 342 if ( !mCalendar ) {
341 qDebug("NOT CAL "); 343 qDebug("NOT CAL ");
342 return; 344 return;
343 } 345 }
344 //qDebug("KODayMatrix::updateViewTimed "); 346 //qDebug("KODayMatrix::updateViewTimed ");
345 for(int i = 0; i < NUMDAYS; i++) { 347 for(int i = 0; i < NUMDAYS; i++) {
346 // if events are set for the day then remember to draw it bold 348 // if events are set for the day then remember to draw it bold
347 QPtrList<Event> eventlist = mCalendar->events(days[i]); 349 QPtrList<Event> eventlist = mCalendar->events(days[i]);
348 Event *event; 350 Event *event;
349 int numEvents = eventlist.count(); 351 int numEvents = eventlist.count();
350 QString holiStr = ""; 352 QString holiStr = "";
351 bDays.clearBit(i); 353 bDays.clearBit(i);
354 hDays.clearBit(i);
355 eDays.clearBit(i);
352 for(event=eventlist.first();event != 0;event=eventlist.next()) { 356 for(event=eventlist.first();event != 0;event=eventlist.next()) {
353 ushort recurType = event->recurrence()->doesRecur(); 357 ushort recurType = event->recurrence()->doesRecur();
354 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || 358 if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) ||
355 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { 359 (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) {
356 numEvents--; 360 numEvents--;
357 } 361 }
358 if ( event->isHoliday()) { 362 if ( event->isHoliday()) {
363 hDays.setBit(i);
359 if ( !holiStr.isEmpty() ) 364 if ( !holiStr.isEmpty() )
360 holiStr += "\n"; 365 holiStr += "\n";
361 holiStr += event->summary(); 366 holiStr += event->summary();
362 if ( !event->location().isEmpty() ) 367 if ( !event->location().isEmpty() )
363 holiStr += " (" + event->location() + ")"; 368 holiStr += " (" + event->location() + ")";
364 } 369 }
365 if ( event->isBirthday()) { 370 if ( event->isBirthday()) {
366 if ( !holiStr.isEmpty() ) 371 if ( !holiStr.isEmpty() )
367 holiStr += "\n"; 372 holiStr += "\n";
368 holiStr += i18n("Birthday") + ": "+event->summary(); 373 holiStr += i18n("Birthday") + ": "+event->summary();
369 if ( !event->location().isEmpty() ) 374 if ( !event->location().isEmpty() )
370 holiStr += " (" + event->location() + ")"; 375 holiStr += " (" + event->location() + ")";
371 bDays.setBit(i); 376 bDays.setBit(i);
372 } 377 }
373 } 378 }
374 events[i] = numEvents; 379 if ( numEvents )
380 eDays.setBit(i);
375 //if it is a holy day then draw it red. Sundays are consider holidays, too 381 //if it is a holy day then draw it red. Sundays are consider holidays, too
376 if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) || 382 if ( (KOGlobals::self()->calendarSystem()->dayOfWeek(days[i]) == KOGlobals::self()->calendarSystem()->weekDayOfPray()) ||
377 !holiStr.isEmpty()) { 383 !holiStr.isEmpty()) {
378 mHolidays[i] = holiStr; 384 mHolidays[i] = holiStr;
379 } else { 385 } else {
380 mHolidays[i] = QString::null; 386 mHolidays[i] = QString::null;
381 } 387 }
382 } 388 }
383 if ( ! mPendingUpdateBeforeRepaint ) 389 if ( ! mPendingUpdateBeforeRepaint )
384 repaint(false); 390 repaint(false);
385} 391}
386void KODayMatrix::updateView(QDate actdate) 392void KODayMatrix::updateView(QDate actdate)
387{ 393{
388 394
389 if ( ! actdate.isValid() ) { 395 if ( ! actdate.isValid() ) {
390 //qDebug("date not valid "); 396 //qDebug("date not valid ");
391 return; 397 return;
392 } 398 }
393 mDayChanged = false; 399 mDayChanged = false;
394 //flag to indicate if the starting day of the matrix has changed by this call 400 //flag to indicate if the starting day of the matrix has changed by this call
395 //mDayChanged = false; 401 //mDayChanged = false;
396 // if a new startdate is to be set then apply Cornelius's calculation 402 // if a new startdate is to be set then apply Cornelius's calculation
397 // of the first day to be shown 403 // of the first day to be shown
398 if (actdate != startdate) { 404 if (actdate != startdate) {
@@ -427,49 +433,52 @@ void KODayMatrix::updateView(QDate actdate)
427 mRepaintTimer->start( 350 ); 433 mRepaintTimer->start( 350 );
428 mUpdateTimer->start( 1200 ); 434 mUpdateTimer->start( 1200 );
429#endif 435#endif
430 } 436 }
431} 437}
432void KODayMatrix::updateEvents() 438void KODayMatrix::updateEvents()
433{ 439{
434 if ( !mCalendar ) return; 440 if ( !mCalendar ) return;
435 441
436 for( int i = 0; i < NUMDAYS; i++ ) { 442 for( int i = 0; i < NUMDAYS; i++ ) {
437 // if events are set for the day then remember to draw it bold 443 // if events are set for the day then remember to draw it bold
438 QPtrList<Event> eventlist = mCalendar->events( days[ i ] ); 444 QPtrList<Event> eventlist = mCalendar->events( days[ i ] );
439 int numEvents = eventlist.count(); 445 int numEvents = eventlist.count();
440 Event *event; 446 Event *event;
441 for( event = eventlist.first(); event != 0;event=eventlist.next()) { 447 for( event = eventlist.first(); event != 0;event=eventlist.next()) {
442 ushort recurType = event->doesRecur(); 448 ushort recurType = event->doesRecur();
443 449
444 if ( ( recurType == Recurrence::rDaily && 450 if ( ( recurType == Recurrence::rDaily &&
445 !KOPrefs::instance()->mDailyRecur ) || 451 !KOPrefs::instance()->mDailyRecur ) ||
446 ( recurType == Recurrence::rWeekly && 452 ( recurType == Recurrence::rWeekly &&
447 !KOPrefs::instance()->mWeeklyRecur ) ) { 453 !KOPrefs::instance()->mWeeklyRecur ) ) {
448 numEvents--; 454 numEvents--;
449 } 455 }
450 } 456 }
451 events[ i ] = numEvents; 457 if ( numEvents )
458 eDays.setBit(i);
459 else
460 eDays.clearBit(i);
452 } 461 }
453} 462}
454 463
455const QDate& KODayMatrix::getDate(int offset) 464const QDate& KODayMatrix::getDate(int offset)
456{ 465{
457 if (offset < 0 || offset > NUMDAYS-1) { 466 if (offset < 0 || offset > NUMDAYS-1) {
458 qDebug("Wrong offset2 %d", offset); 467 qDebug("Wrong offset2 %d", offset);
459 return days[0]; 468 return days[0];
460 } 469 }
461 return days[offset]; 470 return days[offset];
462} 471}
463 472
464QString KODayMatrix::getHolidayLabel(int offset) 473QString KODayMatrix::getHolidayLabel(int offset)
465{ 474{
466 if (offset < 0 || offset > NUMDAYS-1) { 475 if (offset < 0 || offset > NUMDAYS-1) {
467 qDebug("Wrong offset1 %d", offset); 476 qDebug("Wrong offset1 %d", offset);
468 return QString(); 477 return QString();
469 } 478 }
470 return mHolidays[offset]; 479 return mHolidays[offset];
471} 480}
472 481
473int KODayMatrix::getDayIndexFrom(int x, int y) 482int KODayMatrix::getDayIndexFrom(int x, int y)
474{ 483{
475 int colModulo = (width()-2) % 7; 484 int colModulo = (width()-2) % 7;
@@ -841,96 +850,99 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent)
841 if (i >= mSelStartT && i <= mSelEndT) { 850 if (i >= mSelStartT && i <= mSelEndT) {
842 QColor grey("grey"); 851 QColor grey("grey");
843 mTodayPen.setColor(grey); 852 mTodayPen.setColor(grey);
844 } 853 }
845 p.setPen(mTodayPen); 854 p.setPen(mTodayPen);
846 855
847 856
848 int addCol = 0; 857 int addCol = 0;
849 int addRow = 0; 858 int addRow = 0;
850 if (rowModulo) { 859 if (rowModulo) {
851 if ( row >= 6 - rowModulo ) 860 if ( row >= 6 - rowModulo )
852 addRow = row - 5 + rowModulo; 861 addRow = row - 5 + rowModulo;
853 } 862 }
854 if ( colModulo ) { 863 if ( colModulo ) {
855 if ( col >= 7 - colModulo ) 864 if ( col >= 7 - colModulo )
856 addCol = col - 6 + colModulo-1; 865 addCol = col - 6 + colModulo-1;
857 } 866 }
858 867
859 addCol += 1; 868 addCol += 1;
860 p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1); 869 p.drawRect(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight+1);
861 p.setPen(tmppen); 870 p.setPen(tmppen);
862 } 871 }
863 872
864 // if any events are on that day then draw it using a bold font 873 // if any events are on that day then draw it using a bold font
865 if (events[i] > 0) { 874 if ( eDays.testBit(i) ) {
866 QFont myFont = font(); 875 QFont myFont = font();
867 myFont.setBold(true); 876 myFont.setBold(true);
868 p.setFont(myFont); 877 p.setFont(myFont);
869 } 878 }
870 879
871 // if it is a holiday then use the default holiday color 880 // if it is a holiday then use the default holiday color
872 if (!mHolidays[i].isNull()) { 881 if (!mHolidays[i].isNull()) {
873 if ( bDays.testBit(i) ) { 882 if ( bDays.testBit(i) ) {
874 p.setPen(Qt::green); 883 if ( hDays.testBit(i) )
884 p.setPen(QColor(Qt::green));
885 else
886 p.setPen(QColor(Qt::green).dark());
875 } else { 887 } else {
876 if (actcol == mDefaultTextColor) { 888 if (actcol == mDefaultTextColor) {
877 p.setPen(KOPrefs::instance()->mHolidayColor); 889 p.setPen(KOPrefs::instance()->mHolidayColor);
878 } else { 890 } else {
879 p.setPen(mHolidayColorShaded); 891 p.setPen(mHolidayColorShaded);
880 } 892 }
881 } 893 }
882 } 894 }
883 895
884 // draw selected days with special color 896 // draw selected days with special color
885 // DO NOT specially highlight holidays in selection ! 897 // DO NOT specially highlight holidays in selection !
886 if (i >= mSelStartT && i <= mSelEndT) { 898 if (i >= mSelStartT && i <= mSelEndT) {
887 ;//p.setPen(mSelectedDaysColor); 899 ;//p.setPen(mSelectedDaysColor);
888 } 900 }
889 901
890 int addCol = 0; 902 int addCol = 0;
891 int addRow = 0; 903 int addRow = 0;
892 if ( colModulo ) { 904 if ( colModulo ) {
893 if ( col >= 7 - colModulo ) 905 if ( col >= 7 - colModulo )
894 addCol = col - 7 + colModulo; 906 addCol = col - 7 + colModulo;
895 } 907 }
896 if ( rowModulo ) { 908 if ( rowModulo ) {
897 if ( row >= 6 - rowModulo ) 909 if ( row >= 6 - rowModulo )
898 addRow = row - 5 + rowModulo; 910 addRow = row - 5 + rowModulo;
899 } 911 }
900 //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); 912 //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow);
901 ++addCol;//++addCol; 913 ++addCol;//++addCol;
902 if ( row == 0) 914 if ( row == 0)
903 addRow = 1; 915 addRow = 1;
904 p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, 916 p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight,
905 Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); 917 Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]);
906 918
907 // reset color to actual color 919 // reset color to actual color
908 if (!mHolidays[i].isNull()) { 920 if (!mHolidays[i].isNull()) {
909 p.setPen(actcol); 921 p.setPen(actcol);
910 } 922 }
911 // reset bold font to plain font 923 // reset bold font to plain font
912 if (events[i] > 0) { 924 if ( eDays.testBit(i)) {
913 QFont myFont = font(); 925 QFont myFont = font();
914 myFont.setBold(false); 926 myFont.setBold(false);
915 p.setFont(myFont); 927 p.setFont(myFont);
916 } 928 }
917 } 929 }
918 int off = 0;//xyOff; 930 int off = 0;//xyOff;
919 bitBlt (this, off, off, &myPix, 0 ,0,width(), height() ,CopyROP); 931 bitBlt (this, off, off, &myPix, 0 ,0,width(), height() ,CopyROP);
920 //qDebug("ffffffffff %d ", off); 932 //qDebug("ffffffffff %d ", off);
921} 933}
922 934
923// ---------------------------------------------------------------------------- 935// ----------------------------------------------------------------------------
924// R E SI Z E E V E N T H A N D L I N G 936// R E SI Z E E V E N T H A N D L I N G
925// ---------------------------------------------------------------------------- 937// ----------------------------------------------------------------------------
926 938
927void KODayMatrix::resizeEvent(QResizeEvent *) 939void KODayMatrix::resizeEvent(QResizeEvent *)
928{ 940{
929 QRect sz = frameRect(); 941 QRect sz = frameRect();
930 daysize.setHeight(sz.height()*7 / NUMDAYS); 942 daysize.setHeight(sz.height()*7 / NUMDAYS);
931 daysize.setWidth(sz.width() / 7); 943 daysize.setWidth(sz.width() / 7);
932} 944}
933 945
934QSize KODayMatrix::sizeHint() const 946QSize KODayMatrix::sizeHint() const
935{ 947{
936 948
diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h
index 2a1959c..38a7f92 100644
--- a/korganizer/kodaymatrix.h
+++ b/korganizer/kodaymatrix.h
@@ -209,89 +209,91 @@ signals:
209protected: 209protected:
210 210
211 void paintEvent(QPaintEvent *ev); 211 void paintEvent(QPaintEvent *ev);
212 212
213 void mousePressEvent (QMouseEvent* e); 213 void mousePressEvent (QMouseEvent* e);
214 214
215 void mouseReleaseEvent (QMouseEvent* e); 215 void mouseReleaseEvent (QMouseEvent* e);
216 216
217 void mouseMoveEvent (QMouseEvent* e); 217 void mouseMoveEvent (QMouseEvent* e);
218 218
219 void dragEnterEvent(QDragEnterEvent *); 219 void dragEnterEvent(QDragEnterEvent *);
220 220
221 void dragMoveEvent(QDragMoveEvent *); 221 void dragMoveEvent(QDragMoveEvent *);
222 222
223 void dragLeaveEvent(QDragLeaveEvent *); 223 void dragLeaveEvent(QDragLeaveEvent *);
224 224
225 void dropEvent(QDropEvent *); 225 void dropEvent(QDropEvent *);
226 226
227 void resizeEvent(QResizeEvent *); 227 void resizeEvent(QResizeEvent *);
228 228
229private: 229private:
230 KODaymatrixWhatsThis* mKODaymatrixWhatsThis; 230 KODaymatrixWhatsThis* mKODaymatrixWhatsThis;
231 bool mouseDown; 231 bool mouseDown;
232 QBitArray bDays; 232 QBitArray bDays;
233 QBitArray hDays;
234 QBitArray eDays;
233 QPixmap myPix; 235 QPixmap myPix;
234 QTimer* mUpdateTimer; 236 QTimer* mUpdateTimer;
235 QTimer* mRepaintTimer; 237 QTimer* mRepaintTimer;
236 bool mDayChanged; 238 bool mDayChanged;
237 bool mPendingUpdateBeforeRepaint; 239 bool mPendingUpdateBeforeRepaint;
238 240
239 /** returns the index of the day located at the matrix's widget (x,y) position. 241 /** returns the index of the day located at the matrix's widget (x,y) position.
240 * 242 *
241 * @param x horizontal coordinate 243 * @param x horizontal coordinate
242 * @param y vertical coordinate 244 * @param y vertical coordinate
243 */ 245 */
244 int getDayIndexFrom(int x, int y); 246 int getDayIndexFrom(int x, int y);
245 247
246 /** calculates a "shaded" color from the supplied color object. 248 /** calculates a "shaded" color from the supplied color object.
247 * (Copied from Cornelius's kdpdatebutton.cpp) 249 * (Copied from Cornelius's kdpdatebutton.cpp)
248 * 250 *
249 * @param color source based on which a shaded color should be calculated. 251 * @param color source based on which a shaded color should be calculated.
250 */ 252 */
251 QColor getShadedColor(QColor color); 253 QColor getShadedColor(QColor color);
252 254
253 /** number of days to be displayed. For now there is no support for any other number then 42. 255 /** number of days to be displayed. For now there is no support for any other number then 42.
254 so change it at your own risk :o) */ 256 so change it at your own risk :o) */
255 static const int NUMDAYS; 257 static const int NUMDAYS;
256 258
257 /** calendar instance to be queried for holidays, events, ... */ 259 /** calendar instance to be queried for holidays, events, ... */
258 Calendar *mCalendar; 260 Calendar *mCalendar;
259 261
260 /** starting date of the matrix */ 262 /** starting date of the matrix */
261 QDate startdate; 263 QDate startdate;
262 264
263 /** array of day labels to optimeize drawing performance. */ 265 /** array of day labels to optimeize drawing performance. */
264 QString *daylbls; 266 QString *daylbls;
265 267
266 /** array of days displayed to reduce memory consumption by 268 /** array of days displayed to reduce memory consumption by
267 subsequently calling QDate::addDays(). */ 269 subsequently calling QDate::addDays(). */
268 QDate *days; 270 QDate *days;
269 271
270 /** array of storing the number of events on a given day. 272 /** array of storing the number of events on a given day.
271 * used for drawing a bold font if there is at least one event on that day. 273 * used for drawing a bold font if there is at least one event on that day.
272 */ 274 */
273 int *events; 275 //int *events;
274 276
275 /** stores holiday names of the days shown in the matrix. */ 277 /** stores holiday names of the days shown in the matrix. */
276 QMap<int,QString> mHolidays; 278 QMap<int,QString> mHolidays;
277 279
278 /** indey of today or -1 if today is not visible in the matrix. */ 280 /** indey of today or -1 if today is not visible in the matrix. */
279 int today; 281 int today;
280 282
281 /** index of day where dragged selection was initiated. 283 /** index of day where dragged selection was initiated.
282 used to detect "negative" timely selections */ 284 used to detect "negative" timely selections */
283 int mSelInit; 285 int mSelInit;
284 286
285 /** if mSelStart has this value it indicates that there is no 287 /** if mSelStart has this value it indicates that there is no
286 actual selection in the matrix. */ 288 actual selection in the matrix. */
287 static const int NOSELECTION; 289 static const int NOSELECTION;
288 290
289 /** index of first selected day. */ 291 /** index of first selected day. */
290 int mSelStart; 292 int mSelStart;
291 293
292 /** index of last selected day. */ 294 /** index of last selected day. */
293 int mSelEnd; 295 int mSelEnd;
294 296
295 /** dynamic tooltip to handle mouse dependent tips for each day in the matrix. */ 297 /** dynamic tooltip to handle mouse dependent tips for each day in the matrix. */
296 DynamicTip* mToolTip; 298 DynamicTip* mToolTip;
297 299