-rw-r--r-- | korganizer/koagendaitem.cpp | 2 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index a39feb1..f027343 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -1,170 +1,170 @@ | |||
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 <qlabel.h> | 20 | #include <qlabel.h> |
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qhbox.h> | 22 | #include <qhbox.h> |
23 | #include <qvbox.h> | 23 | #include <qvbox.h> |
24 | #include <qtooltip.h> | 24 | #include <qtooltip.h> |
25 | #include <qwhatsthis.h> | 25 | #include <qwhatsthis.h> |
26 | #include <qdragobject.h> | 26 | #include <qdragobject.h> |
27 | #include <qdrawutil.h> | 27 | #include <qdrawutil.h> |
28 | #include <qpainter.h> | 28 | #include <qpainter.h> |
29 | 29 | ||
30 | #include <kiconloader.h> | 30 | #include <kiconloader.h> |
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | #include <kglobal.h> | 32 | #include <kglobal.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #ifndef DESKTOP_VERSION | 34 | #ifndef DESKTOP_VERSION |
35 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
36 | #define AGENDA_ICON_SIZE 5 | 36 | #define AGENDA_ICON_SIZE 5 |
37 | #else | 37 | #else |
38 | #define AGENDA_ICON_SIZE 7 | 38 | #define AGENDA_ICON_SIZE 7 |
39 | #endif | 39 | #endif |
40 | #include <libkcal/icaldrag.h> | 40 | #include <libkcal/icaldrag.h> |
41 | #include <libkcal/vcaldrag.h> | 41 | #include <libkcal/vcaldrag.h> |
42 | #include <libkdepim/kincidenceformatter.h> | 42 | #include <libkcal/kincidenceformatter.h> |
43 | extern int globalFlagBlockAgenda; | 43 | extern int globalFlagBlockAgenda; |
44 | extern int globalFlagBlockAgendaItemPaint; | 44 | extern int globalFlagBlockAgendaItemPaint; |
45 | extern int globalFlagBlockAgendaItemUpdate; | 45 | extern int globalFlagBlockAgendaItemUpdate; |
46 | 46 | ||
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | 48 | ||
49 | #include "koagendaitem.h" | 49 | #include "koagendaitem.h" |
50 | //#include "koagendaitem.moc" | 50 | //#include "koagendaitem.moc" |
51 | 51 | ||
52 | 52 | ||
53 | //-------------------------------------------------------------------------- | 53 | //-------------------------------------------------------------------------- |
54 | 54 | ||
55 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; | 55 | QToolTipGroup *KOAgendaItem::mToolTipGroup = 0; |
56 | 56 | ||
57 | //-------------------------------------------------------------------------- | 57 | //-------------------------------------------------------------------------- |
58 | 58 | ||
59 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, | 59 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, |
60 | const char *name,WFlags) : | 60 | const char *name,WFlags) : |
61 | QWidget(parent, name), mIncidence(incidence), mDate(qd) | 61 | QWidget(parent, name), mIncidence(incidence), mDate(qd) |
62 | { | 62 | { |
63 | #ifndef DESKTOP_VERSION | 63 | #ifndef DESKTOP_VERSION |
64 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 64 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
65 | #endif | 65 | #endif |
66 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase | 66 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase |
67 | setWFlags ( wflags); | 67 | setWFlags ( wflags); |
68 | mAllDay = allday; | 68 | mAllDay = allday; |
69 | init ( incidence, qd ); | 69 | init ( incidence, qd ); |
70 | setMouseTracking(true); | 70 | setMouseTracking(true); |
71 | //setAcceptDrops(true); | 71 | //setAcceptDrops(true); |
72 | xPaintCoord = -1; | 72 | xPaintCoord = -1; |
73 | yPaintCoord = -1; | 73 | yPaintCoord = -1; |
74 | } | 74 | } |
75 | 75 | ||
76 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | 76 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) |
77 | { | 77 | { |
78 | mIncidence = incidence; | 78 | mIncidence = incidence; |
79 | mDate = qd; | 79 | mDate = qd; |
80 | mFirstMultiItem = 0; | 80 | mFirstMultiItem = 0; |
81 | mNextMultiItem = 0; | 81 | mNextMultiItem = 0; |
82 | mLastMultiItem = 0; | 82 | mLastMultiItem = 0; |
83 | computeText(); | 83 | computeText(); |
84 | 84 | ||
85 | if ( (incidence->type() == "Todo") && | 85 | if ( (incidence->type() == "Todo") && |
86 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && | 86 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && |
87 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { | 87 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { |
88 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) | 88 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) |
89 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; | 89 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; |
90 | else | 90 | else |
91 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; | 91 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; |
92 | } | 92 | } |
93 | else { | 93 | else { |
94 | QStringList categories = mIncidence->categories(); | 94 | QStringList categories = mIncidence->categories(); |
95 | QString cat = categories.first(); | 95 | QString cat = categories.first(); |
96 | if (cat.isEmpty()) { | 96 | if (cat.isEmpty()) { |
97 | mBackgroundColor =KOPrefs::instance()->mEventColor; | 97 | mBackgroundColor =KOPrefs::instance()->mEventColor; |
98 | } else { | 98 | } else { |
99 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); | 99 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | mColorGroup = QColorGroup( mBackgroundColor.light(), | 102 | mColorGroup = QColorGroup( mBackgroundColor.light(), |
103 | mBackgroundColor.dark(),mBackgroundColor.light(), | 103 | mBackgroundColor.dark(),mBackgroundColor.light(), |
104 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; | 104 | mBackgroundColor.dark(),mBackgroundColor, black, mBackgroundColor) ; |
105 | setBackgroundColor( mBackgroundColor ); | 105 | setBackgroundColor( mBackgroundColor ); |
106 | 106 | ||
107 | setCellXY(0,0,1); | 107 | setCellXY(0,0,1); |
108 | setCellXWidth(0); | 108 | setCellXWidth(0); |
109 | setSubCell(0); | 109 | setSubCell(0); |
110 | setSubCells(1); | 110 | setSubCells(1); |
111 | setMultiItem(0,0,0); | 111 | setMultiItem(0,0,0); |
112 | startMove(); | 112 | startMove(); |
113 | mSelected = true; | 113 | mSelected = true; |
114 | select(false); | 114 | select(false); |
115 | QString tipText = mIncidence->summary(); | 115 | QString tipText = mIncidence->summary(); |
116 | // QToolTip::add(this,tipText); | 116 | // QToolTip::add(this,tipText); |
117 | QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); | 117 | QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); |
118 | if ( !mIncidence->doesFloat() ) | 118 | if ( !mIncidence->doesFloat() ) |
119 | if ( mIncidence->type() == "Event" ) { | 119 | if ( mIncidence->type() == "Event" ) { |
120 | if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { | 120 | if ( (static_cast<Event*>(mIncidence))->isMultiDay() ) { |
121 | tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); | 121 | tipText += "\n"+i18n("From: ")+mIncidence->dtStartStr(); |
122 | tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); | 122 | tipText += "\n"+i18n("To: ")+(static_cast<Event*>(mIncidence))->dtEndStr(); |
123 | } | 123 | } |
124 | else { | 124 | else { |
125 | tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); | 125 | tipText += "\n"+i18n("Time: ")+mIncidence->dtStartTimeStr(); |
126 | tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); | 126 | tipText += " - "+(static_cast<Event*>(mIncidence))->dtEndTimeStr(); |
127 | } | 127 | } |
128 | } | 128 | } |
129 | else if ( mIncidence->type() == "Todo" ) { | 129 | else if ( mIncidence->type() == "Todo" ) { |
130 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueTimeStr(); | 130 | tipText += "\n"+i18n("Due: ")+ (static_cast<Todo*>(mIncidence))->dtDueTimeStr(); |
131 | } | 131 | } |
132 | 132 | ||
133 | if (!mIncidence->location().isEmpty()) { | 133 | if (!mIncidence->location().isEmpty()) { |
134 | tipText += "\n"+i18n("Location: ")+mIncidence->location(); | 134 | tipText += "\n"+i18n("Location: ")+mIncidence->location(); |
135 | } | 135 | } |
136 | QToolTip::add(this,tipText,toolTipGroup(),""); | 136 | QToolTip::add(this,tipText,toolTipGroup(),""); |
137 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); | 137 | QFontMetrics fontinf(KOPrefs::instance()->mAgendaViewFont); |
138 | mFontPixelSize = fontinf.height();; | 138 | mFontPixelSize = fontinf.height();; |
139 | hide(); | 139 | hide(); |
140 | xPaintCoord = -1; | 140 | xPaintCoord = -1; |
141 | yPaintCoord = -1; | 141 | yPaintCoord = -1; |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | KOAgendaItem::~KOAgendaItem() | 145 | KOAgendaItem::~KOAgendaItem() |
146 | { | 146 | { |
147 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); | 147 | // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); |
148 | 148 | ||
149 | } | 149 | } |
150 | 150 | ||
151 | void KOAgendaItem::recreateIncidence() | 151 | void KOAgendaItem::recreateIncidence() |
152 | { | 152 | { |
153 | Incidence* newInc = mIncidence->clone(); | 153 | Incidence* newInc = mIncidence->clone(); |
154 | newInc->recreate(); | 154 | newInc->recreate(); |
155 | if ( mIncidence->doesRecur() ) { | 155 | if ( mIncidence->doesRecur() ) { |
156 | mIncidence->addExDate( mDate ); | 156 | mIncidence->addExDate( mDate ); |
157 | newInc->recurrence()->unsetRecurs(); | 157 | newInc->recurrence()->unsetRecurs(); |
158 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); | 158 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); |
159 | QTime tim = mIncidence->dtStart().time(); | 159 | QTime tim = mIncidence->dtStart().time(); |
160 | newInc->setDtStart( QDateTime(mDate, tim) ); | 160 | newInc->setDtStart( QDateTime(mDate, tim) ); |
161 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 161 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
162 | } | 162 | } |
163 | mIncidence = newInc; | 163 | mIncidence = newInc; |
164 | } | 164 | } |
165 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) | 165 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) |
166 | { | 166 | { |
167 | int size = AGENDA_ICON_SIZE; | 167 | int size = AGENDA_ICON_SIZE; |
168 | 168 | ||
169 | int yOff = 0; | 169 | int yOff = 0; |
170 | int xOff = 0; | 170 | int xOff = 0; |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index df60564..688d9e1 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -1,180 +1,180 @@ | |||
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 <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qtooltip.h> | 27 | #include <qtooltip.h> |
28 | #include <qpainter.h> | 28 | #include <qpainter.h> |
29 | #include <qwhatsthis.h> | 29 | #include <qwhatsthis.h> |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | #include <qpe/qpeapplication.h> | 31 | #include <qpe/qpeapplication.h> |
32 | #else | 32 | #else |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #include <kdebug.h> | 36 | #include <kdebug.h> |
37 | #include <klocale.h> | 37 | #include <klocale.h> |
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kconfig.h> | 39 | #include <kconfig.h> |
40 | #include <kiconloader.h> | 40 | #include <kiconloader.h> |
41 | 41 | ||
42 | #include <kcalendarsystem.h> | 42 | #include <kcalendarsystem.h> |
43 | 43 | ||
44 | #ifndef KORG_NOPRINTER | 44 | #ifndef KORG_NOPRINTER |
45 | #include "calprinter.h" | 45 | #include "calprinter.h" |
46 | #endif | 46 | #endif |
47 | #include "koprefs.h" | 47 | #include "koprefs.h" |
48 | #ifndef KORG_NOPLUGINS | 48 | #ifndef KORG_NOPLUGINS |
49 | #include "kocore.h" | 49 | #include "kocore.h" |
50 | #endif | 50 | #endif |
51 | #include "koglobals.h" | 51 | #include "koglobals.h" |
52 | #include <libkdepim/kincidenceformatter.h> | 52 | #include <libkcal/kincidenceformatter.h> |
53 | 53 | ||
54 | #include "komonthview.h" | 54 | #include "komonthview.h" |
55 | 55 | ||
56 | #define PIXMAP_SIZE 5 | 56 | #define PIXMAP_SIZE 5 |
57 | 57 | ||
58 | class KNOWhatsThis :public QWhatsThis | 58 | class KNOWhatsThis :public QWhatsThis |
59 | { | 59 | { |
60 | public: | 60 | public: |
61 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; | 61 | KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; |
62 | 62 | ||
63 | protected: | 63 | protected: |
64 | virtual QString text( const QPoint& p) | 64 | virtual QString text( const QPoint& p) |
65 | { | 65 | { |
66 | return _wid->getWhatsThisText(p) ; | 66 | return _wid->getWhatsThisText(p) ; |
67 | }; | 67 | }; |
68 | private: | 68 | private: |
69 | KNoScrollListBox* _wid; | 69 | KNoScrollListBox* _wid; |
70 | 70 | ||
71 | }; | 71 | }; |
72 | 72 | ||
73 | 73 | ||
74 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) | 74 | KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) |
75 | : QListBox(parent, name) | 75 | : QListBox(parent, name) |
76 | { | 76 | { |
77 | #ifndef DESKTOP_VERSION | 77 | #ifndef DESKTOP_VERSION |
78 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 78 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
79 | #endif | 79 | #endif |
80 | new KNOWhatsThis(this); | 80 | new KNOWhatsThis(this); |
81 | } | 81 | } |
82 | 82 | ||
83 | QString KNoScrollListBox::getWhatsThisText(QPoint p) | 83 | QString KNoScrollListBox::getWhatsThisText(QPoint p) |
84 | { | 84 | { |
85 | QListBoxItem* item = itemAt ( p ); | 85 | QListBoxItem* item = itemAt ( p ); |
86 | if ( ! item ) { | 86 | if ( ! item ) { |
87 | return i18n("Click in the cell or\non the date label\nto add an event!"); | 87 | return i18n("Click in the cell or\non the date label\nto add an event!"); |
88 | } | 88 | } |
89 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); | 89 | return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); |
90 | } | 90 | } |
91 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) | 91 | void KNoScrollListBox::keyPressEvent(QKeyEvent *e) |
92 | { | 92 | { |
93 | 93 | ||
94 | switch(e->key()) { | 94 | switch(e->key()) { |
95 | case Key_Right: | 95 | case Key_Right: |
96 | // if ( e->state() == Qt::ControlButton ) | 96 | // if ( e->state() == Qt::ControlButton ) |
97 | { | 97 | { |
98 | e->ignore(); | 98 | e->ignore(); |
99 | return; | 99 | return; |
100 | } | 100 | } |
101 | scrollBy(4,0); | 101 | scrollBy(4,0); |
102 | break; | 102 | break; |
103 | case Key_Left: | 103 | case Key_Left: |
104 | // if ( e->state() == Qt::ControlButton ) | 104 | // if ( e->state() == Qt::ControlButton ) |
105 | { | 105 | { |
106 | e->ignore(); | 106 | e->ignore(); |
107 | return; | 107 | return; |
108 | } | 108 | } |
109 | scrollBy(-4,0); | 109 | scrollBy(-4,0); |
110 | break; | 110 | break; |
111 | case Key_Up: | 111 | case Key_Up: |
112 | if(!count()) break; | 112 | if(!count()) break; |
113 | setCurrentItem((currentItem()+count()-1)%count()); | 113 | setCurrentItem((currentItem()+count()-1)%count()); |
114 | if(!itemVisible(currentItem())) { | 114 | if(!itemVisible(currentItem())) { |
115 | if((unsigned int) currentItem() == (count()-1)) { | 115 | if((unsigned int) currentItem() == (count()-1)) { |
116 | setTopItem(currentItem()-numItemsVisible()+1); | 116 | setTopItem(currentItem()-numItemsVisible()+1); |
117 | } else { | 117 | } else { |
118 | setTopItem(topItem()-1); | 118 | setTopItem(topItem()-1); |
119 | } | 119 | } |
120 | } | 120 | } |
121 | break; | 121 | break; |
122 | case Key_Down: | 122 | case Key_Down: |
123 | if(!count()) break; | 123 | if(!count()) break; |
124 | setCurrentItem((currentItem()+1)%count()); | 124 | setCurrentItem((currentItem()+1)%count()); |
125 | if(!itemVisible(currentItem())) { | 125 | if(!itemVisible(currentItem())) { |
126 | if(currentItem() == 0) { | 126 | if(currentItem() == 0) { |
127 | setTopItem(0); | 127 | setTopItem(0); |
128 | } else { | 128 | } else { |
129 | setTopItem(topItem()+1); | 129 | setTopItem(topItem()+1); |
130 | } | 130 | } |
131 | } | 131 | } |
132 | break; | 132 | break; |
133 | case Key_Shift: | 133 | case Key_Shift: |
134 | emit shiftDown(); | 134 | emit shiftDown(); |
135 | break; | 135 | break; |
136 | default: | 136 | default: |
137 | e->ignore(); | 137 | e->ignore(); |
138 | break; | 138 | break; |
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) | 142 | void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e) |
143 | { | 143 | { |
144 | switch(e->key()) { | 144 | switch(e->key()) { |
145 | case Key_Shift: | 145 | case Key_Shift: |
146 | emit shiftUp(); | 146 | emit shiftUp(); |
147 | break; | 147 | break; |
148 | default: | 148 | default: |
149 | break; | 149 | break; |
150 | } | 150 | } |
151 | } | 151 | } |
152 | 152 | ||
153 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) | 153 | void KNoScrollListBox::mousePressEvent(QMouseEvent *e) |
154 | { | 154 | { |
155 | QListBox::mousePressEvent(e); | 155 | QListBox::mousePressEvent(e); |
156 | 156 | ||
157 | if(e->button() == RightButton) { | 157 | if(e->button() == RightButton) { |
158 | emit rightClick(); | 158 | emit rightClick(); |
159 | } | 159 | } |
160 | } | 160 | } |
161 | 161 | ||
162 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) | 162 | MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) |
163 | : QListBoxItem() | 163 | : QListBoxItem() |
164 | { | 164 | { |
165 | setText( s ); | 165 | setText( s ); |
166 | 166 | ||
167 | mIncidence = incidence; | 167 | mIncidence = incidence; |
168 | mDate = qd; | 168 | mDate = qd; |
169 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); | 169 | // QWhatsThis::add(this,KIncidenceFormatter::instance()->getFormattedText( mIncidence )); |
170 | mRecur = false; | 170 | mRecur = false; |
171 | mAlarm = false; | 171 | mAlarm = false; |
172 | mReply = false; | 172 | mReply = false; |
173 | mInfo = false; | 173 | mInfo = false; |
174 | } | 174 | } |
175 | 175 | ||
176 | void MonthViewItem::paint(QPainter *p) | 176 | void MonthViewItem::paint(QPainter *p) |
177 | { | 177 | { |
178 | #if QT_VERSION >= 0x030000 | 178 | #if QT_VERSION >= 0x030000 |
179 | bool sel = isSelected(); | 179 | bool sel = isSelected(); |
180 | #else | 180 | #else |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 3bc6081..b1c7709 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,164 +1,164 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | #include <qlineedit.h> | 8 | #include <qlineedit.h> |
9 | #include <qfile.h> | 9 | #include <qfile.h> |
10 | #include <qdir.h> | 10 | #include <qdir.h> |
11 | #include <qapp.h> | 11 | #include <qapp.h> |
12 | #include <qfileinfo.h> | 12 | #include <qfileinfo.h> |
13 | #include <qlabel.h> | 13 | #include <qlabel.h> |
14 | #include <qmap.h> | 14 | #include <qmap.h> |
15 | #include <qwmatrix.h> | 15 | #include <qwmatrix.h> |
16 | #include <qtextbrowser.h> | 16 | #include <qtextbrowser.h> |
17 | #include <qtextstream.h> | 17 | #include <qtextstream.h> |
18 | #ifndef DESKTOP_VERSION | 18 | #ifndef DESKTOP_VERSION |
19 | #include <qpe/global.h> | 19 | #include <qpe/global.h> |
20 | #include <qpe/qpemenubar.h> | 20 | #include <qpe/qpemenubar.h> |
21 | #include <qpe/qpetoolbar.h> | 21 | #include <qpe/qpetoolbar.h> |
22 | #include <qpe/resource.h> | 22 | #include <qpe/resource.h> |
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <qtopia/alarmserver.h> | 24 | #include <qtopia/alarmserver.h> |
25 | #include <qtopia/qcopenvelope_qws.h> | 25 | #include <qtopia/qcopenvelope_qws.h> |
26 | #else | 26 | #else |
27 | #include <qmenubar.h> | 27 | #include <qmenubar.h> |
28 | #include <qtoolbar.h> | 28 | #include <qtoolbar.h> |
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | //#include <resource.h> | 30 | //#include <resource.h> |
31 | 31 | ||
32 | #endif | 32 | #endif |
33 | #include <libkcal/calendarlocal.h> | 33 | #include <libkcal/calendarlocal.h> |
34 | #include <libkcal/todo.h> | 34 | #include <libkcal/todo.h> |
35 | #include <libkdepim/ksyncprofile.h> | 35 | #include <libkdepim/ksyncprofile.h> |
36 | #include <libkdepim/kincidenceformatter.h> | 36 | #include <libkcal/kincidenceformatter.h> |
37 | 37 | ||
38 | #include "calendarview.h" | 38 | #include "calendarview.h" |
39 | #include "koviewmanager.h" | 39 | #include "koviewmanager.h" |
40 | #include "datenavigator.h" | 40 | #include "datenavigator.h" |
41 | #include "koagendaview.h" | 41 | #include "koagendaview.h" |
42 | #include "koagenda.h" | 42 | #include "koagenda.h" |
43 | #include "kodialogmanager.h" | 43 | #include "kodialogmanager.h" |
44 | #include "kdialogbase.h" | 44 | #include "kdialogbase.h" |
45 | #include "kapplication.h" | 45 | #include "kapplication.h" |
46 | #include "kofilterview.h" | 46 | #include "kofilterview.h" |
47 | #include "kstandarddirs.h" | 47 | #include "kstandarddirs.h" |
48 | #include "koprefs.h" | 48 | #include "koprefs.h" |
49 | #include "kfiledialog.h" | 49 | #include "kfiledialog.h" |
50 | #include "koglobals.h" | 50 | #include "koglobals.h" |
51 | #include "kglobal.h" | 51 | #include "kglobal.h" |
52 | #include "klocale.h" | 52 | #include "klocale.h" |
53 | #include "kconfig.h" | 53 | #include "kconfig.h" |
54 | #include "simplealarmclient.h" | 54 | #include "simplealarmclient.h" |
55 | #include "externalapphandler.h" | 55 | #include "externalapphandler.h" |
56 | 56 | ||
57 | using namespace KCal; | 57 | using namespace KCal; |
58 | #ifndef _WIN32_ | 58 | #ifndef _WIN32_ |
59 | #include <unistd.h> | 59 | #include <unistd.h> |
60 | #else | 60 | #else |
61 | #include "koimportoldialog.h" | 61 | #include "koimportoldialog.h" |
62 | #endif | 62 | #endif |
63 | #include "mainwindow.h" | 63 | #include "mainwindow.h" |
64 | 64 | ||
65 | int globalFlagBlockStartup; | 65 | int globalFlagBlockStartup; |
66 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 66 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
67 | QMainWindow( parent, name ) | 67 | QMainWindow( parent, name ) |
68 | { | 68 | { |
69 | 69 | ||
70 | #ifdef DESKTOP_VERSION | 70 | #ifdef DESKTOP_VERSION |
71 | setFont( QFont("Arial"), 14 ); | 71 | setFont( QFont("Arial"), 14 ); |
72 | #endif | 72 | #endif |
73 | 73 | ||
74 | mClosed = false; | 74 | mClosed = false; |
75 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 75 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
76 | QString confFile = locateLocal("config","korganizerrc"); | 76 | QString confFile = locateLocal("config","korganizerrc"); |
77 | QFileInfo finf ( confFile ); | 77 | QFileInfo finf ( confFile ); |
78 | bool showWarning = !finf.exists(); | 78 | bool showWarning = !finf.exists(); |
79 | setIcon(SmallIcon( "ko24" ) ); | 79 | setIcon(SmallIcon( "ko24" ) ); |
80 | mBlockAtStartup = true; | 80 | mBlockAtStartup = true; |
81 | mFlagKeyPressed = false; | 81 | mFlagKeyPressed = false; |
82 | setCaption("KOrganizer/Pi"); | 82 | setCaption("KOrganizer/Pi"); |
83 | KOPrefs *p = KOPrefs::instance(); | 83 | KOPrefs *p = KOPrefs::instance(); |
84 | // if ( QApplication::desktop()->height() > 480 ) { | 84 | // if ( QApplication::desktop()->height() > 480 ) { |
85 | // if ( p->mHourSize == 4 ) | 85 | // if ( p->mHourSize == 4 ) |
86 | // p->mHourSize = 6; | 86 | // p->mHourSize = 6; |
87 | // } | 87 | // } |
88 | if ( p->mHourSize > 18 ) | 88 | if ( p->mHourSize > 18 ) |
89 | p->mHourSize = 18; | 89 | p->mHourSize = 18; |
90 | QMainWindow::ToolBarDock tbd; | 90 | QMainWindow::ToolBarDock tbd; |
91 | if ( p->mToolBarHor ) { | 91 | if ( p->mToolBarHor ) { |
92 | if ( p->mToolBarUp ) | 92 | if ( p->mToolBarUp ) |
93 | tbd = Bottom; | 93 | tbd = Bottom; |
94 | else | 94 | else |
95 | tbd = Top; | 95 | tbd = Top; |
96 | } | 96 | } |
97 | else { | 97 | else { |
98 | if ( p->mToolBarUp ) | 98 | if ( p->mToolBarUp ) |
99 | tbd = Right; | 99 | tbd = Right; |
100 | else | 100 | else |
101 | tbd = Left; | 101 | tbd = Left; |
102 | } | 102 | } |
103 | if ( KOPrefs::instance()->mUseAppColors ) | 103 | if ( KOPrefs::instance()->mUseAppColors ) |
104 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 104 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
105 | globalFlagBlockStartup = 1; | 105 | globalFlagBlockStartup = 1; |
106 | iconToolBar = new QPEToolBar( this ); | 106 | iconToolBar = new QPEToolBar( this ); |
107 | addToolBar (iconToolBar , tbd ); | 107 | addToolBar (iconToolBar , tbd ); |
108 | mBlockSaveFlag = false; | 108 | mBlockSaveFlag = false; |
109 | mCalendarModifiedFlag = false; | 109 | mCalendarModifiedFlag = false; |
110 | 110 | ||
111 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 111 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
112 | splash->setAlignment ( AlignCenter ); | 112 | splash->setAlignment ( AlignCenter ); |
113 | setCentralWidget( splash ); | 113 | setCentralWidget( splash ); |
114 | #ifndef DESKTOP_VERSION | 114 | #ifndef DESKTOP_VERSION |
115 | showMaximized(); | 115 | showMaximized(); |
116 | #endif | 116 | #endif |
117 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 117 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
118 | setDefaultPreferences(); | 118 | setDefaultPreferences(); |
119 | mCalendar = new CalendarLocal(); | 119 | mCalendar = new CalendarLocal(); |
120 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 120 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
121 | mView->hide(); | 121 | mView->hide(); |
122 | //mView->resize(splash->size() ); | 122 | //mView->resize(splash->size() ); |
123 | initActions(); | 123 | initActions(); |
124 | #ifndef DESKTOP_VERSION | 124 | #ifndef DESKTOP_VERSION |
125 | iconToolBar->show(); | 125 | iconToolBar->show(); |
126 | qApp->processEvents(); | 126 | qApp->processEvents(); |
127 | #endif | 127 | #endif |
128 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 128 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
129 | int vh = height() ; | 129 | int vh = height() ; |
130 | int vw = width(); | 130 | int vw = width(); |
131 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 131 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
132 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 132 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
133 | vh -= iconToolBar->height(); | 133 | vh -= iconToolBar->height(); |
134 | } else { | 134 | } else { |
135 | vw -= iconToolBar->height(); | 135 | vw -= iconToolBar->height(); |
136 | } | 136 | } |
137 | //mView->setMaximumSize( splash->size() ); | 137 | //mView->setMaximumSize( splash->size() ); |
138 | //mView->resize( splash->size() ); | 138 | //mView->resize( splash->size() ); |
139 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 139 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
140 | mView->readSettings(); | 140 | mView->readSettings(); |
141 | bool oldOpened = false; | 141 | bool oldOpened = false; |
142 | bool newFile = false; | 142 | bool newFile = false; |
143 | if( !QFile::exists( defaultFileName() ) ) { | 143 | if( !QFile::exists( defaultFileName() ) ) { |
144 | QFileInfo finfo ( defaultFileName() ); | 144 | QFileInfo finfo ( defaultFileName() ); |
145 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 145 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
146 | qDebug("oldfile %s ", oldFile.latin1()); | 146 | qDebug("oldfile %s ", oldFile.latin1()); |
147 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; | 147 | QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; |
148 | finfo.setFile( oldFile ); | 148 | finfo.setFile( oldFile ); |
149 | if (finfo.exists() ) { | 149 | if (finfo.exists() ) { |
150 | KMessageBox::information( this, message); | 150 | KMessageBox::information( this, message); |
151 | mView->openCalendar( oldFile ); | 151 | mView->openCalendar( oldFile ); |
152 | qApp->processEvents(); | 152 | qApp->processEvents(); |
153 | } else { | 153 | } else { |
154 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 154 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
155 | finfo.setFile( oldFile ); | 155 | finfo.setFile( oldFile ); |
156 | if (finfo.exists() ) { | 156 | if (finfo.exists() ) { |
157 | KMessageBox::information( this, message); | 157 | KMessageBox::information( this, message); |
158 | mView->openCalendar( oldFile ); | 158 | mView->openCalendar( oldFile ); |
159 | qApp->processEvents(); | 159 | qApp->processEvents(); |
160 | } | 160 | } |
161 | } | 161 | } |
162 | mView->saveCalendar( defaultFileName() ); | 162 | mView->saveCalendar( defaultFileName() ); |
163 | newFile = true; | 163 | newFile = true; |
164 | } | 164 | } |