summaryrefslogtreecommitdiffabout
path: root/microkde
authorzautrix <zautrix>2004-10-16 13:36:11 (UTC)
committer zautrix <zautrix>2004-10-16 13:36:11 (UTC)
commitc3325ebbb92a2814fcb622caaf71316cfa0c2908 (patch) (unidiff)
treeb53545c39f84fc6ce694f371509b4a9fe2ddd743 /microkde
parent023b3c542a6dd4d1c4b53dba6bb2c68f605a7917 (diff)
downloadkdepimpi-c3325ebbb92a2814fcb622caaf71316cfa0c2908.zip
kdepimpi-c3325ebbb92a2814fcb622caaf71316cfa0c2908.tar.gz
kdepimpi-c3325ebbb92a2814fcb622caaf71316cfa0c2908.tar.bz2
made todos reparentable
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/klistview.cpp7
-rw-r--r--microkde/kdeui/klistview.h1
2 files changed, 5 insertions, 3 deletions
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp
index 2856f2d..6477d11 100644
--- a/microkde/kdeui/klistview.cpp
+++ b/microkde/kdeui/klistview.cpp
@@ -1122,1070 +1122,1071 @@ QListViewItem* KListView::lastChild () const
1122 QListViewItem* lastchild = firstChild(); 1122 QListViewItem* lastchild = firstChild();
1123 1123
1124 if (lastchild) 1124 if (lastchild)
1125 for (; lastchild->nextSibling(); lastchild = lastchild->nextSibling()); 1125 for (; lastchild->nextSibling(); lastchild = lastchild->nextSibling());
1126 1126
1127 return lastchild; 1127 return lastchild;
1128} 1128}
1129 1129
1130QListViewItem *KListView::lastItem() const 1130QListViewItem *KListView::lastItem() const
1131{ 1131{
1132 QListViewItem* last = lastChild(); 1132 QListViewItem* last = lastChild();
1133 1133
1134 for (QListViewItemIterator it (last); it.current(); ++it) 1134 for (QListViewItemIterator it (last); it.current(); ++it)
1135 last = it.current(); 1135 last = it.current();
1136 1136
1137 return last; 1137 return last;
1138} 1138}
1139 1139
1140KLineEdit *KListView::renameLineEdit() const 1140KLineEdit *KListView::renameLineEdit() const
1141{ 1141{
1142//US return d->editor; 1142//US return d->editor;
1143qDebug("KListView::renameLineEdit returns 0. Might crash"); 1143qDebug("KListView::renameLineEdit returns 0. Might crash");
1144return 0; 1144return 0;
1145} 1145}
1146 1146
1147void KListView::startDrag() 1147void KListView::startDrag()
1148{ 1148{
1149qDebug("KListView::startDrag drag&drop not supported yet."); 1149qDebug("KListView::startDrag drag&drop not supported yet.");
1150/*US 1150/*US
1151 QDragObject *drag = dragObject(); 1151 QDragObject *drag = dragObject();
1152 1152
1153 if (!drag) 1153 if (!drag)
1154 return; 1154 return;
1155 1155
1156 if (drag->drag() && drag->target() != viewport()) 1156 if (drag->drag() && drag->target() != viewport())
1157 emit moved(); 1157 emit moved();
1158*/ 1158*/
1159} 1159}
1160 1160
1161QDragObject *KListView::dragObject() 1161QDragObject *KListView::dragObject()
1162{ 1162{
1163 if (!currentItem()) 1163 if (!currentItem())
1164 return 0; 1164 return 0;
1165 1165
1166 return new QStoredDrag("application/x-qlistviewitem", viewport()); 1166 return new QStoredDrag("application/x-qlistviewitem", viewport());
1167} 1167}
1168 1168
1169void KListView::setItemsMovable(bool b) 1169void KListView::setItemsMovable(bool b)
1170{ 1170{
1171 d->itemsMovable=b; 1171 d->itemsMovable=b;
1172} 1172}
1173 1173
1174bool KListView::itemsMovable() const 1174bool KListView::itemsMovable() const
1175{ 1175{
1176 return d->itemsMovable; 1176 return d->itemsMovable;
1177} 1177}
1178 1178
1179void KListView::setItemsRenameable(bool b) 1179void KListView::setItemsRenameable(bool b)
1180{ 1180{
1181 d->itemsRenameable=b; 1181 d->itemsRenameable=b;
1182} 1182}
1183 1183
1184bool KListView::itemsRenameable() const 1184bool KListView::itemsRenameable() const
1185{ 1185{
1186 return d->itemsRenameable; 1186 return d->itemsRenameable;
1187} 1187}
1188 1188
1189 1189
1190void KListView::setDragEnabled(bool b) 1190void KListView::setDragEnabled(bool b)
1191{ 1191{
1192 d->dragEnabled=b; 1192 d->dragEnabled=b;
1193} 1193}
1194 1194
1195bool KListView::dragEnabled() const 1195bool KListView::dragEnabled() const
1196{ 1196{
1197 return d->dragEnabled; 1197 return d->dragEnabled;
1198} 1198}
1199 1199
1200void KListView::setAutoOpen(bool b) 1200void KListView::setAutoOpen(bool b)
1201{ 1201{
1202 d->autoOpen=b; 1202 d->autoOpen=b;
1203} 1203}
1204 1204
1205bool KListView::autoOpen() const 1205bool KListView::autoOpen() const
1206{ 1206{
1207 return d->autoOpen; 1207 return d->autoOpen;
1208} 1208}
1209 1209
1210bool KListView::dropVisualizer() const 1210bool KListView::dropVisualizer() const
1211{ 1211{
1212 return d->dropVisualizer; 1212 return d->dropVisualizer;
1213} 1213}
1214 1214
1215void KListView::setDropVisualizer(bool b) 1215void KListView::setDropVisualizer(bool b)
1216{ 1216{
1217 d->dropVisualizer=b; 1217 d->dropVisualizer=b;
1218} 1218}
1219 1219
1220QPtrList<QListViewItem> KListView::selectedItems() const 1220QPtrList<QListViewItem> KListView::selectedItems() const
1221{ 1221{
1222 QPtrList<QListViewItem> list; 1222 QPtrList<QListViewItem> list;
1223 for (QListViewItem *i=firstChild(); i!=0; i=i->itemBelow()) 1223 for (QListViewItem *i=firstChild(); i!=0; i=i->itemBelow())
1224 if (i->isSelected()) list.append(i); 1224 if (i->isSelected()) list.append(i);
1225 return list; 1225 return list;
1226} 1226}
1227 1227
1228 1228
1229void KListView::moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after) 1229void KListView::moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after)
1230{ 1230{
1231 // sanity check - don't move a item into it's own child structure 1231 // sanity check - don't move a item into it's own child structure
1232 QListViewItem *i = parent; 1232 QListViewItem *i = parent;
1233 while(i) 1233 while(i)
1234 { 1234 {
1235 if(i == item) 1235 if(i == item)
1236 return; 1236 return;
1237 i = i->parent(); 1237 i = i->parent();
1238 } 1238 }
1239 1239
1240 // Basically reimplementing the QListViewItem(QListViewItem*, QListViewItem*) constructor 1240 // Basically reimplementing the QListViewItem(QListViewItem*, QListViewItem*) constructor
1241 // in here, without ever deleting the item. 1241 // in here, without ever deleting the item.
1242 if (item->parent()) 1242 if (item->parent())
1243 item->parent()->takeItem(item); 1243 item->parent()->takeItem(item);
1244 else 1244 else
1245 takeItem(item); 1245 takeItem(item);
1246 1246
1247 if (parent) 1247 if (parent)
1248 parent->insertItem(item); 1248 parent->insertItem(item);
1249 else 1249 else
1250 insertItem(item); 1250 insertItem(item);
1251 1251
1252 if (after) 1252 if (after)
1253 ;//item->moveToJustAfter(after); 1253 ;//item->moveToJustAfter(after);
1254} 1254}
1255 1255
1256void KListView::contentsDragEnterEvent(QDragEnterEvent *event) 1256void KListView::contentsDragEnterEvent(QDragEnterEvent *event)
1257{ 1257{
1258qDebug("KListView::contentsDragEnterEvent drag&drop not supported yet."); 1258qDebug("KListView::contentsDragEnterEvent drag&drop not supported yet.");
1259/*US 1259/*US
1260 if (acceptDrag (event)) 1260 if (acceptDrag (event))
1261 event->accept(); 1261 event->accept();
1262*/ 1262*/
1263} 1263}
1264 1264
1265void KListView::setDropVisualizerWidth (int w) 1265void KListView::setDropVisualizerWidth (int w)
1266{ 1266{
1267 d->mDropVisualizerWidth = w > 0 ? w : 1; 1267 d->mDropVisualizerWidth = w > 0 ? w : 1;
1268} 1268}
1269 1269
1270QRect KListView::drawDropVisualizer(QPainter *p, QListViewItem *parent, 1270QRect KListView::drawDropVisualizer(QPainter *p, QListViewItem *parent,
1271 QListViewItem *after) 1271 QListViewItem *after)
1272{ 1272{
1273 QRect insertmarker; 1273 QRect insertmarker;
1274 1274
1275 if (!after && !parent) 1275 if (!after && !parent)
1276 insertmarker = QRect (0, 0, viewport()->width(), d->mDropVisualizerWidth/2); 1276 insertmarker = QRect (0, 0, viewport()->width(), d->mDropVisualizerWidth/2);
1277 else 1277 else
1278 { 1278 {
1279 int level = 0; 1279 int level = 0;
1280 if (after) 1280 if (after)
1281 { 1281 {
1282 QListViewItem* it = 0L; 1282 QListViewItem* it = 0L;
1283 if (after->isOpen()) 1283 if (after->isOpen())
1284 { 1284 {
1285 // Look for the last child (recursively) 1285 // Look for the last child (recursively)
1286 it = after->firstChild(); 1286 it = after->firstChild();
1287 if (it) 1287 if (it)
1288 while (it->nextSibling() || it->firstChild()) 1288 while (it->nextSibling() || it->firstChild())
1289 if ( it->nextSibling() ) 1289 if ( it->nextSibling() )
1290 it = it->nextSibling(); 1290 it = it->nextSibling();
1291 else 1291 else
1292 it = it->firstChild(); 1292 it = it->firstChild();
1293 } 1293 }
1294 1294
1295 insertmarker = itemRect (it ? it : after); 1295 insertmarker = itemRect (it ? it : after);
1296 level = after->depth(); 1296 level = after->depth();
1297 } 1297 }
1298 else if (parent) 1298 else if (parent)
1299 { 1299 {
1300 insertmarker = itemRect (parent); 1300 insertmarker = itemRect (parent);
1301 level = parent->depth() + 1; 1301 level = parent->depth() + 1;
1302 } 1302 }
1303 insertmarker.setLeft( treeStepSize() * ( level + (rootIsDecorated() ? 1 : 0) ) + itemMargin() ); 1303 insertmarker.setLeft( treeStepSize() * ( level + (rootIsDecorated() ? 1 : 0) ) + itemMargin() );
1304 insertmarker.setRight (viewport()->width()); 1304 insertmarker.setRight (viewport()->width());
1305 insertmarker.setTop (insertmarker.bottom() - d->mDropVisualizerWidth/2 + 1); 1305 insertmarker.setTop (insertmarker.bottom() - d->mDropVisualizerWidth/2 + 1);
1306 insertmarker.setBottom (insertmarker.bottom() + d->mDropVisualizerWidth/2); 1306 insertmarker.setBottom (insertmarker.bottom() + d->mDropVisualizerWidth/2);
1307 } 1307 }
1308 1308
1309 // This is not used anymore, at least by KListView itself (see viewportPaintEvent) 1309 // This is not used anymore, at least by KListView itself (see viewportPaintEvent)
1310 // Remove for KDE 3.0. 1310 // Remove for KDE 3.0.
1311 if (p) 1311 if (p)
1312 p->fillRect(insertmarker, Dense4Pattern); 1312 p->fillRect(insertmarker, Dense4Pattern);
1313 1313
1314 return insertmarker; 1314 return insertmarker;
1315} 1315}
1316 1316
1317QRect KListView::drawItemHighlighter(QPainter *painter, QListViewItem *item) 1317QRect KListView::drawItemHighlighter(QPainter *painter, QListViewItem *item)
1318{ 1318{
1319 QRect r; 1319 QRect r;
1320 1320
1321 if (item) 1321 if (item)
1322 { 1322 {
1323 r = itemRect(item); 1323 r = itemRect(item);
1324 r.setLeft(r.left()+(item->depth()+1)*treeStepSize()); 1324 r.setLeft(r.left()+(item->depth()+1)*treeStepSize());
1325 if (painter) { 1325 if (painter) {
1326//US style().drawPrimitive(QStyle::PE_FocusRect, painter, r, colorGroup(), 1326//US style().drawPrimitive(QStyle::PE_FocusRect, painter, r, colorGroup(),
1327//US QStyle::Style_FocusAtBorder, colorGroup().highlight()); 1327//US QStyle::Style_FocusAtBorder, colorGroup().highlight());
1328 const QColor* pHighl = &(colorGroup().highlight()); 1328 const QColor* pHighl = &(colorGroup().highlight());
1329 //LR style().drawFocusRect(painter, r, colorGroup(), pHighl, true); 1329 //LR style().drawFocusRect(painter, r, colorGroup(), pHighl, true);
1330 1330
1331qDebug("KListView::drawItemHighlighter has to be verified"); 1331qDebug("KListView::drawItemHighlighter has to be verified");
1332 1332
1333 } 1333 }
1334 1334
1335 } 1335 }
1336 1336
1337 return r; 1337 return r;
1338} 1338}
1339 1339
1340void KListView::cleanItemHighlighter () 1340void KListView::cleanItemHighlighter ()
1341{ 1341{
1342 if (d->mOldDropHighlighter.isValid()) 1342 if (d->mOldDropHighlighter.isValid())
1343 { 1343 {
1344 QRect rect=d->mOldDropHighlighter; 1344 QRect rect=d->mOldDropHighlighter;
1345 d->mOldDropHighlighter = QRect(); 1345 d->mOldDropHighlighter = QRect();
1346 viewport()->repaint(rect, true); 1346 viewport()->repaint(rect, true);
1347 } 1347 }
1348} 1348}
1349 1349
1350void KListView::rename(QListViewItem *item, int c) 1350void KListView::rename(QListViewItem *item, int c)
1351{ 1351{
1352 if (d->renameable.contains(c)) 1352 if (d->renameable.contains(c))
1353 { 1353 {
1354 ensureItemVisible(item); 1354 ensureItemVisible(item);
1355//US d->editor->load(item,c); 1355//US d->editor->load(item,c);
1356qDebug("KListView::rename has to be verified"); 1356qDebug("KListView::rename has to be verified");
1357 1357
1358 } 1358 }
1359} 1359}
1360 1360
1361bool KListView::isRenameable (int col) const 1361bool KListView::isRenameable (int col) const
1362{ 1362{
1363 return d->renameable.contains(col); 1363 return d->renameable.contains(col);
1364} 1364}
1365 1365
1366void KListView::setRenameable (int col, bool yesno) 1366void KListView::setRenameable (int col, bool yesno)
1367{ 1367{
1368 if (col>=header()->count()) return; 1368 if (col>=header()->count()) return;
1369 1369
1370 d->renameable.remove(col); 1370 d->renameable.remove(col);
1371 if (yesno && d->renameable.find(col)==d->renameable.end()) 1371 if (yesno && d->renameable.find(col)==d->renameable.end())
1372 d->renameable+=col; 1372 d->renameable+=col;
1373 else if (!yesno && d->renameable.find(col)!=d->renameable.end()) 1373 else if (!yesno && d->renameable.find(col)!=d->renameable.end())
1374 d->renameable.remove(col); 1374 d->renameable.remove(col);
1375} 1375}
1376 1376
1377void KListView::doneEditing(QListViewItem *item, int row) 1377void KListView::doneEditing(QListViewItem *item, int row)
1378{ 1378{
1379 emit itemRenamed(item, item->text(row), row); 1379 emit itemRenamed(item, item->text(row), row);
1380 emit itemRenamed(item); 1380 emit itemRenamed(item);
1381} 1381}
1382 1382
1383bool KListView::acceptDrag(QDropEvent* e) const 1383bool KListView::acceptDrag(QDropEvent* e) const
1384{ 1384{
1385qDebug("KListView::acceptDrag drag&drop not supported yet"); 1385qDebug("KListView::acceptDrag drag&drop not supported yet");
1386//US return acceptDrops() && itemsMovable() && (e->source()==viewport()); 1386//US return acceptDrops() && itemsMovable() && (e->source()==viewport());
1387return false; 1387return false;
1388} 1388}
1389 1389
1390void KListView::setCreateChildren(bool b) 1390void KListView::setCreateChildren(bool b)
1391{ 1391{
1392 d->createChildren=b; 1392 d->createChildren=b;
1393} 1393}
1394 1394
1395bool KListView::createChildren() const 1395bool KListView::createChildren() const
1396{ 1396{
1397 return d->createChildren; 1397 return d->createChildren;
1398} 1398}
1399 1399
1400 1400
1401int KListView::tooltipColumn() const 1401int KListView::tooltipColumn() const
1402{ 1402{
1403 return d->tooltipColumn; 1403 return d->tooltipColumn;
1404} 1404}
1405 1405
1406void KListView::setTooltipColumn(int column) 1406void KListView::setTooltipColumn(int column)
1407{ 1407{
1408 d->tooltipColumn=column; 1408 d->tooltipColumn=column;
1409} 1409}
1410 1410
1411void KListView::setDropHighlighter(bool b) 1411void KListView::setDropHighlighter(bool b)
1412{ 1412{
1413 d->dropHighlighter=b; 1413 d->dropHighlighter=b;
1414} 1414}
1415 1415
1416bool KListView::dropHighlighter() const 1416bool KListView::dropHighlighter() const
1417{ 1417{
1418 return d->dropHighlighter; 1418 return d->dropHighlighter;
1419} 1419}
1420 1420
1421bool KListView::showTooltip(QListViewItem *item, const QPoint &, int column) const 1421bool KListView::showTooltip(QListViewItem *item, const QPoint &, int column) const
1422{ 1422{
1423 return ((tooltip(item, column).length()>0) && (column==tooltipColumn())); 1423 return ((tooltip(item, column).length()>0) && (column==tooltipColumn()));
1424} 1424}
1425 1425
1426QString KListView::tooltip(QListViewItem *item, int column) const 1426QString KListView::tooltip(QListViewItem *item, int column) const
1427{ 1427{
1428 return item->text(column); 1428 return item->text(column);
1429} 1429}
1430 1430
1431void KListView::setTabOrderedRenaming(bool b) 1431void KListView::setTabOrderedRenaming(bool b)
1432{ 1432{
1433 d->tabRename = b; 1433 d->tabRename = b;
1434} 1434}
1435 1435
1436bool KListView::tabOrderedRenaming() const 1436bool KListView::tabOrderedRenaming() const
1437{ 1437{
1438 return d->tabRename; 1438 return d->tabRename;
1439} 1439}
1440 1440
1441void KListView::keyPressEvent (QKeyEvent* e) 1441void KListView::keyPressEvent (QKeyEvent* e)
1442{ 1442{
1443 //don't we need a contextMenuModifier too ? (aleXXX) 1443 //don't we need a contextMenuModifier too ? (aleXXX)
1444 if (e->key() == d->contextMenuKey) 1444 if (e->key() == d->contextMenuKey)
1445 { 1445 {
1446 emit menuShortCutPressed (this, currentItem()); 1446 emit menuShortCutPressed (this, currentItem());
1447 return; 1447 return;
1448 } 1448 }
1449 if (e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace) 1449 if (e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace)
1450 { 1450 {
1451 emit signalDelete ( ); 1451 emit signalDelete ( );
1452 return; 1452 return;
1453 } 1453 }
1454 1454
1455 if (d->selectionMode != FileManager) 1455 if (d->selectionMode != FileManager)
1456 QListView::keyPressEvent (e); 1456 QListView::keyPressEvent (e);
1457 else 1457 else
1458 fileManagerKeyPressEvent (e); 1458 fileManagerKeyPressEvent (e);
1459} 1459}
1460 1460
1461void KListView::activateAutomaticSelection() 1461void KListView::activateAutomaticSelection()
1462{ 1462{
1463 d->selectedBySimpleMove=true; 1463 d->selectedBySimpleMove=true;
1464 d->selectedUsingMouse=false; 1464 d->selectedUsingMouse=false;
1465 if (currentItem()!=0) 1465 if (currentItem()!=0)
1466 { 1466 {
1467 selectAll(false); 1467 selectAll(false);
1468 currentItem()->setSelected(true); 1468 currentItem()->setSelected(true);
1469 currentItem()->repaint(); 1469 currentItem()->repaint();
1470 emit selectionChanged(); 1470 emit selectionChanged();
1471 }; 1471 };
1472} 1472}
1473 1473
1474void KListView::deactivateAutomaticSelection() 1474void KListView::deactivateAutomaticSelection()
1475{ 1475{
1476 d->selectedBySimpleMove=false; 1476 d->selectedBySimpleMove=false;
1477} 1477}
1478 1478
1479bool KListView::automaticSelection() const 1479bool KListView::automaticSelection() const
1480{ 1480{
1481 return d->selectedBySimpleMove; 1481 return d->selectedBySimpleMove;
1482} 1482}
1483 1483
1484void KListView::fileManagerKeyPressEvent (QKeyEvent* e) 1484void KListView::fileManagerKeyPressEvent (QKeyEvent* e)
1485{ 1485{
1486 //don't care whether it's on the keypad or not 1486 //don't care whether it's on the keypad or not
1487 int e_state=(e->state() & ~Keypad); 1487 int e_state=(e->state() & ~Keypad);
1488 1488
1489 int oldSelectionDirection(d->selectionDirection); 1489 int oldSelectionDirection(d->selectionDirection);
1490 1490
1491 if ((e->key()!=Key_Shift) && (e->key()!=Key_Control) 1491 if ((e->key()!=Key_Shift) && (e->key()!=Key_Control)
1492 && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)) 1492 && (e->key()!=Key_Meta) && (e->key()!=Key_Alt))
1493 { 1493 {
1494 if ((e_state==ShiftButton) && (!d->wasShiftEvent) && (!d->selectedBySimpleMove)) 1494 if ((e_state==ShiftButton) && (!d->wasShiftEvent) && (!d->selectedBySimpleMove))
1495 selectAll(FALSE); 1495 selectAll(FALSE);
1496 d->selectionDirection=0; 1496 d->selectionDirection=0;
1497 d->wasShiftEvent = (e_state == ShiftButton); 1497 d->wasShiftEvent = (e_state == ShiftButton);
1498 }; 1498 };
1499 1499
1500 //d->wasShiftEvent = (e_state == ShiftButton); 1500 //d->wasShiftEvent = (e_state == ShiftButton);
1501 1501
1502 1502
1503 QListViewItem* item = currentItem(); 1503 QListViewItem* item = currentItem();
1504 if (item==0) return; 1504 if (item==0) return;
1505 1505
1506 QListViewItem* repaintItem1 = item; 1506 QListViewItem* repaintItem1 = item;
1507 QListViewItem* repaintItem2 = 0L; 1507 QListViewItem* repaintItem2 = 0L;
1508 QListViewItem* visItem = 0L; 1508 QListViewItem* visItem = 0L;
1509 1509
1510 QListViewItem* nextItem = 0L; 1510 QListViewItem* nextItem = 0L;
1511 int items = 0; 1511 int items = 0;
1512 1512
1513 bool shiftOrCtrl((e_state==ControlButton) || (e_state==ShiftButton)); 1513 bool shiftOrCtrl((e_state==ControlButton) || (e_state==ShiftButton));
1514 int selectedItems(0); 1514 int selectedItems(0);
1515 for (QListViewItem *tmpItem=firstChild(); tmpItem!=0; tmpItem=tmpItem->nextSibling()) 1515 for (QListViewItem *tmpItem=firstChild(); tmpItem!=0; tmpItem=tmpItem->nextSibling())
1516 if (tmpItem->isSelected()) selectedItems++; 1516 if (tmpItem->isSelected()) selectedItems++;
1517 1517
1518 if (((selectedItems==0) || ((selectedItems==1) && (d->selectedUsingMouse))) 1518 if (((selectedItems==0) || ((selectedItems==1) && (d->selectedUsingMouse)))
1519 && (e_state==NoButton) 1519 && (e_state==NoButton)
1520 && ((e->key()==Key_Down) 1520 && ((e->key()==Key_Down)
1521 || (e->key()==Key_Up) 1521 || (e->key()==Key_Up)
1522 || (e->key()==Key_Next) 1522 || (e->key()==Key_Next)
1523 || (e->key()==Key_Prior) 1523 || (e->key()==Key_Prior)
1524 || (e->key()==Key_Home) 1524 || (e->key()==Key_Home)
1525 || (e->key()==Key_End))) 1525 || (e->key()==Key_End)))
1526 { 1526 {
1527 d->selectedBySimpleMove=true; 1527 d->selectedBySimpleMove=true;
1528 d->selectedUsingMouse=false; 1528 d->selectedUsingMouse=false;
1529 } 1529 }
1530 else if (selectedItems>1) 1530 else if (selectedItems>1)
1531 d->selectedBySimpleMove=false; 1531 d->selectedBySimpleMove=false;
1532 1532
1533 bool emitSelectionChanged(false); 1533 bool emitSelectionChanged(false);
1534 1534
1535 switch (e->key()) 1535 switch (e->key())
1536 { 1536 {
1537 case Key_Escape: 1537 case Key_Escape:
1538 selectAll(FALSE); 1538 selectAll(FALSE);
1539 emitSelectionChanged=TRUE; 1539 emitSelectionChanged=TRUE;
1540 break; 1540 break;
1541 1541
1542 case Key_Space: 1542 case Key_Space:
1543 //toggle selection of current item 1543 //toggle selection of current item
1544 if (d->selectedBySimpleMove) 1544 if (d->selectedBySimpleMove)
1545 d->selectedBySimpleMove=false; 1545 d->selectedBySimpleMove=false;
1546 item->setSelected(!item->isSelected()); 1546 item->setSelected(!item->isSelected());
1547 emitSelectionChanged=TRUE; 1547 emitSelectionChanged=TRUE;
1548 break; 1548 break;
1549 1549
1550 case Key_Insert: 1550 case Key_Insert:
1551 //toggle selection of current item and move to the next item 1551 //toggle selection of current item and move to the next item
1552 if (d->selectedBySimpleMove) 1552 if (d->selectedBySimpleMove)
1553 { 1553 {
1554 d->selectedBySimpleMove=false; 1554 d->selectedBySimpleMove=false;
1555 if (!item->isSelected()) item->setSelected(TRUE); 1555 if (!item->isSelected()) item->setSelected(TRUE);
1556 } 1556 }
1557 else 1557 else
1558 { 1558 {
1559 item->setSelected(!item->isSelected()); 1559 item->setSelected(!item->isSelected());
1560 }; 1560 };
1561 1561
1562 nextItem=item->itemBelow(); 1562 nextItem=item->itemBelow();
1563 1563
1564 if (nextItem!=0) 1564 if (nextItem!=0)
1565 { 1565 {
1566 repaintItem2=nextItem; 1566 repaintItem2=nextItem;
1567 visItem=nextItem; 1567 visItem=nextItem;
1568 setCurrentItem(nextItem); 1568 setCurrentItem(nextItem);
1569 }; 1569 };
1570 d->selectionDirection=1; 1570 d->selectionDirection=1;
1571 emitSelectionChanged=TRUE; 1571 emitSelectionChanged=TRUE;
1572 break; 1572 break;
1573 1573
1574 case Key_Down: 1574 case Key_Down:
1575 nextItem=item->itemBelow(); 1575 nextItem=item->itemBelow();
1576 //toggle selection of current item and move to the next item 1576 //toggle selection of current item and move to the next item
1577 if (shiftOrCtrl) 1577 if (shiftOrCtrl)
1578 { 1578 {
1579 d->selectionDirection=1; 1579 d->selectionDirection=1;
1580 if (d->selectedBySimpleMove) 1580 if (d->selectedBySimpleMove)
1581 d->selectedBySimpleMove=false; 1581 d->selectedBySimpleMove=false;
1582 else 1582 else
1583 { 1583 {
1584 if (oldSelectionDirection!=-1) 1584 if (oldSelectionDirection!=-1)
1585 { 1585 {
1586 item->setSelected(!item->isSelected()); 1586 item->setSelected(!item->isSelected());
1587 emitSelectionChanged=TRUE; 1587 emitSelectionChanged=TRUE;
1588 }; 1588 };
1589 }; 1589 };
1590 } 1590 }
1591 else if ((d->selectedBySimpleMove) && (nextItem!=0)) 1591 else if ((d->selectedBySimpleMove) && (nextItem!=0))
1592 { 1592 {
1593 item->setSelected(false); 1593 item->setSelected(false);
1594 emitSelectionChanged=TRUE; 1594 emitSelectionChanged=TRUE;
1595 }; 1595 };
1596 1596
1597 if (nextItem!=0) 1597 if (nextItem!=0)
1598 { 1598 {
1599 if (d->selectedBySimpleMove) 1599 if (d->selectedBySimpleMove)
1600 nextItem->setSelected(true); 1600 nextItem->setSelected(true);
1601 repaintItem2=nextItem; 1601 repaintItem2=nextItem;
1602 visItem=nextItem; 1602 visItem=nextItem;
1603 setCurrentItem(nextItem); 1603 setCurrentItem(nextItem);
1604 }; 1604 };
1605 break; 1605 break;
1606 1606
1607 case Key_Up: 1607 case Key_Up:
1608 nextItem=item->itemAbove(); 1608 nextItem=item->itemAbove();
1609 d->selectionDirection=-1; 1609 d->selectionDirection=-1;
1610 //move to the prev. item and toggle selection of this one 1610 //move to the prev. item and toggle selection of this one
1611 // => No, can't select the last item, with this. For symmetry, let's 1611 // => No, can't select the last item, with this. For symmetry, let's
1612 // toggle selection and THEN move up, just like we do in down (David) 1612 // toggle selection and THEN move up, just like we do in down (David)
1613 if (shiftOrCtrl) 1613 if (shiftOrCtrl)
1614 { 1614 {
1615 if (d->selectedBySimpleMove) 1615 if (d->selectedBySimpleMove)
1616 d->selectedBySimpleMove=false; 1616 d->selectedBySimpleMove=false;
1617 else 1617 else
1618 { 1618 {
1619 if (oldSelectionDirection!=1) 1619 if (oldSelectionDirection!=1)
1620 { 1620 {
1621 item->setSelected(!item->isSelected()); 1621 item->setSelected(!item->isSelected());
1622 emitSelectionChanged=TRUE; 1622 emitSelectionChanged=TRUE;
1623 }; 1623 };
1624 } 1624 }
1625 } 1625 }
1626 else if ((d->selectedBySimpleMove) && (nextItem!=0)) 1626 else if ((d->selectedBySimpleMove) && (nextItem!=0))
1627 { 1627 {
1628 item->setSelected(false); 1628 item->setSelected(false);
1629 emitSelectionChanged=TRUE; 1629 emitSelectionChanged=TRUE;
1630 }; 1630 };
1631 1631
1632 if (nextItem!=0) 1632 if (nextItem!=0)
1633 { 1633 {
1634 if (d->selectedBySimpleMove) 1634 if (d->selectedBySimpleMove)
1635 nextItem->setSelected(true); 1635 nextItem->setSelected(true);
1636 repaintItem2=nextItem; 1636 repaintItem2=nextItem;
1637 visItem=nextItem; 1637 visItem=nextItem;
1638 setCurrentItem(nextItem); 1638 setCurrentItem(nextItem);
1639 }; 1639 };
1640 break; 1640 break;
1641 1641
1642 case Key_End: 1642 case Key_End:
1643 //move to the last item and toggle selection of all items inbetween 1643 //move to the last item and toggle selection of all items inbetween
1644 nextItem=item; 1644 nextItem=item;
1645 if (d->selectedBySimpleMove) 1645 if (d->selectedBySimpleMove)
1646 item->setSelected(false); 1646 item->setSelected(false);
1647 if (shiftOrCtrl) 1647 if (shiftOrCtrl)
1648 d->selectedBySimpleMove=false; 1648 d->selectedBySimpleMove=false;
1649 1649
1650 while(nextItem!=0) 1650 while(nextItem!=0)
1651 { 1651 {
1652 if (shiftOrCtrl) 1652 if (shiftOrCtrl)
1653 nextItem->setSelected(!nextItem->isSelected()); 1653 nextItem->setSelected(!nextItem->isSelected());
1654 if (nextItem->itemBelow()==0) 1654 if (nextItem->itemBelow()==0)
1655 { 1655 {
1656 if (d->selectedBySimpleMove) 1656 if (d->selectedBySimpleMove)
1657 nextItem->setSelected(true); 1657 nextItem->setSelected(true);
1658 repaintItem2=nextItem; 1658 repaintItem2=nextItem;
1659 visItem=nextItem; 1659 visItem=nextItem;
1660 setCurrentItem(nextItem); 1660 setCurrentItem(nextItem);
1661 } 1661 }
1662 nextItem=nextItem->itemBelow(); 1662 nextItem=nextItem->itemBelow();
1663 } 1663 }
1664 emitSelectionChanged=TRUE; 1664 emitSelectionChanged=TRUE;
1665 break; 1665 break;
1666 1666
1667 case Key_Home: 1667 case Key_Home:
1668 // move to the first item and toggle selection of all items inbetween 1668 // move to the first item and toggle selection of all items inbetween
1669 nextItem = firstChild(); 1669 nextItem = firstChild();
1670 visItem = nextItem; 1670 visItem = nextItem;
1671 repaintItem2 = visItem; 1671 repaintItem2 = visItem;
1672 if (d->selectedBySimpleMove) 1672 if (d->selectedBySimpleMove)
1673 item->setSelected(false); 1673 item->setSelected(false);
1674 if (shiftOrCtrl) 1674 if (shiftOrCtrl)
1675 { 1675 {
1676 d->selectedBySimpleMove=false; 1676 d->selectedBySimpleMove=false;
1677 1677
1678 while ( nextItem != item ) 1678 while ( nextItem != item )
1679 { 1679 {
1680 nextItem->setSelected( !nextItem->isSelected() ); 1680 nextItem->setSelected( !nextItem->isSelected() );
1681 nextItem = nextItem->itemBelow(); 1681 nextItem = nextItem->itemBelow();
1682 } 1682 }
1683 item->setSelected( !item->isSelected() ); 1683 item->setSelected( !item->isSelected() );
1684 } 1684 }
1685 setCurrentItem( firstChild() ); 1685 setCurrentItem( firstChild() );
1686 emitSelectionChanged=TRUE; 1686 emitSelectionChanged=TRUE;
1687 break; 1687 break;
1688 1688
1689 case Key_Next: 1689 case Key_Next:
1690 items=visibleHeight()/item->height(); 1690 items=visibleHeight()/item->height();
1691 nextItem=item; 1691 nextItem=item;
1692 if (d->selectedBySimpleMove) 1692 if (d->selectedBySimpleMove)
1693 item->setSelected(false); 1693 item->setSelected(false);
1694 if (shiftOrCtrl) 1694 if (shiftOrCtrl)
1695 { 1695 {
1696 d->selectedBySimpleMove=false; 1696 d->selectedBySimpleMove=false;
1697 d->selectionDirection=1; 1697 d->selectionDirection=1;
1698 }; 1698 };
1699 1699
1700 for (int i=0; i<items; i++) 1700 for (int i=0; i<items; i++)
1701 { 1701 {
1702 if (shiftOrCtrl) 1702 if (shiftOrCtrl)
1703 nextItem->setSelected(!nextItem->isSelected()); 1703 nextItem->setSelected(!nextItem->isSelected());
1704 //the end 1704 //the end
1705 if ((i==items-1) || (nextItem->itemBelow()==0)) 1705 if ((i==items-1) || (nextItem->itemBelow()==0))
1706 1706
1707 { 1707 {
1708 if (shiftOrCtrl) 1708 if (shiftOrCtrl)
1709 nextItem->setSelected(!nextItem->isSelected()); 1709 nextItem->setSelected(!nextItem->isSelected());
1710 if (d->selectedBySimpleMove) 1710 if (d->selectedBySimpleMove)
1711 nextItem->setSelected(true); 1711 nextItem->setSelected(true);
1712 ensureItemVisible(nextItem); 1712 ensureItemVisible(nextItem);
1713 setCurrentItem(nextItem); 1713 setCurrentItem(nextItem);
1714 update(); 1714 update();
1715 if ((shiftOrCtrl) || (d->selectedBySimpleMove)) 1715 if ((shiftOrCtrl) || (d->selectedBySimpleMove))
1716 { 1716 {
1717 emit selectionChanged(); 1717 emit selectionChanged();
1718 } 1718 }
1719 return; 1719 return;
1720 } 1720 }
1721 nextItem=nextItem->itemBelow(); 1721 nextItem=nextItem->itemBelow();
1722 } 1722 }
1723 break; 1723 break;
1724 1724
1725 case Key_Prior: 1725 case Key_Prior:
1726 items=visibleHeight()/item->height(); 1726 items=visibleHeight()/item->height();
1727 nextItem=item; 1727 nextItem=item;
1728 if (d->selectedBySimpleMove) 1728 if (d->selectedBySimpleMove)
1729 item->setSelected(false); 1729 item->setSelected(false);
1730 if (shiftOrCtrl) 1730 if (shiftOrCtrl)
1731 { 1731 {
1732 d->selectionDirection=-1; 1732 d->selectionDirection=-1;
1733 d->selectedBySimpleMove=false; 1733 d->selectedBySimpleMove=false;
1734 }; 1734 };
1735 1735
1736 for (int i=0; i<items; i++) 1736 for (int i=0; i<items; i++)
1737 { 1737 {
1738 if ((nextItem!=item) &&(shiftOrCtrl)) 1738 if ((nextItem!=item) &&(shiftOrCtrl))
1739 nextItem->setSelected(!nextItem->isSelected()); 1739 nextItem->setSelected(!nextItem->isSelected());
1740 //the end 1740 //the end
1741 if ((i==items-1) || (nextItem->itemAbove()==0)) 1741 if ((i==items-1) || (nextItem->itemAbove()==0))
1742 1742
1743 { 1743 {
1744 if (d->selectedBySimpleMove) 1744 if (d->selectedBySimpleMove)
1745 nextItem->setSelected(true); 1745 nextItem->setSelected(true);
1746 ensureItemVisible(nextItem); 1746 ensureItemVisible(nextItem);
1747 setCurrentItem(nextItem); 1747 setCurrentItem(nextItem);
1748 update(); 1748 update();
1749 if ((shiftOrCtrl) || (d->selectedBySimpleMove)) 1749 if ((shiftOrCtrl) || (d->selectedBySimpleMove))
1750 { 1750 {
1751 emit selectionChanged(); 1751 emit selectionChanged();
1752 } 1752 }
1753 return; 1753 return;
1754 } 1754 }
1755 nextItem=nextItem->itemAbove(); 1755 nextItem=nextItem->itemAbove();
1756 } 1756 }
1757 break; 1757 break;
1758 1758
1759 case Key_Minus: 1759 case Key_Minus:
1760 if ( item->isOpen() ) 1760 if ( item->isOpen() )
1761 setOpen( item, FALSE ); 1761 setOpen( item, FALSE );
1762 break; 1762 break;
1763 case Key_Plus: 1763 case Key_Plus:
1764 if ( !item->isOpen() && (item->isExpandable() || item->childCount()) ) 1764 if ( !item->isOpen() && (item->isExpandable() || item->childCount()) )
1765 setOpen( item, TRUE ); 1765 setOpen( item, TRUE );
1766 break; 1766 break;
1767 default: 1767 default:
1768 bool realKey = ((e->key()!=Key_Shift) && (e->key()!=Key_Control) 1768 bool realKey = ((e->key()!=Key_Shift) && (e->key()!=Key_Control)
1769 && (e->key()!=Key_Meta) && (e->key()!=Key_Alt)); 1769 && (e->key()!=Key_Meta) && (e->key()!=Key_Alt));
1770 1770
1771 bool selectCurrentItem = (d->selectedBySimpleMove) && (item->isSelected()); 1771 bool selectCurrentItem = (d->selectedBySimpleMove) && (item->isSelected());
1772 if (realKey && selectCurrentItem) 1772 if (realKey && selectCurrentItem)
1773 item->setSelected(false); 1773 item->setSelected(false);
1774 //this is mainly for the "goto filename beginning with pressed char" feature (aleXXX) 1774 //this is mainly for the "goto filename beginning with pressed char" feature (aleXXX)
1775 QListView::SelectionMode oldSelectionMode = selectionMode(); 1775 QListView::SelectionMode oldSelectionMode = selectionMode();
1776 setSelectionMode (QListView::Multi); 1776 setSelectionMode (QListView::Multi);
1777 QListView::keyPressEvent (e); 1777 QListView::keyPressEvent (e);
1778 setSelectionMode (oldSelectionMode); 1778 setSelectionMode (oldSelectionMode);
1779 if (realKey && selectCurrentItem) 1779 if (realKey && selectCurrentItem)
1780 { 1780 {
1781 currentItem()->setSelected(true); 1781 currentItem()->setSelected(true);
1782 emitSelectionChanged=TRUE; 1782 emitSelectionChanged=TRUE;
1783 } 1783 }
1784 repaintItem2=currentItem(); 1784 repaintItem2=currentItem();
1785 if (realKey) 1785 if (realKey)
1786 visItem=currentItem(); 1786 visItem=currentItem();
1787 break; 1787 break;
1788 } 1788 }
1789 1789
1790 if (visItem) 1790 if (visItem)
1791 ensureItemVisible(visItem); 1791 ensureItemVisible(visItem);
1792 1792
1793 QRect ir; 1793 QRect ir;
1794 if (repaintItem1) 1794 if (repaintItem1)
1795 ir = ir.unite( itemRect(repaintItem1) ); 1795 ir = ir.unite( itemRect(repaintItem1) );
1796 if (repaintItem2) 1796 if (repaintItem2)
1797 ir = ir.unite( itemRect(repaintItem2) ); 1797 ir = ir.unite( itemRect(repaintItem2) );
1798 1798
1799 if ( !ir.isEmpty() ) 1799 if ( !ir.isEmpty() )
1800 { // rectangle to be repainted 1800 { // rectangle to be repainted
1801 if ( ir.x() < 0 ) 1801 if ( ir.x() < 0 )
1802 ir.moveBy( -ir.x(), 0 ); 1802 ir.moveBy( -ir.x(), 0 );
1803 viewport()->repaint( ir, FALSE ); 1803 viewport()->repaint( ir, FALSE );
1804 } 1804 }
1805 /*if (repaintItem1) 1805 /*if (repaintItem1)
1806 repaintItem1->repaint(); 1806 repaintItem1->repaint();
1807 if (repaintItem2) 1807 if (repaintItem2)
1808 repaintItem2->repaint();*/ 1808 repaintItem2->repaint();*/
1809 update(); 1809 update();
1810 if (emitSelectionChanged) 1810 if (emitSelectionChanged)
1811 emit selectionChanged(); 1811 emit selectionChanged();
1812} 1812}
1813 1813
1814void KListView::setSelectionModeExt (SelectionModeExt mode) 1814void KListView::setSelectionModeExt (SelectionModeExt mode)
1815{ 1815{
1816 d->selectionMode = mode; 1816 d->selectionMode = mode;
1817 1817
1818 switch (mode) 1818 switch (mode)
1819 { 1819 {
1820 case Single: 1820 case Single:
1821 case Multi: 1821 case Multi:
1822 case Extended: 1822 case Extended:
1823 case NoSelection: 1823 case NoSelection:
1824 setSelectionMode (static_cast<QListView::SelectionMode>(static_cast<int>(mode))); 1824 setSelectionMode (static_cast<QListView::SelectionMode>(static_cast<int>(mode)));
1825 break; 1825 break;
1826 1826
1827 case FileManager: 1827 case FileManager:
1828 setSelectionMode (QListView::Extended); 1828 setSelectionMode (QListView::Extended);
1829 break; 1829 break;
1830 1830
1831 default: 1831 default:
1832 kdWarning () << "Warning: illegal selection mode " << int(mode) << " set!" << endl; 1832 kdWarning () << "Warning: illegal selection mode " << int(mode) << " set!" << endl;
1833 break; 1833 break;
1834 } 1834 }
1835} 1835}
1836 1836
1837KListView::SelectionModeExt KListView::selectionModeExt () const 1837KListView::SelectionModeExt KListView::selectionModeExt () const
1838{ 1838{
1839 return d->selectionMode; 1839 return d->selectionMode;
1840} 1840}
1841 1841
1842int KListView::itemIndex( const QListViewItem *item ) const 1842int KListView::itemIndex( const QListViewItem *item ) const
1843{ 1843{
1844 if ( !item ) 1844 if ( !item )
1845 return -1; 1845 return -1;
1846 1846
1847 if ( item == firstChild() ) 1847 if ( item == firstChild() )
1848 return 0; 1848 return 0;
1849 else { 1849 else {
1850 QListViewItemIterator it(firstChild()); 1850 QListViewItemIterator it(firstChild());
1851 uint j = 0; 1851 uint j = 0;
1852 for (; it.current() && it.current() != item; ++it, ++j ); 1852 for (; it.current() && it.current() != item; ++it, ++j );
1853 1853
1854 if( !it.current() ) 1854 if( !it.current() )
1855 return -1; 1855 return -1;
1856 1856
1857 return j; 1857 return j;
1858 } 1858 }
1859} 1859}
1860 1860
1861QListViewItem* KListView::itemAtIndex(int index) 1861QListViewItem* KListView::itemAtIndex(int index)
1862{ 1862{
1863 if (index<0) 1863 if (index<0)
1864 return 0; 1864 return 0;
1865 1865
1866 int j(0); 1866 int j(0);
1867 for (QListViewItemIterator it=firstChild(); it.current(); it++) 1867 for (QListViewItemIterator it=firstChild(); it.current(); it++)
1868 { 1868 {
1869 if (j==index) 1869 if (j==index)
1870 return it.current(); 1870 return it.current();
1871 j++; 1871 j++;
1872 }; 1872 };
1873 return 0; 1873 return 0;
1874} 1874}
1875 1875
1876 1876
1877void KListView::emitContextMenu (KListView*, QListViewItem* i) 1877void KListView::emitContextMenu (KListView*, QListViewItem* i)
1878{ 1878{
1879 QPoint p; 1879 QPoint p;
1880 qDebug("KListView::emitContextMenu "); 1880 qDebug("KListView::emitContextMenu ");
1881 1881
1882 if (i) 1882 if (i)
1883 p = viewport()->mapToGlobal(itemRect(i).center()); 1883 p = viewport()->mapToGlobal(itemRect(i).center());
1884 else 1884 else
1885 p = mapToGlobal(rect().center()); 1885 p = mapToGlobal(rect().center());
1886 1886
1887 emit contextMenu (this, i, p); 1887 emit contextMenu (this, i, p);
1888} 1888}
1889 1889
1890void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int) 1890void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col)
1891{ 1891{
1892 qDebug("KListView::emitContextMenu "); 1892 qDebug("KListView::emitContextMenu col");
1893 emit contextMenu (this, i, p); 1893 emit contextRequest( i, p, col );
1894 emit contextMenu (this, i, p);
1894} 1895}
1895 1896
1896void KListView::setAcceptDrops (bool val) 1897void KListView::setAcceptDrops (bool val)
1897{ 1898{
1898 QListView::setAcceptDrops (val); 1899 QListView::setAcceptDrops (val);
1899 viewport()->setAcceptDrops (val); 1900 viewport()->setAcceptDrops (val);
1900} 1901}
1901 1902
1902int KListView::dropVisualizerWidth () const 1903int KListView::dropVisualizerWidth () const
1903{ 1904{
1904 return d->mDropVisualizerWidth; 1905 return d->mDropVisualizerWidth;
1905} 1906}
1906 1907
1907 1908
1908void KListView::viewportPaintEvent(QPaintEvent *e) 1909void KListView::viewportPaintEvent(QPaintEvent *e)
1909{ 1910{
1910 QListView::viewportPaintEvent(e); 1911 QListView::viewportPaintEvent(e);
1911 1912
1912 if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer)) 1913 if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer))
1913 { 1914 {
1914 QPainter painter(viewport()); 1915 QPainter painter(viewport());
1915 1916
1916 // This is where we actually draw the drop-visualizer 1917 // This is where we actually draw the drop-visualizer
1917 painter.fillRect(d->mOldDropVisualizer, Dense4Pattern); 1918 painter.fillRect(d->mOldDropVisualizer, Dense4Pattern);
1918 } 1919 }
1919 if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter)) 1920 if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter))
1920 { 1921 {
1921 QPainter painter(viewport()); 1922 QPainter painter(viewport());
1922 1923
1923qDebug("KListView::viewportPaintEvent has to be verified"); 1924qDebug("KListView::viewportPaintEvent has to be verified");
1924 1925
1925 // This is where we actually draw the drop-highlighter 1926 // This is where we actually draw the drop-highlighter
1926//US style().drawPrimitive(QStyle::PE_FocusRect, &painter, d->mOldDropHighlighter, colorGroup(), 1927//US style().drawPrimitive(QStyle::PE_FocusRect, &painter, d->mOldDropHighlighter, colorGroup(),
1927//US QStyle::Style_FocusAtBorder); 1928//US QStyle::Style_FocusAtBorder);
1928 1929
1929//LR style().drawFocusRect(&painter, d->mOldDropHighlighter, colorGroup(), (const QColor*)0, true); 1930//LR style().drawFocusRect(&painter, d->mOldDropHighlighter, colorGroup(), (const QColor*)0, true);
1930 1931
1931 1932
1932 } 1933 }
1933} 1934}
1934 1935
1935void KListView::setFullWidth() 1936void KListView::setFullWidth()
1936{ 1937{
1937 setFullWidth(true); 1938 setFullWidth(true);
1938} 1939}
1939 1940
1940void KListView::setFullWidth(bool fullWidth) 1941void KListView::setFullWidth(bool fullWidth)
1941{ 1942{
1942 d->fullWidth = fullWidth; 1943 d->fullWidth = fullWidth;
1943//US header()->setStretchEnabled(fullWidth, columns()-1); 1944//US header()->setStretchEnabled(fullWidth, columns()-1);
1944} 1945}
1945 1946
1946bool KListView::fullWidth() const 1947bool KListView::fullWidth() const
1947{ 1948{
1948 return d->fullWidth; 1949 return d->fullWidth;
1949} 1950}
1950 1951
1951int KListView::addColumn(const QString& label, int width) 1952int KListView::addColumn(const QString& label, int width)
1952{ 1953{
1953 int result = QListView::addColumn(label, width); 1954 int result = QListView::addColumn(label, width);
1954 if (d->fullWidth) { 1955 if (d->fullWidth) {
1955//US header()->setStretchEnabled(false, columns()-2); 1956//US header()->setStretchEnabled(false, columns()-2);
1956//US header()->setStretchEnabled(true, columns()-1); 1957//US header()->setStretchEnabled(true, columns()-1);
1957 } 1958 }
1958 return result; 1959 return result;
1959} 1960}
1960 1961
1961int KListView::addColumn(const QIconSet& iconset, const QString& label, int width) 1962int KListView::addColumn(const QIconSet& iconset, const QString& label, int width)
1962{ 1963{
1963 int result = QListView::addColumn(iconset, label, width); 1964 int result = QListView::addColumn(iconset, label, width);
1964 if (d->fullWidth) { 1965 if (d->fullWidth) {
1965//US header()->setStretchEnabled(false, columns()-2); 1966//US header()->setStretchEnabled(false, columns()-2);
1966//US header()->setStretchEnabled(true, columns()-1); 1967//US header()->setStretchEnabled(true, columns()-1);
1967 } 1968 }
1968 return result; 1969 return result;
1969} 1970}
1970 1971
1971void KListView::removeColumn(int index) 1972void KListView::removeColumn(int index)
1972{ 1973{
1973 QListView::removeColumn(index); 1974 QListView::removeColumn(index);
1974//US if (d->fullWidth && index == columns()) header()->setStretchEnabled(true, columns()-1); 1975//US if (d->fullWidth && index == columns()) header()->setStretchEnabled(true, columns()-1);
1975} 1976}
1976 1977
1977void KListView::viewportResizeEvent(QResizeEvent* e) 1978void KListView::viewportResizeEvent(QResizeEvent* e)
1978{ 1979{
1979 QListView::viewportResizeEvent(e); 1980 QListView::viewportResizeEvent(e);
1980} 1981}
1981 1982
1982const QColor &KListView::alternateBackground() const 1983const QColor &KListView::alternateBackground() const
1983{ 1984{
1984 return d->alternateBackground; 1985 return d->alternateBackground;
1985} 1986}
1986 1987
1987void KListView::setAlternateBackground(const QColor &c) 1988void KListView::setAlternateBackground(const QColor &c)
1988{ 1989{
1989 d->alternateBackground = c; 1990 d->alternateBackground = c;
1990 repaint(); 1991 repaint();
1991} 1992}
1992 1993
1993void KListView::saveLayout(KConfig *config, const QString &group) const 1994void KListView::saveLayout(KConfig *config, const QString &group) const
1994{ 1995{
1995 KConfigGroupSaver saver(config, group); 1996 KConfigGroupSaver saver(config, group);
1996 QStringList widths, order; 1997 QStringList widths, order;
1997 for (int i = 0; i < columns(); ++i) 1998 for (int i = 0; i < columns(); ++i)
1998 { 1999 {
1999 widths << QString::number(columnWidth(i)); 2000 widths << QString::number(columnWidth(i));
2000 order << QString::number(header()->mapToIndex(i)); 2001 order << QString::number(header()->mapToIndex(i));
2001 } 2002 }
2002 config->writeEntry("ColumnWidths", widths); 2003 config->writeEntry("ColumnWidths", widths);
2003 config->writeEntry("ColumnOrder", order); 2004 config->writeEntry("ColumnOrder", order);
2004 config->writeEntry("SortColumn", d->sortColumn); 2005 config->writeEntry("SortColumn", d->sortColumn);
2005 config->writeEntry("SortAscending", d->sortAscending); 2006 config->writeEntry("SortAscending", d->sortAscending);
2006} 2007}
2007 2008
2008void KListView::restoreLayout(KConfig *config, const QString &group) 2009void KListView::restoreLayout(KConfig *config, const QString &group)
2009{ 2010{
2010 KConfigGroupSaver saver(config, group); 2011 KConfigGroupSaver saver(config, group);
2011 QStringList cols = config->readListEntry("ColumnWidths"); 2012 QStringList cols = config->readListEntry("ColumnWidths");
2012 int i = 0; 2013 int i = 0;
2013 for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it) 2014 for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it)
2014 setColumnWidth(i++, (*it).toInt()); 2015 setColumnWidth(i++, (*it).toInt());
2015 2016
2016 cols = config->readListEntry("ColumnOrder"); 2017 cols = config->readListEntry("ColumnOrder");
2017 i = 0; 2018 i = 0;
2018 for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it) 2019 for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it)
2019 header()->moveSection(i++, (*it).toInt()); 2020 header()->moveSection(i++, (*it).toInt());
2020 2021
2021/*US I changed the following code, because hasKey is not available. 2022/*US I changed the following code, because hasKey is not available.
2022!!! check if my version is correct 2023!!! check if my version is correct
2023 if (config->hasKey("SortColumn")) 2024 if (config->hasKey("SortColumn"))
2024 setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); 2025 setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true));
2025*/ 2026*/
2026 QStringList langLst = config->readListEntry( "SortColumn" ); 2027 QStringList langLst = config->readListEntry( "SortColumn" );
2027 if (!langLst.isEmpty()) 2028 if (!langLst.isEmpty())
2028 setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true)); 2029 setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true));
2029} 2030}
2030 2031
2031void KListView::setSorting(int column, bool ascending) 2032void KListView::setSorting(int column, bool ascending)
2032{ 2033{
2033 d->sortColumn = column; 2034 d->sortColumn = column;
2034 d->sortAscending = ascending; 2035 d->sortAscending = ascending;
2035 QListView::setSorting(column, ascending); 2036 QListView::setSorting(column, ascending);
2036} 2037}
2037 2038
2038int KListView::columnSorted(void) const 2039int KListView::columnSorted(void) const
2039{ 2040{
2040 return d->sortColumn; 2041 return d->sortColumn;
2041} 2042}
2042 2043
2043bool KListView::ascendingSort(void) const 2044bool KListView::ascendingSort(void) const
2044{ 2045{
2045 return d->sortAscending; 2046 return d->sortAscending;
2046} 2047}
2047 2048
2048KListViewItem::KListViewItem(QListView *parent) 2049KListViewItem::KListViewItem(QListView *parent)
2049 : QListViewItem(parent) 2050 : QListViewItem(parent)
2050{ 2051{
2051 init(); 2052 init();
2052} 2053}
2053 2054
2054KListViewItem::KListViewItem(QListViewItem *parent) 2055KListViewItem::KListViewItem(QListViewItem *parent)
2055 : QListViewItem(parent) 2056 : QListViewItem(parent)
2056{ 2057{
2057 init(); 2058 init();
2058} 2059}
2059 2060
2060KListViewItem::KListViewItem(QListView *parent, QListViewItem *after) 2061KListViewItem::KListViewItem(QListView *parent, QListViewItem *after)
2061 : QListViewItem(parent, after) 2062 : QListViewItem(parent, after)
2062{ 2063{
2063 init(); 2064 init();
2064} 2065}
2065 2066
2066KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after) 2067KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after)
2067 : QListViewItem(parent, after) 2068 : QListViewItem(parent, after)
2068{ 2069{
2069 init(); 2070 init();
2070} 2071}
2071 2072
2072KListViewItem::KListViewItem(QListView *parent, 2073KListViewItem::KListViewItem(QListView *parent,
2073 QString label1, QString label2, QString label3, QString label4, 2074 QString label1, QString label2, QString label3, QString label4,
2074 QString label5, QString label6, QString label7, QString label8) 2075 QString label5, QString label6, QString label7, QString label8)
2075 : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) 2076 : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8)
2076{ 2077{
2077 init(); 2078 init();
2078} 2079}
2079 2080
2080KListViewItem::KListViewItem(QListViewItem *parent, 2081KListViewItem::KListViewItem(QListViewItem *parent,
2081 QString label1, QString label2, QString label3, QString label4, 2082 QString label1, QString label2, QString label3, QString label4,
2082 QString label5, QString label6, QString label7, QString label8) 2083 QString label5, QString label6, QString label7, QString label8)
2083 : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8) 2084 : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8)
2084{ 2085{
2085 init(); 2086 init();
2086} 2087}
2087 2088
2088KListViewItem::KListViewItem(QListView *parent, QListViewItem *after, 2089KListViewItem::KListViewItem(QListView *parent, QListViewItem *after,
2089 QString label1, QString label2, QString label3, QString label4, 2090 QString label1, QString label2, QString label3, QString label4,
2090 QString label5, QString label6, QString label7, QString label8) 2091 QString label5, QString label6, QString label7, QString label8)
2091 : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) 2092 : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8)
2092{ 2093{
2093 init(); 2094 init();
2094} 2095}
2095 2096
2096KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after, 2097KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after,
2097 QString label1, QString label2, QString label3, QString label4, 2098 QString label1, QString label2, QString label3, QString label4,
2098 QString label5, QString label6, QString label7, QString label8) 2099 QString label5, QString label6, QString label7, QString label8)
2099 : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8) 2100 : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8)
2100{ 2101{
2101 init(); 2102 init();
2102} 2103}
2103 2104
2104KListViewItem::~KListViewItem() 2105KListViewItem::~KListViewItem()
2105{ 2106{
2106} 2107}
2107 2108
2108void KListViewItem::init() 2109void KListViewItem::init()
2109{ 2110{
2110 m_known = false; 2111 m_known = false;
2111} 2112}
2112 2113
2113const QColor &KListViewItem::backgroundColor() 2114const QColor &KListViewItem::backgroundColor()
2114{ 2115{
2115 if (isAlternate()) 2116 if (isAlternate())
2116 return static_cast< KListView* >(listView())->alternateBackground(); 2117 return static_cast< KListView* >(listView())->alternateBackground();
2117 return listView()->viewport()->colorGroup().base(); 2118 return listView()->viewport()->colorGroup().base();
2118} 2119}
2119 2120
2120bool KListViewItem::isAlternate() 2121bool KListViewItem::isAlternate()
2121{ 2122{
2122 KListView *lv = static_cast<KListView *>(listView()); 2123 KListView *lv = static_cast<KListView *>(listView());
2123 if (lv && lv->alternateBackground().isValid()) 2124 if (lv && lv->alternateBackground().isValid())
2124 { 2125 {
2125 KListViewItem *above = 0; 2126 KListViewItem *above = 0;
2126//US above = dynamic_cast<KListViewItem *>(itemAbove()); 2127//US above = dynamic_cast<KListViewItem *>(itemAbove());
2127 above = (KListViewItem *)(itemAbove()); 2128 above = (KListViewItem *)(itemAbove());
2128 m_known = above ? above->m_known : true; 2129 m_known = above ? above->m_known : true;
2129 if (m_known) 2130 if (m_known)
2130 { 2131 {
2131 m_odd = above ? !above->m_odd : false; 2132 m_odd = above ? !above->m_odd : false;
2132 } 2133 }
2133 else 2134 else
2134 { 2135 {
2135 KListViewItem *item; 2136 KListViewItem *item;
2136 bool previous = true; 2137 bool previous = true;
2137 if (parent()) 2138 if (parent())
2138 { 2139 {
2139//US item = dynamic_cast<KListViewItem *>(parent()); 2140//US item = dynamic_cast<KListViewItem *>(parent());
2140 item = (KListViewItem *)(parent()); 2141 item = (KListViewItem *)(parent());
2141 if (item) 2142 if (item)
2142 previous = item->m_odd; 2143 previous = item->m_odd;
2143//US item = dynamic_cast<KListViewItem *>(parent()->firstChild()); 2144//US item = dynamic_cast<KListViewItem *>(parent()->firstChild());
2144 item = (KListViewItem *)(parent()->firstChild()); 2145 item = (KListViewItem *)(parent()->firstChild());
2145 } 2146 }
2146 else 2147 else
2147 { 2148 {
2148//US item = dynamic_cast<KListViewItem *>(lv->firstChild()); 2149//US item = dynamic_cast<KListViewItem *>(lv->firstChild());
2149 item = (KListViewItem *)(lv->firstChild()); 2150 item = (KListViewItem *)(lv->firstChild());
2150 } 2151 }
2151 2152
2152 while(item) 2153 while(item)
2153 { 2154 {
2154 item->m_odd = previous = !previous; 2155 item->m_odd = previous = !previous;
2155 item->m_known = true; 2156 item->m_known = true;
2156//US item = dynamic_cast<KListViewItem *>(item->nextSibling()); 2157//US item = dynamic_cast<KListViewItem *>(item->nextSibling());
2157 item = (KListViewItem *)(item->nextSibling()); 2158 item = (KListViewItem *)(item->nextSibling());
2158 } 2159 }
2159 } 2160 }
2160 return m_odd; 2161 return m_odd;
2161 } 2162 }
2162 return false; 2163 return false;
2163} 2164}
2164 2165
2165void KListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) 2166void KListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
2166{ 2167{
2167 QColorGroup _cg = cg; 2168 QColorGroup _cg = cg;
2168 const QPixmap *pm = listView()->viewport()->backgroundPixmap(); 2169 const QPixmap *pm = listView()->viewport()->backgroundPixmap();
2169 if (pm && !pm->isNull()) 2170 if (pm && !pm->isNull())
2170 { 2171 {
2171 _cg.setBrush(QColorGroup::Base, QBrush(backgroundColor(), *pm)); 2172 _cg.setBrush(QColorGroup::Base, QBrush(backgroundColor(), *pm));
2172 QPoint o = p->brushOrigin(); 2173 QPoint o = p->brushOrigin();
2173 p->setBrushOrigin( o.x()-listView()->contentsX(), o.y()-listView()->contentsY() ); 2174 p->setBrushOrigin( o.x()-listView()->contentsX(), o.y()-listView()->contentsY() );
2174 } 2175 }
2175 else if (isAlternate()) { 2176 else if (isAlternate()) {
2176//US if (listView()->viewport()->backgroundMode()==Qt::FixedColor) 2177//US if (listView()->viewport()->backgroundMode()==Qt::FixedColor)
2177 if (listView()->viewport()->backgroundMode()==QWidget::PaletteBackground) 2178 if (listView()->viewport()->backgroundMode()==QWidget::PaletteBackground)
2178 _cg.setColor(QColorGroup::Background, static_cast< KListView* >(listView())->alternateBackground()); 2179 _cg.setColor(QColorGroup::Background, static_cast< KListView* >(listView())->alternateBackground());
2179 else 2180 else
2180 _cg.setColor(QColorGroup::Base, static_cast< KListView* >(listView())->alternateBackground()); 2181 _cg.setColor(QColorGroup::Base, static_cast< KListView* >(listView())->alternateBackground());
2181 } 2182 }
2182 QListViewItem::paintCell(p, _cg, column, width, alignment); 2183 QListViewItem::paintCell(p, _cg, column, width, alignment);
2183} 2184}
2184 2185
2185void KListView::virtual_hook( int, void* ) 2186void KListView::virtual_hook( int, void* )
2186{ /*BASE::virtual_hook( id, data );*/ } 2187{ /*BASE::virtual_hook( id, data );*/ }
2187 2188
2188//US #include "klistview.moc" 2189//US #include "klistview.moc"
2189//US #include "klistviewlineedit.moc" 2190//US #include "klistviewlineedit.moc"
2190 2191
2191// vim: ts=2 sw=2 et 2192// vim: ts=2 sw=2 et
diff --git a/microkde/kdeui/klistview.h b/microkde/kdeui/klistview.h
index f7d9f85..8d933f6 100644
--- a/microkde/kdeui/klistview.h
+++ b/microkde/kdeui/klistview.h
@@ -1,1033 +1,1034 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 Copyright (C) 2000 Reginald Stadlbauer <reggie@kde.org> 2 Copyright (C) 2000 Reginald Stadlbauer <reggie@kde.org>
3 Copyright (C) 2000 Charles Samuels <charles@kde.org> 3 Copyright (C) 2000 Charles Samuels <charles@kde.org>
4 Copyright (C) 2000 Peter Putzer <putzer@kde.org> 4 Copyright (C) 2000 Peter Putzer <putzer@kde.org>
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License version 2 as published by the Free Software Foundation. 8 License version 2 as published by the Free Software Foundation.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20#ifndef KLISTVIEW_H 20#ifndef KLISTVIEW_H
21#define KLISTVIEW_H 21#define KLISTVIEW_H
22 22
23#include <qlistview.h> 23#include <qlistview.h>
24 24
25#include <qptrlist.h> 25#include <qptrlist.h>
26 26
27//US 27//US
28class QDropEvent; 28class QDropEvent;
29class QDragLeaveEvent; 29class QDragLeaveEvent;
30class QDragMoveEvent; 30class QDragMoveEvent;
31class QDragEnterEvent; 31class QDragEnterEvent;
32 32
33class QDragObject; 33class QDragObject;
34class KConfig; 34class KConfig;
35class KLineEdit; 35class KLineEdit;
36/** 36/**
37 * This Widget extends the functionality of QListView to honor the system 37 * This Widget extends the functionality of QListView to honor the system
38 * wide settings for Single Click/Double Click mode, AutoSelection and 38 * wide settings for Single Click/Double Click mode, AutoSelection and
39 * ChangeCursorOverLink (TM). 39 * ChangeCursorOverLink (TM).
40 * 40 *
41 * There is a new signal executed(). It gets connected to either 41 * There is a new signal executed(). It gets connected to either
42 * @ref QListView::clicked() or @ref QListView::doubleClicked() depending on the KDE 42 * @ref QListView::clicked() or @ref QListView::doubleClicked() depending on the KDE
43 * wide Single Click/Double Click settings. It is strongly recommended that 43 * wide Single Click/Double Click settings. It is strongly recommended that
44 * you use this signal instead of the above mentioned. This way you dont 44 * you use this signal instead of the above mentioned. This way you dont
45 * need to care about the current settings. 45 * need to care about the current settings.
46 * If you want to get informed when the user selects something connect to the 46 * If you want to get informed when the user selects something connect to the
47 * QListView::selectionChanged() signal. 47 * QListView::selectionChanged() signal.
48 * 48 *
49 * Drag-and-Drop is supported with the signal @ref #dropped(), just @ref #setAcceptDrops(true) 49 * Drag-and-Drop is supported with the signal @ref #dropped(), just @ref #setAcceptDrops(true)
50 * and connect it to a suitable slot. 50 * and connect it to a suitable slot.
51 * To see where you are dropping, @ref setDropVisualizer(true). 51 * To see where you are dropping, @ref setDropVisualizer(true).
52 * And also you'll need @ref acceptDrag(QDropEvent*) 52 * And also you'll need @ref acceptDrag(QDropEvent*)
53 * 53 *
54 * KListView is drag-enabled, too: to benefit from that you've got derive from it. 54 * KListView is drag-enabled, too: to benefit from that you've got derive from it.
55 * Reimplement @ref dragObject() and (possibly) @ref startDrag(), 55 * Reimplement @ref dragObject() and (possibly) @ref startDrag(),
56 * and @ref setDragEnabled(true). 56 * and @ref setDragEnabled(true).
57 * 57 *
58 * @version $Id$ 58 * @version $Id$
59 */ 59 */
60class KListView : public QListView 60class KListView : public QListView
61{ 61{
62 Q_OBJECT 62 Q_OBJECT
63 Q_ENUMS( SelectionModeExt ) 63 Q_ENUMS( SelectionModeExt )
64 Q_PROPERTY( bool fullWidth READ fullWidth WRITE setFullWidth ) 64 Q_PROPERTY( bool fullWidth READ fullWidth WRITE setFullWidth )
65 Q_PROPERTY( bool itemsMovable READ itemsMovable WRITE setItemsMovable ) 65 Q_PROPERTY( bool itemsMovable READ itemsMovable WRITE setItemsMovable )
66 Q_PROPERTY( bool itemsRenameable READ itemsRenameable WRITE setItemsRenameable ) 66 Q_PROPERTY( bool itemsRenameable READ itemsRenameable WRITE setItemsRenameable )
67 Q_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled ) 67 Q_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled )
68 Q_PROPERTY( bool autoOpen READ autoOpen WRITE setAutoOpen ) 68 Q_PROPERTY( bool autoOpen READ autoOpen WRITE setAutoOpen )
69 Q_PROPERTY( bool dropVisualizer READ dropVisualizer WRITE setDropVisualizer ) 69 Q_PROPERTY( bool dropVisualizer READ dropVisualizer WRITE setDropVisualizer )
70//US Q_PROPERTY( int tooltipColumn READ tooltipColumn WRITE setTooltipColumn ) 70//US Q_PROPERTY( int tooltipColumn READ tooltipColumn WRITE setTooltipColumn )
71 Q_PROPERTY( int dropVisualizerWidth READ dropVisualizerWidth WRITE setDropVisualizerWidth ) 71 Q_PROPERTY( int dropVisualizerWidth READ dropVisualizerWidth WRITE setDropVisualizerWidth )
72 Q_PROPERTY( QColor alternateBackground READ alternateBackground WRITE setAlternateBackground ) 72 Q_PROPERTY( QColor alternateBackground READ alternateBackground WRITE setAlternateBackground )
73 73
74 Q_OVERRIDE( SelectionModeExt selectionMode READ selectionModeExt WRITE setSelectionModeExt ) 74 Q_OVERRIDE( SelectionModeExt selectionMode READ selectionModeExt WRITE setSelectionModeExt )
75 75
76public: 76public:
77 /** 77 /**
78 * Possible selection modes. 78 * Possible selection modes.
79 * 79 *
80 * The first four correspond directly to QListView::SelectionMode, while 80 * The first four correspond directly to QListView::SelectionMode, while
81 * the FileManager selection mode is defined as follows: 81 * the FileManager selection mode is defined as follows:
82 * @li home: move to the first 82 * @li home: move to the first
83 * @li end: move to the last 83 * @li end: move to the last
84 * @li PgUp/PgDn: move one page up/down 84 * @li PgUp/PgDn: move one page up/down
85 * @li up/down: move one item up/down 85 * @li up/down: move one item up/down
86 * @li insert: toggle selection of current and move to the next 86 * @li insert: toggle selection of current and move to the next
87 * @li space: toggle selection of the current 87 * @li space: toggle selection of the current
88 * @li CTRL+up: move to the previous item and toggle selection of this one 88 * @li CTRL+up: move to the previous item and toggle selection of this one
89 * @li CTRL+down: toggle selection of the current item and move to the next 89 * @li CTRL+down: toggle selection of the current item and move to the next
90 * @li CTRL+end: toggle selection from (including) the current 90 * @li CTRL+end: toggle selection from (including) the current
91 * item to (including) the last item 91 * item to (including) the last item
92 * @li CTRL+home: toggle selection from (including) the current 92 * @li CTRL+home: toggle selection from (including) the current
93 * item to the (including) the first item 93 * item to the (including) the first item
94 * @li CTRL+PgDn: toggle selection from (including) the current 94 * @li CTRL+PgDn: toggle selection from (including) the current
95 * item to (excluding) the item one page down 95 * item to (excluding) the item one page down
96 * @li CTRL+PgUp: toggle selection from (excluding) the current 96 * @li CTRL+PgUp: toggle selection from (excluding) the current
97 * item to (including) the item one page up 97 * item to (including) the item one page up
98 * 98 *
99 * The combinations work the same with SHIFT instead of CTRL, except 99 * The combinations work the same with SHIFT instead of CTRL, except
100 * that if you start selecting something using SHIFT everything selected 100 * that if you start selecting something using SHIFT everything selected
101 * before will be deselected first. 101 * before will be deselected first.
102 * 102 *
103 * Additionally the current item is always selected automatically when 103 * Additionally the current item is always selected automatically when
104 * navigating using the keyboard, except other items were selected explicitely. 104 * navigating using the keyboard, except other items were selected explicitely.
105 * 105 *
106 * This way e.g. SHIFT+up/PgUp then SHIFT+down/PgDn leaves no item selected 106 * This way e.g. SHIFT+up/PgUp then SHIFT+down/PgDn leaves no item selected
107 */ 107 */
108 enum SelectionModeExt { 108 enum SelectionModeExt {
109 Single = QListView::Single, 109 Single = QListView::Single,
110 Multi = QListView::Multi, 110 Multi = QListView::Multi,
111 Extended = QListView::Extended, 111 Extended = QListView::Extended,
112 NoSelection = QListView::NoSelection, 112 NoSelection = QListView::NoSelection,
113 FileManager 113 FileManager
114 }; 114 };
115 void repaintContents( bool erase = true ) 115 void repaintContents( bool erase = true )
116 { 116 {
117 QScrollView::repaintContents( contentsX(), contentsY(), 117 QScrollView::repaintContents( contentsX(), contentsY(),
118 visibleWidth(), visibleHeight(), erase ); 118 visibleWidth(), visibleHeight(), erase );
119 }; 119 };
120 /** 120 /**
121 * Constructor. 121 * Constructor.
122 * 122 *
123 * The parameters @p parent and @p name are handled by 123 * The parameters @p parent and @p name are handled by
124 * @ref QListView, as usual. 124 * @ref QListView, as usual.
125 */ 125 */
126 KListView (QWidget *parent = 0, const char *name = 0); 126 KListView (QWidget *parent = 0, const char *name = 0);
127 127
128 /** 128 /**
129 * Destructor. 129 * Destructor.
130 */ 130 */
131 virtual ~KListView(); 131 virtual ~KListView();
132 132
133 /** 133 /**
134 * Reimplemented for internal reasons. 134 * Reimplemented for internal reasons.
135 * Further reimplementations should call this function or else 135 * Further reimplementations should call this function or else
136 * some features may not work correctly. 136 * some features may not work correctly.
137 * 137 *
138 * The API is unaffected. 138 * The API is unaffected.
139 */ 139 */
140 virtual void setAcceptDrops (bool); 140 virtual void setAcceptDrops (bool);
141 141
142 /** 142 /**
143 * This function determines whether the given coordinates are within the 143 * This function determines whether the given coordinates are within the
144 * execute area. The execute area is the part of a @ref QListViewItem where mouse 144 * execute area. The execute area is the part of a @ref QListViewItem where mouse
145 * clicks or double clicks respectively generate a @ref #executed() signal. 145 * clicks or double clicks respectively generate a @ref #executed() signal.
146 * Depending on @ref QListView::allColumnsShowFocus() this is either the 146 * Depending on @ref QListView::allColumnsShowFocus() this is either the
147 * whole item or only the first column. 147 * whole item or only the first column.
148 * @return true if point is inside execute area of an item, false in all 148 * @return true if point is inside execute area of an item, false in all
149 * other cases including the case that it is over the viewport. 149 * other cases including the case that it is over the viewport.
150 */ 150 */
151 virtual bool isExecuteArea( const QPoint& point ); 151 virtual bool isExecuteArea( const QPoint& point );
152 152
153 /** 153 /**
154 * Same thing, but from an x coordinate only. This only checks if x is in 154 * Same thing, but from an x coordinate only. This only checks if x is in
155 * the first column (if all columns don't show focus), without testing if 155 * the first column (if all columns don't show focus), without testing if
156 * the y coordinate is over an item or not. 156 * the y coordinate is over an item or not.
157 */ 157 */
158 bool isExecuteArea( int x ); 158 bool isExecuteArea( int x );
159 159
160 /** 160 /**
161 * @return a list containing the currently selected items. 161 * @return a list containing the currently selected items.
162 */ 162 */
163 QPtrList<QListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?) 163 QPtrList<QListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?)
164 164
165 /** 165 /**
166 * Arbitrarily move @p item to @p parent, positioned immediately after item @p after. 166 * Arbitrarily move @p item to @p parent, positioned immediately after item @p after.
167 */ 167 */
168 void moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after); 168 void moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after);
169 169
170 /** 170 /**
171 * @return the last item (not child!) of this listview. 171 * @return the last item (not child!) of this listview.
172 * 172 *
173 * @see lastChild() 173 * @see lastChild()
174 */ 174 */
175 QListViewItem *lastItem() const; 175 QListViewItem *lastItem() const;
176 176
177 /** 177 /**
178 * @return the last child of this listview. 178 * @return the last child of this listview.
179 * 179 *
180 * @see lastItem() 180 * @see lastItem()
181 */ 181 */
182 QListViewItem* lastChild () const; 182 QListViewItem* lastChild () const;
183 183
184 /** 184 /**
185 * @return the lineedit used for inline renaming. 185 * @return the lineedit used for inline renaming.
186 * Use that to setup a @ref KCompletion or @ref QValidator for the lineedit 186 * Use that to setup a @ref KCompletion or @ref QValidator for the lineedit
187 * 187 *
188 * @since 3.2 188 * @since 3.2
189 */ 189 */
190 KLineEdit* renameLineEdit() const; 190 KLineEdit* renameLineEdit() const;
191 191
192 /** 192 /**
193 * @returns if it is legal to move items in the list view. True by default. 193 * @returns if it is legal to move items in the list view. True by default.
194 * 194 *
195 * @see #setDragEnabled() 195 * @see #setDragEnabled()
196 * @see #setItemsMovable() 196 * @see #setItemsMovable()
197 */ 197 */
198 bool itemsMovable() const; 198 bool itemsMovable() const;
199 199
200 /** 200 /**
201 * @return whether inplace-renaming has been enabled. False by default. 201 * @return whether inplace-renaming has been enabled. False by default.
202 * 202 *
203 * @see #setItemsRenameable() 203 * @see #setItemsRenameable()
204 */ 204 */
205 bool itemsRenameable() const; 205 bool itemsRenameable() const;
206 206
207 /** 207 /**
208 * @return whether dragging is enabled. False by default. 208 * @return whether dragging is enabled. False by default.
209 * 209 *
210 * @see #setDragEnabled() 210 * @see #setDragEnabled()
211 */ 211 */
212 bool dragEnabled() const; 212 bool dragEnabled() const;
213 213
214 /** 214 /**
215 * @return true if AutoOpen is enabled (not implemented currently). 215 * @return true if AutoOpen is enabled (not implemented currently).
216 * 216 *
217 * @see #setAutoOpen() 217 * @see #setAutoOpen()
218 */ 218 */
219 bool autoOpen() const; 219 bool autoOpen() const;
220 220
221 /** 221 /**
222 * @return true if @p column is renamable. 222 * @return true if @p column is renamable.
223 * 223 *
224 * @see #setRenameable() 224 * @see #setRenameable()
225 */ 225 */
226 bool isRenameable (int column) const; 226 bool isRenameable (int column) const;
227 227
228 /** 228 /**
229 * @return true if drawing of the drop-visualizer has been enabled. True by default. 229 * @return true if drawing of the drop-visualizer has been enabled. True by default.
230 * 230 *
231 * @see #setDropVisualizer() 231 * @see #setDropVisualizer()
232 */ 232 */
233 bool dropVisualizer() const; 233 bool dropVisualizer() const;
234 234
235 /** 235 /**
236 * @return the column for which tooltips are displayed (or -1 if none set). 236 * @return the column for which tooltips are displayed (or -1 if none set).
237 * 237 *
238 * @see #setTooltipColumn() 238 * @see #setTooltipColumn()
239 */ 239 */
240 int tooltipColumn() const; 240 int tooltipColumn() const;
241 241
242 /** 242 /**
243 * For future expansions. 243 * For future expansions.
244 * 244 *
245 * Do not use. 245 * Do not use.
246 * @deprecated 246 * @deprecated
247 */ 247 */
248 bool createChildren() const; 248 bool createChildren() const;
249 249
250 /** 250 /**
251 * @return true if drawing of the drop-highlighter has been enabled. False by default. 251 * @return true if drawing of the drop-highlighter has been enabled. False by default.
252 * 252 *
253 * @see #setDropHighlighter() 253 * @see #setDropHighlighter()
254 */ 254 */
255 bool dropHighlighter() const; 255 bool dropHighlighter() const;
256 256
257 /** 257 /**
258 * The dropVisualizerWidth defaults to 4. 258 * The dropVisualizerWidth defaults to 4.
259 * 259 *
260 * @see #setDropVisualizerWidth() 260 * @see #setDropVisualizerWidth()
261 * @return the current width of the drop-visualizer. 261 * @return the current width of the drop-visualizer.
262 */ 262 */
263 int dropVisualizerWidth () const; 263 int dropVisualizerWidth () const;
264 264
265 /** 265 /**
266 * @return the "extended" selection mode of this listview. 266 * @return the "extended" selection mode of this listview.
267 * 267 *
268 * @see SelectionModeExt 268 * @see SelectionModeExt
269 * @see setSelectionModeExt 269 * @see setSelectionModeExt
270 */ 270 */
271 SelectionModeExt selectionModeExt () const; 271 SelectionModeExt selectionModeExt () const;
272 272
273 /** 273 /**
274 * Returns the index of @p item within the item tree or -1 if 274 * Returns the index of @p item within the item tree or -1 if
275 * @p item doesn't exist in this list view. This function takes 275 * @p item doesn't exist in this list view. This function takes
276 * all items into account not only the visible ones. 276 * all items into account not only the visible ones.
277 */ 277 */
278 int itemIndex( const QListViewItem *item ) const; 278 int itemIndex( const QListViewItem *item ) const;
279 279
280 /** 280 /**
281 * Returns the item of @p index within the item tree or 0 if 281 * Returns the item of @p index within the item tree or 0 if
282 * @p index doesn't exist in this list view. This function takes 282 * @p index doesn't exist in this list view. This function takes
283 * all items into account not only the visible ones. 283 * all items into account not only the visible ones.
284 */ 284 */
285 QListViewItem* itemAtIndex(int index); 285 QListViewItem* itemAtIndex(int index);
286 286
287 /** 287 /**
288 * @deprecated 288 * @deprecated
289 * @see #setFullWidth() 289 * @see #setFullWidth()
290 */ 290 */
291 void setFullWidth(); 291 void setFullWidth();
292 292
293 /** 293 /**
294 * Let the last column fit exactly all the available width. 294 * Let the last column fit exactly all the available width.
295 * 295 *
296 * @see #fullWidth() 296 * @see #fullWidth()
297 */ 297 */
298 void setFullWidth(bool fullWidth); 298 void setFullWidth(bool fullWidth);
299 299
300 /** 300 /**
301 * Returns whether the last column is set to fit the available width. 301 * Returns whether the last column is set to fit the available width.
302 * 302 *
303 * @see #setFullWidth() 303 * @see #setFullWidth()
304 */ 304 */
305 bool fullWidth() const; 305 bool fullWidth() const;
306 306
307 /** 307 /**
308 * Reimplemented for full width support 308 * Reimplemented for full width support
309 * 309 *
310 * @see #removeColumn() 310 * @see #removeColumn()
311 */ 311 */
312 virtual int addColumn(const QString& label, int width = -1); 312 virtual int addColumn(const QString& label, int width = -1);
313 /** 313 /**
314 * Reimplemented for full width support 314 * Reimplemented for full width support
315 */ 315 */
316 virtual int addColumn(const QIconSet& iconset, const QString& label, int width = -1); 316 virtual int addColumn(const QIconSet& iconset, const QString& label, int width = -1);
317 /** 317 /**
318 * Reimplemented for full width support 318 * Reimplemented for full width support
319 * 319 *
320 * @see #addColumn() 320 * @see #addColumn()
321 */ 321 */
322 virtual void removeColumn(int index); 322 virtual void removeColumn(int index);
323 323
324 /** 324 /**
325 * sets the alternate background background color. 325 * sets the alternate background background color.
326 * This only has an effect if the items are KListViewItems 326 * This only has an effect if the items are KListViewItems
327 * 327 *
328 * @param c the color to use for every other item. Set to an invalid 328 * @param c the color to use for every other item. Set to an invalid
329 * colour to disable alternate colours. 329 * colour to disable alternate colours.
330 * 330 *
331 * @see #alternateBackground() 331 * @see #alternateBackground()
332 **/ 332 **/
333 void setAlternateBackground(const QColor &c); 333 void setAlternateBackground(const QColor &c);
334 /** 334 /**
335 * @return the alternate background color 335 * @return the alternate background color
336 * 336 *
337 * @see #setAlternateBackground() 337 * @see #setAlternateBackground()
338 */ 338 */
339 const QColor &alternateBackground() const; 339 const QColor &alternateBackground() const;
340 340
341 /** 341 /**
342 * Saves the list view's layout (column widtsh, column order, sort column) 342 * Saves the list view's layout (column widtsh, column order, sort column)
343 * to a KConfig group 343 * to a KConfig group
344 * 344 *
345 * @param config the @ref KConfig object to write to 345 * @param config the @ref KConfig object to write to
346 * @param group the config group to use 346 * @param group the config group to use
347 */ 347 */
348 void saveLayout(KConfig *config, const QString &group) const; 348 void saveLayout(KConfig *config, const QString &group) const;
349 /** 349 /**
350 * Reads the list view's layout from a KConfig group as stored with 350 * Reads the list view's layout from a KConfig group as stored with
351 * @ref #saveLayout 351 * @ref #saveLayout
352 * 352 *
353 * @param config the @ref KConfig object to read from 353 * @param config the @ref KConfig object to read from
354 * @param group the config group to use 354 * @param group the config group to use
355 */ 355 */
356 void restoreLayout(KConfig *config, const QString &group); 356 void restoreLayout(KConfig *config, const QString &group);
357 /** 357 /**
358 * Reimplemented to remember the current sort column and order. 358 * Reimplemented to remember the current sort column and order.
359 * @param column is the column to be sorted, or -1 to sort in order of 359 * @param column is the column to be sorted, or -1 to sort in order of
360 * insertion 360 * insertion
361 * @param whether to sort ascending (or descending) 361 * @param whether to sort ascending (or descending)
362 */ 362 */
363 virtual void setSorting(int column, bool ascending = true); 363 virtual void setSorting(int column, bool ascending = true);
364 364
365 /** 365 /**
366 * @return the currently sorted column, or -1 if none is sorted 366 * @return the currently sorted column, or -1 if none is sorted
367 */ 367 */
368 int columnSorted(void) const; 368 int columnSorted(void) const;
369 369
370 /** 370 /**
371 * @return whether the current sort is ascending (or descending) 371 * @return whether the current sort is ascending (or descending)
372 */ 372 */
373 bool ascendingSort(void) const; 373 bool ascendingSort(void) const;
374 374
375signals: 375signals:
376 376
377 /** 377 /**
378 * This signal is emitted whenever the user executes an listview item. 378 * This signal is emitted whenever the user executes an listview item.
379 * That means depending on the KDE wide Single Click/Double Click 379 * That means depending on the KDE wide Single Click/Double Click
380 * setting the user clicked or double clicked on that item. 380 * setting the user clicked or double clicked on that item.
381 * @param item is the pointer to the executed listview item. 381 * @param item is the pointer to the executed listview item.
382 * 382 *
383 * Note that you may not delete any @ref QListViewItem objects in slots 383 * Note that you may not delete any @ref QListViewItem objects in slots
384 * connected to this signal. 384 * connected to this signal.
385 */ 385 */
386 void executed( QListViewItem *item ); 386 void executed( QListViewItem *item );
387 387
388 /** 388 /**
389 * This signal is emitted whenever the user executes an listview item. 389 * This signal is emitted whenever the user executes an listview item.
390 * That means depending on the KDE wide Single Click/Double Click 390 * That means depending on the KDE wide Single Click/Double Click
391 * setting the user clicked or double clicked on that item. 391 * setting the user clicked or double clicked on that item.
392 * @param item is the pointer to the executed listview item. 392 * @param item is the pointer to the executed listview item.
393 * @param pos is the position where the user has clicked 393 * @param pos is the position where the user has clicked
394 * @param c is the column into which the user clicked. 394 * @param c is the column into which the user clicked.
395 * 395 *
396 * Note that you may not delete any @ref QListViewItem objects in slots 396 * Note that you may not delete any @ref QListViewItem objects in slots
397 * connected to this signal. 397 * connected to this signal.
398 */ 398 */
399 void executed( QListViewItem *item, const QPoint &pos, int c ); 399 void executed( QListViewItem *item, const QPoint &pos, int c );
400 400
401 /** 401 /**
402 * This signal gets emitted whenever the user double clicks into the 402 * This signal gets emitted whenever the user double clicks into the
403 * listview. 403 * listview.
404 * @param item is the pointer to the clicked listview item. 404 * @param item is the pointer to the clicked listview item.
405 * @param pos is the position where the user has clicked, and 405 * @param pos is the position where the user has clicked, and
406 * @param c is the column into which the user clicked. 406 * @param c is the column into which the user clicked.
407 * 407 *
408 * Note that you may not delete any @ref QListViewItem objects in slots 408 * Note that you may not delete any @ref QListViewItem objects in slots
409 * connected to this signal. 409 * connected to this signal.
410 * 410 *
411 * This signal is more or less here for the sake of completeness. 411 * This signal is more or less here for the sake of completeness.
412 * You should normally not need to use this. In most cases its better 412 * You should normally not need to use this. In most cases its better
413 * to use @ref #executed() instead. 413 * to use @ref #executed() instead.
414 */ 414 */
415 void doubleClicked( QListViewItem *item, const QPoint &pos, int c ); 415 void doubleClicked( QListViewItem *item, const QPoint &pos, int c );
416 void contextRequest( QListViewItem *item, const QPoint &pos, int c );
416 417
417 /** 418 /**
418 * This signal gets emitted whenever something acceptable is 419 * This signal gets emitted whenever something acceptable is
419 * dropped onto the listview. 420 * dropped onto the listview.
420 * 421 *
421 * @param e is the drop event itself (it has already been accepted) 422 * @param e is the drop event itself (it has already been accepted)
422 * @param after is the item after which the drop occured (or 0L, if 423 * @param after is the item after which the drop occured (or 0L, if
423 * the drop was above all items) 424 * the drop was above all items)
424 * 425 *
425 * @see #acceptDrop() 426 * @see #acceptDrop()
426 */ 427 */
427 void dropped (QDropEvent * e, QListViewItem *after); 428 void dropped (QDropEvent * e, QListViewItem *after);
428 429
429 /** 430 /**
430 * This signal gets emitted whenever something acceptable is 431 * This signal gets emitted whenever something acceptable is
431 * dropped onto the listview. 432 * dropped onto the listview.
432 * 433 *
433 * This is an overloaded version of the above (provided to simplify 434 * This is an overloaded version of the above (provided to simplify
434 * processing drops outside of the class). 435 * processing drops outside of the class).
435 * 436 *
436 * @param list is the listview 437 * @param list is the listview
437 * @param e is the drop event itself (it has already been accepted) 438 * @param e is the drop event itself (it has already been accepted)
438 * @param after is the item after which the drop occured (or 0L, if 439 * @param after is the item after which the drop occured (or 0L, if
439 * the drop was above all items 440 * the drop was above all items
440 */ 441 */
441 void dropped (KListView* list, QDropEvent* e, QListViewItem* after); 442 void dropped (KListView* list, QDropEvent* e, QListViewItem* after);
442 443
443 /** 444 /**
444 * This signal gets emitted whenever something acceptable is 445 * This signal gets emitted whenever something acceptable is
445 * dropped onto the listview. 446 * dropped onto the listview.
446 * 447 *
447 * This function also provides a parent, in the event that your listview 448 * This function also provides a parent, in the event that your listview
448 * is a tree 449 * is a tree
449 * @param list is the listview 450 * @param list is the listview
450 * @param e is the drop event itself (it has already been accepted) 451 * @param e is the drop event itself (it has already been accepted)
451 * @param parent the item that is to be the parent of the new item 452 * @param parent the item that is to be the parent of the new item
452 * @param after is the item after which the drop occured (or 0L, if 453 * @param after is the item after which the drop occured (or 0L, if
453 * the drop was above all items 454 * the drop was above all items
454 */ 455 */
455 void dropped (KListView* list, QDropEvent* e, QListViewItem* parent, QListViewItem* after); 456 void dropped (KListView* list, QDropEvent* e, QListViewItem* parent, QListViewItem* after);
456 457
457 /** 458 /**
458 * This signal gets emitted whenever something acceptable is 459 * This signal gets emitted whenever something acceptable is
459 * dropped onto the listview. 460 * dropped onto the listview.
460 * 461 *
461 * This function also provides a parent, in the event that your listview 462 * This function also provides a parent, in the event that your listview
462 * is a tree 463 * is a tree
463 * @param e is the drop event itself (it has already been accepted) 464 * @param e is the drop event itself (it has already been accepted)
464 * @param parent the item that is to be the parent of the new item 465 * @param parent the item that is to be the parent of the new item
465 * @param after is the item after which the drop occured (or 0L, if 466 * @param after is the item after which the drop occured (or 0L, if
466 * the drop was above all items 467 * the drop was above all items
467 */ 468 */
468 void dropped (QDropEvent* e, QListViewItem* parent, QListViewItem* after); 469 void dropped (QDropEvent* e, QListViewItem* parent, QListViewItem* after);
469 470
470 /** 471 /**
471 * This signal is emitted when ever the user moves an item in the list via 472 * This signal is emitted when ever the user moves an item in the list via
472 * DnD. 473 * DnD.
473 * If more than one item is moved at the same time, this signal is only emitted 474 * If more than one item is moved at the same time, this signal is only emitted
474 * once. 475 * once.
475 */ 476 */
476 void moved(); 477 void moved();
477 478
478 /** 479 /**
479 * Connect to this signal if you want to do some preprocessing before 480 * Connect to this signal if you want to do some preprocessing before
480 * a move is made, for example, to disable sorting 481 * a move is made, for example, to disable sorting
481 * 482 *
482 * This is sent only once per each groups of moves. That is, for each 483 * This is sent only once per each groups of moves. That is, for each
483 * drop that is a move this will be emitted once, before KListView calls 484 * drop that is a move this will be emitted once, before KListView calls
484 * @see moveItem() 485 * @see moveItem()
485 */ 486 */
486 void aboutToMove(); 487 void aboutToMove();
487 488
488 /** 489 /**
489 * This signal is emitted when ever the user moves an item in the list via 490 * This signal is emitted when ever the user moves an item in the list via
490 * DnD. 491 * DnD.
491 * If more than one item is moved at the same time, @p afterFirst and 492 * If more than one item is moved at the same time, @p afterFirst and
492 * @p afterNow will reflect what was true before the move. 493 * @p afterNow will reflect what was true before the move.
493 * This differs from @ref moved(), so be careful. All the items will have been 494 * This differs from @ref moved(), so be careful. All the items will have been
494 * moved before @ref moved() is emitted, which is not true in this method. // FIXME 495 * moved before @ref moved() is emitted, which is not true in this method. // FIXME
495 * @param item the item that was moved 496 * @param item the item that was moved
496 * @param afterFirst the item that parameter item was in before the move, in the list 497 * @param afterFirst the item that parameter item was in before the move, in the list
497 * @param afterNow the item it's currently after. 498 * @param afterNow the item it's currently after.
498 */ 499 */
499 void moved (QListViewItem *item, QListViewItem *afterFirst, QListViewItem *afterNow); 500 void moved (QListViewItem *item, QListViewItem *afterFirst, QListViewItem *afterNow);
500 501
501 502
502 /** 503 /**
503 * This signal is emitted after all the items have been moved. It reports info for 504 * This signal is emitted after all the items have been moved. It reports info for
504 * each and every item moved, in order. The first element in @p items associates 505 * each and every item moved, in order. The first element in @p items associates
505 * with the first of afterFirst and afterNow. 506 * with the first of afterFirst and afterNow.
506 */ 507 */
507 void moved(QPtrList<QListViewItem> &items, QPtrList<QListViewItem> &afterFirst, QPtrList<QListViewItem> &afterNow); 508 void moved(QPtrList<QListViewItem> &items, QPtrList<QListViewItem> &afterFirst, QPtrList<QListViewItem> &afterNow);
508 509
509 /** 510 /**
510 * This signal gets emitted when an item is renamed via in-place renaming. 511 * This signal gets emitted when an item is renamed via in-place renaming.
511 * 512 *
512 * @param item is the renamed item. 513 * @param item is the renamed item.
513 * @param str is the new value of column @p col. 514 * @param str is the new value of column @p col.
514 * @param col is the renamed column. 515 * @param col is the renamed column.
515 */ 516 */
516 void itemRenamed(QListViewItem* item, const QString &str, int col); 517 void itemRenamed(QListViewItem* item, const QString &str, int col);
517 518
518 /** 519 /**
519 * Same as above, but without the extra information. 520 * Same as above, but without the extra information.
520 */ 521 */
521 void itemRenamed(QListViewItem* item); 522 void itemRenamed(QListViewItem* item);
522 void signalDelete(); 523 void signalDelete();
523 524
524 /** 525 /**
525 * This signal is emitted when the shortcut key for popup-menus is pressed. 526 * This signal is emitted when the shortcut key for popup-menus is pressed.
526 * 527 *
527 * Normally you should not use this, just connect a slot to signal 528 * Normally you should not use this, just connect a slot to signal
528 * @ref contextMenu (KListView*, QListViewItem*, const QPoint&) to correctly 529 * @ref contextMenu (KListView*, QListViewItem*, const QPoint&) to correctly
529 * handle showing context menus regardless of settings. 530 * handle showing context menus regardless of settings.
530 * 531 *
531 * @param list is this listview. 532 * @param list is this listview.
532 * @param item is the @ref currentItem() at the time the key was pressed. May be 0L. 533 * @param item is the @ref currentItem() at the time the key was pressed. May be 0L.
533 */ 534 */
534 void menuShortCutPressed (KListView* list, QListViewItem* item); 535 void menuShortCutPressed (KListView* list, QListViewItem* item);
535 536
536 /** 537 /**
537 * This signal is emitted whenever a context-menu should be shown for item @p i. 538 * This signal is emitted whenever a context-menu should be shown for item @p i.
538 * It automatically adjusts for all settings involved (Menu key, showMenuOnPress/Click). 539 * It automatically adjusts for all settings involved (Menu key, showMenuOnPress/Click).
539 * 540 *
540 * @param l is this listview. 541 * @param l is this listview.
541 * @param i is the item for which the menu should be shown. May be 0L. 542 * @param i is the item for which the menu should be shown. May be 0L.
542 * @param p is the point at which the menu should be shown. 543 * @param p is the point at which the menu should be shown.
543 */ 544 */
544 void contextMenu (KListView* l, QListViewItem* i, const QPoint& p); 545 void contextMenu (KListView* l, QListViewItem* i, const QPoint& p);
545 546
546public slots: 547public slots:
547 /** 548 /**
548 * Rename column @p c of @p item. 549 * Rename column @p c of @p item.
549 */ 550 */
550 virtual void rename(QListViewItem *item, int c); 551 virtual void rename(QListViewItem *item, int c);
551 552
552 /** 553 /**
553 * By default, if you called setItemsRenameable(true), 554 * By default, if you called setItemsRenameable(true),
554 * only the first column is renameable. 555 * only the first column is renameable.
555 * Use this function to enable the feature on other columns. 556 * Use this function to enable the feature on other columns.
556 * 557 *
557 * If you want more intelligent (dynamic) selection, 558 * If you want more intelligent (dynamic) selection,
558 * you'll have to derive from KListView, 559 * you'll have to derive from KListView,
559 * and override @ref rename() and call only call it 560 * and override @ref rename() and call only call it
560 * if you want the item to be renamed. 561 * if you want the item to be renamed.
561 */ 562 */
562 void setRenameable (int column, bool yesno=true); 563 void setRenameable (int column, bool yesno=true);
563 564
564 /** 565 /**
565 * Set whether items in the list view can be moved. 566 * Set whether items in the list view can be moved.
566 * It is enabled by default. 567 * It is enabled by default.
567 * 568 *
568 * @see itemsMovable() 569 * @see itemsMovable()
569 */ 570 */
570 virtual void setItemsMovable(bool b); 571 virtual void setItemsMovable(bool b);
571 572
572 /** 573 /**
573 * Enables inplace-renaming of items. 574 * Enables inplace-renaming of items.
574 * It is disabled by default. 575 * It is disabled by default.
575 * 576 *
576 * @see itemsRenameable() 577 * @see itemsRenameable()
577 * @see setRenameable() 578 * @see setRenameable()
578 */ 579 */
579 virtual void setItemsRenameable(bool b); 580 virtual void setItemsRenameable(bool b);
580 581
581 /** 582 /**
582 * Enable/Disable the dragging of items. 583 * Enable/Disable the dragging of items.
583 * It is disabled by default. 584 * It is disabled by default.
584 */ 585 */
585 virtual void setDragEnabled(bool b); 586 virtual void setDragEnabled(bool b);
586 587
587 /** 588 /**
588 * Enable/Disable AutoOpen (not implemented currently). 589 * Enable/Disable AutoOpen (not implemented currently).
589 */ 590 */
590 virtual void setAutoOpen(bool b); 591 virtual void setAutoOpen(bool b);
591 592
592 /** 593 /**
593 * Enable/Disable the drawing of a drop-visualizer 594 * Enable/Disable the drawing of a drop-visualizer
594 * (a bar that shows where a dropped item would be inserted). 595 * (a bar that shows where a dropped item would be inserted).
595 * It is enabled by default, if dragging is enabled 596 * It is enabled by default, if dragging is enabled
596 */ 597 */
597 virtual void setDropVisualizer(bool b); 598 virtual void setDropVisualizer(bool b);
598 599
599 /** 600 /**
600 * Set the width of the (default) drop-visualizer. 601 * Set the width of the (default) drop-visualizer.
601 * If you don't call this method, the width is set to 4. 602 * If you don't call this method, the width is set to 4.
602 */ 603 */
603 void setDropVisualizerWidth (int w); 604 void setDropVisualizerWidth (int w);
604 605
605 /** 606 /**
606 * Set which column should be used for automatic tooltips. 607 * Set which column should be used for automatic tooltips.
607 * 608 *
608 * @param column is the column for which tooltips will be shown. 609 * @param column is the column for which tooltips will be shown.
609 * Set -1 to disable this feature. 610 * Set -1 to disable this feature.
610 */ 611 */
611 virtual void setTooltipColumn(int column); 612 virtual void setTooltipColumn(int column);
612 613
613 /** 614 /**
614 * Enable/Disable the drawing of a drop-highlighter 615 * Enable/Disable the drawing of a drop-highlighter
615 * (a rectangle around the item under the mouse cursor). 616 * (a rectangle around the item under the mouse cursor).
616 * It is disabled by default. 617 * It is disabled by default.
617 */ 618 */
618 virtual void setDropHighlighter(bool b); 619 virtual void setDropHighlighter(bool b);
619 620
620 /** 621 /**
621 * For future expansions. 622 * For future expansions.
622 * 623 *
623 * Do not use. 624 * Do not use.
624 * @deprecated 625 * @deprecated
625 */ 626 */
626 virtual void setCreateChildren(bool b); 627 virtual void setCreateChildren(bool b);
627 628
628 /** 629 /**
629 * Set the selection mode. 630 * Set the selection mode.
630 * 631 *
631 * A different name was chosen to avoid API-clashes with @ref QListView::setSelectionMode(). 632 * A different name was chosen to avoid API-clashes with @ref QListView::setSelectionMode().
632 */ 633 */
633 void setSelectionModeExt (SelectionModeExt mode); 634 void setSelectionModeExt (SelectionModeExt mode);
634 635
635 /** 636 /**
636 * Enable/disable tabbing between editable cells 637 * Enable/disable tabbing between editable cells
637 * @since 3.1 638 * @since 3.1
638 */ 639 */
639 void setTabOrderedRenaming(bool b); 640 void setTabOrderedRenaming(bool b);
640 641
641 /** 642 /**
642 * Returns whether tab ordered renaming is enabled 643 * Returns whether tab ordered renaming is enabled
643 * @since 3.1 644 * @since 3.1
644 */ 645 */
645 bool tabOrderedRenaming() const; 646 bool tabOrderedRenaming() const;
646 647
647protected: 648protected:
648 /** 649 /**
649 * Determine whether a drop on position @p p would count as 650 * Determine whether a drop on position @p p would count as
650 * being above or below the QRect @p rect. 651 * being above or below the QRect @p rect.
651 * 652 *
652 * @param rect is the rectangle we examine. 653 * @param rect is the rectangle we examine.
653 * @param p is the point located in the rectangle, p is assumed to be in 654 * @param p is the point located in the rectangle, p is assumed to be in
654 * viewport coordinates. 655 * viewport coordinates.
655 */ 656 */
656 inline bool below (const QRect& rect, const QPoint& p) 657 inline bool below (const QRect& rect, const QPoint& p)
657 { 658 {
658 return (p.y() > (rect.top() + (rect.bottom() - rect.top())/2)); 659 return (p.y() > (rect.top() + (rect.bottom() - rect.top())/2));
659 } 660 }
660 661
661 /** 662 /**
662 * An overloaded version of below(const QRect&, const QPoint&). 663 * An overloaded version of below(const QRect&, const QPoint&).
663 * 664 *
664 * It differs from the above only in what arguments it takes. 665 * It differs from the above only in what arguments it takes.
665 * 666 *
666 * @param i the item whose rect() is passed to the above function. 667 * @param i the item whose rect() is passed to the above function.
667 * @param p is translated from contents coordinates to viewport coordinates 668 * @param p is translated from contents coordinates to viewport coordinates
668 * before being passed to the above function. 669 * before being passed to the above function.
669 */ 670 */
670 inline bool below (QListViewItem* i, const QPoint& p) 671 inline bool below (QListViewItem* i, const QPoint& p)
671 { 672 {
672 return below (itemRect(i), contentsToViewport(p)); 673 return below (itemRect(i), contentsToViewport(p));
673 } 674 }
674 675
675 /** 676 /**
676 * Reimplemented to reload the alternate background in palette changes. 677 * Reimplemented to reload the alternate background in palette changes.
677 * @internal 678 * @internal
678 */ 679 */
679 virtual bool event( QEvent * ); 680 virtual bool event( QEvent * );
680 681
681 /** 682 /**
682 * Emit signal @ref #executed. 683 * Emit signal @ref #executed.
683 * @internal 684 * @internal
684 */ 685 */
685 void emitExecute( QListViewItem *item, const QPoint &pos, int c ); 686 void emitExecute( QListViewItem *item, const QPoint &pos, int c );
686 687
687 /** 688 /**
688 * Reimplemented for internal reasons. 689 * Reimplemented for internal reasons.
689 * Further reimplementations should call this function or else 690 * Further reimplementations should call this function or else
690 * some features may not work correctly. 691 * some features may not work correctly.
691 * 692 *
692 * The API is unaffected. 693 * The API is unaffected.
693 */ 694 */
694 virtual void focusInEvent(QFocusEvent* fe); 695 virtual void focusInEvent(QFocusEvent* fe);
695 696
696 /** 697 /**
697 * Reimplemented for internal reasons. 698 * Reimplemented for internal reasons.
698 * Further reimplementations should call this function or else 699 * Further reimplementations should call this function or else
699 * some features may not work correctly. 700 * some features may not work correctly.
700 * 701 *
701 * The API is unaffected. 702 * The API is unaffected.
702 */ 703 */
703 virtual void focusOutEvent( QFocusEvent *fe ); 704 virtual void focusOutEvent( QFocusEvent *fe );
704 705
705 /** 706 /**
706 * Reimplemented for internal reasons. 707 * Reimplemented for internal reasons.
707 * Further reimplementations should call this function or else 708 * Further reimplementations should call this function or else
708 * some features may not work correctly. 709 * some features may not work correctly.
709 * 710 *
710 * The API is unaffected. 711 * The API is unaffected.
711 */ 712 */
712 virtual void leaveEvent( QEvent *e ); 713 virtual void leaveEvent( QEvent *e );
713 714
714 /** 715 /**
715 * @return the tooltip for @p column of @p item. 716 * @return the tooltip for @p column of @p item.
716 */ 717 */
717 virtual QString tooltip(QListViewItem* item, int column) const; 718 virtual QString tooltip(QListViewItem* item, int column) const;
718 719
719 /** 720 /**
720 * @return whether the tooltip for @p column of @p item shall be shown at point @p pos. 721 * @return whether the tooltip for @p column of @p item shall be shown at point @p pos.
721 */ 722 */
722 virtual bool showTooltip(QListViewItem *item, const QPoint &pos, int column) const; 723 virtual bool showTooltip(QListViewItem *item, const QPoint &pos, int column) const;
723 724
724 /** 725 /**
725 * Reimplemented for internal reasons. 726 * Reimplemented for internal reasons.
726 * Further reimplementations should call this function or else 727 * Further reimplementations should call this function or else
727 * some features may not work correctly. 728 * some features may not work correctly.
728 * 729 *
729 * The API is unaffected. 730 * The API is unaffected.
730 */ 731 */
731 virtual void contentsDragMoveEvent (QDragMoveEvent *event); 732 virtual void contentsDragMoveEvent (QDragMoveEvent *event);
732 733
733 /** 734 /**
734 * Reimplemented for internal reasons. 735 * Reimplemented for internal reasons.
735 * Further reimplementations should call this function or else 736 * Further reimplementations should call this function or else
736 * some features may not work correctly. 737 * some features may not work correctly.
737 * 738 *
738 * The API is unaffected. 739 * The API is unaffected.
739 */ 740 */
740 virtual void contentsMousePressEvent( QMouseEvent *e ); 741 virtual void contentsMousePressEvent( QMouseEvent *e );
741 742
742 /** 743 /**
743 * Reimplemented for internal reasons. 744 * Reimplemented for internal reasons.
744 * Further reimplementations should call this function or else 745 * Further reimplementations should call this function or else
745 * some features may not work correctly. 746 * some features may not work correctly.
746 * 747 *
747 * The API is unaffected. 748 * The API is unaffected.
748 */ 749 */
749 virtual void contentsMouseMoveEvent( QMouseEvent *e ); 750 virtual void contentsMouseMoveEvent( QMouseEvent *e );
750 751
751 /** 752 /**
752 * Reimplemented for internal reasons. 753 * Reimplemented for internal reasons.
753 * Further reimplementations should call this function or else 754 * Further reimplementations should call this function or else
754 * some features may not work correctly. 755 * some features may not work correctly.
755 * 756 *
756 * The API is unaffected. 757 * The API is unaffected.
757 */ 758 */
758 virtual void contentsMouseDoubleClickEvent ( QMouseEvent *e ); 759 virtual void contentsMouseDoubleClickEvent ( QMouseEvent *e );
759 760
760 /** 761 /**
761 * Reimplemented for internal reasons. 762 * Reimplemented for internal reasons.
762 * Further reimplementations should call this function or else 763 * Further reimplementations should call this function or else
763 * some features may not work correctly. 764 * some features may not work correctly.
764 * 765 *
765 * The API is unaffected. 766 * The API is unaffected.
766 */ 767 */
767 virtual void contentsDragLeaveEvent (QDragLeaveEvent *event); 768 virtual void contentsDragLeaveEvent (QDragLeaveEvent *event);
768 769
769 /** 770 /**
770 * Reimplemented for internal reasons. 771 * Reimplemented for internal reasons.
771 * Further reimplementations should call this function or else 772 * Further reimplementations should call this function or else
772 * some features may not work correctly. 773 * some features may not work correctly.
773 * 774 *
774 * The API is unaffected. 775 * The API is unaffected.
775 */ 776 */
776 virtual void contentsMouseReleaseEvent (QMouseEvent*); 777 virtual void contentsMouseReleaseEvent (QMouseEvent*);
777 778
778 /** 779 /**
779 * Reimplemented for internal reasons. 780 * Reimplemented for internal reasons.
780 * Further reimplementations should call this function or else 781 * Further reimplementations should call this function or else
781 * some features may not work correctly. 782 * some features may not work correctly.
782 * 783 *
783 * The API is unaffected. 784 * The API is unaffected.
784 */ 785 */
785 virtual void contentsDropEvent (QDropEvent*); 786 virtual void contentsDropEvent (QDropEvent*);
786 787
787 /** 788 /**
788 * Reimplemented for internal reasons. 789 * Reimplemented for internal reasons.
789 * Further reimplementations should call this function or else 790 * Further reimplementations should call this function or else
790 * some features may not work correctly. 791 * some features may not work correctly.
791 * 792 *
792 * The API is unaffected. 793 * The API is unaffected.
793 */ 794 */
794 virtual void contentsDragEnterEvent (QDragEnterEvent *); 795 virtual void contentsDragEnterEvent (QDragEnterEvent *);
795 796
796 /** 797 /**
797 * @return a dragobject encoding the current selection. 798 * @return a dragobject encoding the current selection.
798 * 799 *
799 * @see setDragEnabled() 800 * @see setDragEnabled()
800 */ 801 */
801 virtual QDragObject *dragObject(); 802 virtual QDragObject *dragObject();
802 803
803 /** 804 /**
804 * @return true if the @p event provides some acceptable 805 * @return true if the @p event provides some acceptable
805 * format. 806 * format.
806 * A common mistake is to forget the "const" in your reimplementation 807 * A common mistake is to forget the "const" in your reimplementation
807 */ 808 */
808 virtual bool acceptDrag (QDropEvent* event) const; 809 virtual bool acceptDrag (QDropEvent* event) const;
809 810
810 /** 811 /**
811 * Paint the drag line. If painter is null, don't try to :) 812 * Paint the drag line. If painter is null, don't try to :)
812 * 813 *
813 * If after == 0 then the marker should be drawn at the top. 814 * If after == 0 then the marker should be drawn at the top.
814 * 815 *
815 * @return the rectangle that you painted to. 816 * @return the rectangle that you painted to.
816 */ 817 */
817 virtual QRect drawDropVisualizer (QPainter *p, QListViewItem *parent, QListViewItem *after); 818 virtual QRect drawDropVisualizer (QPainter *p, QListViewItem *parent, QListViewItem *after);
818 819
819 /** 820 /**
820 * Paint the drag rectangle. If painter is null, don't try to :) 821 * Paint the drag rectangle. If painter is null, don't try to :)
821 * 822 *
822 * 823 *
823 * @return the rectangle that you painted to. 824 * @return the rectangle that you painted to.
824 */ 825 */
825 virtual QRect drawItemHighlighter(QPainter *painter, QListViewItem *item); 826 virtual QRect drawItemHighlighter(QPainter *painter, QListViewItem *item);
826 827
827 /** 828 /**
828 * This method calls @ref dragObject() and starts the drag. 829 * This method calls @ref dragObject() and starts the drag.
829 * 830 *
830 * Reimplement it to do fancy stuff like setting a pixmap or 831 * Reimplement it to do fancy stuff like setting a pixmap or
831 * using a non-default DragMode 832 * using a non-default DragMode
832 */ 833 */
833 virtual void startDrag(); 834 virtual void startDrag();
834 835
835 /** 836 /**
836 * Reimplemented for internal reasons. 837 * Reimplemented for internal reasons.
837 * Further reimplementations should call this function or else 838 * Further reimplementations should call this function or else
838 * some features may not work correctly. 839 * some features may not work correctly.
839 * 840 *
840 * The API is unaffected. 841 * The API is unaffected.
841 */ 842 */
842 virtual void keyPressEvent (QKeyEvent*); 843 virtual void keyPressEvent (QKeyEvent*);
843 844
844 /** 845 /**
845 * Reimplemented for internal reasons. 846 * Reimplemented for internal reasons.
846 * Further reimplementations should call this function or else 847 * Further reimplementations should call this function or else
847 * some features may not work correctly. 848 * some features may not work correctly.
848 * 849 *
849 * The API is unaffected. 850 * The API is unaffected.
850 */ 851 */
851 virtual void viewportPaintEvent(QPaintEvent*); 852 virtual void viewportPaintEvent(QPaintEvent*);
852 853
853 /** 854 /**
854 * In FileManager selection mode: explicitely activate the mode 855 * In FileManager selection mode: explicitely activate the mode
855 * in which the current item is automatically selected. 856 * in which the current item is automatically selected.
856 */ 857 */
857 void activateAutomaticSelection(); 858 void activateAutomaticSelection();
858 /** 859 /**
859 * In FileManager selection mode: explicitely deactivate the mode 860 * In FileManager selection mode: explicitely deactivate the mode
860 * in which the current item is automatically selected. 861 * in which the current item is automatically selected.
861 */ 862 */
862 void deactivateAutomaticSelection(); 863 void deactivateAutomaticSelection();
863 /** 864 /**
864 * In FileManager selection mode: return whether it is currently in the mode 865 * In FileManager selection mode: return whether it is currently in the mode
865 * where the current item is selected automatically. 866 * where the current item is selected automatically.
866 * Returns false if items were selected explicitely, e.g. using the mouse. 867 * Returns false if items were selected explicitely, e.g. using the mouse.
867 */ 868 */
868 bool automaticSelection() const; 869 bool automaticSelection() const;
869 870
870 /** 871 /**
871 * Reimplemented for setFullWidth() 872 * Reimplemented for setFullWidth()
872 */ 873 */
873 virtual void viewportResizeEvent(QResizeEvent* e); 874 virtual void viewportResizeEvent(QResizeEvent* e);
874 875
875protected slots: 876protected slots:
876 /** 877 /**
877 * Update internal settings whenever the global ones change. 878 * Update internal settings whenever the global ones change.
878 * @internal 879 * @internal
879 */ 880 */
880 void slotSettingsChanged(int); 881 void slotSettingsChanged(int);
881 882
882 void slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c ); 883 void slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c );
883 void doneEditing(QListViewItem *item, int row); 884 void doneEditing(QListViewItem *item, int row);
884 885
885 /** 886 /**
886 * Repaint the rect where I was drawing the drop line. 887 * Repaint the rect where I was drawing the drop line.
887 */ 888 */
888 void cleanDropVisualizer(); 889 void cleanDropVisualizer();
889 890
890 /** 891 /**
891 * Repaint the rect where I was drawing the drop rectangle. 892 * Repaint the rect where I was drawing the drop rectangle.
892 */ 893 */
893 void cleanItemHighlighter(); 894 void cleanItemHighlighter();
894 895
895 /** 896 /**
896 * Emit the @ref contextMenu signal. This slot is for mouse actions. 897 * Emit the @ref contextMenu signal. This slot is for mouse actions.
897 */ 898 */
898 void emitContextMenu (QListViewItem*, const QPoint&, int); 899 void emitContextMenu (QListViewItem*, const QPoint&, int);
899 900
900 /** 901 /**
901 * Emit the @ref #contextMenu signal. This slot is for key presses. 902 * Emit the @ref #contextMenu signal. This slot is for key presses.
902 */ 903 */
903 void emitContextMenu (KListView*, QListViewItem*); 904 void emitContextMenu (KListView*, QListViewItem*);
904 905
905 /** 906 /**
906 * Accessory slot for AutoSelect 907 * Accessory slot for AutoSelect
907 * @internal 908 * @internal
908 */ 909 */
909 void slotOnItem( QListViewItem *item ); 910 void slotOnItem( QListViewItem *item );
910 911
911 /** 912 /**
912 * Accessory slot for AutoSelect/ChangeCursorOverItem 913 * Accessory slot for AutoSelect/ChangeCursorOverItem
913 * @internal 914 * @internal
914 */ 915 */
915 void slotOnViewport(); 916 void slotOnViewport();
916 917
917 /** 918 /**
918 * Process AutoSelection. 919 * Process AutoSelection.
919 * @internal 920 * @internal
920 */ 921 */
921 void slotAutoSelect(); 922 void slotAutoSelect();
922 923
923 void slotDragExpand(); 924 void slotDragExpand();
924 925
925 /** 926 /**
926 * Reacts to header changes in full width mode 927 * Reacts to header changes in full width mode
927 * @internal 928 * @internal
928 */ 929 */
929 void slotHeaderChanged(); 930 void slotHeaderChanged();
930 931
931protected: 932protected:
932 /** 933 /**
933 * Handle dropEvent when itemsMovable() is set to true. 934 * Handle dropEvent when itemsMovable() is set to true.
934 */ 935 */
935 virtual void movableDropEvent (QListViewItem* parent, QListViewItem* afterme); 936 virtual void movableDropEvent (QListViewItem* parent, QListViewItem* afterme);
936 937
937 /** 938 /**
938 * Where is the nearest QListViewItem that I'm going to drop? 939 * Where is the nearest QListViewItem that I'm going to drop?
939 * 940 *
940 * FIXME KDE 4.0: Make this method const so it can be called from an 941 * FIXME KDE 4.0: Make this method const so it can be called from an
941 * acceptDrag method without ugly casts 942 * acceptDrag method without ugly casts
942 */ 943 */
943 virtual void findDrop(const QPoint &pos, QListViewItem *&parent, QListViewItem *&after); 944 virtual void findDrop(const QPoint &pos, QListViewItem *&parent, QListViewItem *&after);
944 945
945 /** 946 /**
946 * A special keyPressEvent (for FileManager selection mode). 947 * A special keyPressEvent (for FileManager selection mode).
947 */ 948 */
948 void fileManagerKeyPressEvent (QKeyEvent*); 949 void fileManagerKeyPressEvent (QKeyEvent*);
949 950
950 /** 951 /**
951 * Convert the depth of an item into its indentation in pixels 952 * Convert the depth of an item into its indentation in pixels
952 */ 953 */
953 int depthToPixels( int depth ); 954 int depthToPixels( int depth );
954 955
955private: 956private:
956 class Tooltip; 957 class Tooltip;
957protected: 958protected:
958 virtual void virtual_hook( int id, void* data ); 959 virtual void virtual_hook( int id, void* data );
959private: 960private:
960 class KListViewPrivate; 961 class KListViewPrivate;
961 KListViewPrivate *d; 962 KListViewPrivate *d;
962}; 963};
963 964
964/** 965/**
965 * A listview item with support for alternate background colours. It is 966 * A listview item with support for alternate background colours. It is
966 * a drop-in replacement for @ref QListViewItem 967 * a drop-in replacement for @ref QListViewItem
967 * 968 *
968 * @short listview item with alternate background colour support 969 * @short listview item with alternate background colour support
969 */ 970 */
970class KListViewItem : public QListViewItem 971class KListViewItem : public QListViewItem
971{ 972{
972public: 973public:
973 /** 974 /**
974 * constructors. The semantics remain as in @ref QListViewItem. 975 * constructors. The semantics remain as in @ref QListViewItem.
975 * Although they accept a @ref QListViewItem as parent, please 976 * Although they accept a @ref QListViewItem as parent, please
976 * don't mix KListViewItem (or subclasses) with QListViewItem 977 * don't mix KListViewItem (or subclasses) with QListViewItem
977 * (or subclasses). 978 * (or subclasses).
978 */ 979 */
979 KListViewItem(QListView *parent); 980 KListViewItem(QListView *parent);
980 KListViewItem(QListViewItem *parent); 981 KListViewItem(QListViewItem *parent);
981 KListViewItem(QListView *parent, QListViewItem *after); 982 KListViewItem(QListView *parent, QListViewItem *after);
982 KListViewItem(QListViewItem *parent, QListViewItem *after); 983 KListViewItem(QListViewItem *parent, QListViewItem *after);
983 984
984 KListViewItem(QListView *parent, 985 KListViewItem(QListView *parent,
985 QString, QString = QString::null, 986 QString, QString = QString::null,
986 QString = QString::null, QString = QString::null, 987 QString = QString::null, QString = QString::null,
987 QString = QString::null, QString = QString::null, 988 QString = QString::null, QString = QString::null,
988 QString = QString::null, QString = QString::null); 989 QString = QString::null, QString = QString::null);
989 990
990 KListViewItem(QListViewItem *parent, 991 KListViewItem(QListViewItem *parent,
991 QString, QString = QString::null, 992 QString, QString = QString::null,
992 QString = QString::null, QString = QString::null, 993 QString = QString::null, QString = QString::null,
993 QString = QString::null, QString = QString::null, 994 QString = QString::null, QString = QString::null,
994 QString = QString::null, QString = QString::null); 995 QString = QString::null, QString = QString::null);
995 996
996 KListViewItem(QListView *parent, QListViewItem *after, 997 KListViewItem(QListView *parent, QListViewItem *after,
997 QString, QString = QString::null, 998 QString, QString = QString::null,
998 QString = QString::null, QString = QString::null, 999 QString = QString::null, QString = QString::null,
999 QString = QString::null, QString = QString::null, 1000 QString = QString::null, QString = QString::null,
1000 QString = QString::null, QString = QString::null); 1001 QString = QString::null, QString = QString::null);
1001 1002
1002 KListViewItem(QListViewItem *parent, QListViewItem *after, 1003 KListViewItem(QListViewItem *parent, QListViewItem *after,
1003 QString, QString = QString::null, 1004 QString, QString = QString::null,
1004 QString = QString::null, QString = QString::null, 1005 QString = QString::null, QString = QString::null,
1005 QString = QString::null, QString = QString::null, 1006 QString = QString::null, QString = QString::null,
1006 QString = QString::null, QString = QString::null); 1007 QString = QString::null, QString = QString::null);
1007 1008
1008 virtual ~KListViewItem(); 1009 virtual ~KListViewItem();
1009 1010
1010 /** 1011 /**
1011 * retuns true if this item is to be drawn with the alternate background 1012 * retuns true if this item is to be drawn with the alternate background
1012 */ 1013 */
1013 bool isAlternate(); 1014 bool isAlternate();
1014 /** 1015 /**
1015 * returns the background colour for this item 1016 * returns the background colour for this item
1016 */ 1017 */
1017 const QColor &backgroundColor(); 1018 const QColor &backgroundColor();
1018 1019
1019 virtual void paintCell(QPainter *p, const QColorGroup &cg, 1020 virtual void paintCell(QPainter *p, const QColorGroup &cg,
1020 int column, int width, int alignment); 1021 int column, int width, int alignment);
1021 1022
1022private: 1023private:
1023 void init(); 1024 void init();
1024 1025
1025private: 1026private:
1026 uint m_odd : 1; 1027 uint m_odd : 1;
1027 uint m_known : 1; 1028 uint m_known : 1;
1028 uint m_unused : 30; 1029 uint m_unused : 30;
1029}; 1030};
1030 1031
1031#endif 1032#endif
1032 1033
1033// vim: ts=2 sw=2 et 1034// vim: ts=2 sw=2 et