author | zautrix <zautrix> | 2005-03-26 11:03:22 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-26 11:03:22 (UTC) |
commit | ef825f1805452ba2cfb30cd7a41c392d3961f01e (patch) (side-by-side diff) | |
tree | 60e896e2867bf3d90f0719f72c50add28bcf1d04 | |
parent | 6427570041c902840fe0f557415a07bb7aa8c031 (diff) | |
download | kdepimpi-ef825f1805452ba2cfb30cd7a41c392d3961f01e.zip kdepimpi-ef825f1805452ba2cfb30cd7a41c392d3961f01e.tar.gz kdepimpi-ef825f1805452ba2cfb30cd7a41c392d3961f01e.tar.bz2 |
next rry
-rw-r--r-- | bin/kdepim/WhatsNew.txt | 2 | ||||
-rw-r--r-- | korganizer/koagenda.cpp | 191 | ||||
-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 | 53 | ||||
-rw-r--r-- | korganizer/kolistview.h | 7 | ||||
-rw-r--r-- | microkde/kdeui/klistview.cpp | 3 | ||||
-rw-r--r-- | microkde/kdeui/klistview.h | 2 |
10 files changed, 261 insertions, 20 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 @@ -13,2 +13,4 @@ Made first datenavigator repainting faster. Changed the title of the event/todo edit dialogs. +Timelabels in agenga changed from 22:00 to 22 oo. ( the oo higher, of course). +Please report, if there are layout problems with the new timelabels. diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 66ad4ec..14f52b8 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -72,3 +72,2 @@ MarcusBains::MarcusBains(KOAgenda *_agenda,const char *name) minutes->start(0, true); - mTimeBox = new QLabel(this); @@ -177,3 +176,3 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent, #ifndef DESKTOP_VERSION - QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); + //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); #endif @@ -197,3 +196,3 @@ KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) : #ifndef DESKTOP_VERSION - QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); + //QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); #endif @@ -224,2 +223,5 @@ void KOAgenda::init() { + mPopupTimer = new QTimer(this); + connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); + mNewItemPopup = new QPopupMenu( this ); @@ -314,2 +316,4 @@ void KOAgenda::init() } + mPopupKind = 0; + mPopupItem = 0; } @@ -384,3 +388,26 @@ bool KOAgenda::eventFilter ( QObject *object, QEvent *event ) } +void KOAgenda::popupMenu() +{ + mPopupTimer->stop(); + if ( mPopupKind == 1 ) { + if (mActionItem ) { + endItemAction(); + } + mLeftMouseDown = false; // no more leftMouse computation + if (mPopupItem) { + selectItem(mPopupItem); + emit showIncidencePopupSignal(mPopupItem->incidence()); + } + } else if ( mPopupKind == 2 ) { + if ( mLeftMouseDown ) { // we have a simulated right click - clear left mouse action + endSelectAction( false ); // do not emit new event signal + mLeftMouseDown = false; // no more leftMouse computation + } + mNewItemPopup->popup( mPopupPos); + } + mLeftMouseDown = false; + mPopupItem = 0; + mPopupKind = 0; +} @@ -399,2 +426,159 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) static bool blockMoving = true; + switch (me->type()) { + case QEvent::MouseButtonPress: + if (me->button() == LeftButton) { + mPopupTimer->start( 600 ); + mLeftMouseDown = true; + } + blockMoving = true; + startX = viewportPos.x(); + startY = viewportPos.y(); + if (object != viewport()) { + mPopupItem = (KOAgendaItem *)object; + mPopupKind = 1; + if (me->button() == RightButton) { + popupMenu(); + } else if (me->button() == LeftButton) { + mActionItem = (KOAgendaItem *)object; + if (mActionItem) { + if ( mSelectionHeight > 0 ) { + int selectionCellX = mSelectionCellX * mGridSpacingX; + int selectionYTop = mSelectionYTop; + int gridSpacingX = mGridSpacingX; + int selectionHeight = mSelectionHeight; + clearSelection(); + repaintContents( selectionCellX, selectionYTop, + gridSpacingX, selectionHeight,false ); + } + selectItem(mActionItem); + Incidence *incidence = mActionItem->incidence(); + if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { + mActionItem = 0; + } else { + startItemAction(viewportPos); + } + } + } + } else { // ---------- viewport() + mPopupItem = 0; + mPopupKind = 2; + selectItem(0); + mActionItem = 0; + mPopupPos = viewport()->mapToGlobal( me->pos() ); + if (me->button() == RightButton) { + popupMenu(); + } else if (me->button() == LeftButton) { + setCursor(arrowCursor); + startSelectAction(viewportPos); + } + } + break; + + case QEvent::MouseButtonRelease: + if (me->button() == LeftButton ) { + mPopupTimer->stop(); + } + if (object != viewport()) { + if (me->button() == LeftButton && mLeftMouseDown) { + if (mActionItem) { + QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); + //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); + if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { + mScrollUpTimer.stop(); + mScrollDownTimer.stop(); + mActionItem->resetMove(); + placeSubCells( mActionItem ); + // emit startDragSignal( mActionItem->incidence() ); + setCursor( arrowCursor ); + mActionItem = 0; + mActionType = NOP; + mItemMoved = 0; + mLeftMouseDown = false; + return true; + } + endItemAction(); + } + } + + } else { // ---------- viewport() + if (me->button() == LeftButton && mLeftMouseDown ) { //left click + endSelectAction( true ); // emit new event signal + } + } + if (me->button() == LeftButton) + mLeftMouseDown = false; + + break; + + case QEvent::MouseMove: + if ( !mLeftMouseDown ) + return true; + if ( blockMoving ) { + int dX, dY; + dX = startX - viewportPos.x(); + if ( dX < 0 ) + dX = -dX; + dY = viewportPos.y() - startY; + if ( dY < 0 ) + dY = -dY; + //qDebug("%d %d %d ", dX, dY , blockmoveDist ); + if ( dX > blockmoveDist || dY > blockmoveDist ) { + blockMoving = false; + } + } + if ( ! blockMoving ) + mPopupTimer->stop(); + if (object != viewport()) { + KOAgendaItem *moveItem = (KOAgendaItem *)object; + if (!moveItem->incidence()->isReadOnly() ) { + if (!mActionItem) + setNoActionCursor(moveItem,viewportPos); + else { + if ( !blockMoving ) + performItemAction(viewportPos); + } + } + } else { // ---------- viewport() + mPopupPos = viewport()->mapToGlobal( me->pos() ); + if ( mActionType == SELECT ) { + performSelectAction( viewportPos ); + } + } + break; + + case QEvent::MouseButtonDblClick: + mPopupTimer->stop(); + if (object == viewport()) { + selectItem(0); + int x,y; + viewportToContents(viewportPos.x(),viewportPos.y(),x,y); + int gx,gy; + contentsToGrid(x,y,gx,gy); + emit newEventSignal(gx,gy); + } else { + KOAgendaItem *doubleClickedItem = (KOAgendaItem *)object; + selectItem(doubleClickedItem); + if ( KOPrefs::instance()->mEditOnDoubleClick ) + emit editIncidenceSignal(doubleClickedItem->incidence()); + else + emit showIncidenceSignal(doubleClickedItem->incidence()); + } + break; + + default: + break; + } + return true; +#if 0 + //qDebug("KOAgenda::eventFilter_mous "); + QPoint viewportPos; + if (object != viewport()) { + viewportPos = ((QWidget *)object)->mapToParent(me->pos()); + } else { + viewportPos = me->pos(); + } + static int startX = 0; + static int startY = 0; + static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 ); + static bool blockMoving = true; static bool leftMouseDown = false; @@ -561,2 +745,3 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) return true; +#endif } diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h index f3f1772..3d33ae5 100644 --- a/korganizer/koagenda.h +++ b/korganizer/koagenda.h @@ -128,2 +128,3 @@ class KOAgenda : public QScrollView public slots: + void popupMenu(); void newItem( int ); @@ -216,2 +217,7 @@ class KOAgenda : public QScrollView bool blockResize; + bool mLeftMouseDown; + KOAgendaItem *mPopupItem; + QTimer* mPopupTimer; + int mPopupKind; + QPoint mPopupPos; QTimer mResizeTimer; diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 905c1bf..b30ad75 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -77,3 +77,3 @@ KOAgendaItem::KOAgendaItem(Incidence *incidence, QDate qd, QWidget *parent,bool #ifndef DESKTOP_VERSION - QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); + //QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); #endif diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 957ac52..b9c7dec 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -131,3 +131,3 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) timeHeight -= (timeHeight/4-2); - int borderWidth = 5; + int borderWidth = 2; QFont nFont = p->font(); @@ -181,11 +181,3 @@ int TimeLabels::minimumWidth() const { - QFontMetrics fm = fontMetrics(); - - //TODO: calculate this value - int borderWidth = 4; - - // the maximum width possible - int width = fm.width("88:88x") + borderWidth; - - return width; + return mMiniWidth; } @@ -199,3 +191,3 @@ void TimeLabels::updateConfig() setFont(KOPrefs::instance()->mTimeBarFont); - + mMiniWidth = fontMetrics().width("88:88") + 2 ; // update geometry restrictions based on new settings diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index 8b8bac0..0cb9310 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h @@ -103,2 +103,3 @@ class TimeLabels : public QScrollView { private: + int mMiniWidth; int mMouseDownY; diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 6b63d7f..09d70f1 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -1156,6 +1156,8 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e) KOListViewListView::KOListViewListView(KOListView * lv ) - : KListView( lv ) + : KListView( lv, "kolistlistview", false ) { + mPopupTimer = new QTimer(this); + connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); #ifndef DESKTOP_VERSION - QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); + //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); #endif @@ -1175,3 +1177,30 @@ void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) } - +#if 0 +void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) +{ + //qDebug("contentsMousePressEvent++++ "); + KListView::contentsMousePressEvent( e ); + if ( e->button() == RightButton ) { + QListViewItem* ci = currentItem(); + clearSelection () ; + if ( ci ) + ci->setSelected( true ); + } +} +void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) +{ + KListView::contentsMouseReleaseEvent(e); +} +void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) +{ + KListView::contentsMouseMoveEvent(e); +} +#endif +void KOListViewListView::popupMenu() +{ + mPopupTimer->stop(); + //qDebug("HUUUUUUUUUUUUUUUUUUUU "); + QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); + QApplication::postEvent( this->viewport(), e ); +} void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) @@ -1179,2 +1208,8 @@ void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) //qDebug("contentsMousePressEvent++++ "); + mYMousePos = mapToGlobal( (e->pos())).y(); + if ( e->button() == LeftButton ) { + mPopupTimer->start( 600 ); + mEventPos = e->pos(); + mEventGlobalPos = e->globalPos(); + } KListView::contentsMousePressEvent( e ); @@ -1189,2 +1224,3 @@ void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) { + mPopupTimer->stop(); KListView::contentsMouseReleaseEvent(e); @@ -1193,3 +1229,14 @@ void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) { + // qDebug("contentsMouseMoveEv....... "); + // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); + int diff = mYMousePos - mapToGlobal( (e->pos())).y(); + if ( diff < 0 ) diff = -diff; + if ( diff > 15 ) + mPopupTimer->stop(); + else { + mEventPos = e->pos(); + mEventGlobalPos = e->globalPos(); + } KListView::contentsMouseMoveEvent(e); } + diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index eca71e2..bb0e23e 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h @@ -49,2 +49,3 @@ using namespace KCal; #include <qdialog.h> +#include <qtimer.h> #include <qcombobox.h> @@ -219,3 +220,9 @@ class KOListViewListView : public KListView void showIncidence( Incidence* ); + public slots: + void popupMenu(); private: + QPoint mEventPos; + QPoint mEventGlobalPos; + QTimer* mPopupTimer; + int mYMousePos; void keyPressEvent ( QKeyEvent * ) ; 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 @@ -407,3 +407,3 @@ void KListViewLineEdit::slotSelectionChanged() -KListView::KListView( QWidget *parent, const char *name ) +KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse ) : QListView( parent, name ), @@ -412,2 +412,3 @@ KListView::KListView( QWidget *parent, const char *name ) #ifndef DESKTOP_VERSION + if ( emulateRightMouse ) QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 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 @@ -125,3 +125,3 @@ public: */ - KListView (QWidget *parent = 0, const char *name = 0); + KListView (QWidget *parent = 0, const char *name = 0, bool emulateRightMouse = true ); |