summaryrefslogtreecommitdiffabout
path: root/korganizer/kolistview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/kolistview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kolistview.cpp46
1 files changed, 7 insertions, 39 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 3519985..6b63d7f 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -287,49 +287,49 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
#ifndef DESKTOP_VERSION
mPopupMenu->insertSeparator();
mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
i18n("Beam selected via IR"),this,
SLOT(beamSelected()),true);
#endif
/*
mPopupMenu = new QPopupMenu;
mPopupMenu->insertItem(i18n("Edit Event"), this,
SLOT (editEvent()));
mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
SLOT (deleteEvent()));
mPopupMenu->insertSeparator();
mPopupMenu->insertItem(i18n("Show Dates"), this,
SLOT(showDates()));
mPopupMenu->insertItem(i18n("Hide Dates"), this,
SLOT(hideDates()));
*/
QObject::connect(mListView,SIGNAL( newEvent()),
this,SIGNAL(signalNewEvent()));
QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
this,SLOT(defaultItemAction(QListViewItem *)));
- QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *,
+ QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *,
const QPoint &, int )),
this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
SLOT(processSelectionChange(QListViewItem *)));
QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
SIGNAL(showIncidenceSignal(Incidence *)) );
readSettings(KOGlobals::config(),"KOListView Layout");
}
KOListView::~KOListView()
{
delete mPopupMenu;
}
QString KOListView::getWhatsThisText(QPoint p)
{
KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
if ( item )
return KIncidenceFormatter::instance()->getFormattedText( item->data(),
KOPrefs::instance()->mWTshowDetails,
KOPrefs::instance()->mWTshowCreated,
KOPrefs::instance()->mWTshowChanged);
return i18n("That is the list view" );
@@ -1138,90 +1138,58 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e)
if ( e->state() == ShiftButton )
ci->setSelected( false );
else
ci->setSelected( true );
cn = cn->nextSibling();
if ( cn ) {
setCurrentItem ( cn );
ensureItemVisible ( cn );
}
}
}
e->accept();
}
break;
default:
e->ignore();
}
}
KOListViewListView::KOListViewListView(KOListView * lv )
: KListView( lv )
{
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
#endif
- mYMousePos = -1000;
setSelectionMode( QListView::Multi );
setMultiSelection( true);
- mAllowPopupMenu = true;
- mMouseDown = false;
-
}
void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
{
if (!e) return;
QPoint vp = contentsToViewport(e->pos());
QListViewItem *item = itemAt(vp);
if (!item) {
emit newEvent();
return;
}
KListView::contentsMouseDoubleClickEvent(e);
}
-
void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
{
//qDebug("contentsMousePressEvent++++ ");
- if (! mMouseDown ) {
- mAllowPopupMenu = true;
- mYMousePos = mapToGlobal( (e->pos())).y();
- }
- if ( e->button() == RightButton && mMouseDown )
- return;
- if ( e->button() == LeftButton )
- mMouseDown = true;
KListView::contentsMousePressEvent( e );
+ if ( e->button() == RightButton ) {
+ QListViewItem* ci = currentItem();
+ clearSelection () ;
+ if ( ci )
+ ci->setSelected( true );
+ }
}
void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
{
- //qDebug("contentsMouseReleaseEv---- ");
- if ( ! mMouseDown ) {
- if ( e->button() == RightButton && ! mAllowPopupMenu )
- return;
- QListViewItem* ci = currentItem();
- if ( ci )
- ci->setSelected( true );
- KListView::contentsMouseReleaseEvent(e);
- return;
- }
- if ( e->button() == LeftButton )
- mMouseDown = false;
- if ( e->button() == RightButton && ! mAllowPopupMenu )
- return;
- if ( e->button() == RightButton ) {
- QListViewItem* ci = currentItem();
- if ( ci )
- ci->setSelected( true );
- }
KListView::contentsMouseReleaseEvent(e);
}
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 > 20 )
- mAllowPopupMenu = false;
KListView::contentsMouseMoveEvent(e);
}