• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDE3Support

  • sources
  • kde-4.14
  • kdelibs
  • kde3support
  • kio
  • kfile
k3filetreeview.cpp
Go to the documentation of this file.
1 /* This file is part of the KDEproject
2  Copyright (C) 2000 David Faure <faure@kde.org>
3  2000 Carsten Pfeiffer <pfeiffer@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #include "k3filetreeview.h"
21 #include "kfiletreebranch.h"
22 
23 #include <Qt3Support/Q3Header>
24 #include <QtGui/QKeyEvent>
25 #include <QtCore/QTimer>
26 #include <QtCore/QDir>
27 #include <QtGui/QApplication>
28 #include <kdebug.h>
29 #include <kglobalsettings.h>
30 #include <kfileitem.h>
31 #include <kmimetype.h>
32 #include <kstandarddirs.h>
33 #include <stdlib.h>
34 #include <assert.h>
35 #include <kio/job.h>
36 #include <kio/global.h>
37 #include <kiconloader.h>
38 
39 
40 K3FileTreeView::K3FileTreeView( QWidget *parent )
41  : K3ListView( parent ),
42  m_wantOpenFolderPixmaps( true )
43 {
44  setDragEnabled(true);
45  setSelectionModeExt( K3ListView::Single );
46 
47  m_animationTimer = new QTimer( this );
48  connect( m_animationTimer, SIGNAL(timeout()),
49  this, SLOT(slotAnimation()) );
50 
51  m_currentBeforeDropItem = 0;
52  m_dropItem = 0;
53 
54  m_autoOpenTimer = new QTimer( this );
55  connect( m_autoOpenTimer, SIGNAL(timeout()),
56  this, SLOT(slotAutoOpenFolder()) );
57 
58  /* The executed-Slot only opens a path, while the expanded-Slot populates it */
59  connect( this, SIGNAL(executed(Q3ListViewItem*)),
60  this, SLOT(slotExecuted(Q3ListViewItem*)) );
61  connect( this, SIGNAL(expanded(Q3ListViewItem*)),
62  this, SLOT(slotExpanded(Q3ListViewItem*)));
63  connect( this, SIGNAL(collapsed(Q3ListViewItem*)),
64  this, SLOT(slotCollapsed(Q3ListViewItem*)));
65 
66 
67  /* connections from the konqtree widget */
68  connect( this, SIGNAL(selectionChanged()),
69  this, SLOT(slotSelectionChanged()) );
70  connect( this, SIGNAL(onItem(Q3ListViewItem*)),
71  this, SLOT(slotOnItem(Q3ListViewItem*)) );
72  connect( this, SIGNAL(itemRenamed(Q3ListViewItem*,QString,int)),
73  this, SLOT(slotItemRenamed(Q3ListViewItem*,QString,int)));
74 
75 
76  m_bDrag = false;
77  m_branches.setAutoDelete( true );
78 
79  m_openFolderPixmap = DesktopIcon( "folder-open",KIconLoader::SizeSmall,KIconLoader::ActiveState );
80 }
81 
82 K3FileTreeView::~K3FileTreeView()
83 {
84  // we must make sure that the KFileTreeViewItems are deleted _before_ the
85  // branches are deleted. Otherwise, the KFileItems would be destroyed
86  // and the KFileTreeViewItems had dangling pointers to them.
87  hide();
88  clear();
89  m_branches.clear(); // finally delete the branches and KFileItems
90 }
91 
92 
93 bool K3FileTreeView::isValidItem( Q3ListViewItem *item)
94 {
95  if (!item)
96  return false;
97  Q3PtrList<Q3ListViewItem> lst;
98  Q3ListViewItemIterator it( this );
99  while ( it.current() )
100  {
101  if ( it.current() == item )
102  return true;
103  ++it;
104  }
105  return false;
106 }
107 
108 void K3FileTreeView::contentsDragEnterEvent( QDragEnterEvent *ev )
109 {
110  if ( ! acceptDrag( ev ) )
111  {
112  ev->ignore();
113  return;
114  }
115  ev->acceptProposedAction();
116  m_currentBeforeDropItem = selectedItem();
117 
118  Q3ListViewItem *item = itemAt( contentsToViewport( ev->pos() ) );
119  if( item )
120  {
121  m_dropItem = item;
122  m_autoOpenTimer->start( (QApplication::startDragTime() * 3) / 2 );
123  }
124  else
125  {
126  m_dropItem = 0;
127 }
128 }
129 
130 void K3FileTreeView::contentsDragMoveEvent( QDragMoveEvent *e )
131 {
132  if( ! acceptDrag( e ) )
133  {
134  e->ignore();
135  return;
136  }
137  e->acceptProposedAction();
138 
139 
140  Q3ListViewItem *afterme;
141  Q3ListViewItem *parent;
142 
143  findDrop( e->pos(), parent, afterme );
144 
145  // "afterme" is 0 when aiming at a directory itself
146  Q3ListViewItem *item = afterme ? afterme : parent;
147 
148  if( item && item->isSelectable() )
149  {
150  setSelected( item, true );
151  if( item != m_dropItem ) {
152  m_autoOpenTimer->stop();
153  m_dropItem = item;
154  m_autoOpenTimer->start( (QApplication::startDragTime() * 3) / 2 );
155  }
156  }
157  else
158  {
159  m_autoOpenTimer->stop();
160  m_dropItem = 0;
161  }
162 }
163 
164 void K3FileTreeView::contentsDragLeaveEvent( QDragLeaveEvent * )
165 {
166  // Restore the current item to what it was before the dragging (#17070)
167  if ( isValidItem(m_currentBeforeDropItem) )
168  {
169  setSelected( m_currentBeforeDropItem, true );
170  ensureItemVisible( m_currentBeforeDropItem );
171  }
172  else if ( isValidItem(m_dropItem) )
173  setSelected( m_dropItem, false ); // no item selected
174  m_currentBeforeDropItem = 0;
175  m_dropItem = 0;
176 
177 }
178 
179 void K3FileTreeView::contentsDropEvent( QDropEvent *e )
180 {
181 
182  m_autoOpenTimer->stop();
183  m_dropItem = 0;
184 
185  kDebug(250) << "contentsDropEvent !";
186  if( ! acceptDrag( e ) ) {
187  e->ignore();
188  return;
189  }
190 
191  e->acceptProposedAction();
192  Q3ListViewItem *afterme;
193  Q3ListViewItem *parent;
194  findDrop(e->pos(), parent, afterme);
195 
196  //kDebug(250) << " parent=" << (parent?parent->text(0):QString())
197  // << " afterme=" << (afterme?afterme->text(0):QString()) << endl;
198 
199  if (e->source() == viewport() && itemsMovable())
200  movableDropEvent(parent, afterme);
201  else
202  {
203  emit dropped(e, afterme);
204  emit dropped(this, e, afterme);
205  emit dropped(e, parent, afterme);
206  emit dropped(this, e, parent, afterme);
207 
208  KUrl::List urls = KUrl::List::fromMimeData( e->mimeData() );
209  if ( urls.isEmpty() )
210  return;
211  emit dropped( this, e, urls );
212 
213  KUrl parentURL;
214  if( parent )
215  parentURL = static_cast<K3FileTreeViewItem*>(parent)->url();
216  else
217  // can happen when dropping above the root item
218  // Should we choose the first branch in such a case ??
219  return;
220 
221  emit dropped( urls, parentURL );
222  emit dropped( this , e, urls, parentURL );
223  }
224 }
225 
226 bool K3FileTreeView::acceptDrag(QDropEvent* e ) const
227 {
228 
229  bool ancestOK= acceptDrops();
230  // kDebug(250) << "Do accept drops: " << ancestOK;
231  ancestOK = ancestOK && itemsMovable();
232  // kDebug(250) << "acceptDrag: " << ancestOK;
233  // kDebug(250) << "canDecode: " << KUrl::List::canDecode(e->mimeData());
234  // kDebug(250) << "action: " << e->action();
235 
236  /* K3ListView::acceptDrag(e); */
237  /* this is what K3ListView does:
238  * acceptDrops() && itemsMovable() && (e->source()==viewport());
239  * ask acceptDrops and itemsMovable, but not the third
240  */
241  return ancestOK && KUrl::List::canDecode( e->mimeData() ) &&
242  // Why this test? All DnDs are one of those AFAIK (DF)
243  ( e->dropAction() == Qt::CopyAction
244  || e->dropAction() == Qt::MoveAction
245  || e->dropAction() == Qt::LinkAction );
246 }
247 
248 
249 
250 Q3DragObject * K3FileTreeView::dragObject()
251 {
252 
253  KUrl::List urls;
254  const QList<Q3ListViewItem *> fileList = selectedItems();
255  for (int i = 0; i < fileList.size(); ++i)
256  {
257  urls.append( static_cast<K3FileTreeViewItem*>(fileList.at(i))->url() );
258  }
259  QPoint hotspot;
260  QPixmap pixmap;
261  if( urls.count() > 1 ){
262  pixmap = DesktopIcon( "kmultiple", 16 );
263  }
264  if( pixmap.isNull() )
265  pixmap = currentKFileTreeViewItem()->fileItem().pixmap( 16 );
266  hotspot.setX( pixmap.width() / 2 );
267  hotspot.setY( pixmap.height() / 2 );
268 #if 0 // there is no more kurldrag, this should use urls.setInMimeData( mimeData ) instead
269  Q3DragObject* dragObject = new KUrlDrag( urls, this );
270  if( dragObject )
271  dragObject->setPixmap( pixmap, hotspot );
272  return dragObject;
273 #endif
274  return 0;
275 }
276 
277 
278 
279 void K3FileTreeView::slotCollapsed( Q3ListViewItem *item )
280 {
281  K3FileTreeViewItem *kftvi = static_cast<K3FileTreeViewItem*>(item);
282  kDebug(250) << "hit slotCollapsed";
283  if( kftvi && kftvi->isDir())
284  {
285  item->setPixmap( 0, itemIcon(kftvi));
286  }
287 }
288 
289 void K3FileTreeView::slotExpanded( Q3ListViewItem *item )
290 {
291  kDebug(250) << "slotExpanded here !";
292 
293  if( ! item ) return;
294 
295  K3FileTreeViewItem *it = static_cast<K3FileTreeViewItem*>(item);
296  KFileTreeBranch *branch = it->branch();
297 
298  /* Start the animation for the branch object */
299  if( it->isDir() && branch && item->childCount() == 0 )
300  {
301  /* check here if the branch really needs to be populated again */
302  kDebug(250 ) << "starting to open " << it->url().prettyUrl();
303  startAnimation( it );
304  bool branchAnswer = branch->populate( it->url(), it );
305  kDebug(250) << "Branches answer: " << branchAnswer;
306  if( ! branchAnswer )
307  {
308  kDebug(250) << "ERR: Could not populate!";
309  stopAnimation( it );
310  }
311  }
312 
313  /* set a pixmap 'open folder' */
314  if( it->isDir() && isOpen( item ) )
315  {
316  kDebug(250)<< "Setting open Pixmap";
317  item->setPixmap( 0, itemIcon( it )); // 0, m_openFolderPixmap );
318  }
319 }
320 
321 
322 
323 void K3FileTreeView::slotExecuted( Q3ListViewItem *item )
324 {
325  if ( !item )
326  return;
327  /* This opens the dir and causes the Expanded-slot to be called,
328  * which strolls through the children.
329  */
330  if( static_cast<K3FileTreeViewItem*>(item)->isDir())
331  {
332  item->setOpen( !item->isOpen() );
333  }
334 }
335 
336 
337 void K3FileTreeView::slotAutoOpenFolder()
338 {
339  m_autoOpenTimer->stop();
340 
341  if ( !isValidItem(m_dropItem) || m_dropItem->isOpen() )
342  return;
343 
344  m_dropItem->setOpen( true );
345  m_dropItem->repaint();
346 }
347 
348 
349 void K3FileTreeView::slotSelectionChanged()
350 {
351  if ( !m_dropItem ) // don't do this while the dragmove thing
352  {
353  }
354 }
355 
356 
357 KFileTreeBranch* K3FileTreeView::addBranch( const KUrl &path, const QString& name,
358  bool showHidden )
359 {
360  const QPixmap& folderPix = KIconLoader::global()->loadMimeTypeIcon( KMimeType::mimeType("inode/directory")->iconName(),
361  KIconLoader::Desktop, KIconLoader::SizeSmall );
362 
363  return addBranch( path, name, folderPix, showHidden);
364 }
365 
366 KFileTreeBranch* K3FileTreeView::addBranch( const KUrl &path, const QString& name,
367  const QPixmap& pix, bool showHidden )
368 {
369  kDebug(250) << "adding another root " << path.prettyUrl();
370 
371  /* Open a new branch */
372  KFileTreeBranch *newBranch = new KFileTreeBranch( this, path, name, pix,
373  showHidden );
374  return addBranch(newBranch);
375 }
376 
377 KFileTreeBranch *K3FileTreeView::addBranch(KFileTreeBranch *newBranch)
378 {
379  connect( newBranch, SIGNAL(populateFinished(K3FileTreeViewItem*)),
380  this, SLOT(slotPopulateFinished(K3FileTreeViewItem*)));
381 
382  connect( newBranch, SIGNAL( newTreeViewItems( KFileTreeBranch*,
383  const K3FileTreeViewItemList& )),
384  this, SLOT( slotNewTreeViewItems( KFileTreeBranch*,
385  const K3FileTreeViewItemList& )));
386 
387  m_branches.append( newBranch );
388  return( newBranch );
389 }
390 
391 KFileTreeBranch *K3FileTreeView::branch( const QString& searchName )
392 {
393  KFileTreeBranch *branch = 0;
394  Q3PtrListIterator<KFileTreeBranch> it( m_branches );
395 
396  while ( (branch = it.current()) != 0 ) {
397  ++it;
398  QString bname = branch->name();
399  kDebug(250) << "This is the branches name: " << bname;
400  if( bname == searchName )
401  {
402  kDebug(250) << "Found branch " << bname << " and return ptr";
403  return( branch );
404  }
405  }
406  return ( 0L );
407 }
408 
409 KFileTreeBranchList& K3FileTreeView::branches()
410 {
411  return( m_branches );
412 }
413 
414 
415 bool K3FileTreeView::removeBranch( KFileTreeBranch *branch )
416 {
417  if(m_branches.contains(branch))
418  {
419  delete (branch->root());
420  m_branches.remove( branch );
421  return true;
422  }
423  else
424  {
425  return false;
426  }
427 }
428 
429 void K3FileTreeView::setDirOnlyMode( KFileTreeBranch* branch, bool bom )
430 {
431  if( branch )
432  {
433  branch->setDirOnlyMode( bom );
434  }
435 }
436 
437 
438 void K3FileTreeView::slotPopulateFinished( K3FileTreeViewItem *it )
439 {
440  if( it && it->isDir())
441  stopAnimation( it );
442 }
443 
444 void K3FileTreeView::slotNewTreeViewItems( KFileTreeBranch* branch, const K3FileTreeViewItemList& itemList )
445 {
446  if( ! branch ) return;
447  kDebug(250) << "hitting slotNewTreeViewItems";
448 
449  /* Sometimes it happens that new items should become selected, i.e. if the user
450  * creates a new dir, he probably wants it to be selected. This can not be done
451  * right after creating the directory or file, because it takes some time until
452  * the item appears here in the treeview. Thus, the creation code sets the member
453  * m_neUrlToSelect to the required url. If this url appears here, the item becomes
454  * selected and the member nextUrlToSelect will be cleared.
455  */
456  if( ! m_nextUrlToSelect.isEmpty() )
457  {
458  K3FileTreeViewItemListIterator it( itemList );
459 
460  bool end = false;
461  for( ; !end && it.current(); ++it )
462  {
463  KUrl url = (*it)->url();
464 
465  if( m_nextUrlToSelect.equals(url, KUrl::CompareWithoutTrailingSlash )) // ignore trailing / on dirs
466  {
467  setCurrentItem( static_cast<Q3ListViewItem*>(*it) );
468  m_nextUrlToSelect = KUrl();
469  end = true;
470  }
471  }
472  }
473 }
474 
475 QPixmap K3FileTreeView::itemIcon( K3FileTreeViewItem *item, int gap ) const
476 {
477  QPixmap pix;
478  kDebug(250) << "Setting icon for column " << gap;
479 
480  if( item )
481  {
482  /* Check if it is a branch root */
483  KFileTreeBranch *brnch = item->branch();
484  if( item == brnch->root() )
485  {
486  pix = brnch->pixmap();
487  if( m_wantOpenFolderPixmaps && brnch->root()->isOpen() )
488  {
489  pix = brnch->openPixmap();
490  }
491  }
492  else
493  {
494  // TODO: different modes, user Pixmaps ?
495  pix = item->fileItem().pixmap( KIconLoader::SizeSmall ); // , KIconLoader::DefaultState);
496 
497  /* Only if it is a dir and the user wants open dir pixmap and it is open,
498  * change the fileitem's pixmap to the open folder pixmap. */
499  if( item->isDir() && m_wantOpenFolderPixmaps )
500  {
501  if( isOpen( static_cast<Q3ListViewItem*>(item)))
502  pix = m_openFolderPixmap;
503  }
504  }
505  }
506 
507  return pix;
508 }
509 
510 
511 void K3FileTreeView::slotAnimation()
512 {
513  MapCurrentOpeningFolders::Iterator it = m_mapCurrentOpeningFolders.begin();
514  MapCurrentOpeningFolders::Iterator end = m_mapCurrentOpeningFolders.end();
515  for (; it != end;)
516  {
517  K3FileTreeViewItem *item = it.key();
518  if (!isValidItem(item))
519  {
520  ++it;
521  m_mapCurrentOpeningFolders.remove(item);
522  continue;
523  }
524 
525  uint & iconNumber = it.value().iconNumber;
526  QString icon = QString::fromLatin1( it.value().iconBaseName ).append( QString::number( iconNumber ) );
527  // kDebug(250) << "Loading icon " << icon;
528  item->setPixmap( 0, DesktopIcon( icon,KIconLoader::SizeSmall,KIconLoader::ActiveState )); // KFileTreeViewFactory::instance() ) );
529 
530  iconNumber++;
531  if ( iconNumber > it.value().iconCount )
532  iconNumber = 1;
533 
534  ++it;
535  }
536 }
537 
538 
539 void K3FileTreeView::startAnimation( K3FileTreeViewItem * item, const char * iconBaseName, uint iconCount )
540 {
541  /* TODO: allow specific icons */
542  if( ! item )
543  {
544  kDebug(250) << " startAnimation Got called without valid item !";
545  return;
546  }
547 
548  m_mapCurrentOpeningFolders.insert( item,
549  AnimationInfo( iconBaseName,
550  iconCount,
551  itemIcon(item, 0) ) );
552  if ( !m_animationTimer->isActive() )
553  m_animationTimer->start( 50 );
554 }
555 
556 void K3FileTreeView::stopAnimation( K3FileTreeViewItem * item )
557 {
558  if( ! item ) return;
559 
560  kDebug(250) << "Stoping Animation !";
561 
562  MapCurrentOpeningFolders::Iterator it = m_mapCurrentOpeningFolders.find(item);
563  if ( it != m_mapCurrentOpeningFolders.end() )
564  {
565  if( item->isDir() && isOpen( item) )
566  {
567  kDebug(250) << "Setting folder open pixmap !";
568  item->setPixmap( 0, itemIcon( item ));
569  }
570  else
571  {
572  item->setPixmap( 0, it.value().originalPixmap );
573  }
574  m_mapCurrentOpeningFolders.remove( item );
575  }
576  else
577  {
578  if( item )
579  kDebug(250)<< "StopAnimation - could not find item " << item->url().prettyUrl();
580  else
581  kDebug(250)<< "StopAnimation - item is zero !";
582  }
583  if (m_mapCurrentOpeningFolders.isEmpty())
584  m_animationTimer->stop();
585 }
586 
587 K3FileTreeViewItem * K3FileTreeView::currentKFileTreeViewItem() const
588 {
589  return static_cast<K3FileTreeViewItem *>( selectedItem() );
590 }
591 
592 KUrl K3FileTreeView::currentUrl() const
593 {
594  K3FileTreeViewItem *item = currentKFileTreeViewItem();
595  if ( item )
596  return currentKFileTreeViewItem()->url();
597  else
598  return KUrl();
599 }
600 
601 void K3FileTreeView::slotOnItem( Q3ListViewItem *item )
602 {
603  K3FileTreeViewItem *i = static_cast<K3FileTreeViewItem *>( item );
604  if( i )
605  {
606  const KUrl url = i->url();
607  if ( url.isLocalFile() )
608  emit onItem( url.toLocalFile() );
609  else
610  emit onItem( url.prettyUrl() );
611  }
612 }
613 
614 void K3FileTreeView::slotItemRenamed(Q3ListViewItem* item, const QString &name, int col)
615 {
616  (void) item;
617  kDebug(250) << "Do not bother: " << name << col;
618 }
619 
620 K3FileTreeViewItem *K3FileTreeView::findItem( const QString& branchName, const QString& relUrl )
621 {
622  KFileTreeBranch *br = branch( branchName );
623  return( findItem( br, relUrl ));
624 }
625 
626 K3FileTreeViewItem *K3FileTreeView::findItem( KFileTreeBranch* brnch, const QString& relUrl )
627 {
628  K3FileTreeViewItem *ret = 0;
629  if( brnch )
630  {
631  KUrl url = brnch->rootUrl();
632 
633  if( ! relUrl.isEmpty() && QDir::isRelativePath(relUrl) )
634  {
635  QString partUrl( relUrl );
636 
637  if( partUrl.endsWith('/'))
638  partUrl.truncate( relUrl.length()-1 );
639 
640  url.addPath( partUrl );
641 
642  kDebug(250) << "assembled complete dir string " << url.prettyUrl();
643 
644  KFileItem fi = brnch->findByUrl( url );
645  if( !fi.isNull() )
646  {
647  ret =
648  const_cast<K3FileTreeViewItem *>(
649  static_cast<const K3FileTreeViewItem*>(fi.extraData(brnch)));
650  kDebug(250) << "Found item !" <<ret;
651  }
652  }
653  else
654  {
655  ret = brnch->root();
656  }
657  }
658  return( ret );
659 }
660 
661 bool K3FileTreeView::showFolderOpenPixmap() const
662 {
663  return m_wantOpenFolderPixmaps;
664 }
665 
666 void K3FileTreeView::setShowFolderOpenPixmap( bool showIt )
667 {
668  m_wantOpenFolderPixmaps = showIt;
669 }
670 
671 void K3FileTreeView::slotSetNextUrlToSelect( const KUrl &url )
672 {
673  m_nextUrlToSelect = url;
674 }
675 
678 
679 
680 #include "k3filetreeview.moc"
K3FileTreeView::setShowFolderOpenPixmap
virtual void setShowFolderOpenPixmap(bool showIt=true)
set the flag to show 'extended' folder icons on or off.
Definition: k3filetreeview.cpp:666
QDropEvent::source
QWidget * source() const
QWidget
KFileTreeBranch::openPixmap
QPixmap openPixmap() const
Definition: kfiletreebranch.cpp:125
Q3DragObject
QString::truncate
void truncate(int position)
QPixmap::width
int width() const
kdebug.h
QDropEvent::mimeData
const QMimeData * mimeData() const
DesktopIcon
QPixmap DesktopIcon(const QString &name, int force_size, int state, const QStringList &overlays)
kmimetype.h
Q3ListViewItem::childCount
int childCount() const
Q3PtrList::clear
virtual void clear()
KIconLoader::global
static KIconLoader * global()
kglobalsettings.h
QDragMoveEvent
K3FileTreeView::dragObject
virtual Q3DragObject * dragObject()
Definition: k3filetreeview.cpp:250
timeout
int timeout
KFileItem::isNull
bool isNull() const
KFileTreeBranch
This is the branch class of the K3FileTreeView, which represents one branch in the treeview...
Definition: kfiletreebranch.h:49
K3ListView::setDragEnabled
virtual void setDragEnabled(bool b)
Enable/Disable the dragging of items.
Definition: k3listview.cpp:1185
Q3DragObject::setPixmap
virtual void setPixmap(QPixmap pm)
K3FileTreeView::currentKFileTreeViewItem
K3FileTreeViewItem * currentKFileTreeViewItem() const
Definition: k3filetreeview.cpp:587
K3FileTreeView::removeBranch
virtual bool removeBranch(KFileTreeBranch *branch)
removes the branch from the treeview.
Definition: k3filetreeview.cpp:415
QList::at
const T & at(int i) const
Q3ScrollView::contentsToViewport
void contentsToViewport(int x, int y, int &vx, int &vy) const
QDropEvent::pos
const QPoint & pos() const
KDirLister::findByUrl
virtual KFileItem findByUrl(const KUrl &_url) const
K3FileTreeView::itemIcon
virtual QPixmap itemIcon(K3FileTreeViewItem *, int gap=0) const
Definition: k3filetreeview.cpp:475
Q3ListViewItem::isOpen
bool isOpen() const
kiconloader.h
KUrl::toLocalFile
QString toLocalFile(AdjustPathOption trailing=LeaveTrailingSlash) const
K3FileTreeViewItem::fileItem
KFileItem fileItem() const
Definition: k3filetreeviewitem.h:56
QWidget::icon
const QPixmap * icon() const
Q3PtrList
QPoint
K3FileTreeView::addBranch
KFileTreeBranch * addBranch(const KUrl &path, const QString &name, bool showHidden=false)
Adds a branch to the treeview item.
Definition: k3filetreeview.cpp:357
KUrl::CompareWithoutTrailingSlash
KFileTreeBranch::root
K3FileTreeViewItem * root()
Definition: kfiletreebranch.cpp:105
KUrl::List::canDecode
static bool canDecode(const QMimeData *mimeData)
QDropEvent::acceptProposedAction
void acceptProposedAction()
kDebug
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
Q3ListView::ensureItemVisible
void ensureItemVisible(const Q3ListViewItem *i)
global.h
QUrl::isEmpty
bool isEmpty() const
K3FileTreeViewItem::branch
KFileTreeBranch * branch() const
Definition: k3filetreeviewitem.h:51
KIconLoader::Desktop
K3FileTreeView::showFolderOpenPixmap
bool showFolderOpenPixmap() const
Definition: k3filetreeview.cpp:661
KUrl
K3FileTreeView::findItem
K3FileTreeViewItem * findItem(KFileTreeBranch *brnch, const QString &relUrl)
searches a branch for a K3FileTreeViewItem identified by the relative url given as second parameter...
Definition: k3filetreeview.cpp:626
Q3PtrListIterator::current
type * current() const
QList::size
int size() const
Q3ListViewItemIterator
Q3ListViewItem::setOpen
virtual void setOpen(bool o)
Q3PtrList::append
void append(const type *item)
Q3ListView::collapsed
void collapsed(Q3ListViewItem *item)
KUrl::addPath
void addPath(const QString &txt)
QString::number
QString number(int n, int base)
QList::count
int count(const T &value) const
QList::append
void append(const T &value)
Q3ListViewItem
QEvent::ignore
void ignore()
KDirLister::setDirOnlyMode
virtual void setDirOnlyMode(bool dirsOnly)
QTimer
Q3ListView::selectedItem
Q3ListViewItem * selectedItem() const
K3FileTreeView::contentsDropEvent
virtual void contentsDropEvent(QDropEvent *ev)
Reimplemented for internal reasons.
Definition: k3filetreeview.cpp:179
KUrl::List::fromMimeData
static KUrl::List fromMimeData(const QMimeData *mimeData, KUrl::MetaDataMap *metaData=0)
KIconLoader::ActiveState
K3ListView::itemsMovable
bool itemsMovable() const
K3FileTreeView::branch
KFileTreeBranch * branch(const QString &searchName)
Definition: k3filetreeview.cpp:391
Q3ListView::setCurrentItem
virtual void setCurrentItem(Q3ListViewItem *i)
K3FileTreeView::startAnimation
virtual void startAnimation(K3FileTreeViewItem *item, const char *iconBaseName="kde", uint iconCount=6)
Definition: k3filetreeview.cpp:539
QDropEvent
QList::isEmpty
bool isEmpty() const
QString::isEmpty
bool isEmpty() const
Q3ListView::itemAt
Q3ListViewItem * itemAt(const QPoint &viewPos) const
KFileItem::extraData
const void * extraData(const void *key) const
KIconLoader::loadMimeTypeIcon
QPixmap loadMimeTypeIcon(const QString &iconName, KIconLoader::Group group, int size=0, int state=KIconLoader::DefaultState, const QStringList &overlays=QStringList(), QString *path_store=0) const
K3FileTreeViewItem::isDir
bool isDir() const
Definition: k3filetreeviewitem.cpp:83
QString::endsWith
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
Q3ListView::isOpen
bool isOpen(const Q3ListViewItem *item) const
QString
QList
QWidget::hide
void hide()
QMap::end
iterator end()
K3FileTreeView::stopAnimation
virtual void stopAnimation(K3FileTreeViewItem *item)
Definition: k3filetreeview.cpp:556
QMap::begin
iterator begin()
Q3ListViewItem::key
virtual QString key(int column, bool ascending) const
K3ListView
This Widget extends the functionality of Q3ListView to honor the system wide settings for Single Clic...
Definition: k3listview.h:57
QPixmap
QWidget::acceptDrops
bool acceptDrops() const
Q3PtrListIterator
QDragMoveEvent::ignore
void ignore()
K3ListView::itemRenamed
void itemRenamed(Q3ListViewItem *item, const QString &str, int col)
This signal gets emitted when an item is renamed via in-place renaming.
K3ListView::findDrop
virtual void findDrop(const QPoint &pos, Q3ListViewItem *&parent, Q3ListViewItem *&after)
Where is the nearest Q3ListViewItem that I'm going to drop?
Definition: k3listview.cpp:1050
Q3ListView::expanded
void expanded(Q3ListViewItem *item)
QPixmap::isNull
bool isNull() const
KFileTreeBranch::name
QString name() const
Definition: kfiletreebranch.cpp:110
K3FileTreeView::acceptDrag
virtual bool acceptDrag(QDropEvent *event) const
Definition: k3filetreeview.cpp:226
K3FileTreeView::contentsDragEnterEvent
virtual void contentsDragEnterEvent(QDragEnterEvent *e)
Reimplemented for internal reasons.
Definition: k3filetreeview.cpp:108
K3FileTreeView::onItem
void onItem(const QString &)
QPixmap::height
int height() const
K3ListView::executed
void executed(Q3ListViewItem *item)
This signal is emitted whenever the user executes an listview item.
K3ListView::setSelectionModeExt
void setSelectionModeExt(SelectionModeExt mode)
Set the selection mode.
Definition: k3listview.cpp:1824
QDir::isRelativePath
bool isRelativePath(const QString &path)
K3FileTreeView::branches
KFileTreeBranchList & branches()
Definition: k3filetreeview.cpp:409
QTimer::stop
void stop()
QDragLeaveEvent
K3ListView::movableDropEvent
virtual void movableDropEvent(Q3ListViewItem *parent, Q3ListViewItem *afterme)
Handle dropEvent when itemsMovable() is set to true.
Definition: k3listview.cpp:926
job.h
KUrl::List
QApplication::startDragTime
int startDragTime()
KFileTreeBranch::populate
virtual bool populate(const KUrl &url, K3FileTreeViewItem *currItem)
populates a branch.
Definition: kfiletreebranch.cpp:540
K3FileTreeViewItem
An item for a K3FileTreeView that knows about its own KFileItem.
Definition: k3filetreeviewitem.h:41
KIconLoader::SizeSmall
QDragEnterEvent
kstandarddirs.h
K3FileTreeView::contentsDragLeaveEvent
virtual void contentsDragLeaveEvent(QDragLeaveEvent *e)
Reimplemented for internal reasons.
Definition: k3filetreeview.cpp:164
KFileTreeBranch::rootUrl
KUrl rootUrl() const
Definition: kfiletreebranch.cpp:95
Q3PtrList::contains
uint contains(const type *item) const
K3FileTreeView::setDirOnlyMode
virtual void setDirOnlyMode(KFileTreeBranch *branch, bool)
set the directory mode for branches.
Definition: k3filetreeview.cpp:429
QString::length
int length() const
QPoint::setX
void setX(int x)
QPoint::setY
void setY(int y)
QDropEvent::dropAction
Qt::DropAction dropAction() const
kfiletreebranch.h
Q3ListViewItem::repaint
void repaint() const
QString::fromLatin1
QString fromLatin1(const char *str, int size)
QTimer::start
void start(int msec)
k3filetreeview.h
K3FileTreeView::dropped
void dropped(QWidget *, QDropEvent *)
QMap::insert
iterator insert(const Key &key, const T &value)
Q3PtrList::remove
bool remove(uint index)
KUrl::url
QString url(AdjustPathOption trailing=LeaveTrailingSlash) const
QMap::isEmpty
bool isEmpty() const
QMap< K3FileTreeViewItem *, AnimationInfo >::Iterator
typedef Iterator
K3FileTreeViewItem::url
KUrl url() const
Definition: k3filetreeviewitem.cpp:73
K3ListView::Single
Definition: k3listview.h:109
Q3ListViewItem::setPixmap
virtual void setPixmap(int column, const QPixmap &pm)
K3FileTreeView::K3FileTreeView
K3FileTreeView(QWidget *parent)
Definition: k3filetreeview.cpp:40
Q3ScrollView::viewport
QWidget * viewport() const
K3FileTreeView::m_nextUrlToSelect
KUrl m_nextUrlToSelect
Definition: k3filetreeview.h:208
KUrl::isLocalFile
bool isLocalFile() const
K3FileTreeView::contentsDragMoveEvent
virtual void contentsDragMoveEvent(QDragMoveEvent *e)
Reimplemented for internal reasons.
Definition: k3filetreeview.cpp:130
K3FileTreeView::~K3FileTreeView
virtual ~K3FileTreeView()
Definition: k3filetreeview.cpp:82
QTimer::isActive
bool isActive() const
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
K3FileTreeView::currentUrl
KUrl currentUrl() const
Definition: k3filetreeview.cpp:592
K3ListView::selectedItems
QList< Q3ListViewItem * > selectedItems(bool includeHiddenItems=true) const
Definition: k3listview.cpp:1215
QObject::parent
QObject * parent() const
end
const KShortcut & end()
KUrl::equals
bool equals(const KUrl &u, const EqualsOptions &options=0) const
QMap::find
iterator find(const Key &key)
kfileitem.h
KUrl::prettyUrl
QString prettyUrl(AdjustPathOption trailing=LeaveTrailingSlash) const
Q3ListView::selectionChanged
void selectionChanged()
KFileItem
KFileItem::pixmap
QPixmap pixmap(int _size, int _state=0) const
Q3ListView::clear
virtual void clear()
K3FileTreeView::slotNewTreeViewItems
virtual void slotNewTreeViewItems(KFileTreeBranch *, const K3FileTreeViewItemList &)
Definition: k3filetreeview.cpp:444
KFileTreeBranch::pixmap
QPixmap pixmap() const
Definition: kfiletreebranch.cpp:120
QMap::remove
int remove(const Key &key)
Q3ListView::setSelected
virtual void setSelected(Q3ListViewItem *item, bool selected)
K3FileTreeView::slotSetNextUrlToSelect
virtual void slotSetNextUrlToSelect(const KUrl &url)
Definition: k3filetreeview.cpp:671
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:26:47 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDE3Support

Skip menu "KDE3Support"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal