|
Lines 17-22
Link Here
|
| 17 |
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 |
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 |
Boston, MA 02110-1301, USA. |
18 |
Boston, MA 02110-1301, USA. |
| 19 |
*/ |
19 |
*/ |
|
|
20 |
|
| 20 |
#include "config.h" |
21 |
#include "config.h" |
| 21 |
|
22 |
|
| 22 |
#include <tqdragobject.h> |
23 |
#include <tqdragobject.h> |
|
Lines 72-79
Link Here
|
| 72 |
autoSelectDelay(0), |
73 |
autoSelectDelay(0), |
| 73 |
useSmallExecuteArea(false), |
74 |
useSmallExecuteArea(false), |
| 74 |
dragOverItem(0), |
75 |
dragOverItem(0), |
| 75 |
dragDelay (TDEGlobalSettings::dndEventDelay()), |
76 |
dragDelay(TDEGlobalSettings::dndEventDelay()), |
| 76 |
editor (new TDEListViewLineEdit (listview)), |
77 |
editor(new TDEListViewLineEdit(listview)), |
| 77 |
cursorInExecuteArea(false), |
78 |
cursorInExecuteArea(false), |
| 78 |
itemsMovable (true), |
79 |
itemsMovable (true), |
| 79 |
selectedBySimpleMove(false), |
80 |
selectedBySimpleMove(false), |
|
Lines 106-111
Link Here
|
| 106 |
{ |
107 |
{ |
| 107 |
renameable.append(0); |
108 |
renameable.append(0); |
| 108 |
connect(editor, TQT_SIGNAL(done(TQListViewItem*,int)), listview, TQT_SLOT(doneEditing(TQListViewItem*,int))); |
109 |
connect(editor, TQT_SIGNAL(done(TQListViewItem*,int)), listview, TQT_SLOT(doneEditing(TQListViewItem*,int))); |
|
|
110 |
connect(editor, TQT_SIGNAL(renameNext(TQListViewItem*,int)), listview, TQT_SLOT(renameNextProxy(TQListViewItem*,int))); |
| 111 |
connect(editor, TQT_SIGNAL(renamePrev(TQListViewItem*,int)), listview, TQT_SLOT(renamePrevProxy(TQListViewItem*,int))); |
| 109 |
} |
112 |
} |
| 110 |
|
113 |
|
| 111 |
~TDEListViewPrivate () |
114 |
~TDEListViewPrivate () |
|
Lines 176-188
Link Here
|
| 176 |
|
179 |
|
| 177 |
|
180 |
|
| 178 |
TDEListViewLineEdit::TDEListViewLineEdit(TDEListView *parent) |
181 |
TDEListViewLineEdit::TDEListViewLineEdit(TDEListView *parent) |
| 179 |
: KLineEdit(parent->viewport()), item(0), col(0), p(parent) |
182 |
: KLineEdit(parent->viewport()), item(0), col(0), p(parent), m_renSett() |
| 180 |
{ |
183 |
{ |
| 181 |
setFrame( false ); |
184 |
setFrame( false ); |
| 182 |
hide(); |
185 |
hide(); |
| 183 |
connect( parent, TQT_SIGNAL( selectionChanged() ), TQT_SLOT( slotSelectionChanged() )); |
186 |
connect( parent, TQT_SIGNAL( selectionChanged() ), TQT_SLOT( slotSelectionChanged() )); |
| 184 |
connect( parent, TQT_SIGNAL( itemRemoved( TQListViewItem * ) ), |
187 |
connect( parent, TQT_SIGNAL( itemRemoved( TQListViewItem * ) ), |
| 185 |
TQT_SLOT( slotItemRemoved( TQListViewItem * ) )); |
188 |
TQT_SLOT( slotItemRemoved( TQListViewItem * ) )); |
| 186 |
} |
189 |
} |
| 187 |
|
190 |
|
| 188 |
TDEListViewLineEdit::~TDEListViewLineEdit() |
191 |
TDEListViewLineEdit::~TDEListViewLineEdit() |
|
Lines 323-359
Link Here
|
| 323 |
#undef KeyPress |
326 |
#undef KeyPress |
| 324 |
#endif |
327 |
#endif |
| 325 |
|
328 |
|
| 326 |
bool TDEListViewLineEdit::event (TQEvent *pe) |
329 |
bool TDEListViewLineEdit::event(TQEvent *pe) |
| 327 |
{ |
330 |
{ |
| 328 |
if (pe->type() == TQEvent::KeyPress) |
331 |
if (pe->type() == TQEvent::KeyPress) |
| 329 |
{ |
332 |
{ |
| 330 |
TQKeyEvent *k = (TQKeyEvent *) pe; |
333 |
TQKeyEvent *k = (TQKeyEvent*)pe; |
| 331 |
|
334 |
KKey kk(k); |
| 332 |
if ((k->key() == Qt::Key_Backtab || k->key() == Qt::Key_Tab) && |
335 |
if (m_renSett.m_useRenameSignals && |
| 333 |
p->tabOrderedRenaming() && p->itemsRenameable() && |
336 |
(m_renSett.m_SCNext.contains(kk) || m_renSett.m_SCPrev.contains(kk))) |
| 334 |
!(k->state() & ControlButton || k->state() & AltButton)) |
337 |
{ |
|
|
338 |
keyPressEvent(k); |
| 339 |
return true; |
| 340 |
} |
| 341 |
else if ((k->key() == Qt::Key_Backtab || k->key() == Qt::Key_Tab) && |
| 342 |
p->tabOrderedRenaming() && p->itemsRenameable() && |
| 343 |
!(k->state() & ControlButton || k->state() & AltButton)) |
| 335 |
{ |
344 |
{ |
| 336 |
selectNextCell(item, col, |
345 |
selectNextCell(item, col, (k->key() == Key_Tab && !(k->state() & ShiftButton))); |
| 337 |
(k->key() == Key_Tab && !(k->state() & ShiftButton))); |
|
|
| 338 |
return true; |
346 |
return true; |
| 339 |
} |
347 |
} |
| 340 |
} |
348 |
} |
| 341 |
|
|
|
| 342 |
return KLineEdit::event(pe); |
349 |
return KLineEdit::event(pe); |
| 343 |
} |
350 |
} |
| 344 |
|
351 |
|
| 345 |
void TDEListViewLineEdit::keyPressEvent(TQKeyEvent *e) |
352 |
void TDEListViewLineEdit::keyPressEvent(TQKeyEvent *e) |
| 346 |
{ |
353 |
{ |
| 347 |
if(e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) |
354 |
KKey kk(e); |
|
|
355 |
if (m_renSett.m_useRenameSignals && |
| 356 |
(m_renSett.m_SCNext.contains(kk) || m_renSett.m_SCPrev.contains(kk))) |
| 357 |
{ |
| 358 |
TQListViewItem *i=item; |
| 359 |
int c=col; |
| 360 |
terminate(true); |
| 361 |
KLineEdit::keyPressEvent(e); |
| 362 |
if (m_renSett.m_SCNext.contains(kk)) |
| 363 |
{ |
| 364 |
emit renameNext(i,c); |
| 365 |
} |
| 366 |
else |
| 367 |
{ |
| 368 |
emit renamePrev(i,c); |
| 369 |
} |
| 370 |
} |
| 371 |
else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) |
| 348 |
terminate(true); |
372 |
terminate(true); |
| 349 |
else if(e->key() == Qt::Key_Escape) |
373 |
else if(e->key() == Qt::Key_Escape) |
| 350 |
terminate(false); |
374 |
terminate(false); |
| 351 |
else if (e->key() == Qt::Key_Down || e->key() == Qt::Key_Up) |
375 |
else if (e->key() == Qt::Key_Down || e->key() == Qt::Key_Up) |
| 352 |
{ |
376 |
{ |
| 353 |
terminate(true); |
377 |
terminate(true); |
| 354 |
KLineEdit::keyPressEvent(e); |
378 |
KLineEdit::keyPressEvent(e); |
| 355 |
} |
379 |
} |
| 356 |
else |
380 |
else |
| 357 |
KLineEdit::keyPressEvent(e); |
381 |
KLineEdit::keyPressEvent(e); |
| 358 |
} |
382 |
} |
| 359 |
|
383 |
|
|
Lines 425-432
Link Here
|
| 425 |
|
449 |
|
| 426 |
|
450 |
|
| 427 |
TDEListView::TDEListView( TQWidget *parent, const char *name ) |
451 |
TDEListView::TDEListView( TQWidget *parent, const char *name ) |
| 428 |
: TQListView( parent, name ), |
452 |
: TQListView(parent, name), d(new TDEListViewPrivate(this)) |
| 429 |
d (new TDEListViewPrivate (this)) |
|
|
| 430 |
{ |
453 |
{ |
| 431 |
setDragAutoScroll(true); |
454 |
setDragAutoScroll(true); |
| 432 |
|
455 |
|
|
Lines 1416-1421
Link Here
|
| 1416 |
emit itemRenamed(item); |
1439 |
emit itemRenamed(item); |
| 1417 |
} |
1440 |
} |
| 1418 |
|
1441 |
|
|
|
1442 |
void TDEListView::renameNextProxy(TQListViewItem *item, int col) |
| 1443 |
{ |
| 1444 |
emit renameNext(item, col); |
| 1445 |
} |
| 1446 |
|
| 1447 |
void TDEListView::renamePrevProxy(TQListViewItem *item, int col) |
| 1448 |
{ |
| 1449 |
emit renamePrev(item, col); |
| 1450 |
} |
| 1451 |
|
| 1452 |
|
| 1419 |
bool TDEListView::acceptDrag(TQDropEvent* e) const |
1453 |
bool TDEListView::acceptDrag(TQDropEvent* e) const |
| 1420 |
{ |
1454 |
{ |
| 1421 |
return acceptDrops() && itemsMovable() && (e->source()==viewport()); |
1455 |
return acceptDrops() && itemsMovable() && (e->source()==viewport()); |
|
Lines 2424-2429
Link Here
|
| 2424 |
return d->useSmallExecuteArea; |
2458 |
return d->useSmallExecuteArea; |
| 2425 |
} |
2459 |
} |
| 2426 |
|
2460 |
|
|
|
2461 |
void TDEListView::setRenameSettings(const TDEListViewRenameSettings &renSett) |
| 2462 |
{ |
| 2463 |
d->editor->setRenameSettings(renSett); |
| 2464 |
} |
| 2465 |
|
| 2427 |
void TDEListView::virtual_hook( int, void* ) |
2466 |
void TDEListView::virtual_hook( int, void* ) |
| 2428 |
{ /*BASE::virtual_hook( id, data );*/ } |
2467 |
{ /*BASE::virtual_hook( id, data );*/ } |
| 2429 |
|
2468 |
|