-rw-r--r-- | bin/kdepim/WhatsNew.txt | 2 | ||||
-rw-r--r-- | korganizer/koagenda.cpp | 195 | ||||
-rw-r--r-- | korganizer/koagenda.h | 6 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 2 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 14 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 1 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 55 | ||||
-rw-r--r-- | korganizer/kolistview.h | 7 | ||||
-rw-r--r-- | microkde/kdeui/klistview.cpp | 5 | ||||
-rw-r--r-- | microkde/kdeui/klistview.h | 2 |
10 files changed, 265 insertions, 24 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 6f8b041..d5d1f76 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,61 +1,63 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 2.0.21 ************ | 3 | ********** VERSION 2.0.21 ************ |
4 | 4 | ||
5 | Fixed another SMTP problem in OM/Pi. | 5 | Fixed another SMTP problem in OM/Pi. |
6 | Some small changed in the new datenavigator in KO/Pi. | 6 | Some small changed in the new datenavigator in KO/Pi. |
7 | Changed default setting for new filter in KA/Pi to "exclude categories". | 7 | Changed default setting for new filter in KA/Pi to "exclude categories". |
8 | Changed the default font size for 640x480 display . | 8 | Changed the default font size for 640x480 display . |
9 | Changed popup menu behaviour in agenda and list view. | 9 | Changed popup menu behaviour in agenda and list view. |
10 | Fixed some layout problems of the date label size in the month view. | 10 | Fixed some layout problems of the date label size in the month view. |
11 | Made month view update faster. | 11 | Made month view update faster. |
12 | Made first datenavigator repainting faster. | 12 | Made first datenavigator repainting faster. |
13 | Changed the title of the event/todo edit dialogs. | 13 | Changed the title of the event/todo edit dialogs. |
14 | Timelabels in agenga changed from 22:00 to 22 oo. ( the oo higher, of course). | ||
15 | Please report, if there are layout problems with the new timelabels. | ||
14 | 16 | ||
15 | 17 | ||
16 | ********** VERSION 2.0.20 ************ | 18 | ********** VERSION 2.0.20 ************ |
17 | 19 | ||
18 | Two small fixes in OM/Pi. | 20 | Two small fixes in OM/Pi. |
19 | 21 | ||
20 | Better resizing of the new datenavigator in KO/Pi. | 22 | Better resizing of the new datenavigator in KO/Pi. |
21 | 23 | ||
22 | ********** VERSION 2.0.19 ************ | 24 | ********** VERSION 2.0.19 ************ |
23 | KO/Pi: | 25 | KO/Pi: |
24 | Enhancements and bugfixes in the new datenavigator. | 26 | Enhancements and bugfixes in the new datenavigator. |
25 | Bugfix in this changelog: | 27 | Bugfix in this changelog: |
26 | The datenavigator was changed in version 2.0.18, not the datepicker. | 28 | The datenavigator was changed in version 2.0.18, not the datepicker. |
27 | 29 | ||
28 | ********** VERSION 2.0.18 ************ | 30 | ********** VERSION 2.0.18 ************ |
29 | KO/Pi: | 31 | KO/Pi: |
30 | Fixed some minor problems. | 32 | Fixed some minor problems. |
31 | Cleaned up the KO/Pi config dialog. | 33 | Cleaned up the KO/Pi config dialog. |
32 | Fixed problem moving events in aganda view. | 34 | Fixed problem moving events in aganda view. |
33 | Made datepicker scaleable, i.e. if the datenavigator shows now a | 35 | Made datepicker scaleable, i.e. if the datenavigator shows now a |
34 | datenavigator matrix depending on its size. | 36 | datenavigator matrix depending on its size. |
35 | Birthdays are now displayed green in the datenavigator. | 37 | Birthdays are now displayed green in the datenavigator. |
36 | What'sThis Help in datenavigator shows all events of the day. | 38 | What'sThis Help in datenavigator shows all events of the day. |
37 | 39 | ||
38 | OM/Pi: | 40 | OM/Pi: |
39 | Updated the backend mail library to the latest version. | 41 | Updated the backend mail library to the latest version. |
40 | Please backup your mail before using this version. | 42 | Please backup your mail before using this version. |
41 | 43 | ||
42 | ********** VERSION 2.0.17 ************ | 44 | ********** VERSION 2.0.17 ************ |
43 | 45 | ||
44 | KO/Pi: | 46 | KO/Pi: |
45 | Tooltips in month view were not sorted. Fixed. | 47 | Tooltips in month view were not sorted. Fixed. |
46 | Daylabel in agenda view ( for display of one day ) was too short. Fixed. | 48 | Daylabel in agenda view ( for display of one day ) was too short. Fixed. |
47 | Conflict display dialog for syncing was not on top of other windows. Fixed. | 49 | Conflict display dialog for syncing was not on top of other windows. Fixed. |
48 | Fixed some minor problems. | 50 | Fixed some minor problems. |
49 | 51 | ||
50 | Fixed an endless loop when importing vcs file with RESOURCES entry. | 52 | Fixed an endless loop when importing vcs file with RESOURCES entry. |
51 | 53 | ||
52 | ********** VERSION 2.0.16 ************ | 54 | ********** VERSION 2.0.16 ************ |
53 | OM/Pi: | 55 | OM/Pi: |
54 | Fixed the SMTP account setting the option. | 56 | Fixed the SMTP account setting the option. |
55 | Fixed something in mail sending. | 57 | Fixed something in mail sending. |
56 | 58 | ||
57 | KO/Pi: | 59 | KO/Pi: |
58 | Added possibility to export selected events/todos as vcal file. | 60 | Added possibility to export selected events/todos as vcal file. |
59 | 61 | ||
60 | ********** VERSION 2.0.15 ************ | 62 | ********** VERSION 2.0.15 ************ |
61 | 63 | ||
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 66ad4ec..14f52b8 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -25,97 +25,96 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #ifndef _WIN32_ | 27 | #ifndef _WIN32_ |
28 | #define protected public | 28 | #define protected public |
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #undef protected | 30 | #undef protected |
31 | #endif | 31 | #endif |
32 | #include <qintdict.h> | 32 | #include <qintdict.h> |
33 | #include <qdatetime.h> | 33 | #include <qdatetime.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | #include <qpopupmenu.h> | 35 | #include <qpopupmenu.h> |
36 | #include <qcursor.h> | 36 | #include <qcursor.h> |
37 | #include <qpainter.h> | 37 | #include <qpainter.h> |
38 | 38 | ||
39 | #include <kdebug.h> | 39 | #include <kdebug.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kiconloader.h> | 41 | #include <kiconloader.h> |
42 | #include <kglobal.h> | 42 | #include <kglobal.h> |
43 | 43 | ||
44 | #include "koagendaitem.h" | 44 | #include "koagendaitem.h" |
45 | #include "koprefs.h" | 45 | #include "koprefs.h" |
46 | #include "koglobals.h" | 46 | #include "koglobals.h" |
47 | 47 | ||
48 | #include "koagenda.h" | 48 | #include "koagenda.h" |
49 | 49 | ||
50 | #include <libkcal/event.h> | 50 | #include <libkcal/event.h> |
51 | #include <libkcal/todo.h> | 51 | #include <libkcal/todo.h> |
52 | 52 | ||
53 | #ifndef DESKTOP_VERSION | 53 | #ifndef DESKTOP_VERSION |
54 | #include <qpe/qpeapplication.h> | 54 | #include <qpe/qpeapplication.h> |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | //extern bool globalFlagBlockPainting; | 57 | //extern bool globalFlagBlockPainting; |
58 | extern int globalFlagBlockAgenda; | 58 | extern int globalFlagBlockAgenda; |
59 | extern int globalFlagBlockAgendaItemPaint; | 59 | extern int globalFlagBlockAgendaItemPaint; |
60 | extern int globalFlagBlockAgendaItemUpdate; | 60 | extern int globalFlagBlockAgendaItemUpdate; |
61 | extern int globalFlagBlockStartup; | 61 | extern int globalFlagBlockStartup; |
62 | 62 | ||
63 | //////////////////////////////////////////////////////////////////////////// | 63 | //////////////////////////////////////////////////////////////////////////// |
64 | MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) | 64 | MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) |
65 | : QFrame(_agenda->viewport(),name), agenda(_agenda) | 65 | : QFrame(_agenda->viewport(),name), agenda(_agenda) |
66 | { | 66 | { |
67 | setLineWidth(0); | 67 | setLineWidth(0); |
68 | setMargin(0); | 68 | setMargin(0); |
69 | setBackgroundColor(Qt::red); | 69 | setBackgroundColor(Qt::red); |
70 | minutes = new QTimer(this); | 70 | minutes = new QTimer(this); |
71 | connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); | 71 | connect(minutes, SIGNAL(timeout()), this, SLOT(updateLoc())); |
72 | minutes->start(0, true); | 72 | minutes->start(0, true); |
73 | |||
74 | mTimeBox = new QLabel(this); | 73 | mTimeBox = new QLabel(this); |
75 | mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); | 74 | mTimeBox->setAlignment(Qt::AlignRight | Qt::AlignBottom); |
76 | QPalette pal = mTimeBox->palette(); | 75 | QPalette pal = mTimeBox->palette(); |
77 | pal.setColor(QColorGroup::Foreground, Qt::red); | 76 | pal.setColor(QColorGroup::Foreground, Qt::red); |
78 | mTimeBox->setPalette(pal); | 77 | mTimeBox->setPalette(pal); |
79 | //mTimeBox->setAutoMask(true); | 78 | //mTimeBox->setAutoMask(true); |
80 | 79 | ||
81 | agenda->addChild(mTimeBox); | 80 | agenda->addChild(mTimeBox); |
82 | 81 | ||
83 | oldToday = -1; | 82 | oldToday = -1; |
84 | } | 83 | } |
85 | 84 | ||
86 | MarcusBains::~MarcusBains() | 85 | MarcusBains::~MarcusBains() |
87 | { | 86 | { |
88 | delete minutes; | 87 | delete minutes; |
89 | } | 88 | } |
90 | 89 | ||
91 | int MarcusBains::todayColumn() | 90 | int MarcusBains::todayColumn() |
92 | { | 91 | { |
93 | QDate currentDate = QDate::currentDate(); | 92 | QDate currentDate = QDate::currentDate(); |
94 | 93 | ||
95 | DateList dateList = agenda->dateList(); | 94 | DateList dateList = agenda->dateList(); |
96 | DateList::ConstIterator it; | 95 | DateList::ConstIterator it; |
97 | int col = 0; | 96 | int col = 0; |
98 | for(it = dateList.begin(); it != dateList.end(); ++it) { | 97 | for(it = dateList.begin(); it != dateList.end(); ++it) { |
99 | if((*it) == currentDate) | 98 | if((*it) == currentDate) |
100 | return KOGlobals::self()->reverseLayout() ? | 99 | return KOGlobals::self()->reverseLayout() ? |
101 | agenda->columns() - 1 - col : col; | 100 | agenda->columns() - 1 - col : col; |
102 | ++col; | 101 | ++col; |
103 | } | 102 | } |
104 | 103 | ||
105 | return -1; | 104 | return -1; |
106 | } | 105 | } |
107 | void MarcusBains::updateLoc() | 106 | void MarcusBains::updateLoc() |
108 | { | 107 | { |
109 | updateLocation(); | 108 | updateLocation(); |
110 | } | 109 | } |
111 | void MarcusBains::updateLocation(bool recalculate) | 110 | void MarcusBains::updateLocation(bool recalculate) |
112 | { | 111 | { |
113 | 112 | ||
114 | QTime tim = QTime::currentTime(); | 113 | QTime tim = QTime::currentTime(); |
115 | //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1()); | 114 | //qDebug(" MarcusBains::updateLocation %s ", tim.toString().latin1()); |
116 | if((tim.hour() == 0) && (oldTime.hour()==23)) | 115 | if((tim.hour() == 0) && (oldTime.hour()==23)) |
117 | recalculate = true; | 116 | recalculate = true; |
118 | 117 | ||
119 | int mins = tim.hour()*60 + tim.minute(); | 118 | int mins = tim.hour()*60 + tim.minute(); |
120 | int minutesPerCell = 24 * 60 / agenda->rows(); | 119 | int minutesPerCell = 24 * 60 / agenda->rows(); |
121 | int y = mins*agenda->gridSpacingY()/minutesPerCell; | 120 | int y = mins*agenda->gridSpacingY()/minutesPerCell; |
@@ -130,307 +129,492 @@ void MarcusBains::updateLocation(bool recalculate) | |||
130 | hide(); mTimeBox->hide(); | 129 | hide(); mTimeBox->hide(); |
131 | return; | 130 | return; |
132 | } else { | 131 | } else { |
133 | show(); mTimeBox->show(); | 132 | show(); mTimeBox->show(); |
134 | } | 133 | } |
135 | 134 | ||
136 | if(recalculate) | 135 | if(recalculate) |
137 | setFixedSize(agenda->gridSpacingX(),1); | 136 | setFixedSize(agenda->gridSpacingX(),1); |
138 | agenda->moveChild(this, x, y); | 137 | agenda->moveChild(this, x, y); |
139 | raise(); | 138 | raise(); |
140 | 139 | ||
141 | if(recalculate) | 140 | if(recalculate) |
142 | //mTimeBox->setFont(QFont("helvetica",10)); | 141 | //mTimeBox->setFont(QFont("helvetica",10)); |
143 | mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); | 142 | mTimeBox->setFont(KOPrefs::instance()->mMarcusBainsFont); |
144 | 143 | ||
145 | mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); | 144 | mTimeBox->setText(KGlobal::locale()->formatTime(tim, KOPrefs::instance()->mMarcusBainsShowSeconds)); |
146 | mTimeBox->adjustSize(); | 145 | mTimeBox->adjustSize(); |
147 | // the -2 below is there because there is a bug in this program | 146 | // the -2 below is there because there is a bug in this program |
148 | // somewhere, where the last column of this widget is a few pixels | 147 | // somewhere, where the last column of this widget is a few pixels |
149 | // narrower than the other columns. | 148 | // narrower than the other columns. |
150 | int offs = (today==agenda->columns()-1) ? -4 : 0; | 149 | int offs = (today==agenda->columns()-1) ? -4 : 0; |
151 | agenda->moveChild(mTimeBox, | 150 | agenda->moveChild(mTimeBox, |
152 | x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, | 151 | x+agenda->gridSpacingX()-mTimeBox->width()+offs-1, |
153 | y-mTimeBox->height()); | 152 | y-mTimeBox->height()); |
154 | 153 | ||
155 | mTimeBox->raise(); | 154 | mTimeBox->raise(); |
156 | //mTimeBox->setAutoMask(true); | 155 | //mTimeBox->setAutoMask(true); |
157 | minutes->start(5000,true); | 156 | minutes->start(5000,true); |
158 | } | 157 | } |
159 | 158 | ||
160 | 159 | ||
161 | //////////////////////////////////////////////////////////////////////////// | 160 | //////////////////////////////////////////////////////////////////////////// |
162 | 161 | ||
163 | 162 | ||
164 | /* | 163 | /* |
165 | Create an agenda widget with rows rows and columns columns. | 164 | Create an agenda widget with rows rows and columns columns. |
166 | */ | 165 | */ |
167 | KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, | 166 | KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, |
168 | const char *name,WFlags f) : | 167 | const char *name,WFlags f) : |
169 | QScrollView(parent,name,f) | 168 | QScrollView(parent,name,f) |
170 | { | 169 | { |
171 | 170 | ||
172 | 171 | ||
173 | mColumns = columns; | 172 | mColumns = columns; |
174 | mRows = rows; | 173 | mRows = rows; |
175 | mGridSpacingY = rowSize; | 174 | mGridSpacingY = rowSize; |
176 | mAllDayMode = false; | 175 | mAllDayMode = false; |
177 | #ifndef DESKTOP_VERSION | 176 | #ifndef DESKTOP_VERSION |
178 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 177 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
179 | #endif | 178 | #endif |
180 | mHolidayMask = 0; | 179 | mHolidayMask = 0; |
181 | init(); | 180 | init(); |
182 | } | 181 | } |
183 | 182 | ||
184 | /* | 183 | /* |
185 | Create an agenda widget with columns columns and one row. This is used for | 184 | Create an agenda widget with columns columns and one row. This is used for |
186 | all-day events. | 185 | all-day events. |
187 | */ | 186 | */ |
188 | KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : | 187 | KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : |
189 | QScrollView(parent,name,f) | 188 | QScrollView(parent,name,f) |
190 | { | 189 | { |
191 | blockResize = false; | 190 | blockResize = false; |
192 | mColumns = columns; | 191 | mColumns = columns; |
193 | mRows = 1; | 192 | mRows = 1; |
194 | //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); | 193 | //qDebug("aaaaaaaaaaaaaaaaaaldays %d ", KOPrefs::instance()->mAllDaySize); |
195 | mGridSpacingY = KOPrefs::instance()->mAllDaySize; | 194 | mGridSpacingY = KOPrefs::instance()->mAllDaySize; |
196 | mAllDayMode = true; | 195 | mAllDayMode = true; |
197 | #ifndef DESKTOP_VERSION | 196 | #ifndef DESKTOP_VERSION |
198 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 197 | //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
199 | #endif | 198 | #endif |
200 | mHolidayMask = 0; | 199 | mHolidayMask = 0; |
201 | init(); | 200 | init(); |
202 | } | 201 | } |
203 | 202 | ||
204 | 203 | ||
205 | KOAgenda::~KOAgenda() | 204 | KOAgenda::~KOAgenda() |
206 | { | 205 | { |
207 | if(mMarcusBains) delete mMarcusBains; | 206 | if(mMarcusBains) delete mMarcusBains; |
208 | 207 | ||
209 | } | 208 | } |
210 | 209 | ||
211 | Incidence *KOAgenda::selectedIncidence() const | 210 | Incidence *KOAgenda::selectedIncidence() const |
212 | { | 211 | { |
213 | return (mSelectedItem ? mSelectedItem->incidence() : 0); | 212 | return (mSelectedItem ? mSelectedItem->incidence() : 0); |
214 | } | 213 | } |
215 | 214 | ||
216 | 215 | ||
217 | QDate KOAgenda::selectedIncidenceDate() const | 216 | QDate KOAgenda::selectedIncidenceDate() const |
218 | { | 217 | { |
219 | return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); | 218 | return (mSelectedItem ? mSelectedItem->itemDate() : QDate()); |
220 | } | 219 | } |
221 | 220 | ||
222 | 221 | ||
223 | void KOAgenda::init() | 222 | void KOAgenda::init() |
224 | { | 223 | { |
224 | mPopupTimer = new QTimer(this); | ||
225 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); | ||
226 | |||
225 | mNewItemPopup = new QPopupMenu( this ); | 227 | mNewItemPopup = new QPopupMenu( this ); |
226 | connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); | 228 | connect ( mNewItemPopup, SIGNAL (activated ( int ) ), this, SLOT ( newItem(int)) ); |
227 | QString pathString = ""; | 229 | QString pathString = ""; |
228 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { | 230 | if ( !KOPrefs::instance()->mToolBarMiniIcons ) { |
229 | if ( QApplication::desktop()->width() < 480 ) | 231 | if ( QApplication::desktop()->width() < 480 ) |
230 | pathString += "icons16/"; | 232 | pathString += "icons16/"; |
231 | } else | 233 | } else |
232 | pathString += "iconsmini/"; | 234 | pathString += "iconsmini/"; |
233 | 235 | ||
234 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); | 236 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 ); |
235 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); | 237 | mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 ); |
236 | mNewItemPopup->insertSeparator ( ); | 238 | mNewItemPopup->insertSeparator ( ); |
237 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); | 239 | mNewItemPopup->insertItem ( SmallIcon( pathString +"day" ), i18n("Day view"),3 ); |
238 | mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); | 240 | mNewItemPopup->insertItem ( SmallIcon( pathString +"xdays" ), i18n("Next days"),8 ); |
239 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 ); | 241 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next week"),4 ); |
240 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); | 242 | mNewItemPopup->insertItem ( SmallIcon( pathString +"week" ), i18n("Next two weeks"),5 ); |
241 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next month"),6 ); | 243 | mNewItemPopup->insertItem ( SmallIcon( pathString +"month" ), i18n("Next month"),6 ); |
242 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); | 244 | mNewItemPopup->insertItem ( SmallIcon( pathString +"journal" ), i18n("Journal view"),7 ); |
243 | #ifndef _WIN32_ | 245 | #ifndef _WIN32_ |
244 | int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase | 246 | int wflags = viewport()-> getWFlags() |WRepaintNoErase;//WResizeNoErase |
245 | viewport()->setWFlags ( wflags); | 247 | viewport()->setWFlags ( wflags); |
246 | #endif | 248 | #endif |
247 | mGridSpacingX = 80; | 249 | mGridSpacingX = 80; |
248 | mResizeBorderWidth = 8; | 250 | mResizeBorderWidth = 8; |
249 | mScrollBorderWidth = 8; | 251 | mScrollBorderWidth = 8; |
250 | mScrollDelay = 30; | 252 | mScrollDelay = 30; |
251 | mScrollOffset = 10; | 253 | mScrollOffset = 10; |
252 | mPaintPixmap.resize( 20,20); | 254 | mPaintPixmap.resize( 20,20); |
253 | //enableClipper(true); | 255 | //enableClipper(true); |
254 | 256 | ||
255 | // Grab key strokes for keyboard navigation of agenda. Seems to have no | 257 | // Grab key strokes for keyboard navigation of agenda. Seems to have no |
256 | // effect. Has to be fixed. | 258 | // effect. Has to be fixed. |
257 | setFocusPolicy(WheelFocus); | 259 | setFocusPolicy(WheelFocus); |
258 | 260 | ||
259 | connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); | 261 | connect(&mScrollUpTimer,SIGNAL(timeout()),SLOT(scrollUp())); |
260 | connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); | 262 | connect(&mScrollDownTimer,SIGNAL(timeout()),SLOT(scrollDown())); |
261 | connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); | 263 | connect(&mResizeTimer,SIGNAL(timeout()),SLOT(finishResize())); |
262 | 264 | ||
263 | mStartCellX = 0; | 265 | mStartCellX = 0; |
264 | mStartCellY = 0; | 266 | mStartCellY = 0; |
265 | mCurrentCellX = 0; | 267 | mCurrentCellX = 0; |
266 | mCurrentCellY = 0; | 268 | mCurrentCellY = 0; |
267 | 269 | ||
268 | mSelectionCellX = 0; | 270 | mSelectionCellX = 0; |
269 | mSelectionYTop = 0; | 271 | mSelectionYTop = 0; |
270 | mSelectionHeight = 0; | 272 | mSelectionHeight = 0; |
271 | 273 | ||
272 | mOldLowerScrollValue = -1; | 274 | mOldLowerScrollValue = -1; |
273 | mOldUpperScrollValue = -1; | 275 | mOldUpperScrollValue = -1; |
274 | 276 | ||
275 | mClickedItem = 0; | 277 | mClickedItem = 0; |
276 | 278 | ||
277 | mActionItem = 0; | 279 | mActionItem = 0; |
278 | mActionType = NOP; | 280 | mActionType = NOP; |
279 | mItemMoved = false; | 281 | mItemMoved = false; |
280 | 282 | ||
281 | mSelectedItem = 0; | 283 | mSelectedItem = 0; |
282 | 284 | ||
283 | // mItems.setAutoDelete(true); | 285 | // mItems.setAutoDelete(true); |
284 | 286 | ||
285 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); | 287 | resizeContents( mGridSpacingX * mColumns + 1 , mGridSpacingY * mRows + 1 ); |
286 | 288 | ||
287 | viewport()->update(); | 289 | viewport()->update(); |
288 | 290 | ||
289 | setMinimumSize(30, 1); | 291 | setMinimumSize(30, 1); |
290 | // setMaximumHeight(mGridSpacingY * mRows + 5); | 292 | // setMaximumHeight(mGridSpacingY * mRows + 5); |
291 | 293 | ||
292 | // Disable horizontal scrollbar. This is a hack. The geometry should be | 294 | // Disable horizontal scrollbar. This is a hack. The geometry should be |
293 | // controlled in a way that the contents horizontally always fits. Then it is | 295 | // controlled in a way that the contents horizontally always fits. Then it is |
294 | // not necessary to turn off the scrollbar. | 296 | // not necessary to turn off the scrollbar. |
295 | setHScrollBarMode(AlwaysOff); | 297 | setHScrollBarMode(AlwaysOff); |
296 | if ( ! mAllDayMode ) | 298 | if ( ! mAllDayMode ) |
297 | setVScrollBarMode(AlwaysOn); | 299 | setVScrollBarMode(AlwaysOn); |
298 | else | 300 | else |
299 | setVScrollBarMode(AlwaysOff); | 301 | setVScrollBarMode(AlwaysOff); |
300 | 302 | ||
301 | setStartHour(KOPrefs::instance()->mDayBegins); | 303 | setStartHour(KOPrefs::instance()->mDayBegins); |
302 | 304 | ||
303 | calculateWorkingHours(); | 305 | calculateWorkingHours(); |
304 | 306 | ||
305 | connect(verticalScrollBar(),SIGNAL(valueChanged(int)), | 307 | connect(verticalScrollBar(),SIGNAL(valueChanged(int)), |
306 | SLOT(checkScrollBoundaries(int))); | 308 | SLOT(checkScrollBoundaries(int))); |
307 | 309 | ||
308 | // Create the Marcus Bains line. | 310 | // Create the Marcus Bains line. |
309 | if(mAllDayMode) | 311 | if(mAllDayMode) |
310 | mMarcusBains = 0; | 312 | mMarcusBains = 0; |
311 | else { | 313 | else { |
312 | mMarcusBains = new MarcusBains(this); | 314 | mMarcusBains = new MarcusBains(this); |
313 | addChild(mMarcusBains); | 315 | addChild(mMarcusBains); |
314 | } | 316 | } |
317 | mPopupKind = 0; | ||
318 | mPopupItem = 0; | ||
315 | } | 319 | } |
316 | 320 | ||
317 | void KOAgenda::clear() | 321 | void KOAgenda::clear() |
318 | { | 322 | { |
319 | KOAgendaItem *item; | 323 | KOAgendaItem *item; |
320 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { | 324 | for ( item=mItems.first(); item != 0; item=mItems.next() ) { |
321 | mUnusedItems.append( item ); | 325 | mUnusedItems.append( item ); |
322 | //item->hide(); | 326 | //item->hide(); |
323 | } | 327 | } |
324 | mItems.clear(); | 328 | mItems.clear(); |
325 | mSelectedItem = 0; | 329 | mSelectedItem = 0; |
326 | clearSelection(); | 330 | clearSelection(); |
327 | } | 331 | } |
328 | 332 | ||
329 | void KOAgenda::clearSelection() | 333 | void KOAgenda::clearSelection() |
330 | { | 334 | { |
331 | mSelectionCellX = 0; | 335 | mSelectionCellX = 0; |
332 | mSelectionYTop = 0; | 336 | mSelectionYTop = 0; |
333 | mSelectionHeight = 0; | 337 | mSelectionHeight = 0; |
334 | } | 338 | } |
335 | 339 | ||
336 | void KOAgenda::marcus_bains() | 340 | void KOAgenda::marcus_bains() |
337 | { | 341 | { |
338 | if(mMarcusBains) mMarcusBains->updateLocation(true); | 342 | if(mMarcusBains) mMarcusBains->updateLocation(true); |
339 | } | 343 | } |
340 | 344 | ||
341 | 345 | ||
342 | void KOAgenda::changeColumns(int columns) | 346 | void KOAgenda::changeColumns(int columns) |
343 | { | 347 | { |
344 | if (columns == 0) { | 348 | if (columns == 0) { |
345 | kdDebug() << "KOAgenda::changeColumns() called with argument 0" << endl; | 349 | kdDebug() << "KOAgenda::changeColumns() called with argument 0" << endl; |
346 | return; | 350 | return; |
347 | } | 351 | } |
348 | 352 | ||
349 | clear(); | 353 | clear(); |
350 | 354 | ||
351 | mColumns = columns; | 355 | mColumns = columns; |
352 | // setMinimumSize(mColumns * 10, mGridSpacingY + 1); | 356 | // setMinimumSize(mColumns * 10, mGridSpacingY + 1); |
353 | // init(); | 357 | // init(); |
354 | // update(); | 358 | // update(); |
355 | //qDebug("KOAgenda::changeColumns "); | 359 | //qDebug("KOAgenda::changeColumns "); |
356 | computeSizes(); | 360 | computeSizes(); |
357 | // QResizeEvent event( size(), size() ); | 361 | // QResizeEvent event( size(), size() ); |
358 | 362 | ||
359 | //QApplication::sendEvent( this, &event ); | 363 | //QApplication::sendEvent( this, &event ); |
360 | } | 364 | } |
361 | 365 | ||
362 | /* | 366 | /* |
363 | This is the eventFilter function, which gets all events from the KOAgendaItems | 367 | This is the eventFilter function, which gets all events from the KOAgendaItems |
364 | contained in the agenda. It has to handle moving and resizing for all items. | 368 | contained in the agenda. It has to handle moving and resizing for all items. |
365 | */ | 369 | */ |
366 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) | 370 | bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) |
367 | { | 371 | { |
368 | // kdDebug() << "KOAgenda::eventFilter" << endl; | 372 | // kdDebug() << "KOAgenda::eventFilter" << endl; |
369 | switch(event->type()) { | 373 | switch(event->type()) { |
370 | case QEvent::MouseButtonPress: | 374 | case QEvent::MouseButtonPress: |
371 | case QEvent::MouseButtonDblClick: | 375 | case QEvent::MouseButtonDblClick: |
372 | case QEvent::MouseButtonRelease: | 376 | case QEvent::MouseButtonRelease: |
373 | case QEvent::MouseMove: | 377 | case QEvent::MouseMove: |
374 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); | 378 | return eventFilter_mouse(object, static_cast<QMouseEvent *>(event)); |
375 | 379 | ||
376 | case (QEvent::Leave): | 380 | case (QEvent::Leave): |
377 | if (!mActionItem) | 381 | if (!mActionItem) |
378 | setCursor(arrowCursor); | 382 | setCursor(arrowCursor); |
379 | return true; | 383 | return true; |
380 | 384 | ||
381 | default: | 385 | default: |
382 | return QScrollView::eventFilter(object,event); | 386 | return QScrollView::eventFilter(object,event); |
383 | } | 387 | } |
384 | } | 388 | } |
385 | 389 | void KOAgenda::popupMenu() | |
390 | { | ||
391 | mPopupTimer->stop(); | ||
392 | if ( mPopupKind == 1 ) { | ||
393 | if (mActionItem ) { | ||
394 | endItemAction(); | ||
395 | } | ||
396 | mLeftMouseDown = false; // no more leftMouse computation | ||
397 | if (mPopupItem) { | ||
398 | selectItem(mPopupItem); | ||
399 | emit showIncidencePopupSignal(mPopupItem->incidence()); | ||
400 | |||
401 | } | ||
402 | } else if ( mPopupKind == 2 ) { | ||
403 | if ( mLeftMouseDown ) { // we have a simulated right click - clear left mouse action | ||
404 | endSelectAction( false ); // do not emit new event signal | ||
405 | mLeftMouseDown = false; // no more leftMouse computation | ||
406 | } | ||
407 | mNewItemPopup->popup( mPopupPos); | ||
408 | } | ||
409 | mLeftMouseDown = false; | ||
410 | mPopupItem = 0; | ||
411 | mPopupKind = 0; | ||
412 | } | ||
386 | 413 | ||
387 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | 414 | bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) |
388 | { | 415 | { |
416 | //qDebug("KOAgenda::eventFilter_mous "); | ||
417 | QPoint viewportPos; | ||
418 | if (object != viewport()) { | ||
419 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); | ||
420 | } else { | ||
421 | viewportPos = me->pos(); | ||
422 | } | ||
423 | static int startX = 0; | ||
424 | static int startY = 0; | ||
425 | static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); | ||
426 | static bool blockMoving = true; | ||
427 | switch (me->type()) { | ||
428 | case QEvent::MouseButtonPress: | ||
429 | if (me->button() == LeftButton) { | ||
430 | mPopupTimer->start( 600 ); | ||
431 | mLeftMouseDown = true; | ||
432 | } | ||
433 | blockMoving = true; | ||
434 | startX = viewportPos.x(); | ||
435 | startY = viewportPos.y(); | ||
436 | if (object != viewport()) { | ||
437 | mPopupItem = (KOAgendaItem *)object; | ||
438 | mPopupKind = 1; | ||
439 | if (me->button() == RightButton) { | ||
440 | popupMenu(); | ||
441 | } else if (me->button() == LeftButton) { | ||
442 | mActionItem = (KOAgendaItem *)object; | ||
443 | if (mActionItem) { | ||
444 | if ( mSelectionHeight > 0 ) { | ||
445 | int selectionCellX = mSelectionCellX * mGridSpacingX; | ||
446 | int selectionYTop = mSelectionYTop; | ||
447 | int gridSpacingX = mGridSpacingX; | ||
448 | int selectionHeight = mSelectionHeight; | ||
449 | clearSelection(); | ||
450 | repaintContents( selectionCellX, selectionYTop, | ||
451 | gridSpacingX, selectionHeight,false ); | ||
452 | } | ||
453 | selectItem(mActionItem); | ||
454 | Incidence *incidence = mActionItem->incidence(); | ||
455 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { | ||
456 | mActionItem = 0; | ||
457 | } else { | ||
458 | startItemAction(viewportPos); | ||
459 | } | ||
460 | } | ||
461 | } | ||
462 | } else { // ---------- viewport() | ||
463 | mPopupItem = 0; | ||
464 | mPopupKind = 2; | ||
465 | selectItem(0); | ||
466 | mActionItem = 0; | ||
467 | mPopupPos = viewport()->mapToGlobal( me->pos() ); | ||
468 | if (me->button() == RightButton) { | ||
469 | popupMenu(); | ||
470 | } else if (me->button() == LeftButton) { | ||
471 | setCursor(arrowCursor); | ||
472 | startSelectAction(viewportPos); | ||
473 | } | ||
474 | } | ||
475 | break; | ||
476 | |||
477 | case QEvent::MouseButtonRelease: | ||
478 | if (me->button() == LeftButton ) { | ||
479 | mPopupTimer->stop(); | ||
480 | } | ||
481 | if (object != viewport()) { | ||
482 | if (me->button() == LeftButton && mLeftMouseDown) { | ||
483 | if (mActionItem) { | ||
484 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | ||
485 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); | ||
486 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { | ||
487 | mScrollUpTimer.stop(); | ||
488 | mScrollDownTimer.stop(); | ||
489 | mActionItem->resetMove(); | ||
490 | placeSubCells( mActionItem ); | ||
491 | // emit startDragSignal( mActionItem->incidence() ); | ||
492 | setCursor( arrowCursor ); | ||
493 | mActionItem = 0; | ||
494 | mActionType = NOP; | ||
495 | mItemMoved = 0; | ||
496 | mLeftMouseDown = false; | ||
497 | return true; | ||
498 | } | ||
499 | endItemAction(); | ||
500 | } | ||
501 | } | ||
502 | |||
503 | } else { // ---------- viewport() | ||
504 | if (me->button() == LeftButton && mLeftMouseDown ) { //left click | ||
505 | endSelectAction( true ); // emit new event signal | ||
506 | } | ||
507 | } | ||
508 | if (me->button() == LeftButton) | ||
509 | mLeftMouseDown = false; | ||
510 | |||
511 | break; | ||
512 | |||
513 | case QEvent::MouseMove: | ||
514 | if ( !mLeftMouseDown ) | ||
515 | return true; | ||
516 | if ( blockMoving ) { | ||
517 | int dX, dY; | ||
518 | dX = startX - viewportPos.x(); | ||
519 | if ( dX < 0 ) | ||
520 | dX = -dX; | ||
521 | dY = viewportPos.y() - startY; | ||
522 | if ( dY < 0 ) | ||
523 | dY = -dY; | ||
524 | //qDebug("%d %d %d ", dX, dY , blockmoveDist ); | ||
525 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | ||
526 | blockMoving = false; | ||
527 | } | ||
528 | } | ||
529 | if ( ! blockMoving ) | ||
530 | mPopupTimer->stop(); | ||
531 | if (object != viewport()) { | ||
532 | KOAgendaItem *moveItem = (KOAgendaItem *)object; | ||
533 | if (!moveItem->incidence()->isReadOnly() ) { | ||
534 | if (!mActionItem) | ||
535 | setNoActionCursor(moveItem,viewportPos); | ||
536 | else { | ||
537 | if ( !blockMoving ) | ||
538 | performItemAction(viewportPos); | ||
539 | } | ||
540 | } | ||
541 | } else { // ---------- viewport() | ||
542 | mPopupPos = viewport()->mapToGlobal( me->pos() ); | ||
543 | if ( mActionType == SELECT ) { | ||
544 | performSelectAction( viewportPos ); | ||
545 | } | ||
546 | } | ||
547 | break; | ||
548 | |||
549 | case QEvent::MouseButtonDblClick: | ||
550 | mPopupTimer->stop(); | ||
551 | if (object == viewport()) { | ||
552 | selectItem(0); | ||
553 | int x,y; | ||
554 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | ||
555 | int gx,gy; | ||
556 | contentsToGrid(x,y,gx,gy); | ||
557 | emit newEventSignal(gx,gy); | ||
558 | } else { | ||
559 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; | ||
560 | selectItem(doubleClickedItem); | ||
561 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | ||
562 | emit editIncidenceSignal(doubleClickedItem->incidence()); | ||
563 | else | ||
564 | emit showIncidenceSignal(doubleClickedItem->incidence()); | ||
565 | } | ||
566 | break; | ||
567 | |||
568 | default: | ||
569 | break; | ||
570 | } | ||
571 | return true; | ||
572 | #if 0 | ||
389 | //qDebug("KOAgenda::eventFilter_mous "); | 573 | //qDebug("KOAgenda::eventFilter_mous "); |
390 | QPoint viewportPos; | 574 | QPoint viewportPos; |
391 | if (object != viewport()) { | 575 | if (object != viewport()) { |
392 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); | 576 | viewportPos = ((QWidget *)object)->mapToParent(me->pos()); |
393 | } else { | 577 | } else { |
394 | viewportPos = me->pos(); | 578 | viewportPos = me->pos(); |
395 | } | 579 | } |
396 | static int startX = 0; | 580 | static int startX = 0; |
397 | static int startY = 0; | 581 | static int startY = 0; |
398 | static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); | 582 | static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); |
399 | static bool blockMoving = true; | 583 | static bool blockMoving = true; |
400 | static bool leftMouseDown = false; | 584 | static bool leftMouseDown = false; |
401 | bool rightButtonPressed = false; | 585 | bool rightButtonPressed = false; |
402 | switch (me->type()) { | 586 | switch (me->type()) { |
403 | case QEvent::MouseButtonPress: | 587 | case QEvent::MouseButtonPress: |
404 | if (me->button() == LeftButton) { | 588 | if (me->button() == LeftButton) { |
405 | leftMouseDown = true; | 589 | leftMouseDown = true; |
406 | } | 590 | } |
407 | else if (me->button() == RightButton) { | 591 | else if (me->button() == RightButton) { |
408 | leftMouseDown = false; | 592 | leftMouseDown = false; |
409 | } | 593 | } |
410 | blockMoving = true; | 594 | blockMoving = true; |
411 | startX = viewportPos.x(); | 595 | startX = viewportPos.x(); |
412 | startY = viewportPos.y(); | 596 | startY = viewportPos.y(); |
413 | if (object != viewport()) { // item clicked ************** | 597 | if (object != viewport()) { // item clicked ************** |
414 | if (me->button() == RightButton) { | 598 | if (me->button() == RightButton) { |
415 | leftMouseDown = false; | 599 | leftMouseDown = false; |
416 | mClickedItem = (KOAgendaItem *)object; | 600 | mClickedItem = (KOAgendaItem *)object; |
417 | if (mActionItem ) { | 601 | if (mActionItem ) { |
418 | endItemAction(); | 602 | endItemAction(); |
419 | } | 603 | } |
420 | if (mClickedItem) { | 604 | if (mClickedItem) { |
421 | selectItem(mClickedItem); | 605 | selectItem(mClickedItem); |
422 | emit showIncidencePopupSignal(mClickedItem->incidence()); | 606 | emit showIncidencePopupSignal(mClickedItem->incidence()); |
423 | } | 607 | } |
424 | return true; | 608 | return true; |
425 | } else if (me->button() == LeftButton) { | 609 | } else if (me->button() == LeftButton) { |
426 | mActionItem = (KOAgendaItem *)object; | 610 | mActionItem = (KOAgendaItem *)object; |
427 | if (mActionItem) { | 611 | if (mActionItem) { |
428 | if ( mSelectionHeight > 0 ) { | 612 | if ( mSelectionHeight > 0 ) { |
429 | int selectionCellX = mSelectionCellX * mGridSpacingX; | 613 | int selectionCellX = mSelectionCellX * mGridSpacingX; |
430 | int selectionYTop = mSelectionYTop; | 614 | int selectionYTop = mSelectionYTop; |
431 | int gridSpacingX = mGridSpacingX; | 615 | int gridSpacingX = mGridSpacingX; |
432 | int selectionHeight = mSelectionHeight; | 616 | int selectionHeight = mSelectionHeight; |
433 | clearSelection(); | 617 | clearSelection(); |
434 | repaintContents( selectionCellX, selectionYTop, | 618 | repaintContents( selectionCellX, selectionYTop, |
435 | gridSpacingX, selectionHeight,false ); | 619 | gridSpacingX, selectionHeight,false ); |
436 | } | 620 | } |
@@ -514,96 +698,97 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
514 | if ( dY < 0 ) | 698 | if ( dY < 0 ) |
515 | dY = -dY; | 699 | dY = -dY; |
516 | //qDebug("%d %d %d ", dX, dY , blockmoveDist ); | 700 | //qDebug("%d %d %d ", dX, dY , blockmoveDist ); |
517 | if ( dX > blockmoveDist || dY > blockmoveDist ) { | 701 | if ( dX > blockmoveDist || dY > blockmoveDist ) { |
518 | blockMoving = false; | 702 | blockMoving = false; |
519 | } | 703 | } |
520 | } | 704 | } |
521 | if (object != viewport()) { | 705 | if (object != viewport()) { |
522 | KOAgendaItem *moveItem = (KOAgendaItem *)object; | 706 | KOAgendaItem *moveItem = (KOAgendaItem *)object; |
523 | if (!moveItem->incidence()->isReadOnly() ) { | 707 | if (!moveItem->incidence()->isReadOnly() ) { |
524 | if (!mActionItem) | 708 | if (!mActionItem) |
525 | setNoActionCursor(moveItem,viewportPos); | 709 | setNoActionCursor(moveItem,viewportPos); |
526 | else { | 710 | else { |
527 | if ( !blockMoving ) | 711 | if ( !blockMoving ) |
528 | performItemAction(viewportPos); | 712 | performItemAction(viewportPos); |
529 | } | 713 | } |
530 | } | 714 | } |
531 | } else { // ---------- viewport() | 715 | } else { // ---------- viewport() |
532 | if ( mActionType == SELECT ) { | 716 | if ( mActionType == SELECT ) { |
533 | performSelectAction( viewportPos ); | 717 | performSelectAction( viewportPos ); |
534 | } | 718 | } |
535 | } | 719 | } |
536 | break; | 720 | break; |
537 | 721 | ||
538 | case QEvent::MouseButtonDblClick: | 722 | case QEvent::MouseButtonDblClick: |
539 | blockMoving = false; | 723 | blockMoving = false; |
540 | leftMouseDown = false; | 724 | leftMouseDown = false; |
541 | if (object == viewport()) { | 725 | if (object == viewport()) { |
542 | selectItem(0); | 726 | selectItem(0); |
543 | int x,y; | 727 | int x,y; |
544 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 728 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
545 | int gx,gy; | 729 | int gx,gy; |
546 | contentsToGrid(x,y,gx,gy); | 730 | contentsToGrid(x,y,gx,gy); |
547 | emit newEventSignal(gx,gy); | 731 | emit newEventSignal(gx,gy); |
548 | } else { | 732 | } else { |
549 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; | 733 | KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; |
550 | selectItem(doubleClickedItem); | 734 | selectItem(doubleClickedItem); |
551 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 735 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
552 | emit editIncidenceSignal(doubleClickedItem->incidence()); | 736 | emit editIncidenceSignal(doubleClickedItem->incidence()); |
553 | else | 737 | else |
554 | emit showIncidenceSignal(doubleClickedItem->incidence()); | 738 | emit showIncidenceSignal(doubleClickedItem->incidence()); |
555 | } | 739 | } |
556 | break; | 740 | break; |
557 | 741 | ||
558 | default: | 742 | default: |
559 | break; | 743 | break; |
560 | } | 744 | } |
561 | return true; | 745 | return true; |
746 | #endif | ||
562 | } | 747 | } |
563 | 748 | ||
564 | void KOAgenda::newItem( int item ) | 749 | void KOAgenda::newItem( int item ) |
565 | { | 750 | { |
566 | if ( item == 1 ) { //new event | 751 | if ( item == 1 ) { //new event |
567 | newEventSignal(mStartCellX ,mStartCellY ); | 752 | newEventSignal(mStartCellX ,mStartCellY ); |
568 | } else | 753 | } else |
569 | if ( item == 2 ) { //new event | 754 | if ( item == 2 ) { //new event |
570 | newTodoSignal(mStartCellX ,mStartCellY ); | 755 | newTodoSignal(mStartCellX ,mStartCellY ); |
571 | } else | 756 | } else |
572 | { | 757 | { |
573 | QDate day = mSelectedDates[mStartCellX]; | 758 | QDate day = mSelectedDates[mStartCellX]; |
574 | emit showDateView( item, day ); | 759 | emit showDateView( item, day ); |
575 | // 3Day view | 760 | // 3Day view |
576 | // 4Week view | 761 | // 4Week view |
577 | // 5Month view | 762 | // 5Month view |
578 | // 6Journal view | 763 | // 6Journal view |
579 | } | 764 | } |
580 | } | 765 | } |
581 | void KOAgenda::startSelectAction(QPoint viewportPos) | 766 | void KOAgenda::startSelectAction(QPoint viewportPos) |
582 | { | 767 | { |
583 | //emit newStartSelectSignal(); | 768 | //emit newStartSelectSignal(); |
584 | 769 | ||
585 | mActionType = SELECT; | 770 | mActionType = SELECT; |
586 | 771 | ||
587 | int x,y; | 772 | int x,y; |
588 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 773 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
589 | int gx,gy; | 774 | int gx,gy; |
590 | contentsToGrid(x,y,gx,gy); | 775 | contentsToGrid(x,y,gx,gy); |
591 | 776 | ||
592 | mStartCellX = gx; | 777 | mStartCellX = gx; |
593 | mStartCellY = gy; | 778 | mStartCellY = gy; |
594 | mCurrentCellX = gx; | 779 | mCurrentCellX = gx; |
595 | mCurrentCellY = gy; | 780 | mCurrentCellY = gy; |
596 | 781 | ||
597 | // Store coordinates of old selection | 782 | // Store coordinates of old selection |
598 | int selectionX = mSelectionCellX * mGridSpacingX; | 783 | int selectionX = mSelectionCellX * mGridSpacingX; |
599 | int selectionYTop = mSelectionYTop; | 784 | int selectionYTop = mSelectionYTop; |
600 | int selectionHeight = mSelectionHeight; | 785 | int selectionHeight = mSelectionHeight; |
601 | 786 | ||
602 | // Store new selection | 787 | // Store new selection |
603 | mSelectionCellX = gx; | 788 | mSelectionCellX = gx; |
604 | mSelectionYTop = gy * mGridSpacingY; | 789 | mSelectionYTop = gy * mGridSpacingY; |
605 | mSelectionHeight = mGridSpacingY; | 790 | mSelectionHeight = mGridSpacingY; |
606 | 791 | ||
607 | // Clear old selection | 792 | // Clear old selection |
608 | repaintContents( selectionX, selectionYTop, | 793 | repaintContents( selectionX, selectionYTop, |
609 | mGridSpacingX, selectionHeight,false ); | 794 | mGridSpacingX, selectionHeight,false ); |
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h index f3f1772..3d33ae5 100644 --- a/korganizer/koagenda.h +++ b/korganizer/koagenda.h | |||
@@ -81,184 +81,190 @@ class KOAgenda : public QScrollView | |||
81 | virtual bool eventFilter ( QObject *, QEvent * ); | 81 | virtual bool eventFilter ( QObject *, QEvent * ); |
82 | 82 | ||
83 | void contentsToGrid (int x, int y, int& gx, int& gy); | 83 | void contentsToGrid (int x, int y, int& gx, int& gy); |
84 | void gridToContents (int gx, int gy, int& x, int& y); | 84 | void gridToContents (int gx, int gy, int& x, int& y); |
85 | 85 | ||
86 | int timeToY (const QTime &time); | 86 | int timeToY (const QTime &time); |
87 | QTime gyToTime (int y); | 87 | QTime gyToTime (int y); |
88 | 88 | ||
89 | void setStartHour(int startHour); | 89 | void setStartHour(int startHour); |
90 | 90 | ||
91 | KOAgendaItem *insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom); | 91 | KOAgendaItem *insertItem (Incidence *event,QDate qd,int X,int YTop,int YBottom); |
92 | KOAgendaItem *insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd); | 92 | KOAgendaItem *insertAllDayItem (Incidence *event,QDate qd,int XBegin,int XEnd); |
93 | void insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, | 93 | void insertMultiItem (Event *event,QDate qd,int XBegin,int XEnd, |
94 | int YTop,int YBottom); | 94 | int YTop,int YBottom); |
95 | 95 | ||
96 | void changeColumns(int columns); | 96 | void changeColumns(int columns); |
97 | 97 | ||
98 | int columns() { return mColumns; } | 98 | int columns() { return mColumns; } |
99 | int rows() { return mRows; } | 99 | int rows() { return mRows; } |
100 | 100 | ||
101 | int gridSpacingX() const { return mGridSpacingX; } | 101 | int gridSpacingX() const { return mGridSpacingX; } |
102 | int gridSpacingY() const { return mGridSpacingY; } | 102 | int gridSpacingY() const { return mGridSpacingY; } |
103 | 103 | ||
104 | // virtual QSizePolicy sizePolicy() const; | 104 | // virtual QSizePolicy sizePolicy() const; |
105 | 105 | ||
106 | void clear(); | 106 | void clear(); |
107 | 107 | ||
108 | void clearSelection(); | 108 | void clearSelection(); |
109 | void hideUnused(); | 109 | void hideUnused(); |
110 | 110 | ||
111 | /** Calculates the minimum width */ | 111 | /** Calculates the minimum width */ |
112 | virtual int minimumWidth() const; | 112 | virtual int minimumWidth() const; |
113 | /** Update configuration from preference settings */ | 113 | /** Update configuration from preference settings */ |
114 | void updateConfig(); | 114 | void updateConfig(); |
115 | 115 | ||
116 | void checkScrollBoundaries(); | 116 | void checkScrollBoundaries(); |
117 | 117 | ||
118 | void setHolidayMask(QMemArray<bool> *); | 118 | void setHolidayMask(QMemArray<bool> *); |
119 | void setDateList(const DateList &selectedDates); | 119 | void setDateList(const DateList &selectedDates); |
120 | DateList dateList() const; | 120 | DateList dateList() const; |
121 | void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false); | 121 | void drawContentsToPainter( QPainter* paint = 0, bool backgroundOnly = false); |
122 | void finishUpdate(); | 122 | void finishUpdate(); |
123 | void printSelection(); | 123 | void printSelection(); |
124 | void storePosition(); | 124 | void storePosition(); |
125 | void restorePosition(); | 125 | void restorePosition(); |
126 | 126 | ||
127 | 127 | ||
128 | public slots: | 128 | public slots: |
129 | void popupMenu(); | ||
129 | void newItem( int ); | 130 | void newItem( int ); |
130 | void moveChild( QWidget *, int, int ); | 131 | void moveChild( QWidget *, int, int ); |
131 | void scrollUp(); | 132 | void scrollUp(); |
132 | void scrollDown(); | 133 | void scrollDown(); |
133 | void updateTodo( Todo * t, int , bool ); | 134 | void updateTodo( Todo * t, int , bool ); |
134 | void popupAlarm(); | 135 | void popupAlarm(); |
135 | 136 | ||
136 | void checkScrollBoundaries(int); | 137 | void checkScrollBoundaries(int); |
137 | 138 | ||
138 | /** Deselect selected items. This function does not emit any signals. */ | 139 | /** Deselect selected items. This function does not emit any signals. */ |
139 | void deselectItem(); | 140 | void deselectItem(); |
140 | /** Select item. If the argument is 0, the currently selected item gets | 141 | /** Select item. If the argument is 0, the currently selected item gets |
141 | deselected. This function emits the itemSelected(bool) signal to inform | 142 | deselected. This function emits the itemSelected(bool) signal to inform |
142 | about selection/deseelction of events. */ | 143 | about selection/deseelction of events. */ |
143 | void selectItem(KOAgendaItem *); | 144 | void selectItem(KOAgendaItem *); |
144 | void finishResize(); | 145 | void finishResize(); |
145 | 146 | ||
146 | signals: | 147 | signals: |
147 | void showDateView( int, QDate ); | 148 | void showDateView( int, QDate ); |
148 | void newEventSignal(); | 149 | void newEventSignal(); |
149 | void newEventSignal(int gx,int gy); | 150 | void newEventSignal(int gx,int gy); |
150 | void newTodoSignal(int gx,int gy); | 151 | void newTodoSignal(int gx,int gy); |
151 | void newEventSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); | 152 | void newEventSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); |
152 | void newTimeSpanSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); | 153 | void newTimeSpanSignal(int gxStart, int gyStart, int gxEnd, int gyEnd); |
153 | void newStartSelectSignal(); | 154 | void newStartSelectSignal(); |
154 | void showIncidenceSignal(Incidence *); | 155 | void showIncidenceSignal(Incidence *); |
155 | void editIncidenceSignal(Incidence *); | 156 | void editIncidenceSignal(Incidence *); |
156 | void deleteIncidenceSignal(Incidence *); | 157 | void deleteIncidenceSignal(Incidence *); |
157 | void showIncidencePopupSignal(Incidence *); | 158 | void showIncidencePopupSignal(Incidence *); |
158 | 159 | ||
159 | void itemModified(KOAgendaItem *item, int ); | 160 | void itemModified(KOAgendaItem *item, int ); |
160 | void incidenceSelected(Incidence *); | 161 | void incidenceSelected(Incidence *); |
161 | 162 | ||
162 | void lowerYChanged(int); | 163 | void lowerYChanged(int); |
163 | void upperYChanged(int); | 164 | void upperYChanged(int); |
164 | 165 | ||
165 | void startDragSignal(Incidence *); | 166 | void startDragSignal(Incidence *); |
166 | void addToCalSignal(Incidence *, Incidence *); | 167 | void addToCalSignal(Incidence *, Incidence *); |
167 | void resizedSignal(); | 168 | void resizedSignal(); |
168 | 169 | ||
169 | protected: | 170 | protected: |
170 | QPainter mPixPainter; | 171 | QPainter mPixPainter; |
171 | QPixmap mPaintPixmap; | 172 | QPixmap mPaintPixmap; |
172 | QPixmap mHighlightPixmap; | 173 | QPixmap mHighlightPixmap; |
173 | void drawContents(QPainter *p,int cx, int cy, int cw, int ch); | 174 | void drawContents(QPainter *p,int cx, int cy, int cw, int ch); |
174 | virtual void resizeEvent ( QResizeEvent * ); | 175 | virtual void resizeEvent ( QResizeEvent * ); |
175 | 176 | ||
176 | /** Handles mouse events. Called from eventFilter */ | 177 | /** Handles mouse events. Called from eventFilter */ |
177 | virtual bool eventFilter_mouse ( QObject *, QMouseEvent * ); | 178 | virtual bool eventFilter_mouse ( QObject *, QMouseEvent * ); |
178 | 179 | ||
179 | /** Start selecting time span. */ | 180 | /** Start selecting time span. */ |
180 | void startSelectAction(QPoint viewportPos); | 181 | void startSelectAction(QPoint viewportPos); |
181 | 182 | ||
182 | /** Select time span. */ | 183 | /** Select time span. */ |
183 | void performSelectAction(QPoint viewportPos); | 184 | void performSelectAction(QPoint viewportPos); |
184 | 185 | ||
185 | /** Emd selecting time span. */ | 186 | /** Emd selecting time span. */ |
186 | void endSelectAction( bool emitNewEvent = false ); | 187 | void endSelectAction( bool emitNewEvent = false ); |
187 | 188 | ||
188 | /** Start moving/resizing agenda item */ | 189 | /** Start moving/resizing agenda item */ |
189 | void startItemAction(QPoint viewportPos); | 190 | void startItemAction(QPoint viewportPos); |
190 | 191 | ||
191 | /** Move/resize agenda item */ | 192 | /** Move/resize agenda item */ |
192 | void performItemAction(QPoint viewportPos); | 193 | void performItemAction(QPoint viewportPos); |
193 | 194 | ||
194 | /** End moving/resizing agenda item */ | 195 | /** End moving/resizing agenda item */ |
195 | void endItemAction(); | 196 | void endItemAction(); |
196 | 197 | ||
197 | /** Set cursor, when no item action is in progress */ | 198 | /** Set cursor, when no item action is in progress */ |
198 | void setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos); | 199 | void setNoActionCursor(KOAgendaItem *moveItem,QPoint viewportPos); |
199 | 200 | ||
200 | /** Place agenda item in agenda and adjust other cells if necessary */ | 201 | /** Place agenda item in agenda and adjust other cells if necessary */ |
201 | void placeSubCells(KOAgendaItem *placeItem); | 202 | void placeSubCells(KOAgendaItem *placeItem); |
202 | 203 | ||
203 | /** Process the keyevent, including the ignored keyevents of eventwidgets. | 204 | /** Process the keyevent, including the ignored keyevents of eventwidgets. |
204 | * Implements pgup/pgdn and cursor key navigation in the view. | 205 | * Implements pgup/pgdn and cursor key navigation in the view. |
205 | */ | 206 | */ |
206 | void keyPressEvent( QKeyEvent * ); | 207 | void keyPressEvent( QKeyEvent * ); |
207 | 208 | ||
208 | void calculateWorkingHours(); | 209 | void calculateWorkingHours(); |
209 | 210 | ||
210 | virtual void contentsMousePressEvent ( QMouseEvent * ); | 211 | virtual void contentsMousePressEvent ( QMouseEvent * ); |
211 | 212 | ||
212 | private: | 213 | private: |
213 | void init(); | 214 | void init(); |
214 | void marcus_bains(); | 215 | void marcus_bains(); |
215 | bool mAllDayMode; | 216 | bool mAllDayMode; |
216 | bool blockResize; | 217 | bool blockResize; |
218 | bool mLeftMouseDown; | ||
219 | KOAgendaItem *mPopupItem; | ||
220 | QTimer* mPopupTimer; | ||
221 | int mPopupKind; | ||
222 | QPoint mPopupPos; | ||
217 | QTimer mResizeTimer; | 223 | QTimer mResizeTimer; |
218 | double mContentPosition; | 224 | double mContentPosition; |
219 | 225 | ||
220 | // Width and height of agenda cells | 226 | // Width and height of agenda cells |
221 | int mGridSpacingX; | 227 | int mGridSpacingX; |
222 | int mGridSpacingY; | 228 | int mGridSpacingY; |
223 | 229 | ||
224 | // size of border, where mouse action will resize the KOAgendaItem | 230 | // size of border, where mouse action will resize the KOAgendaItem |
225 | int mResizeBorderWidth; | 231 | int mResizeBorderWidth; |
226 | 232 | ||
227 | // size of border, where mouse mve will cause a scroll of the agenda | 233 | // size of border, where mouse mve will cause a scroll of the agenda |
228 | int mScrollBorderWidth; | 234 | int mScrollBorderWidth; |
229 | int mScrollDelay; | 235 | int mScrollDelay; |
230 | int mScrollOffset; | 236 | int mScrollOffset; |
231 | 237 | ||
232 | QTimer mScrollUpTimer; | 238 | QTimer mScrollUpTimer; |
233 | QTimer mScrollDownTimer; | 239 | QTimer mScrollDownTimer; |
234 | 240 | ||
235 | // Number of Columns/Rows of agenda grid | 241 | // Number of Columns/Rows of agenda grid |
236 | int mColumns; | 242 | int mColumns; |
237 | int mRows; | 243 | int mRows; |
238 | 244 | ||
239 | // Cells to store Move and Resize coordiantes | 245 | // Cells to store Move and Resize coordiantes |
240 | int mStartCellX; | 246 | int mStartCellX; |
241 | int mStartCellY; | 247 | int mStartCellY; |
242 | int mCurrentCellX; | 248 | int mCurrentCellX; |
243 | int mCurrentCellY; | 249 | int mCurrentCellY; |
244 | 250 | ||
245 | // Working Hour coordiantes | 251 | // Working Hour coordiantes |
246 | bool mWorkingHoursEnable; | 252 | bool mWorkingHoursEnable; |
247 | int mWorkingHoursYTop; | 253 | int mWorkingHoursYTop; |
248 | int mWorkingHoursYBottom; | 254 | int mWorkingHoursYBottom; |
249 | 255 | ||
250 | // Selection | 256 | // Selection |
251 | int mSelectionCellX; | 257 | int mSelectionCellX; |
252 | int mSelectionYTop; | 258 | int mSelectionYTop; |
253 | int mSelectionHeight; | 259 | int mSelectionHeight; |
254 | 260 | ||
255 | // List of dates to be displayed | 261 | // List of dates to be displayed |
256 | DateList mSelectedDates; | 262 | DateList mSelectedDates; |
257 | 263 | ||
258 | // The KOAgendaItem, which has been right-clicked last | 264 | // The KOAgendaItem, which has been right-clicked last |
259 | KOAgendaItem *mClickedItem; | 265 | KOAgendaItem *mClickedItem; |
260 | 266 | ||
261 | // The KOAgendaItem, which is being moved/resized | 267 | // The KOAgendaItem, which is being moved/resized |
262 | QGuardedPtr<KOAgendaItem> mActionItem; | 268 | QGuardedPtr<KOAgendaItem> mActionItem; |
263 | 269 | ||
264 | // Currently selected item | 270 | // Currently selected item |
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 905c1bf..b30ad75 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -30,97 +30,97 @@ | |||
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 <libkcal/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 | class KOAgendaItemWhatsThis :public QWhatsThis | 59 | class KOAgendaItemWhatsThis :public QWhatsThis |
60 | { | 60 | { |
61 | public: | 61 | public: |
62 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; | 62 | KOAgendaItemWhatsThis( KOAgendaItem* view ) : QWhatsThis( view ),_view (view) { }; |
63 | 63 | ||
64 | protected: | 64 | protected: |
65 | virtual QString text( const QPoint& ) | 65 | virtual QString text( const QPoint& ) |
66 | { | 66 | { |
67 | return _view->getWhatsThisText() ; | 67 | return _view->getWhatsThisText() ; |
68 | } | 68 | } |
69 | private: | 69 | private: |
70 | KOAgendaItem * _view; | 70 | KOAgendaItem * _view; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, | 73 | KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool allday, |
74 | const char *name,WFlags) : | 74 | const char *name,WFlags) : |
75 | QWidget(parent, name), mIncidence(incidence), mDate(qd) | 75 | QWidget(parent, name), mIncidence(incidence), mDate(qd) |
76 | { | 76 | { |
77 | #ifndef DESKTOP_VERSION | 77 | #ifndef DESKTOP_VERSION |
78 | QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); | 78 | //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); |
79 | #endif | 79 | #endif |
80 | mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); | 80 | mKOAgendaItemWhatsThis = new KOAgendaItemWhatsThis(this); |
81 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase | 81 | int wflags = getWFlags() |WRepaintNoErase;// WResizeNoErase |
82 | setWFlags ( wflags); | 82 | setWFlags ( wflags); |
83 | mAllDay = allday; | 83 | mAllDay = allday; |
84 | init ( incidence, qd ); | 84 | init ( incidence, qd ); |
85 | //setMouseTracking(true); | 85 | //setMouseTracking(true); |
86 | //setAcceptDrops(true); | 86 | //setAcceptDrops(true); |
87 | xPaintCoord = -1; | 87 | xPaintCoord = -1; |
88 | yPaintCoord = -1; | 88 | yPaintCoord = -1; |
89 | } | 89 | } |
90 | QString KOAgendaItem::getWhatsThisText() | 90 | QString KOAgendaItem::getWhatsThisText() |
91 | { | 91 | { |
92 | if ( mIncidence ) | 92 | if ( mIncidence ) |
93 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, | 93 | return KIncidenceFormatter::instance()->getFormattedText( mIncidence, |
94 | KOPrefs::instance()->mWTshowDetails, | 94 | KOPrefs::instance()->mWTshowDetails, |
95 | KOPrefs::instance()->mWTshowCreated, | 95 | KOPrefs::instance()->mWTshowCreated, |
96 | KOPrefs::instance()->mWTshowChanged); | 96 | KOPrefs::instance()->mWTshowChanged); |
97 | return "KOAgendaItem::getWhatsThisText()::internal error"; | 97 | return "KOAgendaItem::getWhatsThisText()::internal error"; |
98 | } | 98 | } |
99 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) | 99 | void KOAgendaItem::init ( Incidence *incidence, QDate qd ) |
100 | { | 100 | { |
101 | mIncidence = incidence; | 101 | mIncidence = incidence; |
102 | mDate = qd; | 102 | mDate = qd; |
103 | mFirstMultiItem = 0; | 103 | mFirstMultiItem = 0; |
104 | mNextMultiItem = 0; | 104 | mNextMultiItem = 0; |
105 | mLastMultiItem = 0; | 105 | mLastMultiItem = 0; |
106 | computeText(); | 106 | computeText(); |
107 | 107 | ||
108 | if ( (incidence->type() == "Todo") && | 108 | if ( (incidence->type() == "Todo") && |
109 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && | 109 | ( !((static_cast<Todo*>(incidence))->isCompleted()) && |
110 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { | 110 | ((static_cast<Todo*>(incidence))->dtDue().date() <= QDate::currentDate()) ) ) { |
111 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) | 111 | if ( (static_cast<Todo*>(incidence))->dtDue() < QDateTime::currentDateTime().date()) |
112 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; | 112 | mBackgroundColor = KOPrefs::instance()->mTodoOverdueColor ; |
113 | else | 113 | else |
114 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; | 114 | mBackgroundColor = KOPrefs::instance()->mTodoDueTodayColor; |
115 | } | 115 | } |
116 | else { | 116 | else { |
117 | QStringList categories = mIncidence->categories(); | 117 | QStringList categories = mIncidence->categories(); |
118 | QString cat = categories.first(); | 118 | QString cat = categories.first(); |
119 | if (cat.isEmpty()) { | 119 | if (cat.isEmpty()) { |
120 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) | 120 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) |
121 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; | 121 | mBackgroundColor =KOPrefs::instance()->mTodoDoneColor; |
122 | else | 122 | else |
123 | mBackgroundColor =KOPrefs::instance()->mEventColor; | 123 | mBackgroundColor =KOPrefs::instance()->mEventColor; |
124 | } else { | 124 | } else { |
125 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); | 125 | mBackgroundColor = *KOPrefs::instance()->categoryColor(cat); |
126 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { | 126 | if ( (incidence->type() == "Todo") &&((static_cast<Todo*>(incidence))->isCompleted()) ) { |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 957ac52..b9c7dec 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -84,165 +84,157 @@ TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : | |||
84 | mRows = rows; | 84 | mRows = rows; |
85 | 85 | ||
86 | setMinimumHeight( 20 ); | 86 | setMinimumHeight( 20 ); |
87 | mCellHeight = KOPrefs::instance()->mHourSize*4; | 87 | mCellHeight = KOPrefs::instance()->mHourSize*4; |
88 | 88 | ||
89 | enableClipper(true); | 89 | enableClipper(true); |
90 | 90 | ||
91 | setHScrollBarMode(AlwaysOff); | 91 | setHScrollBarMode(AlwaysOff); |
92 | setVScrollBarMode(AlwaysOff); | 92 | setVScrollBarMode(AlwaysOff); |
93 | 93 | ||
94 | resizeContents(50,mRows * mCellHeight); | 94 | resizeContents(50,mRows * mCellHeight); |
95 | 95 | ||
96 | viewport()->setBackgroundMode( PaletteBackground ); | 96 | viewport()->setBackgroundMode( PaletteBackground ); |
97 | } | 97 | } |
98 | 98 | ||
99 | void TimeLabels::setCellHeight(int height) | 99 | void TimeLabels::setCellHeight(int height) |
100 | { | 100 | { |
101 | mCellHeight = height; | 101 | mCellHeight = height; |
102 | } | 102 | } |
103 | 103 | ||
104 | /* | 104 | /* |
105 | Optimization so that only the "dirty" portion of the scroll view | 105 | Optimization so that only the "dirty" portion of the scroll view |
106 | is redrawn. Unfortunately, this is not called by default paintEvent() method. | 106 | is redrawn. Unfortunately, this is not called by default paintEvent() method. |
107 | */ | 107 | */ |
108 | void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) | 108 | void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) |
109 | { | 109 | { |
110 | 110 | ||
111 | // if ( globalFlagBlockAgenda ) | 111 | // if ( globalFlagBlockAgenda ) |
112 | // return; | 112 | // return; |
113 | // bug: the parameters cx, cy, cw, ch are the areas that need to be | 113 | // bug: the parameters cx, cy, cw, ch are the areas that need to be |
114 | // redrawn, not the area of the widget. unfortunately, this | 114 | // redrawn, not the area of the widget. unfortunately, this |
115 | // code assumes the latter... | 115 | // code assumes the latter... |
116 | 116 | ||
117 | // now, for a workaround... | 117 | // now, for a workaround... |
118 | // these two assignments fix the weird redraw bug | 118 | // these two assignments fix the weird redraw bug |
119 | cx = contentsX() + 2; | 119 | cx = contentsX() + 2; |
120 | cw = contentsWidth() - 2; | 120 | cw = contentsWidth() - 2; |
121 | // end of workaround | 121 | // end of workaround |
122 | 122 | ||
123 | int cell = ((int)(cy/mCellHeight)); | 123 | int cell = ((int)(cy/mCellHeight)); |
124 | int y = cell * mCellHeight; | 124 | int y = cell * mCellHeight; |
125 | QFontMetrics fm = fontMetrics(); | 125 | QFontMetrics fm = fontMetrics(); |
126 | QString hour; | 126 | QString hour; |
127 | QString suffix; | 127 | QString suffix; |
128 | QString fullTime; | 128 | QString fullTime; |
129 | int tW = fm.width("24:00i"); | 129 | int tW = fm.width("24:00i"); |
130 | int timeHeight = fm.height(); | 130 | int timeHeight = fm.height(); |
131 | timeHeight -= (timeHeight/4-2); | 131 | timeHeight -= (timeHeight/4-2); |
132 | int borderWidth = 5; | 132 | int borderWidth = 2; |
133 | QFont nFont = p->font(); | 133 | QFont nFont = p->font(); |
134 | QFont sFont = nFont; | 134 | QFont sFont = nFont; |
135 | sFont.setPointSize( sFont.pointSize()/2+2 ); | 135 | sFont.setPointSize( sFont.pointSize()/2+2 ); |
136 | if (!KGlobal::locale()->use12Clock()) | 136 | if (!KGlobal::locale()->use12Clock()) |
137 | suffix = "00"; | 137 | suffix = "00"; |
138 | QFontMetrics fmS( sFont ); | 138 | QFontMetrics fmS( sFont ); |
139 | int sHei = fmS.height(); | 139 | int sHei = fmS.height(); |
140 | if ( timeHeight > mCellHeight ) { | 140 | if ( timeHeight > mCellHeight ) { |
141 | timeHeight = mCellHeight-1; | 141 | timeHeight = mCellHeight-1; |
142 | sHei -= 2; | 142 | sHei -= 2; |
143 | } | 143 | } |
144 | 144 | ||
145 | while (y < cy + ch) { | 145 | while (y < cy + ch) { |
146 | p->drawLine(cx,y,cx+tW,y); | 146 | p->drawLine(cx,y,cx+tW,y); |
147 | hour.setNum(cell); | 147 | hour.setNum(cell); |
148 | 148 | ||
149 | // handle 24h and am/pm time formats | 149 | // handle 24h and am/pm time formats |
150 | if (KGlobal::locale()->use12Clock()) { | 150 | if (KGlobal::locale()->use12Clock()) { |
151 | if (cell > 11) suffix = "pm"; | 151 | if (cell > 11) suffix = "pm"; |
152 | else | 152 | else |
153 | suffix = "am"; | 153 | suffix = "am"; |
154 | if (cell == 0) hour.setNum(12); | 154 | if (cell == 0) hour.setNum(12); |
155 | if (cell > 12) hour.setNum(cell - 12); | 155 | if (cell > 12) hour.setNum(cell - 12); |
156 | } | 156 | } |
157 | 157 | ||
158 | // create string in format of "XX:XX" or "XXpm/am" | 158 | // create string in format of "XX:XX" or "XXpm/am" |
159 | fullTime = hour;// + suffix; | 159 | fullTime = hour;// + suffix; |
160 | 160 | ||
161 | // center and draw the time label | 161 | // center and draw the time label |
162 | int timeWidth = fm.width(fullTime+"i"); | 162 | int timeWidth = fm.width(fullTime+"i"); |
163 | int tw2 = fm.width(suffix); | 163 | int tw2 = fm.width(suffix); |
164 | int offset = this->width() - timeWidth - tw2; | 164 | int offset = this->width() - timeWidth - tw2; |
165 | p->setFont( nFont ); | 165 | p->setFont( nFont ); |
166 | p->drawText(cx - borderWidth + offset, y+ timeHeight, fullTime); | 166 | p->drawText(cx - borderWidth + offset, y+ timeHeight, fullTime); |
167 | p->setFont( sFont ); | 167 | p->setFont( sFont ); |
168 | offset += timeWidth; | 168 | offset += timeWidth; |
169 | p->drawText(cx - borderWidth + offset, y+ sHei, suffix); | 169 | p->drawText(cx - borderWidth + offset, y+ sHei, suffix); |
170 | 170 | ||
171 | // increment indices | 171 | // increment indices |
172 | y += mCellHeight; | 172 | y += mCellHeight; |
173 | cell++; | 173 | cell++; |
174 | } | 174 | } |
175 | } | 175 | } |
176 | 176 | ||
177 | /** | 177 | /** |
178 | Calculates the minimum width. | 178 | Calculates the minimum width. |
179 | */ | 179 | */ |
180 | int TimeLabels::minimumWidth() const | 180 | int TimeLabels::minimumWidth() const |
181 | { | 181 | { |
182 | QFontMetrics fm = fontMetrics(); | 182 | return mMiniWidth; |
183 | |||
184 | //TODO: calculate this value | ||
185 | int borderWidth = 4; | ||
186 | |||
187 | // the maximum width possible | ||
188 | int width = fm.width("88:88x") + borderWidth; | ||
189 | |||
190 | return width; | ||
191 | } | 183 | } |
192 | 184 | ||
193 | /** updates widget's internal state */ | 185 | /** updates widget's internal state */ |
194 | void TimeLabels::updateConfig() | 186 | void TimeLabels::updateConfig() |
195 | { | 187 | { |
196 | // set the font | 188 | // set the font |
197 | // config->setGroup("Fonts"); | 189 | // config->setGroup("Fonts"); |
198 | // QFont font = config->readFontEntry("TimeBar Font"); | 190 | // QFont font = config->readFontEntry("TimeBar Font"); |
199 | setFont(KOPrefs::instance()->mTimeBarFont); | 191 | setFont(KOPrefs::instance()->mTimeBarFont); |
200 | 192 | mMiniWidth = fontMetrics().width("88:88") + 2 ; | |
201 | // update geometry restrictions based on new settings | 193 | // update geometry restrictions based on new settings |
202 | setFixedWidth(minimumWidth()); | 194 | setFixedWidth(minimumWidth()); |
203 | 195 | ||
204 | // update HourSize | 196 | // update HourSize |
205 | mCellHeight = KOPrefs::instance()->mHourSize*4; | 197 | mCellHeight = KOPrefs::instance()->mHourSize*4; |
206 | resizeContents(50,mRows * mCellHeight); | 198 | resizeContents(50,mRows * mCellHeight); |
207 | } | 199 | } |
208 | 200 | ||
209 | /** update time label positions */ | 201 | /** update time label positions */ |
210 | void TimeLabels::positionChanged() | 202 | void TimeLabels::positionChanged() |
211 | { | 203 | { |
212 | int adjustment = mAgenda->contentsY(); | 204 | int adjustment = mAgenda->contentsY(); |
213 | setContentsPos(0, adjustment); | 205 | setContentsPos(0, adjustment); |
214 | } | 206 | } |
215 | 207 | ||
216 | /** */ | 208 | /** */ |
217 | void TimeLabels::setAgenda(KOAgenda* agenda) | 209 | void TimeLabels::setAgenda(KOAgenda* agenda) |
218 | { | 210 | { |
219 | mAgenda = agenda; | 211 | mAgenda = agenda; |
220 | } | 212 | } |
221 | 213 | ||
222 | void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) | 214 | void TimeLabels::contentsMousePressEvent ( QMouseEvent * e) |
223 | { | 215 | { |
224 | mMouseDownY = e->pos().y(); | 216 | mMouseDownY = e->pos().y(); |
225 | mOrgCap = topLevelWidget()->caption(); | 217 | mOrgCap = topLevelWidget()->caption(); |
226 | } | 218 | } |
227 | 219 | ||
228 | void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) | 220 | void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e ) |
229 | { | 221 | { |
230 | int diff = mMouseDownY - e->pos().y(); | 222 | int diff = mMouseDownY - e->pos().y(); |
231 | if ( diff < 10 && diff > -10 ) | 223 | if ( diff < 10 && diff > -10 ) |
232 | return; | 224 | return; |
233 | int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; | 225 | int tSize = KOPrefs::instance()->mHourSize + (diff/10) ; |
234 | if ( tSize < 4 ) | 226 | if ( tSize < 4 ) |
235 | tSize = 4; | 227 | tSize = 4; |
236 | if ( tSize > 22 ) | 228 | if ( tSize > 22 ) |
237 | tSize = 22; | 229 | tSize = 22; |
238 | tSize = (tSize-2)/2; | 230 | tSize = (tSize-2)/2; |
239 | topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); | 231 | topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize)); |
240 | 232 | ||
241 | } | 233 | } |
242 | void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) | 234 | void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e ) |
243 | { | 235 | { |
244 | topLevelWidget()->setCaption( mOrgCap ); | 236 | topLevelWidget()->setCaption( mOrgCap ); |
245 | int diff = mMouseDownY - e->pos().y(); | 237 | int diff = mMouseDownY - e->pos().y(); |
246 | if ( diff < 10 && diff > -10 ) | 238 | if ( diff < 10 && diff > -10 ) |
247 | return; | 239 | return; |
248 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); | 240 | int tSize = KOPrefs::instance()->mHourSize + (diff/10); |
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index 8b8bac0..0cb9310 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h | |||
@@ -56,96 +56,97 @@ class KOAgendaButton : public QPushButton | |||
56 | mNum = -3; | 56 | mNum = -3; |
57 | setFlat( true ); | 57 | setFlat( true ); |
58 | setFocusPolicy(NoFocus); | 58 | setFocusPolicy(NoFocus); |
59 | setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); | 59 | setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); |
60 | connect( this, SIGNAL( clicked() ), this, SLOT ( bClicked() ) ); | 60 | connect( this, SIGNAL( clicked() ), this, SLOT ( bClicked() ) ); |
61 | }; | 61 | }; |
62 | 62 | ||
63 | QSize sizeHint () const { return QSize( 5,5) ;} | 63 | QSize sizeHint () const { return QSize( 5,5) ;} |
64 | void setNum( int n) { mNum = n; } | 64 | void setNum( int n) { mNum = n; } |
65 | private slots: | 65 | private slots: |
66 | void bClicked() {emit numClicked( mNum);} | 66 | void bClicked() {emit numClicked( mNum);} |
67 | signals: | 67 | signals: |
68 | void numClicked( int ); | 68 | void numClicked( int ); |
69 | private: | 69 | private: |
70 | int mNum; | 70 | int mNum; |
71 | }; | 71 | }; |
72 | 72 | ||
73 | class TimeLabels : public QScrollView { | 73 | class TimeLabels : public QScrollView { |
74 | Q_OBJECT | 74 | Q_OBJECT |
75 | public: | 75 | public: |
76 | TimeLabels(int rows,QWidget *parent=0,const char *name=0,WFlags f=0); | 76 | TimeLabels(int rows,QWidget *parent=0,const char *name=0,WFlags f=0); |
77 | 77 | ||
78 | void setCellHeight(int height); | 78 | void setCellHeight(int height); |
79 | 79 | ||
80 | /** Calculates the minimum width */ | 80 | /** Calculates the minimum width */ |
81 | virtual int minimumWidth() const; | 81 | virtual int minimumWidth() const; |
82 | 82 | ||
83 | /** updates widget's internal state */ | 83 | /** updates widget's internal state */ |
84 | void updateConfig(); | 84 | void updateConfig(); |
85 | 85 | ||
86 | /** */ | 86 | /** */ |
87 | void setAgenda(KOAgenda* agenda); | 87 | void setAgenda(KOAgenda* agenda); |
88 | 88 | ||
89 | /** */ | 89 | /** */ |
90 | virtual void paintEvent(QPaintEvent* e); | 90 | virtual void paintEvent(QPaintEvent* e); |
91 | void contentsMousePressEvent ( QMouseEvent * ) ; | 91 | void contentsMousePressEvent ( QMouseEvent * ) ; |
92 | void contentsMouseReleaseEvent ( QMouseEvent * ); | 92 | void contentsMouseReleaseEvent ( QMouseEvent * ); |
93 | void contentsMouseMoveEvent ( QMouseEvent * ); | 93 | void contentsMouseMoveEvent ( QMouseEvent * ); |
94 | 94 | ||
95 | public slots: | 95 | public slots: |
96 | /** update time label positions */ | 96 | /** update time label positions */ |
97 | void positionChanged(); | 97 | void positionChanged(); |
98 | signals: | 98 | signals: |
99 | void scaleChanged(); | 99 | void scaleChanged(); |
100 | protected: | 100 | protected: |
101 | void drawContents(QPainter *p,int cx, int cy, int cw, int ch); | 101 | void drawContents(QPainter *p,int cx, int cy, int cw, int ch); |
102 | 102 | ||
103 | private: | 103 | private: |
104 | int mMiniWidth; | ||
104 | int mMouseDownY; | 105 | int mMouseDownY; |
105 | QString mOrgCap; | 106 | QString mOrgCap; |
106 | int mRows; | 107 | int mRows; |
107 | int mCellHeight; | 108 | int mCellHeight; |
108 | 109 | ||
109 | /** */ | 110 | /** */ |
110 | KOAgenda* mAgenda; | 111 | KOAgenda* mAgenda; |
111 | }; | 112 | }; |
112 | 113 | ||
113 | class EventIndicator : public QFrame { | 114 | class EventIndicator : public QFrame { |
114 | Q_OBJECT | 115 | Q_OBJECT |
115 | public: | 116 | public: |
116 | enum Location { Top, Bottom }; | 117 | enum Location { Top, Bottom }; |
117 | EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0); | 118 | EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0); |
118 | virtual ~EventIndicator(); | 119 | virtual ~EventIndicator(); |
119 | 120 | ||
120 | void changeColumns(int columns); | 121 | void changeColumns(int columns); |
121 | void setPaintWidget( KDGanttMinimizeSplitter* ); | 122 | void setPaintWidget( KDGanttMinimizeSplitter* ); |
122 | void setXOffset( int ); | 123 | void setXOffset( int ); |
123 | void enableColumn(int column, bool enable); | 124 | void enableColumn(int column, bool enable); |
124 | 125 | ||
125 | protected: | 126 | protected: |
126 | void drawContents(QPainter *); | 127 | void drawContents(QPainter *); |
127 | 128 | ||
128 | private: | 129 | private: |
129 | int mXOffset; | 130 | int mXOffset; |
130 | KDGanttMinimizeSplitter* mPaintWidget; | 131 | KDGanttMinimizeSplitter* mPaintWidget; |
131 | int mColumns; | 132 | int mColumns; |
132 | QHBox *mTopBox; | 133 | QHBox *mTopBox; |
133 | QBoxLayout *mTopLayout; | 134 | QBoxLayout *mTopLayout; |
134 | Location mLocation; | 135 | Location mLocation; |
135 | QPixmap mPixmap; | 136 | QPixmap mPixmap; |
136 | QMemArray<bool> mEnabled; | 137 | QMemArray<bool> mEnabled; |
137 | }; | 138 | }; |
138 | 139 | ||
139 | /** | 140 | /** |
140 | KOAgendaView is the agenda-like view used to display events in an one or | 141 | KOAgendaView is the agenda-like view used to display events in an one or |
141 | multi-day view. | 142 | multi-day view. |
142 | */ | 143 | */ |
143 | class KOAgendaView : public KOEventView { | 144 | class KOAgendaView : public KOEventView { |
144 | Q_OBJECT | 145 | Q_OBJECT |
145 | public: | 146 | public: |
146 | KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); | 147 | KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); |
147 | virtual ~KOAgendaView(); | 148 | virtual ~KOAgendaView(); |
148 | void setStartHour( int ); | 149 | void setStartHour( int ); |
149 | void toggleAllDay(); | 150 | void toggleAllDay(); |
150 | 151 | ||
151 | 152 | ||
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 6b63d7f..09d70f1 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -1109,87 +1109,134 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e) | |||
1109 | QListView::keyPressEvent ( e ) ; | 1109 | QListView::keyPressEvent ( e ) ; |
1110 | e->accept(); | 1110 | e->accept(); |
1111 | break; | 1111 | break; |
1112 | case Qt::Key_I: { | 1112 | case Qt::Key_I: { |
1113 | QListViewItem* cn; | 1113 | QListViewItem* cn; |
1114 | cn = currentItem(); | 1114 | cn = currentItem(); |
1115 | if ( cn ) { | 1115 | if ( cn ) { |
1116 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1116 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1117 | if ( ci ){ | 1117 | if ( ci ){ |
1118 | //emit showIncidence( ci->data()); | 1118 | //emit showIncidence( ci->data()); |
1119 | cn = cn->nextSibling(); | 1119 | cn = cn->nextSibling(); |
1120 | if ( cn ) { | 1120 | if ( cn ) { |
1121 | setCurrentItem ( cn ); | 1121 | setCurrentItem ( cn ); |
1122 | ensureItemVisible ( cn ); | 1122 | ensureItemVisible ( cn ); |
1123 | } | 1123 | } |
1124 | emit showIncidence( ci->data()); | 1124 | emit showIncidence( ci->data()); |
1125 | } | 1125 | } |
1126 | } | 1126 | } |
1127 | e->accept(); | 1127 | e->accept(); |
1128 | } | 1128 | } |
1129 | break; | 1129 | break; |
1130 | case Qt::Key_Return: | 1130 | case Qt::Key_Return: |
1131 | case Qt::Key_Enter: | 1131 | case Qt::Key_Enter: |
1132 | { | 1132 | { |
1133 | QListViewItem* cn; | 1133 | QListViewItem* cn; |
1134 | cn = currentItem(); | 1134 | cn = currentItem(); |
1135 | if ( cn ) { | 1135 | if ( cn ) { |
1136 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1136 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1137 | if ( ci ){ | 1137 | if ( ci ){ |
1138 | if ( e->state() == ShiftButton ) | 1138 | if ( e->state() == ShiftButton ) |
1139 | ci->setSelected( false ); | 1139 | ci->setSelected( false ); |
1140 | else | 1140 | else |
1141 | ci->setSelected( true ); | 1141 | ci->setSelected( true ); |
1142 | cn = cn->nextSibling(); | 1142 | cn = cn->nextSibling(); |
1143 | if ( cn ) { | 1143 | if ( cn ) { |
1144 | setCurrentItem ( cn ); | 1144 | setCurrentItem ( cn ); |
1145 | ensureItemVisible ( cn ); | 1145 | ensureItemVisible ( cn ); |
1146 | } | 1146 | } |
1147 | } | 1147 | } |
1148 | } | 1148 | } |
1149 | e->accept(); | 1149 | e->accept(); |
1150 | } | 1150 | } |
1151 | break; | 1151 | break; |
1152 | default: | 1152 | default: |
1153 | e->ignore(); | 1153 | e->ignore(); |
1154 | } | 1154 | } |
1155 | } | 1155 | } |
1156 | KOListViewListView::KOListViewListView(KOListView * lv ) | 1156 | KOListViewListView::KOListViewListView(KOListView * lv ) |
1157 | : KListView( lv ) | 1157 | : KListView( lv, "kolistlistview", false ) |
1158 | { | 1158 | { |
1159 | mPopupTimer = new QTimer(this); | ||
1160 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); | ||
1159 | #ifndef DESKTOP_VERSION | 1161 | #ifndef DESKTOP_VERSION |
1160 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 1162 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
1161 | #endif | 1163 | #endif |
1162 | setSelectionMode( QListView::Multi ); | 1164 | setSelectionMode( QListView::Multi ); |
1163 | setMultiSelection( true); | 1165 | setMultiSelection( true); |
1164 | } | 1166 | } |
1165 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 1167 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
1166 | { | 1168 | { |
1167 | if (!e) return; | 1169 | if (!e) return; |
1168 | QPoint vp = contentsToViewport(e->pos()); | 1170 | QPoint vp = contentsToViewport(e->pos()); |
1169 | QListViewItem *item = itemAt(vp); | 1171 | QListViewItem *item = itemAt(vp); |
1170 | if (!item) { | 1172 | if (!item) { |
1171 | emit newEvent(); | 1173 | emit newEvent(); |
1172 | return; | 1174 | return; |
1173 | } | 1175 | } |
1174 | KListView::contentsMouseDoubleClickEvent(e); | 1176 | KListView::contentsMouseDoubleClickEvent(e); |
1175 | } | 1177 | } |
1176 | 1178 | #if 0 | |
1177 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1179 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1178 | { | 1180 | { |
1179 | //qDebug("contentsMousePressEvent++++ "); | 1181 | //qDebug("contentsMousePressEvent++++ "); |
1180 | KListView::contentsMousePressEvent( e ); | 1182 | KListView::contentsMousePressEvent( e ); |
1181 | if ( e->button() == RightButton ) { | 1183 | if ( e->button() == RightButton ) { |
1182 | QListViewItem* ci = currentItem(); | 1184 | QListViewItem* ci = currentItem(); |
1183 | clearSelection () ; | 1185 | clearSelection () ; |
1184 | if ( ci ) | 1186 | if ( ci ) |
1185 | ci->setSelected( true ); | 1187 | ci->setSelected( true ); |
1186 | } | 1188 | } |
1187 | } | 1189 | } |
1188 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1190 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1189 | { | 1191 | { |
1190 | KListView::contentsMouseReleaseEvent(e); | 1192 | KListView::contentsMouseReleaseEvent(e); |
1191 | } | 1193 | } |
1192 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1194 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1193 | { | 1195 | { |
1194 | KListView::contentsMouseMoveEvent(e); | 1196 | KListView::contentsMouseMoveEvent(e); |
1195 | } | 1197 | } |
1198 | #endif | ||
1199 | void KOListViewListView::popupMenu() | ||
1200 | { | ||
1201 | mPopupTimer->stop(); | ||
1202 | //qDebug("HUUUUUUUUUUUUUUUUUUUU "); | ||
1203 | QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); | ||
1204 | QApplication::postEvent( this->viewport(), e ); | ||
1205 | } | ||
1206 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | ||
1207 | { | ||
1208 | //qDebug("contentsMousePressEvent++++ "); | ||
1209 | mYMousePos = mapToGlobal( (e->pos())).y(); | ||
1210 | if ( e->button() == LeftButton ) { | ||
1211 | mPopupTimer->start( 600 ); | ||
1212 | mEventPos = e->pos(); | ||
1213 | mEventGlobalPos = e->globalPos(); | ||
1214 | } | ||
1215 | KListView::contentsMousePressEvent( e ); | ||
1216 | if ( e->button() == RightButton ) { | ||
1217 | QListViewItem* ci = currentItem(); | ||
1218 | clearSelection(); | ||
1219 | if ( ci ) | ||
1220 | ci->setSelected( true ); | ||
1221 | } | ||
1222 | } | ||
1223 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | ||
1224 | { | ||
1225 | mPopupTimer->stop(); | ||
1226 | KListView::contentsMouseReleaseEvent(e); | ||
1227 | } | ||
1228 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | ||
1229 | { | ||
1230 | // qDebug("contentsMouseMoveEv....... "); | ||
1231 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); | ||
1232 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); | ||
1233 | if ( diff < 0 ) diff = -diff; | ||
1234 | if ( diff > 15 ) | ||
1235 | mPopupTimer->stop(); | ||
1236 | else { | ||
1237 | mEventPos = e->pos(); | ||
1238 | mEventGlobalPos = e->globalPos(); | ||
1239 | } | ||
1240 | KListView::contentsMouseMoveEvent(e); | ||
1241 | } | ||
1242 | |||
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index eca71e2..bb0e23e 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h | |||
@@ -2,96 +2,97 @@ | |||
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 | ||
43 | using namespace KCal; | 43 | using namespace KCal; |
44 | 44 | ||
45 | 45 | ||
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 <qcombobox.h> | 51 | #include <qcombobox.h> |
51 | #include <qspinbox.h> | 52 | #include <qspinbox.h> |
52 | #include <qtooltip.h> | 53 | #include <qtooltip.h> |
53 | #include <qcheckbox.h> | 54 | #include <qcheckbox.h> |
54 | #include <qhbox.h> | 55 | #include <qhbox.h> |
55 | #include <qlabel.h> | 56 | #include <qlabel.h> |
56 | #include <kiconloader.h> | 57 | #include <kiconloader.h> |
57 | #include "kfiledialog.h" | 58 | #include "kfiledialog.h" |
58 | #include "koprefs.h" | 59 | #include "koprefs.h" |
59 | class KOAlarmPrefs : public QDialog | 60 | class KOAlarmPrefs : public QDialog |
60 | { | 61 | { |
61 | Q_OBJECT | 62 | Q_OBJECT |
62 | public: | 63 | public: |
63 | KOAlarmPrefs( QWidget *par=0, const char *name=0 ) : | 64 | KOAlarmPrefs( QWidget *par=0, const char *name=0 ) : |
64 | QDialog( par, name, true ) | 65 | QDialog( par, name, true ) |
65 | { | 66 | { |
66 | setCaption( i18n("Alarm Options") ); | 67 | setCaption( i18n("Alarm Options") ); |
67 | QVBoxLayout* alarmLayout = new QVBoxLayout( this ); | 68 | QVBoxLayout* alarmLayout = new QVBoxLayout( this ); |
68 | alarmLayout->setSpacing( 3 ); | 69 | alarmLayout->setSpacing( 3 ); |
69 | alarmLayout->setMargin( 3 ); | 70 | alarmLayout->setMargin( 3 ); |
70 | QWidget *parent = this; | 71 | QWidget *parent = this; |
71 | mAlarmButton = new QCheckBox(i18n("Set reminder ON with offset to:"),parent); | 72 | mAlarmButton = new QCheckBox(i18n("Set reminder ON with offset to:"),parent); |
72 | alarmLayout->addWidget(mAlarmButton); | 73 | alarmLayout->addWidget(mAlarmButton); |
73 | mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; | 74 | mAlarmTimeEdit = new QSpinBox ( 0, 9999, 1, parent, "mAlarmTimeEdit " ) ; |
74 | mAlarmTimeEdit->setValue( 15 ); | 75 | mAlarmTimeEdit->setValue( 15 ); |
75 | alarmLayout->addWidget(mAlarmTimeEdit); | 76 | alarmLayout->addWidget(mAlarmTimeEdit); |
76 | mAlarmIncrCombo = new QComboBox(false, parent); | 77 | mAlarmIncrCombo = new QComboBox(false, parent); |
77 | mAlarmIncrCombo->insertItem(i18n("minute(s)")); | 78 | mAlarmIncrCombo->insertItem(i18n("minute(s)")); |
78 | mAlarmIncrCombo->insertItem(i18n("hour(s)")); | 79 | mAlarmIncrCombo->insertItem(i18n("hour(s)")); |
79 | mAlarmIncrCombo->insertItem(i18n("day(s)")); | 80 | mAlarmIncrCombo->insertItem(i18n("day(s)")); |
80 | alarmLayout->addWidget(mAlarmIncrCombo); | 81 | alarmLayout->addWidget(mAlarmIncrCombo); |
81 | QHBox * hb = new QHBox ( parent ); | 82 | QHBox * hb = new QHBox ( parent ); |
82 | alarmLayout->addWidget(hb); | 83 | alarmLayout->addWidget(hb); |
83 | mAlarmSoundButton = new QPushButton(hb); | 84 | mAlarmSoundButton = new QPushButton(hb); |
84 | mAlarmSoundButton->setPixmap(SmallIcon("playsound")); | 85 | mAlarmSoundButton->setPixmap(SmallIcon("playsound")); |
85 | mAlarmSoundButton->setToggleButton(true); | 86 | mAlarmSoundButton->setToggleButton(true); |
86 | connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); | 87 | connect(mAlarmSoundButton, SIGNAL(clicked()), SLOT(pickAlarmSound())); |
87 | mAlarmProgramButton = new QPushButton(hb); | 88 | mAlarmProgramButton = new QPushButton(hb); |
88 | mAlarmProgramButton->setPixmap(SmallIcon("run")); | 89 | mAlarmProgramButton->setPixmap(SmallIcon("run")); |
89 | mAlarmProgramButton->setToggleButton(true); | 90 | mAlarmProgramButton->setToggleButton(true); |
90 | connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); | 91 | connect(mAlarmProgramButton, SIGNAL(clicked()), SLOT(pickAlarmProgram())); |
91 | mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); | 92 | mAlarmSoundButton->setMaximumWidth( mAlarmSoundButton->sizeHint().width() + 4 ); |
92 | mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); | 93 | mAlarmProgramButton->setMaximumWidth(mAlarmProgramButton->sizeHint().width() + 4 ); |
93 | mAlarmLabel = new QLabel( this ); | 94 | mAlarmLabel = new QLabel( this ); |
94 | alarmLayout->addWidget( mAlarmLabel ); | 95 | alarmLayout->addWidget( mAlarmLabel ); |
95 | mAlarmLabel->setText( "..."+KOPrefs::instance()->mDefaultAlarmFile.right( 30 ) ); | 96 | mAlarmLabel->setText( "..."+KOPrefs::instance()->mDefaultAlarmFile.right( 30 ) ); |
96 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; | 97 | mAlarmSound = KOPrefs::instance()->mDefaultAlarmFile; |
97 | mAlarmSoundButton->setOn( true ); | 98 | mAlarmSoundButton->setOn( true ); |
@@ -172,97 +173,103 @@ void pickAlarmProgram() | |||
172 | 173 | ||
173 | 174 | ||
174 | 175 | ||
175 | 176 | ||
176 | 177 | ||
177 | 178 | ||
178 | 179 | ||
179 | typedef CustomListViewItem<Incidence *> KOListViewItem; | 180 | typedef CustomListViewItem<Incidence *> KOListViewItem; |
180 | 181 | ||
181 | /** | 182 | /** |
182 | This class provides the initialisation of a KOListViewItem for calendar | 183 | This class provides the initialisation of a KOListViewItem for calendar |
183 | components using the Incidence::Visitor. | 184 | components using the Incidence::Visitor. |
184 | */ | 185 | */ |
185 | class ListItemVisitor : public Incidence::Visitor | 186 | class ListItemVisitor : public Incidence::Visitor |
186 | { | 187 | { |
187 | public: | 188 | public: |
188 | ListItemVisitor(KOListViewItem *, QDate d); | 189 | ListItemVisitor(KOListViewItem *, QDate d); |
189 | ~ListItemVisitor(); | 190 | ~ListItemVisitor(); |
190 | 191 | ||
191 | bool visit(Event *); | 192 | bool visit(Event *); |
192 | bool visit(Todo *); | 193 | bool visit(Todo *); |
193 | bool visit(Journal *); | 194 | bool visit(Journal *); |
194 | 195 | ||
195 | private: | 196 | private: |
196 | KOListViewItem *mItem; | 197 | KOListViewItem *mItem; |
197 | QDate mDate; | 198 | QDate mDate; |
198 | }; | 199 | }; |
199 | 200 | ||
200 | /** | 201 | /** |
201 | This class provides a multi-column list view of events. It can | 202 | This class provides a multi-column list view of events. It can |
202 | display events from one particular day or several days, it doesn't | 203 | display events from one particular day or several days, it doesn't |
203 | matter. To use a view that only handles one day at a time, use | 204 | matter. To use a view that only handles one day at a time, use |
204 | KODayListView. | 205 | KODayListView. |
205 | 206 | ||
206 | @short multi-column list view of various events. | 207 | @short multi-column list view of various events. |
207 | @author Preston Brown <pbrown@kde.org> | 208 | @author Preston Brown <pbrown@kde.org> |
208 | @see KOBaseView, KODayListView | 209 | @see KOBaseView, KODayListView |
209 | */ | 210 | */ |
210 | class KOListView; | 211 | class KOListView; |
211 | 212 | ||
212 | class KOListViewListView : public KListView | 213 | class KOListViewListView : public KListView |
213 | { | 214 | { |
214 | Q_OBJECT | 215 | Q_OBJECT |
215 | public: | 216 | public: |
216 | KOListViewListView(KOListView * lv ); | 217 | KOListViewListView(KOListView * lv ); |
217 | signals: | 218 | signals: |
218 | void newEvent(); | 219 | void newEvent(); |
219 | void showIncidence( Incidence* ); | 220 | void showIncidence( Incidence* ); |
221 | public slots: | ||
222 | void popupMenu(); | ||
220 | private: | 223 | private: |
224 | QPoint mEventPos; | ||
225 | QPoint mEventGlobalPos; | ||
226 | QTimer* mPopupTimer; | ||
227 | int mYMousePos; | ||
221 | void keyPressEvent ( QKeyEvent * ) ; | 228 | void keyPressEvent ( QKeyEvent * ) ; |
222 | void contentsMouseDoubleClickEvent(QMouseEvent *e); | 229 | void contentsMouseDoubleClickEvent(QMouseEvent *e); |
223 | void contentsMousePressEvent(QMouseEvent *e); | 230 | void contentsMousePressEvent(QMouseEvent *e); |
224 | void contentsMouseReleaseEvent(QMouseEvent *e); | 231 | void contentsMouseReleaseEvent(QMouseEvent *e); |
225 | void contentsMouseMoveEvent(QMouseEvent *e); | 232 | void contentsMouseMoveEvent(QMouseEvent *e); |
226 | bool mMouseDown; | 233 | bool mMouseDown; |
227 | }; | 234 | }; |
228 | 235 | ||
229 | class KOListView : public KOEventView | 236 | class KOListView : public KOEventView |
230 | { | 237 | { |
231 | Q_OBJECT | 238 | Q_OBJECT |
232 | public: | 239 | public: |
233 | KOListView(Calendar *calendar, QWidget *parent = 0, | 240 | KOListView(Calendar *calendar, QWidget *parent = 0, |
234 | const char *name = 0); | 241 | const char *name = 0); |
235 | ~KOListView(); | 242 | ~KOListView(); |
236 | 243 | ||
237 | virtual int maxDatesHint(); | 244 | virtual int maxDatesHint(); |
238 | virtual int currentDateCount(); | 245 | virtual int currentDateCount(); |
239 | virtual QPtrList<Incidence> selectedIncidences(); | 246 | virtual QPtrList<Incidence> selectedIncidences(); |
240 | virtual DateList selectedDates(); | 247 | virtual DateList selectedDates(); |
241 | 248 | ||
242 | void showDates(bool show); | 249 | void showDates(bool show); |
243 | Incidence* currentItem(); | 250 | Incidence* currentItem(); |
244 | void addTodos(QPtrList<Todo> eventList); | 251 | void addTodos(QPtrList<Todo> eventList); |
245 | void addJournals(QPtrList<Journal> eventList); | 252 | void addJournals(QPtrList<Journal> eventList); |
246 | virtual void printPreview(CalPrinter *calPrinter, | 253 | virtual void printPreview(CalPrinter *calPrinter, |
247 | const QDate &, const QDate &); | 254 | const QDate &, const QDate &); |
248 | 255 | ||
249 | void readSettings(KConfig *config, QString setting = "KOListView Layout"); | 256 | void readSettings(KConfig *config, QString setting = "KOListView Layout"); |
250 | void writeSettings(KConfig *config, QString setting = "KOListView Layout"); | 257 | void writeSettings(KConfig *config, QString setting = "KOListView Layout"); |
251 | void updateList(); | 258 | void updateList(); |
252 | void setStartDate(const QDate &start); | 259 | void setStartDate(const QDate &start); |
253 | int count(); | 260 | int count(); |
254 | QString getWhatsThisText(QPoint p); | 261 | QString getWhatsThisText(QPoint p); |
255 | void resetFocus(); | 262 | void resetFocus(); |
256 | signals: | 263 | signals: |
257 | void signalNewEvent(); | 264 | void signalNewEvent(); |
258 | void beamIncidenceList(QPtrList<Incidence>); | 265 | void beamIncidenceList(QPtrList<Incidence>); |
259 | 266 | ||
260 | public slots: | 267 | public slots: |
261 | virtual void updateView(); | 268 | virtual void updateView(); |
262 | virtual void showDates(const QDate &start, const QDate &end); | 269 | virtual void showDates(const QDate &start, const QDate &end); |
263 | virtual void showEvents(QPtrList<Event> eventList); | 270 | virtual void showEvents(QPtrList<Event> eventList); |
264 | void clearSelection(); | 271 | void clearSelection(); |
265 | void allSelection(); | 272 | void allSelection(); |
266 | 273 | ||
267 | void clear(); | 274 | void clear(); |
268 | void beamDone( Ir *ir ); | 275 | void beamDone( Ir *ir ); |
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp index 154cd02..31e2053 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp | |||
@@ -360,102 +360,103 @@ void KListViewLineEdit::terminate() | |||
360 | } | 360 | } |
361 | 361 | ||
362 | void KListViewLineEdit::terminate(bool commit) | 362 | void KListViewLineEdit::terminate(bool commit) |
363 | { | 363 | { |
364 | if ( item ) | 364 | if ( item ) |
365 | { | 365 | { |
366 | //kdDebug() << "KListViewLineEdit::terminate " << commit << endl; | 366 | //kdDebug() << "KListViewLineEdit::terminate " << commit << endl; |
367 | if (commit) | 367 | if (commit) |
368 | item->setText(col, text()); | 368 | item->setText(col, text()); |
369 | int c=col; | 369 | int c=col; |
370 | QListViewItem *i=item; | 370 | QListViewItem *i=item; |
371 | col=0; | 371 | col=0; |
372 | item=0; | 372 | item=0; |
373 | hide(); // will call focusOutEvent, that's why we set item=0 before | 373 | hide(); // will call focusOutEvent, that's why we set item=0 before |
374 | emit done(i,c); | 374 | emit done(i,c); |
375 | } | 375 | } |
376 | } | 376 | } |
377 | 377 | ||
378 | void KListViewLineEdit::focusOutEvent(QFocusEvent *ev) | 378 | void KListViewLineEdit::focusOutEvent(QFocusEvent *ev) |
379 | { | 379 | { |
380 | QFocusEvent * focusEv = static_cast<QFocusEvent*>(ev); | 380 | QFocusEvent * focusEv = static_cast<QFocusEvent*>(ev); |
381 | // Don't let a RMB close the editor | 381 | // Don't let a RMB close the editor |
382 | if (focusEv->reason() != QFocusEvent::Popup && focusEv->reason() != QFocusEvent::ActiveWindow) | 382 | if (focusEv->reason() != QFocusEvent::Popup && focusEv->reason() != QFocusEvent::ActiveWindow) |
383 | terminate(true); | 383 | terminate(true); |
384 | } | 384 | } |
385 | 385 | ||
386 | void KListViewLineEdit::paintEvent( QPaintEvent *e ) | 386 | void KListViewLineEdit::paintEvent( QPaintEvent *e ) |
387 | { | 387 | { |
388 | KLineEdit::paintEvent( e ); | 388 | KLineEdit::paintEvent( e ); |
389 | 389 | ||
390 | if ( !frame() ) { | 390 | if ( !frame() ) { |
391 | QPainter p( this ); | 391 | QPainter p( this ); |
392 | p.setClipRegion( e->region() ); | 392 | p.setClipRegion( e->region() ); |
393 | p.drawRect( rect() ); | 393 | p.drawRect( rect() ); |
394 | } | 394 | } |
395 | } | 395 | } |
396 | 396 | ||
397 | // selection changed -> terminate. As our "item" can be already deleted, | 397 | // selection changed -> terminate. As our "item" can be already deleted, |
398 | // we can't call terminate(false), because that would emit done() with | 398 | // we can't call terminate(false), because that would emit done() with |
399 | // a dangling pointer to "item". | 399 | // a dangling pointer to "item". |
400 | void KListViewLineEdit::slotSelectionChanged() | 400 | void KListViewLineEdit::slotSelectionChanged() |
401 | { | 401 | { |
402 | item = 0; | 402 | item = 0; |
403 | col = 0; | 403 | col = 0; |
404 | hide(); | 404 | hide(); |
405 | } | 405 | } |
406 | */ | 406 | */ |
407 | 407 | ||
408 | KListView::KListView( QWidget *parent, const char *name ) | 408 | KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse ) |
409 | : QListView( parent, name ), | 409 | : QListView( parent, name ), |
410 | d (new KListViewPrivate (this)) | 410 | d (new KListViewPrivate (this)) |
411 | { | 411 | { |
412 | #ifndef DESKTOP_VERSION | 412 | #ifndef DESKTOP_VERSION |
413 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 413 | if ( emulateRightMouse ) |
414 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | ||
414 | #endif | 415 | #endif |
415 | //US setDragAutoScroll(true); | 416 | //US setDragAutoScroll(true); |
416 | 417 | ||
417 | connect( this, SIGNAL( onViewport() ), | 418 | connect( this, SIGNAL( onViewport() ), |
418 | this, SLOT( slotOnViewport() ) ); | 419 | this, SLOT( slotOnViewport() ) ); |
419 | connect( this, SIGNAL( onItem( QListViewItem * ) ), | 420 | connect( this, SIGNAL( onItem( QListViewItem * ) ), |
420 | this, SLOT( slotOnItem( QListViewItem * ) ) ); | 421 | this, SLOT( slotOnItem( QListViewItem * ) ) ); |
421 | 422 | ||
422 | connect (this, SIGNAL(contentsMoving(int,int)), | 423 | connect (this, SIGNAL(contentsMoving(int,int)), |
423 | this, SLOT(cleanDropVisualizer())); | 424 | this, SLOT(cleanDropVisualizer())); |
424 | connect (this, SIGNAL(contentsMoving(int,int)), | 425 | connect (this, SIGNAL(contentsMoving(int,int)), |
425 | this, SLOT(cleanItemHighlighter())); | 426 | this, SLOT(cleanItemHighlighter())); |
426 | 427 | ||
427 | /*US | 428 | /*US |
428 | slotSettingsChanged(KApplication::SETTINGS_MOUSE); | 429 | slotSettingsChanged(KApplication::SETTINGS_MOUSE); |
429 | 430 | ||
430 | if (kapp) | 431 | if (kapp) |
431 | { | 432 | { |
432 | connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); | 433 | connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); |
433 | kapp->addKipcEventMask( KIPC::SettingsChanged ); | 434 | kapp->addKipcEventMask( KIPC::SettingsChanged ); |
434 | } | 435 | } |
435 | */ | 436 | */ |
436 | slotSettingsChanged(1); //US do this to initialize the connections | 437 | slotSettingsChanged(1); //US do this to initialize the connections |
437 | 438 | ||
438 | 439 | ||
439 | connect(&d->autoSelect, SIGNAL( timeout() ), | 440 | connect(&d->autoSelect, SIGNAL( timeout() ), |
440 | this, SLOT( slotAutoSelect() ) ); | 441 | this, SLOT( slotAutoSelect() ) ); |
441 | connect(&d->dragExpand, SIGNAL( timeout() ), | 442 | connect(&d->dragExpand, SIGNAL( timeout() ), |
442 | this, SLOT( slotDragExpand() ) ); | 443 | this, SLOT( slotDragExpand() ) ); |
443 | 444 | ||
444 | // context menu handling | 445 | // context menu handling |
445 | if (d->showContextMenusOnPress) | 446 | if (d->showContextMenusOnPress) |
446 | { | 447 | { |
447 | connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), | 448 | connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), |
448 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 449 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
449 | } | 450 | } |
450 | else | 451 | else |
451 | { | 452 | { |
452 | connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), | 453 | connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), |
453 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 454 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
454 | } | 455 | } |
455 | 456 | ||
456 | connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)), | 457 | connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)), |
457 | this, SLOT (emitContextMenu (KListView*, QListViewItem*))); | 458 | this, SLOT (emitContextMenu (KListView*, QListViewItem*))); |
458 | 459 | ||
459 | 460 | ||
460 | //qDebug("KListView::KListView make alternate color configurable"); | 461 | //qDebug("KListView::KListView make alternate color configurable"); |
461 | //US d->alternateBackground = KGlobalSettings::alternateBackgroundColor(); | 462 | //US d->alternateBackground = KGlobalSettings::alternateBackgroundColor(); |
diff --git a/microkde/kdeui/klistview.h b/microkde/kdeui/klistview.h index d559ce7..0058416 100644 --- a/microkde/kdeui/klistview.h +++ b/microkde/kdeui/klistview.h | |||
@@ -78,97 +78,97 @@ public: | |||
78 | * Possible selection modes. | 78 | * Possible selection modes. |
79 | * | 79 | * |
80 | * The first four correspond directly to QListView::SelectionMode, while | 80 | * The first four correspond directly to QListView::SelectionMode, while |
81 | * the FileManager selection mode is defined as follows: | 81 | * the FileManager selection mode is defined as follows: |
82 | * @li home: move to the first | 82 | * @li home: move to the first |
83 | * @li end: move to the last | 83 | * @li end: move to the last |
84 | * @li PgUp/PgDn: move one page up/down | 84 | * @li PgUp/PgDn: move one page up/down |
85 | * @li up/down: move one item up/down | 85 | * @li up/down: move one item up/down |
86 | * @li insert: toggle selection of current and move to the next | 86 | * @li insert: toggle selection of current and move to the next |
87 | * @li space: toggle selection of the current | 87 | * @li space: toggle selection of the current |
88 | * @li CTRL+up: move to the previous item and toggle selection of this one | 88 | * @li CTRL+up: move to the previous item and toggle selection of this one |
89 | * @li CTRL+down: toggle selection of the current item and move to the next | 89 | * @li CTRL+down: toggle selection of the current item and move to the next |
90 | * @li CTRL+end: toggle selection from (including) the current | 90 | * @li CTRL+end: toggle selection from (including) the current |
91 | * item to (including) the last item | 91 | * item to (including) the last item |
92 | * @li CTRL+home: toggle selection from (including) the current | 92 | * @li CTRL+home: toggle selection from (including) the current |
93 | * item to the (including) the first item | 93 | * item to the (including) the first item |
94 | * @li CTRL+PgDn: toggle selection from (including) the current | 94 | * @li CTRL+PgDn: toggle selection from (including) the current |
95 | * item to (excluding) the item one page down | 95 | * item to (excluding) the item one page down |
96 | * @li CTRL+PgUp: toggle selection from (excluding) the current | 96 | * @li CTRL+PgUp: toggle selection from (excluding) the current |
97 | * item to (including) the item one page up | 97 | * item to (including) the item one page up |
98 | * | 98 | * |
99 | * The combinations work the same with SHIFT instead of CTRL, except | 99 | * The combinations work the same with SHIFT instead of CTRL, except |
100 | * that if you start selecting something using SHIFT everything selected | 100 | * that if you start selecting something using SHIFT everything selected |
101 | * before will be deselected first. | 101 | * before will be deselected first. |
102 | * | 102 | * |
103 | * Additionally the current item is always selected automatically when | 103 | * Additionally the current item is always selected automatically when |
104 | * navigating using the keyboard, except other items were selected explicitely. | 104 | * navigating using the keyboard, except other items were selected explicitely. |
105 | * | 105 | * |
106 | * This way e.g. SHIFT+up/PgUp then SHIFT+down/PgDn leaves no item selected | 106 | * This way e.g. SHIFT+up/PgUp then SHIFT+down/PgDn leaves no item selected |
107 | */ | 107 | */ |
108 | enum SelectionModeExt { | 108 | enum SelectionModeExt { |
109 | Single = QListView::Single, | 109 | Single = QListView::Single, |
110 | Multi = QListView::Multi, | 110 | Multi = QListView::Multi, |
111 | Extended = QListView::Extended, | 111 | Extended = QListView::Extended, |
112 | NoSelection = QListView::NoSelection, | 112 | NoSelection = QListView::NoSelection, |
113 | FileManager | 113 | FileManager |
114 | }; | 114 | }; |
115 | void repaintContents( bool erase = true ) | 115 | void repaintContents( bool erase = true ) |
116 | { | 116 | { |
117 | QScrollView::repaintContents( contentsX(), contentsY(), | 117 | QScrollView::repaintContents( contentsX(), contentsY(), |
118 | visibleWidth(), visibleHeight(), erase ); | 118 | visibleWidth(), visibleHeight(), erase ); |
119 | }; | 119 | }; |
120 | /** | 120 | /** |
121 | * Constructor. | 121 | * Constructor. |
122 | * | 122 | * |
123 | * The parameters @p parent and @p name are handled by | 123 | * The parameters @p parent and @p name are handled by |
124 | * @ref QListView, as usual. | 124 | * @ref QListView, as usual. |
125 | */ | 125 | */ |
126 | KListView (QWidget *parent = 0, const char *name = 0); | 126 | KListView (QWidget *parent = 0, const char *name = 0, bool emulateRightMouse = true ); |
127 | 127 | ||
128 | /** | 128 | /** |
129 | * Destructor. | 129 | * Destructor. |
130 | */ | 130 | */ |
131 | virtual ~KListView(); | 131 | virtual ~KListView(); |
132 | 132 | ||
133 | /** | 133 | /** |
134 | * Reimplemented for internal reasons. | 134 | * Reimplemented for internal reasons. |
135 | * Further reimplementations should call this function or else | 135 | * Further reimplementations should call this function or else |
136 | * some features may not work correctly. | 136 | * some features may not work correctly. |
137 | * | 137 | * |
138 | * The API is unaffected. | 138 | * The API is unaffected. |
139 | */ | 139 | */ |
140 | virtual void setAcceptDrops (bool); | 140 | virtual void setAcceptDrops (bool); |
141 | 141 | ||
142 | /** | 142 | /** |
143 | * This function determines whether the given coordinates are within the | 143 | * This function determines whether the given coordinates are within the |
144 | * execute area. The execute area is the part of a @ref QListViewItem where mouse | 144 | * execute area. The execute area is the part of a @ref QListViewItem where mouse |
145 | * clicks or double clicks respectively generate a @ref #executed() signal. | 145 | * clicks or double clicks respectively generate a @ref #executed() signal. |
146 | * Depending on @ref QListView::allColumnsShowFocus() this is either the | 146 | * Depending on @ref QListView::allColumnsShowFocus() this is either the |
147 | * whole item or only the first column. | 147 | * whole item or only the first column. |
148 | * @return true if point is inside execute area of an item, false in all | 148 | * @return true if point is inside execute area of an item, false in all |
149 | * other cases including the case that it is over the viewport. | 149 | * other cases including the case that it is over the viewport. |
150 | */ | 150 | */ |
151 | virtual bool isExecuteArea( const QPoint& point ); | 151 | virtual bool isExecuteArea( const QPoint& point ); |
152 | 152 | ||
153 | /** | 153 | /** |
154 | * Same thing, but from an x coordinate only. This only checks if x is in | 154 | * Same thing, but from an x coordinate only. This only checks if x is in |
155 | * the first column (if all columns don't show focus), without testing if | 155 | * the first column (if all columns don't show focus), without testing if |
156 | * the y coordinate is over an item or not. | 156 | * the y coordinate is over an item or not. |
157 | */ | 157 | */ |
158 | bool isExecuteArea( int x ); | 158 | bool isExecuteArea( int x ); |
159 | 159 | ||
160 | /** | 160 | /** |
161 | * @return a list containing the currently selected items. | 161 | * @return a list containing the currently selected items. |
162 | */ | 162 | */ |
163 | QPtrList<QListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?) | 163 | QPtrList<QListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?) |
164 | 164 | ||
165 | /** | 165 | /** |
166 | * Arbitrarily move @p item to @p parent, positioned immediately after item @p after. | 166 | * Arbitrarily move @p item to @p parent, positioned immediately after item @p after. |
167 | */ | 167 | */ |
168 | void moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after); | 168 | void moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after); |
169 | 169 | ||
170 | /** | 170 | /** |
171 | * @return the last item (not child!) of this listview. | 171 | * @return the last item (not child!) of this listview. |
172 | * | 172 | * |
173 | * @see lastChild() | 173 | * @see lastChild() |
174 | */ | 174 | */ |