-rw-r--r-- | korganizer/kodaymatrix.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 779d67c..fc00828 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -1,97 +1,96 @@ | |||
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 code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qevent.h> | 25 | #include <qevent.h> |
26 | #include <qpainter.h> | 26 | #include <qpainter.h> |
27 | #include <qptrlist.h> | 27 | #include <qptrlist.h> |
28 | 28 | ||
29 | #include <kglobal.h> | 29 | #include <kglobal.h> |
30 | #include <kdebug.h> | 30 | #include <kdebug.h> |
31 | #include <klocale.h> | 31 | #include <klocale.h> |
32 | 32 | ||
33 | #include <libkcal/vcaldrag.h> | 33 | #include <libkcal/vcaldrag.h> |
34 | #include <libkcal/icaldrag.h> | 34 | #include <libkcal/icaldrag.h> |
35 | #include <libkcal/dndfactory.h> | 35 | #include <libkcal/dndfactory.h> |
36 | #include <libkcal/calendarresources.h> | 36 | #include <libkcal/calendarresources.h> |
37 | #include <libkcal/resourcecalendar.h> | 37 | #include <libkcal/resourcecalendar.h> |
38 | #include <kresources/resourceselectdialog.h> | 38 | #include <kresources/resourceselectdialog.h> |
39 | 39 | ||
40 | #include <kcalendarsystem.h> | 40 | #include <kcalendarsystem.h> |
41 | 41 | ||
42 | #ifndef KORG_NOPLUGINS | 42 | #ifndef KORG_NOPLUGINS |
43 | #include "kocore.h" | 43 | #include "kocore.h" |
44 | #endif | 44 | #endif |
45 | #include "koprefs.h" | 45 | #include "koprefs.h" |
46 | #include "koglobals.h" | 46 | #include "koglobals.h" |
47 | 47 | ||
48 | #include "kodaymatrix.h" | 48 | #include "kodaymatrix.h" |
49 | #include "kodaymatrix.moc" | ||
50 | 49 | ||
51 | // ============================================================================ | 50 | // ============================================================================ |
52 | // D Y N A M I C T I P | 51 | // D Y N A M I C T I P |
53 | // ============================================================================ | 52 | // ============================================================================ |
54 | 53 | ||
55 | DynamicTip::DynamicTip( QWidget * parent ) | 54 | DynamicTip::DynamicTip( QWidget * parent ) |
56 | : QToolTip( parent ) | 55 | : QToolTip( parent ) |
57 | { | 56 | { |
58 | matrix = (KODayMatrix*)parent; | 57 | matrix = (KODayMatrix*)parent; |
59 | } | 58 | } |
60 | 59 | ||
61 | 60 | ||
62 | void DynamicTip::maybeTip( const QPoint &pos ) | 61 | void DynamicTip::maybeTip( const QPoint &pos ) |
63 | { | 62 | { |
64 | //calculate which cell of the matrix the mouse is in | 63 | //calculate which cell of the matrix the mouse is in |
65 | QRect sz = matrix->frameRect(); | 64 | QRect sz = matrix->frameRect(); |
66 | int dheight = sz.height()*7 / 42; | 65 | int dheight = sz.height()*7 / 42; |
67 | int dwidth = sz.width() / 7; | 66 | int dwidth = sz.width() / 7; |
68 | int row = pos.y()/dheight; | 67 | int row = pos.y()/dheight; |
69 | int col = pos.x()/dwidth; | 68 | int col = pos.x()/dwidth; |
70 | 69 | ||
71 | QRect rct(col*dwidth, row*dheight, dwidth, dheight); | 70 | QRect rct(col*dwidth, row*dheight, dwidth, dheight); |
72 | 71 | ||
73 | // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << | 72 | // kdDebug() << "DynamicTip::maybeTip matrix cell index [" << |
74 | // col << "][" << row << "] => " <<(col+row*7) << endl; | 73 | // col << "][" << row << "] => " <<(col+row*7) << endl; |
75 | 74 | ||
76 | //show holiday names only | 75 | //show holiday names only |
77 | QString str = matrix->getHolidayLabel(col+row*7); | 76 | QString str = matrix->getHolidayLabel(col+row*7); |
78 | if (str.isEmpty()) return; | 77 | if (str.isEmpty()) return; |
79 | tip(rct, str); | 78 | tip(rct, str); |
80 | } | 79 | } |
81 | 80 | ||
82 | 81 | ||
83 | // ============================================================================ | 82 | // ============================================================================ |
84 | // K O D A Y M A T R I X | 83 | // K O D A Y M A T R I X |
85 | // ============================================================================ | 84 | // ============================================================================ |
86 | 85 | ||
87 | const int KODayMatrix::NOSELECTION = -1000; | 86 | const int KODayMatrix::NOSELECTION = -1000; |
88 | const int KODayMatrix::NUMDAYS = 42; | 87 | const int KODayMatrix::NUMDAYS = 42; |
89 | 88 | ||
90 | KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : | 89 | KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const char *name) : |
91 | QFrame(parent, name) | 90 | QFrame(parent, name) |
92 | { | 91 | { |
93 | mCalendar = calendar; | 92 | mCalendar = calendar; |
94 | 93 | ||
95 | // initialize dynamic arrays | 94 | // initialize dynamic arrays |
96 | days = new QDate[NUMDAYS]; | 95 | days = new QDate[NUMDAYS]; |
97 | daylbls = new QString[NUMDAYS]; | 96 | daylbls = new QString[NUMDAYS]; |