summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-10 20:52:35 (UTC)
committer zautrix <zautrix>2004-10-10 20:52:35 (UTC)
commitad409bf71ce6c3733f9e5ae4e4aa38765329d7d8 (patch) (unidiff)
tree1e8b4286ed0d30499bfdb048fc4163caf05f69ce
parentee6e29a5092d32165b7bf6b39069bd8a1dcd5b0a (diff)
downloadkdepimpi-ad409bf71ce6c3733f9e5ae4e4aa38765329d7d8.zip
kdepimpi-ad409bf71ce6c3733f9e5ae4e4aa38765329d7d8.tar.gz
kdepimpi-ad409bf71ce6c3733f9e5ae4e4aa38765329d7d8.tar.bz2
todo list fixes
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp2
-rw-r--r--korganizer/kotodoview.cpp15
-rw-r--r--korganizer/kotodoview.h1
3 files changed, 11 insertions, 7 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 0c35bb3..1f2c6da 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -301,25 +301,25 @@ void CalendarView::init()
301 leftFrameLayout = new QHBoxLayout(leftFrame ); 301 leftFrameLayout = new QHBoxLayout(leftFrame );
302 } else { 302 } else {
303 mainBoxLayout = new QHBoxLayout(mainBox); 303 mainBoxLayout = new QHBoxLayout(mainBox);
304 leftFrameLayout = new QVBoxLayout(leftFrame ); 304 leftFrameLayout = new QVBoxLayout(leftFrame );
305 } 305 }
306 topLayout->addWidget( mainBox ); 306 topLayout->addWidget( mainBox );
307 mainBoxLayout->addWidget (leftFrame); 307 mainBoxLayout->addWidget (leftFrame);
308 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE, 308 mDateNavigator = new KDateNavigator(leftFrame, mCalendar, TRUE,
309 "CalendarView::DateNavigator", QDate::currentDate()); 309 "CalendarView::DateNavigator", QDate::currentDate());
310 // mDateNavigator->blockSignals( true ); 310 // mDateNavigator->blockSignals( true );
311 leftFrameLayout->addWidget( mDateNavigator ); 311 leftFrameLayout->addWidget( mDateNavigator );
312 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView"); 312 mFilterView = new KOFilterView(&mFilters,leftFrame,"CalendarView::FilterView");
313 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolist"); 313 mTodoList = new KOTodoView(mCalendar, leftFrame, "todolistsmall");
314 314
315 if ( QApplication::desktop()->width() < 480 ) { 315 if ( QApplication::desktop()->width() < 480 ) {
316 leftFrameLayout->addWidget(mFilterView); 316 leftFrameLayout->addWidget(mFilterView);
317 leftFrameLayout->addWidget(mTodoList, 2 ); 317 leftFrameLayout->addWidget(mTodoList, 2 );
318 318
319 } else { 319 } else {
320 leftFrameLayout->addWidget(mTodoList,2 ); 320 leftFrameLayout->addWidget(mTodoList,2 );
321 leftFrameLayout->addWidget(mFilterView ); 321 leftFrameLayout->addWidget(mFilterView );
322 } 322 }
323 mFilterView->hide(); 323 mFilterView->hide();
324 QWidget *rightBox = new QWidget( mainBox ); 324 QWidget *rightBox = new QWidget( mainBox );
325 mainBoxLayout->addWidget ( rightBox, 10 ); 325 mainBoxLayout->addWidget ( rightBox, 10 );
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index da46eca..ca5eadd 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -48,24 +48,25 @@
48#ifndef KORG_NOPRINTER 48#ifndef KORG_NOPRINTER
49#include "calprinter.h" 49#include "calprinter.h"
50#endif 50#endif
51#include "docprefs.h" 51#include "docprefs.h"
52 52
53#include "kotodoview.h" 53#include "kotodoview.h"
54using namespace KOrg; 54using namespace KOrg;
55 55
56KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent, 56KOTodoListView::KOTodoListView(Calendar *calendar,QWidget *parent,
57 const char *name) : 57 const char *name) :
58 KListView(parent,name) 58 KListView(parent,name)
59{ 59{
60 mName = QString ( name );
60 mCalendar = calendar; 61 mCalendar = calendar;
61#ifndef DESKTOP_VERSION 62#ifndef DESKTOP_VERSION
62 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 63 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
63#endif 64#endif
64 mOldCurrent = 0; 65 mOldCurrent = 0;
65 mMousePressed = false; 66 mMousePressed = false;
66 67
67 setAcceptDrops(true); 68 setAcceptDrops(true);
68 viewport()->setAcceptDrops(true); 69 viewport()->setAcceptDrops(true);
69 int size = 16; 70 int size = 16;
70 if (qApp->desktop()->width() < 300 ) 71 if (qApp->desktop()->width() < 300 )
71 size = 12; 72 size = 12;
@@ -255,30 +256,34 @@ void KOTodoListView::keyPressEvent ( QKeyEvent * e )
255 if ( cn ) { 256 if ( cn ) {
256 setCurrentItem ( cn ); 257 setCurrentItem ( cn );
257 ensureItemVisible ( cn ); 258 ensureItemVisible ( cn );
258 } 259 }
259 260
260 } 261 }
261 } 262 }
262 263
263 return; 264 return;
264 } 265 }
265 266
266 // qDebug("KOTodoListView::keyPressEvent "); 267 // qDebug("KOTodoListView::keyPressEvent ");
267 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || ( height() > 150 && width() > 200 ) ) { 268 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || mName != "todolistsmall" ) {
268 switch ( e->key() ) { 269 switch ( e->key() ) {
269 case Qt::Key_Down: 270 case Qt::Key_Down:
270 case Qt::Key_Up: 271 case Qt::Key_Up:
271 QListView::keyPressEvent ( e ); 272 QListView::keyPressEvent ( e );
272 break; 273 break;
274 case Qt::Key_Left:
275 case Qt::Key_Right:
276 QListView::keyPressEvent ( e );
277 break;
273 default: 278 default:
274 e->ignore(); 279 e->ignore();
275 break; 280 break;
276 } 281 }
277 return; 282 return;
278 } 283 }
279 e->ignore(); 284 e->ignore();
280} 285}
281void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e) 286void KOTodoListView::contentsMouseReleaseEvent(QMouseEvent *e)
282{ 287{
283 QListView::contentsMouseReleaseEvent(e); 288 QListView::contentsMouseReleaseEvent(e);
284 mMousePressed = false; 289 mMousePressed = false;
@@ -323,25 +328,25 @@ void KOQuickTodo::focusOutEvent(QFocusEvent *ev)
323 328
324KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : 329KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) :
325 KOrg::BaseView(calendar,parent,name) 330 KOrg::BaseView(calendar,parent,name)
326{ 331{
327 QBoxLayout *topLayout = new QVBoxLayout(this); 332 QBoxLayout *topLayout = new QVBoxLayout(this);
328 mName = QString ( name ); 333 mName = QString ( name );
329 mBlockUpdate = false; 334 mBlockUpdate = false;
330 mQuickAdd = new KOQuickTodo(this); 335 mQuickAdd = new KOQuickTodo(this);
331 topLayout->addWidget(mQuickAdd); 336 topLayout->addWidget(mQuickAdd);
332 337
333 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide(); 338 if ( !KOPrefs::instance()->mEnableQuickTodo ) mQuickAdd->hide();
334 339
335 mTodoListView = new KOTodoListView(calendar,this); 340 mTodoListView = new KOTodoListView(calendar,this, name );
336 topLayout->addWidget(mTodoListView); 341 topLayout->addWidget(mTodoListView);
337 //mTodoListView->header()->setMaximumHeight(30); 342 //mTodoListView->header()->setMaximumHeight(30);
338 mTodoListView->setRootIsDecorated(true); 343 mTodoListView->setRootIsDecorated(true);
339 mTodoListView->setAllColumnsShowFocus(true); 344 mTodoListView->setAllColumnsShowFocus(true);
340 345
341 mTodoListView->setShowSortIndicator(true); 346 mTodoListView->setShowSortIndicator(true);
342 347
343 mTodoListView->addColumn(i18n("Todo")); 348 mTodoListView->addColumn(i18n("Todo"));
344 mTodoListView->addColumn(i18n("Prio")); 349 mTodoListView->addColumn(i18n("Prio"));
345 mTodoListView->setColumnAlignment(1,AlignHCenter); 350 mTodoListView->setColumnAlignment(1,AlignHCenter);
346 mTodoListView->addColumn(i18n("Complete")); 351 mTodoListView->addColumn(i18n("Complete"));
347 mTodoListView->setColumnAlignment(2,AlignHCenter); 352 mTodoListView->setColumnAlignment(2,AlignHCenter);
@@ -962,39 +967,37 @@ void KOTodoView::addQuickTodo()
962 } 967 }
963 mCalendar->addTodo(todo); 968 mCalendar->addTodo(todo);
964 mQuickAdd->setText(""); 969 mQuickAdd->setText("");
965 todoModified (todo, KOGlobals::EVENTADDED ); 970 todoModified (todo, KOGlobals::EVENTADDED );
966 updateView(); 971 updateView();
967} 972}
968void KOTodoView::keyPressEvent ( QKeyEvent * e ) 973void KOTodoView::keyPressEvent ( QKeyEvent * e )
969{ 974{
970 // e->ignore(); 975 // e->ignore();
971 //return; 976 //return;
972 switch ( e->key() ) { 977 switch ( e->key() ) {
973 case Qt::Key_Down: 978 case Qt::Key_Down:
974 QWidget::keyPressEvent ( e );
975 break;
976
977 case Qt::Key_Up: 979 case Qt::Key_Up:
978 QWidget::keyPressEvent ( e ); 980 QWidget::keyPressEvent ( e );
979 break; 981 break;
982
980 case Qt::Key_Q: 983 case Qt::Key_Q:
981 toggleQuickTodo(); 984 toggleQuickTodo();
982 break; 985 break;
983 986
984 default: 987 default:
985 e->ignore(); 988 e->ignore();
986 } 989 }
987 990
988 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton || ( height() > 150 && width() > 200 ) ) { 991 if ( true ) {
989 if ( e->key() == Qt::Key_I ) { 992 if ( e->key() == Qt::Key_I ) {
990 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem(); 993 KOTodoViewItem*cn = (KOTodoViewItem*)mTodoListView->currentItem();
991 if ( cn ) { 994 if ( cn ) {
992 mActiveItem = cn; 995 mActiveItem = cn;
993 KOTodoViewItem* ci = (KOTodoViewItem*)( cn ); 996 KOTodoViewItem* ci = (KOTodoViewItem*)( cn );
994 if ( ci ){ 997 if ( ci ){
995 showTodo(); 998 showTodo();
996 cn = (KOTodoViewItem*)cn->itemBelow(); 999 cn = (KOTodoViewItem*)cn->itemBelow();
997 if ( cn ) { 1000 if ( cn ) {
998 mTodoListView->setCurrentItem ( cn ); 1001 mTodoListView->setCurrentItem ( cn );
999 mTodoListView->ensureItemVisible ( cn ); 1002 mTodoListView->ensureItemVisible ( cn );
1000 } 1003 }
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 4495702..6bf0203 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -65,24 +65,25 @@ class KOTodoListView : public KListView
65 protected: 65 protected:
66 void contentsDragEnterEvent(QDragEnterEvent *); 66 void contentsDragEnterEvent(QDragEnterEvent *);
67 void contentsDragMoveEvent(QDragMoveEvent *); 67 void contentsDragMoveEvent(QDragMoveEvent *);
68 void contentsDragLeaveEvent(QDragLeaveEvent *); 68 void contentsDragLeaveEvent(QDragLeaveEvent *);
69 void contentsDropEvent(QDropEvent *); 69 void contentsDropEvent(QDropEvent *);
70 70
71 void contentsMousePressEvent(QMouseEvent *); 71 void contentsMousePressEvent(QMouseEvent *);
72 void contentsMouseMoveEvent(QMouseEvent *); 72 void contentsMouseMoveEvent(QMouseEvent *);
73 void contentsMouseReleaseEvent(QMouseEvent *); 73 void contentsMouseReleaseEvent(QMouseEvent *);
74 void contentsMouseDoubleClickEvent(QMouseEvent *); 74 void contentsMouseDoubleClickEvent(QMouseEvent *);
75 75
76 private: 76 private:
77 QString mName;
77 Calendar *mCalendar; 78 Calendar *mCalendar;
78 QPoint mPressPos; 79 QPoint mPressPos;
79 bool mMousePressed; 80 bool mMousePressed;
80 QListViewItem *mOldCurrent; 81 QListViewItem *mOldCurrent;
81 void keyPressEvent ( QKeyEvent * ) ; 82 void keyPressEvent ( QKeyEvent * ) ;
82}; 83};
83 84
84 85
85/** 86/**
86 This is the line-edit on top of the todoview for fast addition of new todos 87 This is the line-edit on top of the todoview for fast addition of new todos
87*/ 88*/
88class KOQuickTodo : public QLineEdit 89class KOQuickTodo : public QLineEdit