summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-30 15:49:34 (UTC)
committer zautrix <zautrix>2005-01-30 15:49:34 (UTC)
commita34c528fdd8d2cdec14bae9ccb0eee54c8e4e374 (patch) (unidiff)
tree21a900be618695f6dac42b5e9df6094201a981d0
parent11736af9b5348f251b0e8a3cf90fdb960c877936 (diff)
downloadkdepimpi-a34c528fdd8d2cdec14bae9ccb0eee54c8e4e374.zip
kdepimpi-a34c528fdd8d2cdec14bae9ccb0eee54c8e4e374.tar.gz
kdepimpi-a34c528fdd8d2cdec14bae9ccb0eee54c8e4e374.tar.bz2
fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 902f3f4..2f5259f 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -162,193 +162,193 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e)
162 if ( destinationEvent ) 162 if ( destinationEvent )
163 reparentTodoSignal( destinationEvent, todo ); 163 reparentTodoSignal( destinationEvent, todo );
164 } 164 }
165 } 165 }
166 else { 166 else {
167 QString text; 167 QString text;
168 if (QTextDrag::decode(e,text)) { 168 if (QTextDrag::decode(e,text)) {
169 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) ); 169 //QListViewItem *qlvi = itemAt( contentsToViewport(e->pos()) );
170 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) )); 170 KOTodoViewItem *todoi = static_cast<KOTodoViewItem *>(itemAt( contentsToViewport(e->pos()) ));
171 qDebug("Dropped : " + text); 171 qDebug("Dropped : " + text);
172 QStringList emails = QStringList::split(",",text); 172 QStringList emails = QStringList::split(",",text);
173 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) { 173 for(QStringList::ConstIterator it = emails.begin();it!=emails.end();++it) {
174 int pos = (*it).find("<"); 174 int pos = (*it).find("<");
175 QString name = (*it).left(pos); 175 QString name = (*it).left(pos);
176 QString email = (*it).mid(pos); 176 QString email = (*it).mid(pos);
177 if (!email.isEmpty() && todoi) { 177 if (!email.isEmpty() && todoi) {
178 todoi->todo()->addAttendee(new Attendee(name,email)); 178 todoi->todo()->addAttendee(new Attendee(name,email));
179 } 179 }
180 } 180 }
181 } 181 }
182 else { 182 else {
183 qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable "); 183 qDebug("KOTodoListView::contentsDropEvent(): Todo from drop not decodable ");
184 e->ignore(); 184 e->ignore();
185 } 185 }
186 } 186 }
187#endif 187#endif
188} 188}
189 189
190void KOTodoListView::contentsMousePressEvent(QMouseEvent* e) 190void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
191{ 191{
192#ifndef KORG_NODND 192#ifndef KORG_NODND
193 QPoint p(contentsToViewport(e->pos())); 193 QPoint p(contentsToViewport(e->pos()));
194 QListViewItem *i = itemAt(p); 194 QListViewItem *i = itemAt(p);
195 mMousePressed = false; 195 mMousePressed = false;
196 if (i) { 196 if (i) {
197 // if the user clicked into the root decoration of the item, don't 197 // if the user clicked into the root decoration of the item, don't
198 // try to start a drag! 198 // try to start a drag!
199 if (p.x() > header()->sectionPos(header()->mapToIndex(0)) + 199 if (p.x() > header()->sectionPos(header()->mapToIndex(0)) +
200 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) + 200 treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
201 itemMargin() || 201 itemMargin() ||
202 p.x() < header()->sectionPos(header()->mapToIndex(0))) { 202 p.x() < header()->sectionPos(header()->mapToIndex(0))) {
203 if (e->button()==Qt::LeftButton) { 203 if (e->button()==Qt::LeftButton) {
204 mPressPos = e->pos(); 204 mPressPos = e->pos();
205 mMousePressed = true; 205 mMousePressed = true;
206 } 206 }
207 } 207 }
208 } 208 }
209#endif 209#endif
210 QListView::contentsMousePressEvent(e); 210 QListView::contentsMousePressEvent(e);
211} 211}
212 212
213void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e) 213void KOTodoListView::contentsMouseMoveEvent(QMouseEvent* e)
214{ 214{
215 215
216#ifndef KORG_NODND 216#ifndef KORG_NODND
217 QListView::contentsMouseMoveEvent(e); 217 QListView::contentsMouseMoveEvent(e);
218 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() > 218 if (mMousePressed && (mPressPos - e->pos()).manhattanLength() >
219 QApplication::startDragDistance()) { 219 QApplication::startDragDistance()) {
220 mMousePressed = false; 220 mMousePressed = false;
221 QListViewItem *item = itemAt(contentsToViewport(mPressPos)); 221 QListViewItem *item = itemAt(contentsToViewport(mPressPos));
222 if (item) { 222 if (item) {
223 DndFactory factory( mCalendar ); 223 DndFactory factory( mCalendar );
224 ICalDrag *vd = factory.createDrag( 224 ICalDrag *vd = factory.createDrag(
225 ((KOTodoViewItem *)item)->todo(),viewport()); 225 ((KOTodoViewItem *)item)->todo(),viewport());
226 internalDrop = false; 226 internalDrop = false;
227 // we cannot do any senseful here, because the DnD is still broken in Qt 227 // we cannot do any senseful here, because the DnD is still broken in Qt
228 if (vd->drag()) { 228 if (vd->drag()) {
229 if ( !internalDrop ) { 229 if ( !internalDrop ) {
230 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() ); 230 //emit deleteTodo( ((KOTodoViewItem *)item)->todo() );
231 qDebug("Dnd: External move: Delete drag source "); 231 qDebug("Dnd: External move: Delete drag source ");
232 } else 232 } else
233 qDebug("Dnd: Internal move "); 233 qDebug("Dnd: Internal move ");
234 234
235 } else { 235 } else {
236 if ( !internalDrop ) { 236 if ( !internalDrop ) {
237 qDebug("Dnd: External Copy"); 237 qDebug("Dnd: External Copy");
238 } else 238 } else
239 qDebug("DnD: Internal copy: Copy pending"); 239 qDebug("DnD: Internal copy: Copy pending");
240 } 240 }
241 } 241 }
242 } 242 }
243#endif 243#endif
244} 244}
245void KOTodoListView::keyPressEvent ( QKeyEvent * e ) 245void KOTodoListView::keyPressEvent ( QKeyEvent * e )
246{ 246{
247 247
248 QListViewItem* cn; 248 QListViewItem* cn;
249 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) { 249 if ( e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) {
250 cn = currentItem(); 250 cn = currentItem();
251 if ( cn ) { 251 if ( cn ) {
252 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 252 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
253 if ( ci ){ 253 if ( ci ){
254 if ( e->state() == ShiftButton ) 254 if ( e->state() == ShiftButton )
255 ci->setOn( false ); 255 ci->setOn( false );
256 else 256 else
257 ci->setOn( true ); 257 ci->setOn( true );
258 cn = cn->nextSibling(); 258 cn = cn->itemBelow();
259 if ( cn ) { 259 if ( cn ) {
260 setCurrentItem ( cn ); 260 setCurrentItem ( cn );
261 ensureItemVisible ( cn ); 261 ensureItemVisible ( cn );
262 } 262 }
263 263
264 } 264 }
265 } 265 }
266 266
267 return; 267 return;
268 } 268 }
269 269
270 // qDebug("KOTodoListView::keyPressEvent "); 270 // qDebug("KOTodoListView::keyPressEvent ");
271 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) { 271 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) {
272 switch ( e->key() ) { 272 switch ( e->key() ) {
273 case Qt::Key_Down: 273 case Qt::Key_Down:
274 case Qt::Key_Up: 274 case Qt::Key_Up:
275 QListView::keyPressEvent ( e ); 275 QListView::keyPressEvent ( e );
276 break; 276 break;
277 case Qt::Key_Left: 277 case Qt::Key_Left:
278 case Qt::Key_Right: 278 case Qt::Key_Right:
279 QListView::keyPressEvent ( e ); 279 QListView::keyPressEvent ( e );
280 e->accept(); 280 e->accept();
281 return; 281 return;
282 break; 282 break;
283 default: 283 default:
284 e->ignore(); 284 e->ignore();
285 break; 285 break;
286 } 286 }
287 return; 287 return;
288 } 288 }
289 e->ignore(); 289 e->ignore();
290} 290}
291void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) 291void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e)
292{ 292{
293 QListView::contentsMouseReleaseEvent(e); 293 QListView::contentsMouseReleaseEvent(e);
294 mMousePressed = false; 294 mMousePressed = false;
295} 295}
296 296
297void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 297void KOTodoListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
298{ 298{
299 if (!e) return; 299 if (!e) return;
300 300
301 QPoint vp = contentsToViewport(e->pos()); 301 QPoint vp = contentsToViewport(e->pos());
302 302
303 QListViewItem *item = itemAt(vp); 303 QListViewItem *item = itemAt(vp);
304 304
305 emit double_Clicked(item); 305 emit double_Clicked(item);
306 if (!item) return; 306 if (!item) return;
307 307
308 emit doubleClicked(item,vp,0); 308 emit doubleClicked(item,vp,0);
309} 309}
310 310
311///////////////////////////////////////////////////////////////////////////// 311/////////////////////////////////////////////////////////////////////////////
312 312
313KOQuickTodo::KOQuickTodo(QWidget *parent) : 313KOQuickTodo::KOQuickTodo(QWidget *parent) :
314 QLineEdit(parent) 314 QLineEdit(parent)
315{ 315{
316 setText(i18n("Click to add a new Todo")); 316 setText(i18n("Click to add a new Todo"));
317} 317}
318 318
319void KOQuickTodo::focusInEvent(QFocusEvent *ev) 319void KOQuickTodo::focusInEvent(QFocusEvent *ev)
320{ 320{
321 if ( text()==i18n("Click to add a new Todo") ) 321 if ( text()==i18n("Click to add a new Todo") )
322 setText(""); 322 setText("");
323 QLineEdit::focusInEvent(ev); 323 QLineEdit::focusInEvent(ev);
324} 324}
325 325
326void KOQuickTodo::focusOutEvent(QFocusEvent *ev) 326void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
327{ 327{
328 setText(i18n("Click to add a new Todo")); 328 setText(i18n("Click to add a new Todo"));
329 QLineEdit::focusOutEvent(ev); 329 QLineEdit::focusOutEvent(ev);
330} 330}
331 331
332///////////////////////////////////////////////////////////////////////////// 332/////////////////////////////////////////////////////////////////////////////
333 333
334KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 334KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
335 KOrg::BaseView(calendar,parent,name) 335 KOrg::BaseView(calendar,parent,name)
336{ 336{
337 isFlatDisplay = false; 337 isFlatDisplay = false;
338 mNavigator = 0; 338 mNavigator = 0;
339 QBoxLayout *topLayout = new QVBoxLayout(this); 339 QBoxLayout *topLayout = new QVBoxLayout(this);
340 mName = QString ( name ); 340 mName = QString ( name );
341 mBlockUpdate = false; 341 mBlockUpdate = false;
342 mQuickAdd = new KOQuickTodo(this); 342 mQuickAdd = new KOQuickTodo(this);
343 topLayout->addWidget(mQuickAdd); 343 topLayout->addWidget(mQuickAdd);
344 344
345 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); 345 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide();
346 346
347 mTodoListView = new KOTodoListView(calendar,this, name ); 347 mTodoListView = new KOTodoListView(calendar,this, name );
348 topLayout->addWidget(mTodoListView); 348 topLayout->addWidget(mTodoListView);
349 //mTodoListView->header()->setMaximumHeight(30); 349 //mTodoListView->header()->setMaximumHeight(30);
350 mTodoListView->setRootIsDecorated(true); 350 mTodoListView->setRootIsDecorated(true);
351 mTodoListView->setAllColumnsShowFocus(true); 351 mTodoListView->setAllColumnsShowFocus(true);
352 352
353 mTodoListView->setShowSortIndicator(true); 353 mTodoListView->setShowSortIndicator(true);
354 354