summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-04-02 12:16:34 (UTC)
committer zautrix <zautrix>2005-04-02 12:16:34 (UTC)
commit997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe (patch) (side-by-side diff)
treef788b37459574b5cea0d2ab874882c6a396c240d /korganizer
parente0d51120d2f0c178115746e0c1357af40f95bc77 (diff)
downloadkdepimpi-997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe.zip
kdepimpi-997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe.tar.gz
kdepimpi-997e7660a81baa2b8aeb1b66a3cc3ebe54e00ebe.tar.bz2
more fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagenda.cpp57
-rw-r--r--korganizer/koagenda.h4
-rw-r--r--korganizer/koagendaview.cpp18
-rw-r--r--korganizer/koagendaview.h4
-rw-r--r--korganizer/kotodoview.cpp49
5 files changed, 97 insertions, 35 deletions
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp
index deadfc9..de964da 100644
--- a/korganizer/koagenda.cpp
+++ b/korganizer/koagenda.cpp
@@ -168,7 +168,7 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
QScrollView(parent,name,f)
{
-
+ mAllAgendaPopup = 0;
mColumns = columns;
mRows = rows;
mGridSpacingY = rowSize;
@@ -187,6 +187,7 @@ KOAgenda::KOAgenda(int columns,int rows,int rowSize,QWidget *parent,
KOAgenda::KOAgenda(int columns,QWidget *parent,const char *name,WFlags f) :
QScrollView(parent,name,f)
{
+ mAllAgendaPopup = 0;
blockResize = false;
mColumns = columns;
mRows = 1;
@@ -232,7 +233,7 @@ void KOAgenda::init()
pathString += "icons16/";
} else
pathString += "iconsmini/";
-
+
mNewItemPopup->insertItem ( SmallIcon( pathString +"newevent" ), i18n("New Event..."), 1 );
mNewItemPopup->insertItem ( SmallIcon( pathString +"newtodo" ), i18n("New Todo..."),2 );
mNewItemPopup->insertSeparator ( );
@@ -387,6 +388,8 @@ void KOAgenda::popupMenu()
mLeftMouseDown = false; // no more leftMouse computation
if (mPopupItem) {
selectItem(mPopupItem);
+ if ( mAllAgendaPopup )
+ mAllAgendaPopup->installEventFilter( this );
emit showIncidencePopupSignal(mPopupItem->incidence());
}
@@ -395,7 +398,9 @@ void KOAgenda::popupMenu()
endSelectAction( false ); // do not emit new event signal
mLeftMouseDown = false; // no more leftMouse computation
}
+ mNewItemPopup->installEventFilter( this );
mNewItemPopup->popup( mPopupPos);
+
}
mLeftMouseDown = false;
mPopupItem = 0;
@@ -404,17 +409,51 @@ void KOAgenda::popupMenu()
bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
{
- //qDebug("KOAgenda::eventFilter_mous ");
+ static int startX = 0;
+ static int startY = 0;
+ static int blockmoveDist = ( QApplication::desktop()->width() < 480 ? 15 : 20 );
+ static bool blockMoving = true;
+
+ //qDebug("KOAgenda::eventFilter_mous ");
+ if ( object == mNewItemPopup ) {
+ //qDebug("mNewItemPopup ");
+ if ( me->type() == QEvent::MouseButtonRelease ) {
+ mNewItemPopup->removeEventFilter( this );
+ int dX = me->globalPos().x() - mPopupPos.x();;
+ if ( dX < 0 )
+ dX = -dX;
+ int dY = me->globalPos().y() - mPopupPos.y();
+ if ( dY < 0 )
+ dY = -dY;
+ if ( dX > blockmoveDist || dY > blockmoveDist ) {
+ mNewItemPopup->hide();
+ }
+ }
+ return true;
+ }
+ if ( object == mAllAgendaPopup ) {
+ //qDebug(" mAllAgendaPopup ");
+ if ( me->type() == QEvent::MouseButtonRelease ) {
+ mAllAgendaPopup->removeEventFilter( this );
+ int dX = me->globalPos().x() - mPopupPos.x();;
+ if ( dX < 0 )
+ dX = -dX;
+ int dY = me->globalPos().y() - mPopupPos.y();
+ if ( dY < 0 )
+ dY = -dY;
+ if ( dX > blockmoveDist || dY > blockmoveDist ) {
+ mAllAgendaPopup->hide();
+ }
+ }
+ return true;
+ }
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;
+
switch (me->type()) {
case QEvent::MouseButtonPress:
if (me->button() == LeftButton) {
@@ -423,7 +462,8 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
}
blockMoving = true;
startX = viewportPos.x();
- startY = viewportPos.y();
+ startY = viewportPos.y();
+ mPopupPos = me->globalPos();
if (object != viewport()) {
mPopupItem = (KOAgendaItem *)object;
mPopupKind = 1;
@@ -455,7 +495,6 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me)
mPopupKind = 2;
selectItem(0);
mActionItem = 0;
- mPopupPos = viewport()->mapToGlobal( me->pos() );
if (me->button() == RightButton) {
int x,y;
viewportToContents(viewportPos.x(),viewportPos.y(),x,y);
diff --git a/korganizer/koagenda.h b/korganizer/koagenda.h
index 35c08b6..4f1fdb9 100644
--- a/korganizer/koagenda.h
+++ b/korganizer/koagenda.h
@@ -31,6 +31,7 @@
#include <qguardedptr.h>
#include "koagendaitem.h"
+#include "koeventview.h"
class QPopupMenu;
class QTime;
@@ -123,7 +124,7 @@ class KOAgenda : public QScrollView
void printSelection();
void storePosition();
void restorePosition();
-
+ void setPopup( KOEventPopupMenu * p ) { mAllAgendaPopup = p; }
public slots:
void popupMenu();
@@ -168,6 +169,7 @@ class KOAgenda : public QScrollView
void resizedSignal();
protected:
+ KOEventPopupMenu * mAllAgendaPopup;
QPainter mPixPainter;
QPixmap mPaintPixmap;
QPixmap mHighlightPixmap;
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index 8d32152..95388ef 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -505,9 +505,7 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
QLabel *dummyAllDayRight = new QLabel (mAllDayFrame);
// Create event context menu for all day agenda
- mAllDayAgendaPopup = eventPopup();
- connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
- mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
+ //mAllDayAgendaPopup = eventPopup();
// Create agenda frame
QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3);
@@ -544,16 +542,20 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) :
agendaLayout->setColStretch(1,1);
mAgenda->setFocusPolicy(NoFocus);
// Create event context menu for agenda
- mAgendaPopup = eventPopup();
+ mAllAgendaPopup = eventPopup();
- mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")),
+ mAllAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")),
i18n("Toggle Alarm"),mAgenda,
SLOT(popupAlarm()),true);
connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
- mAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
+ mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
+ connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)),
+ mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *)));
+ mAgenda->setPopup( mAllAgendaPopup );
+ mAllDayAgenda->setPopup( mAllAgendaPopup );
// make connections between dependent widgets
mTimeLabels->setAgenda(mAgenda);
@@ -667,8 +669,8 @@ void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld )
KOAgendaView::~KOAgendaView()
{
- delete mAgendaPopup;
- delete mAllDayAgendaPopup;
+ delete mAllAgendaPopup;
+ //delete mAllDayAgendaPopup;
delete KOAgendaItem::paintPix();
delete KOAgendaItem::paintPixSel();
}
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index 30c9b05..c6e6602 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -271,8 +271,8 @@ class KOAgendaView : public KOEventView {
bool mWeekStartsMonday;
int mStartHour;
- KOEventPopupMenu *mAgendaPopup;
- KOEventPopupMenu *mAllDayAgendaPopup;
+ KOEventPopupMenu *mAllAgendaPopup;
+ //KOEventPopupMenu *mAllDayAgendaPopup;
EventIndicator *mEventIndicatorTop;
EventIndicator *mEventIndicatorBottom;
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index ccc4b01..0a315cb 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -207,25 +207,36 @@ void KOTodoListView::contentsDropEvent(QDropEvent *e)
void KOTodoListView::contentsMousePressEvent(QMouseEvent* e)
{
+
+ QPoint p(contentsToViewport(e->pos()));
+ QListViewItem *i = itemAt(p);
+ bool rootClicked = true;
+ if (i) {
+ // if the user clicked into the root decoration of the item, don't
+ // try to start a drag!
+ int X = p.x();
+ //qDebug("%d %d %d", X, header()->sectionPos(0), treeStepSize() );
+ if (X > header()->sectionPos(0) +
+ treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
+ itemMargin() ||
+ X < header()->sectionPos(0)) {
+ rootClicked = false;
+ }
+ }
#ifndef KORG_NODND
- QPoint p(contentsToViewport(e->pos()));
- QListViewItem *i = itemAt(p);
- mMousePressed = false;
- if (i) {
- // if the user clicked into the root decoration of the item, don't
- // try to start a drag!
- if (p.x() > header()->sectionPos(header()->mapToIndex(0)) +
- treeStepSize() * (i->depth() + (rootIsDecorated() ? 1 : 0)) +
- itemMargin() ||
- p.x() < header()->sectionPos(header()->mapToIndex(0))) {
- if (e->button()==Qt::LeftButton) {
+ mMousePressed = false;
+ if (! rootClicked ) {
mPressPos = e->pos();
mMousePressed = true;
- }
}
- }
#endif
- QListView::contentsMousePressEvent(e);
+ //qDebug("KOTodoListView::contentsMousePressEvent %d", rootClicked);
+#ifndef DESKTOP_VERSION
+ if (!( e->button() == RightButton && rootClicked) )
+ QListView::contentsMousePressEvent(e);
+#else
+ QListView::contentsMousePressEvent(e);
+#endif
}
void KOTodoListView::paintEvent(QPaintEvent* e)
{
@@ -1063,9 +1074,17 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item)
topLevelWidget()->setCaption(i18n("Reparenting aborted!"));
}
pendingSubtodo = 0;
+ int row = mTodoListView->header()->sectionAt ( mTodoListView->header()->mapFromGlobal( QCursor::pos()).x() );
+ //qDebug("ROW %d ", row);
if (!item) {
newTodo();
return;
+ } else {
+ if ( row == 1 ) {
+ mActiveItem = (KOTodoViewItem *) item;
+ newSubTodo();
+ return;
+ }
}
if ( KOPrefs::instance()->mEditOnDoubleClick )
editItem( item );
@@ -1074,7 +1093,7 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item)
}
void KOTodoView::itemClicked(QListViewItem *item)
{
-
+ //qDebug("KOTodoView::itemClicked %d", item);
if (!item) {
if ( pendingSubtodo != 0 ) {
topLevelWidget()->setCaption(i18n("Reparenting aborted!"));