summaryrefslogtreecommitdiffabout
path: root/korganizer/kolistview.cpp
Unidiff
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
@@ -299,25 +299,25 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
299 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this, 299 mPopupMenu->insertItem(SmallIcon("delete"), i18n("Delete Event"), this,
300 SLOT (deleteEvent())); 300 SLOT (deleteEvent()));
301 mPopupMenu->insertSeparator(); 301 mPopupMenu->insertSeparator();
302 mPopupMenu->insertItem(i18n("Show Dates"), this, 302 mPopupMenu->insertItem(i18n("Show Dates"), this,
303 SLOT(showDates())); 303 SLOT(showDates()));
304 mPopupMenu->insertItem(i18n("Hide Dates"), this, 304 mPopupMenu->insertItem(i18n("Hide Dates"), this,
305 SLOT(hideDates())); 305 SLOT(hideDates()));
306 */ 306 */
307 QObject::connect(mListView,SIGNAL( newEvent()), 307 QObject::connect(mListView,SIGNAL( newEvent()),
308 this,SIGNAL(signalNewEvent())); 308 this,SIGNAL(signalNewEvent()));
309 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)), 309 QObject::connect(mListView,SIGNAL(doubleClicked(QListViewItem *)),
310 this,SLOT(defaultItemAction(QListViewItem *))); 310 this,SLOT(defaultItemAction(QListViewItem *)));
311 QObject::connect(mListView,SIGNAL(rightButtonClicked ( QListViewItem *, 311 QObject::connect(mListView,SIGNAL(rightButtonPressed( QListViewItem *,
312 const QPoint &, int )), 312 const QPoint &, int )),
313 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int))); 313 this,SLOT(popupMenu(QListViewItem *,const QPoint &,int)));
314 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)), 314 QObject::connect(mListView,SIGNAL(currentChanged(QListViewItem *)),
315 SLOT(processSelectionChange(QListViewItem *))); 315 SLOT(processSelectionChange(QListViewItem *)));
316 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)), 316 QObject::connect(mListView,SIGNAL(showIncidence(Incidence *)),
317 SIGNAL(showIncidenceSignal(Incidence *)) ); 317 SIGNAL(showIncidenceSignal(Incidence *)) );
318 318
319 readSettings(KOGlobals::config(),"KOListView Layout"); 319 readSettings(KOGlobals::config(),"KOListView Layout");
320} 320}
321 321
322KOListView::~KOListView() 322KOListView::~KOListView()
323{ 323{
@@ -1150,78 +1150,46 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e)
1150 } 1150 }
1151 break; 1151 break;
1152 default: 1152 default:
1153 e->ignore(); 1153 e->ignore();
1154 } 1154 }
1155} 1155}
1156KOListViewListView::KOListViewListView(KOListView * lv ) 1156KOListViewListView::KOListViewListView(KOListView * lv )
1157 : KListView( lv ) 1157 : KListView( lv )
1158{ 1158{
1159#ifndef DESKTOP_VERSION 1159#ifndef DESKTOP_VERSION
1160 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); 1160 QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold );
1161#endif 1161#endif
1162 mYMousePos = -1000;
1163 setSelectionMode( QListView::Multi ); 1162 setSelectionMode( QListView::Multi );
1164 setMultiSelection( true); 1163 setMultiSelection( true);
1165 mAllowPopupMenu = true;
1166 mMouseDown = false;
1167
1168} 1164}
1169void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) 1165void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e)
1170{ 1166{
1171 if (!e) return; 1167 if (!e) return;
1172 QPoint vp = contentsToViewport(e->pos()); 1168 QPoint vp = contentsToViewport(e->pos());
1173 QListViewItem *item = itemAt(vp); 1169 QListViewItem *item = itemAt(vp);
1174 if (!item) { 1170 if (!item) {
1175 emit newEvent(); 1171 emit newEvent();
1176 return; 1172 return;
1177 } 1173 }
1178 KListView::contentsMouseDoubleClickEvent(e); 1174 KListView::contentsMouseDoubleClickEvent(e);
1179} 1175}
1180 1176
1181
1182void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) 1177void KOListViewListView::contentsMousePressEvent(QMouseEvent *e)
1183{ 1178{
1184 //qDebug("contentsMousePressEvent++++ "); 1179 //qDebug("contentsMousePressEvent++++ ");
1185 if (! mMouseDown ) {
1186 mAllowPopupMenu = true;
1187 mYMousePos = mapToGlobal( (e->pos())).y();
1188 }
1189 if ( e->button() == RightButton && mMouseDown )
1190 return;
1191 if ( e->button() == LeftButton )
1192 mMouseDown = true;
1193 KListView::contentsMousePressEvent( e ); 1180 KListView::contentsMousePressEvent( e );
1181 if ( e->button() == RightButton ) {
1182 QListViewItem* ci = currentItem();
1183 clearSelection () ;
1184 if ( ci )
1185 ci->setSelected( true );
1186 }
1194} 1187}
1195void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) 1188void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e)
1196{ 1189{
1197 //qDebug("contentsMouseReleaseEv---- ");
1198 if ( ! mMouseDown ) {
1199 if ( e->button() == RightButton && ! mAllowPopupMenu )
1200 return;
1201 QListViewItem* ci = currentItem();
1202 if ( ci )
1203 ci->setSelected( true );
1204 KListView::contentsMouseReleaseEvent(e);
1205 return;
1206 }
1207 if ( e->button() == LeftButton )
1208 mMouseDown = false;
1209 if ( e->button() == RightButton && ! mAllowPopupMenu )
1210 return;
1211 if ( e->button() == RightButton ) {
1212 QListViewItem* ci = currentItem();
1213 if ( ci )
1214 ci->setSelected( true );
1215 }
1216 KListView::contentsMouseReleaseEvent(e); 1190 KListView::contentsMouseReleaseEvent(e);
1217} 1191}
1218void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) 1192void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e)
1219{ 1193{
1220 // qDebug("contentsMouseMoveEv....... ");
1221 // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() );
1222 int diff = mYMousePos - mapToGlobal( (e->pos())).y();
1223 if ( diff < 0 ) diff = -diff;
1224 if ( diff > 20 )
1225 mAllowPopupMenu = false;
1226 KListView::contentsMouseMoveEvent(e); 1194 KListView::contentsMouseMoveEvent(e);
1227} 1195}