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
@@ -263,97 +263,97 @@ KOListView::KOListView(Calendar *calendar, QWidget *parent,
263 SLOT(clearSelection()),true); 263 SLOT(clearSelection()),true);
264 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 264 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
265 i18n("Delete all selected"),this, 265 i18n("Delete all selected"),this,
266 SLOT(deleteAll()),true); 266 SLOT(deleteAll()),true);
267 mPopupMenu->insertSeparator(); 267 mPopupMenu->insertSeparator();
268 QPopupMenu * exportPO = new QPopupMenu ( this ); 268 QPopupMenu * exportPO = new QPopupMenu ( this );
269 mPopupMenu->insertItem( i18n("Export selected"), exportPO ); 269 mPopupMenu->insertItem( i18n("Export selected"), exportPO );
270 exportPO->insertItem( i18n("As iCal (ics) file..."),this, 270 exportPO->insertItem( i18n("As iCal (ics) file..."),this,
271 SLOT(saveToFile())); 271 SLOT(saveToFile()));
272 exportPO->insertItem( i18n("As vCal (vcs) file..."),this, 272 exportPO->insertItem( i18n("As vCal (vcs) file..."),this,
273 SLOT(saveToFileVCS())); 273 SLOT(saveToFileVCS()));
274 exportPO->insertItem( i18n("Journal/Details..."),this, 274 exportPO->insertItem( i18n("Journal/Details..."),this,
275 SLOT(saveDescriptionToFile())); 275 SLOT(saveDescriptionToFile()));
276 // mPopupMenu->insertSeparator(); 276 // mPopupMenu->insertSeparator();
277 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 277 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
278 i18n("Add Categ. to selected..."),this, 278 i18n("Add Categ. to selected..."),this,
279 SLOT(addCat()),true); 279 SLOT(addCat()),true);
280 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 280 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
281 i18n("Set Categ. for selected..."),this, 281 i18n("Set Categ. for selected..."),this,
282 SLOT(setCat()),true); 282 SLOT(setCat()),true);
283 //mPopupMenu->insertSeparator(); 283 //mPopupMenu->insertSeparator();
284 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 284 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
285 i18n("Set alarm for selected..."),this, 285 i18n("Set alarm for selected..."),this,
286 SLOT(setAlarm()),true); 286 SLOT(setAlarm()),true);
287 287
288 288
289#ifndef DESKTOP_VERSION 289#ifndef DESKTOP_VERSION
290 mPopupMenu->insertSeparator(); 290 mPopupMenu->insertSeparator();
291 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()), 291 mPopupMenu->addAdditionalItem(QIconSet(QPixmap()),
292 i18n("Beam selected via IR"),this, 292 i18n("Beam selected via IR"),this,
293 SLOT(beamSelected()),true); 293 SLOT(beamSelected()),true);
294#endif 294#endif
295 /* 295 /*
296 mPopupMenu = new QPopupMenu; 296 mPopupMenu = new QPopupMenu;
297 mPopupMenu->insertItem(i18n("Edit Event"), this, 297 mPopupMenu->insertItem(i18n("Edit Event"), this,
298 SLOT (editEvent())); 298 SLOT (editEvent()));
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{
324 delete mPopupMenu; 324 delete mPopupMenu;
325} 325}
326QString KOListView::getWhatsThisText(QPoint p) 326QString KOListView::getWhatsThisText(QPoint p)
327{ 327{
328 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p ); 328 KOListViewItem* item = ( KOListViewItem* ) mListView->itemAt( p );
329 if ( item ) 329 if ( item )
330 return KIncidenceFormatter::instance()->getFormattedText( item->data(), 330 return KIncidenceFormatter::instance()->getFormattedText( item->data(),
331 KOPrefs::instance()->mWTshowDetails, 331 KOPrefs::instance()->mWTshowDetails,
332 KOPrefs::instance()->mWTshowCreated, 332 KOPrefs::instance()->mWTshowCreated,
333 KOPrefs::instance()->mWTshowChanged); 333 KOPrefs::instance()->mWTshowChanged);
334 return i18n("That is the list view" ); 334 return i18n("That is the list view" );
335 335
336} 336}
337 337
338void KOListView::updateList() 338void KOListView::updateList()
339{ 339{
340 // qDebug(" KOListView::updateList() "); 340 // qDebug(" KOListView::updateList() ");
341 341
342} 342}
343 343
344void KOListView::addCat( ) 344void KOListView::addCat( )
345{ 345{
346 setCategories( false ); 346 setCategories( false );
347} 347}
348void KOListView::setCat() 348void KOListView::setCat()
349{ 349{
350 setCategories( true ); 350 setCategories( true );
351} 351}
352void KOListView::setAlarm() 352void KOListView::setAlarm()
353{ 353{
354 KOAlarmPrefs kap( this); 354 KOAlarmPrefs kap( this);
355 if ( !kap.exec() ) 355 if ( !kap.exec() )
356 return; 356 return;
357 357
358 358
359 QStringList itemList; 359 QStringList itemList;
@@ -1114,114 +1114,82 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e)
1114 cn = currentItem(); 1114 cn = currentItem();
1115 if ( cn ) { 1115 if ( cn ) {
1116 KOListViewItem* ci = (KOListViewItem*)( cn ); 1116 KOListViewItem* ci = (KOListViewItem*)( cn );
1117 if ( ci ){ 1117 if ( ci ){
1118 //emit showIncidence( ci->data()); 1118 //emit showIncidence( ci->data());
1119 cn = cn->nextSibling(); 1119 cn = cn->nextSibling();
1120 if ( cn ) { 1120 if ( cn ) {
1121 setCurrentItem ( cn ); 1121 setCurrentItem ( cn );
1122 ensureItemVisible ( cn ); 1122 ensureItemVisible ( cn );
1123 } 1123 }
1124 emit showIncidence( ci->data()); 1124 emit showIncidence( ci->data());
1125 } 1125 }
1126 } 1126 }
1127 e->accept(); 1127 e->accept();
1128 } 1128 }
1129 break; 1129 break;
1130 case Qt::Key_Return: 1130 case Qt::Key_Return:
1131 case Qt::Key_Enter: 1131 case Qt::Key_Enter:
1132 { 1132 {
1133 QListViewItem* cn; 1133 QListViewItem* cn;
1134 cn = currentItem(); 1134 cn = currentItem();
1135 if ( cn ) { 1135 if ( cn ) {
1136 KOListViewItem* ci = (KOListViewItem*)( cn ); 1136 KOListViewItem* ci = (KOListViewItem*)( cn );
1137 if ( ci ){ 1137 if ( ci ){
1138 if ( e->state() == ShiftButton ) 1138 if ( e->state() == ShiftButton )
1139 ci->setSelected( false ); 1139 ci->setSelected( false );
1140 else 1140 else
1141 ci->setSelected( true ); 1141 ci->setSelected( true );
1142 cn = cn->nextSibling(); 1142 cn = cn->nextSibling();
1143 if ( cn ) { 1143 if ( cn ) {
1144 setCurrentItem ( cn ); 1144 setCurrentItem ( cn );
1145 ensureItemVisible ( cn ); 1145 ensureItemVisible ( cn );
1146 } 1146 }
1147 } 1147 }
1148 } 1148 }
1149 e->accept(); 1149 e->accept();
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}