• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdefile
 

tdeio/tdefile

  • tdeio
  • tdefile
tdediroperator.cpp
1/* This file is part of the KDE libraries
2 Copyright (C) 1999,2000 Stephan Kulow <coolo@kde.org>
3 1999,2000,2001,2002,2003 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 as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
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
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#include <unistd.h>
22
23#include <tqdir.h>
24#include <tqapplication.h>
25#include <tqdialog.h>
26#include <tqlabel.h>
27#include <tqlayout.h>
28#include <tqpushbutton.h>
29#include <tqpopupmenu.h>
30#include <tqregexp.h>
31#include <tqtimer.h>
32#include <tqvbox.h>
33
34#include <tdeaction.h>
35#include <tdeapplication.h>
36#include <kdebug.h>
37#include <kdialog.h>
38#include <kdialogbase.h>
39#include <kdirlister.h>
40#include <kinputdialog.h>
41#include <tdelocale.h>
42#include <tdemessagebox.h>
43#include <tdepopupmenu.h>
44#include <kprogress.h>
45#include <kstdaction.h>
46#include <tdeio/job.h>
47#include <tdeio/jobclasses.h>
48#include <tdeio/netaccess.h>
49#include <tdeio/previewjob.h>
50#include <tdeio/renamedlg.h>
51#include <kpropertiesdialog.h>
52#include <kservicetypefactory.h>
53#include <tdestdaccel.h>
54#include <kde_file.h>
55
56#include "config-tdefile.h"
57#include "kcombiview.h"
58#include "tdediroperator.h"
59#include "tdefiledetailview.h"
60#include "tdefileiconview.h"
61#include "tdefilepreview.h"
62#include "tdefileview.h"
63#include "tdefileitem.h"
64#include "tdefilemetapreview.h"
65
66
67template class TQPtrStack<KURL>;
68template class TQDict<KFileItem>;
69
70
71class KDirOperator::KDirOperatorPrivate
72{
73public:
74 KDirOperatorPrivate() {
75 onlyDoubleClickSelectsFiles = false;
76 progressDelayTimer = 0L;
77 dirHighlighting = false;
78 config = 0L;
79 dropOptions = 0;
80 }
81
82 ~KDirOperatorPrivate() {
83 delete progressDelayTimer;
84 }
85
86 bool dirHighlighting;
87 TQString lastURL; // used for highlighting a directory on cdUp
88 bool onlyDoubleClickSelectsFiles;
89 TQTimer *progressDelayTimer;
90 TDEActionSeparator *viewActionSeparator;
91 int dropOptions;
92
93 TDEConfig *config;
94 TQString configGroup;
95};
96
97KDirOperator::KDirOperator(const KURL& _url,
98 TQWidget *parent, const char* _name)
99 : TQWidget(parent, _name),
100 dir(0),
101 m_fileView(0),
102 progress(0)
103{
104 myPreview = 0L;
105 myMode = KFile::File;
106 m_viewKind = KFile::Simple;
107 mySorting = static_cast<TQDir::SortSpec>(TQDir::Name | TQDir::DirsFirst);
108 d = new KDirOperatorPrivate;
109
110 if (_url.isEmpty()) { // no dir specified -> current dir
111 TQString strPath = TQDir::currentDirPath();
112 strPath.append('/');
113 currUrl = KURL();
114 currUrl.setProtocol(TQString::fromLatin1("file"));
115 currUrl.setPath(strPath);
116 }
117 else {
118 currUrl = _url;
119 if ( currUrl.protocol().isEmpty() )
120 currUrl.setProtocol(TQString::fromLatin1("file"));
121
122 currUrl.addPath("/"); // make sure we have a trailing slash!
123 }
124
125 setDirLister( new KDirLister( true ) );
126
127 connect(&myCompletion, TQ_SIGNAL(match(const TQString&)),
128 TQ_SLOT(slotCompletionMatch(const TQString&)));
129
130 progress = new KProgress(this, "progress");
131 progress->adjustSize();
132 progress->move(2, height() - progress->height() -2);
133
134 d->progressDelayTimer = new TQTimer( this, "progress delay timer" );
135 connect( d->progressDelayTimer, TQ_SIGNAL( timeout() ),
136 TQ_SLOT( slotShowProgress() ));
137
138 myCompleteListDirty = false;
139
140 backStack.setAutoDelete( true );
141 forwardStack.setAutoDelete( true );
142
143 // action stuff
144 setupActions();
145 setupMenu();
146
147 setFocusPolicy(TQWidget::WheelFocus);
148}
149
150KDirOperator::~KDirOperator()
151{
152 resetCursor();
153 if ( m_fileView )
154 {
155 if ( d->config )
156 m_fileView->writeConfig( d->config, d->configGroup );
157
158 delete m_fileView;
159 m_fileView = 0L;
160 }
161
162 delete myPreview;
163 delete dir;
164 delete d;
165}
166
167
168void KDirOperator::setSorting( TQDir::SortSpec spec )
169{
170 if ( m_fileView )
171 m_fileView->setSorting( spec );
172 mySorting = spec;
173 updateSortActions();
174}
175
176void KDirOperator::resetCursor()
177{
178 TQApplication::restoreOverrideCursor();
179 progress->hide();
180}
181
182void KDirOperator::insertViewDependentActions()
183{
184 // If we have a new view actionCollection(), insert its actions
185 // into viewActionMenu.
186
187 if( !m_fileView )
188 return;
189
190 if ( (viewActionMenu->popupMenu()->count() == 0) || // Not yet initialized or...
191 (viewActionCollection != m_fileView->actionCollection()) ) // ...changed since.
192 {
193 if (viewActionCollection)
194 {
195 disconnect( viewActionCollection, TQ_SIGNAL( inserted( TDEAction * )),
196 this, TQ_SLOT( slotViewActionAdded( TDEAction * )));
197 disconnect( viewActionCollection, TQ_SIGNAL( removed( TDEAction * )),
198 this, TQ_SLOT( slotViewActionRemoved( TDEAction * )));
199 }
200
201 viewActionMenu->popupMenu()->clear();
202// viewActionMenu->insert( shortAction );
203// viewActionMenu->insert( detailedAction );
204// viewActionMenu->insert( actionSeparator );
205 viewActionMenu->insert( myActionCollection->action( "short view" ) );
206 viewActionMenu->insert( myActionCollection->action( "detailed view" ) );
207 viewActionMenu->insert( actionSeparator );
208 viewActionMenu->insert( showHiddenAction );
209// viewActionMenu->insert( myActionCollection->action( "single" ));
210 viewActionMenu->insert( separateDirsAction );
211 // Warning: adjust slotViewActionAdded() and slotViewActionRemoved()
212 // when you add/remove actions here!
213
214 viewActionCollection = m_fileView->actionCollection();
215 if (!viewActionCollection)
216 return;
217
218 if ( !viewActionCollection->isEmpty() )
219 {
220 viewActionMenu->insert( d->viewActionSeparator );
221
222 // first insert the normal actions, then the grouped ones
223 TQStringList groups = viewActionCollection->groups();
224 groups.prepend( TQString::null ); // actions without group
225 TQStringList::ConstIterator git = groups.begin();
226 TDEActionPtrList list;
227 TDEAction *sep = actionCollection()->action("separator");
228 for ( ; git != groups.end(); ++git )
229 {
230 if ( git != groups.begin() )
231 viewActionMenu->insert( sep );
232
233 list = viewActionCollection->actions( *git );
234 TDEActionPtrList::ConstIterator it = list.begin();
235 for ( ; it != list.end(); ++it )
236 viewActionMenu->insert( *it );
237 }
238 }
239
240 connect( viewActionCollection, TQ_SIGNAL( inserted( TDEAction * )),
241 TQ_SLOT( slotViewActionAdded( TDEAction * )));
242 connect( viewActionCollection, TQ_SIGNAL( removed( TDEAction * )),
243 TQ_SLOT( slotViewActionRemoved( TDEAction * )));
244 }
245}
246
247void KDirOperator::activatedMenu( const KFileItem *, const TQPoint& pos )
248{
249 setupMenu();
250 updateSelectionDependentActions();
251
252 actionMenu->popup( pos );
253}
254
255void KDirOperator::updateSelectionDependentActions()
256{
257 bool hasSelection = m_fileView && m_fileView->selectedItems() &&
258 !m_fileView->selectedItems()->isEmpty();
259 myActionCollection->action( "trash" )->setEnabled( hasSelection );
260 myActionCollection->action( "delete" )->setEnabled( hasSelection );
261 myActionCollection->action( "properties" )->setEnabled( hasSelection );
262}
263
264void KDirOperator::setPreviewWidget(const TQWidget *w)
265{
266 if(w != 0L)
267 m_viewKind = (m_viewKind | KFile::PreviewContents);
268 else
269 m_viewKind = (m_viewKind & ~KFile::PreviewContents);
270
271 delete myPreview;
272 myPreview = w;
273
274 TDEToggleAction *preview = static_cast<TDEToggleAction*>(myActionCollection->action("preview"));
275 preview->setEnabled( w != 0L );
276 preview->setChecked( w != 0L );
277 setView( static_cast<KFile::FileView>(m_viewKind) );
278}
279
280int KDirOperator::numDirs() const
281{
282 return m_fileView ? m_fileView->numDirs() : 0;
283}
284
285int KDirOperator::numFiles() const
286{
287 return m_fileView ? m_fileView->numFiles() : 0;
288}
289
290void KDirOperator::slotDetailedView()
291{
292 KFile::FileView view = static_cast<KFile::FileView>( (m_viewKind & ~KFile::Simple) | KFile::Detail );
293 setView( view );
294}
295
296void KDirOperator::slotSimpleView()
297{
298 KFile::FileView view = static_cast<KFile::FileView>( (m_viewKind & ~KFile::Detail) | KFile::Simple );
299 setView( view );
300}
301
302void KDirOperator::slotToggleHidden( bool show )
303{
304 dir->setShowingDotFiles( show );
305 updateDir();
306 if ( m_fileView )
307 m_fileView->listingCompleted();
308}
309
310void KDirOperator::slotSeparateDirs()
311{
312 if (separateDirsAction->isChecked())
313 {
314 KFile::FileView view = static_cast<KFile::FileView>( m_viewKind | KFile::SeparateDirs );
315 setView( view );
316 }
317 else
318 {
319 KFile::FileView view = static_cast<KFile::FileView>( m_viewKind & ~KFile::SeparateDirs );
320 setView( view );
321 }
322}
323
324void KDirOperator::slotDefaultPreview()
325{
326 m_viewKind = m_viewKind | KFile::PreviewContents;
327 if ( !myPreview ) {
328 myPreview = new KFileMetaPreview( this );
329 (static_cast<TDEToggleAction*>( myActionCollection->action("preview") ))->setChecked(true);
330 }
331
332 setView( static_cast<KFile::FileView>(m_viewKind) );
333}
334
335void KDirOperator::slotSortByName()
336{
337 int sorting = (m_fileView->sorting()) & ~TQDir::SortByMask;
338 m_fileView->setSorting( static_cast<TQDir::SortSpec>( sorting | TQDir::Name ));
339 mySorting = m_fileView->sorting();
340 caseInsensitiveAction->setEnabled( true );
341}
342
343void KDirOperator::slotSortBySize()
344{
345 int sorting = (m_fileView->sorting()) & ~TQDir::SortByMask;
346 m_fileView->setSorting( static_cast<TQDir::SortSpec>( sorting | TQDir::Size ));
347 mySorting = m_fileView->sorting();
348 caseInsensitiveAction->setEnabled( false );
349}
350
351void KDirOperator::slotSortByDate()
352{
353 int sorting = (m_fileView->sorting()) & ~TQDir::SortByMask;
354 m_fileView->setSorting( static_cast<TQDir::SortSpec>( sorting | TQDir::Time ));
355 mySorting = m_fileView->sorting();
356 caseInsensitiveAction->setEnabled( false );
357}
358
359void KDirOperator::slotSortReversed()
360{
361 if ( m_fileView )
362 m_fileView->sortReversed();
363}
364
365void KDirOperator::slotToggleDirsFirst()
366{
367 TQDir::SortSpec sorting = m_fileView->sorting();
368 if ( !KFile::isSortDirsFirst( sorting ) )
369 m_fileView->setSorting( static_cast<TQDir::SortSpec>( sorting | TQDir::DirsFirst ));
370 else
371 m_fileView->setSorting( static_cast<TQDir::SortSpec>( sorting & ~TQDir::DirsFirst));
372 mySorting = m_fileView->sorting();
373}
374
375void KDirOperator::slotToggleIgnoreCase()
376{
377 TQDir::SortSpec sorting = m_fileView->sorting();
378 if ( !KFile::isSortCaseInsensitive( sorting ) )
379 m_fileView->setSorting( static_cast<TQDir::SortSpec>( sorting | TQDir::IgnoreCase ));
380 else
381 m_fileView->setSorting( static_cast<TQDir::SortSpec>( sorting & ~TQDir::IgnoreCase));
382 mySorting = m_fileView->sorting();
383}
384
385void KDirOperator::mkdir()
386{
387 bool ok;
388 TQString where = url().pathOrURL();
389 TQString name = i18n( "New Folder" );
390 if ( url().isLocalFile() && TQFileInfo( url().path(+1) + name ).exists() )
391 name = TDEIO::RenameDlg::suggestName( url(), name );
392
393 TQString dir = KInputDialog::getText( i18n( "New Folder" ),
394 i18n( "Create new folder in:\n%1" ).arg( where ),
395 name, &ok, this);
396 if (ok)
397 mkdir( TDEIO::encodeFileName( dir ), true );
398}
399
400bool KDirOperator::mkdir( const TQString& directory, bool enterDirectory )
401{
402 // Creates "directory", relative to the current directory (currUrl).
403 // The given path may contain any number directories, existant or not.
404 // They will all be created, if possible.
405
406 bool writeOk = false;
407 bool exists = false;
408 KURL url( currUrl );
409
410 TQStringList dirs = TQStringList::split( TQDir::separator(), directory );
411 TQStringList::ConstIterator it = dirs.begin();
412
413 for ( ; it != dirs.end(); ++it )
414 {
415 url.addPath( *it );
416 exists = TDEIO::NetAccess::exists( url, false, 0 );
417 writeOk = !exists && TDEIO::NetAccess::mkdir( url, topLevelWidget() );
418 }
419
420 if ( exists ) // url was already existant
421 {
422 KMessageBox::sorry(viewWidget(), i18n("A file or folder named %1 already exists.").arg(url.pathOrURL()));
423 enterDirectory = false;
424 }
425 else if ( !writeOk ) {
426 KMessageBox::sorry(viewWidget(), i18n("You do not have permission to "
427 "create that folder." ));
428 }
429 else if ( enterDirectory ) {
430 setURL( url, true );
431 }
432
433 return writeOk;
434}
435
436TDEIO::DeleteJob * KDirOperator::del( const KFileItemList& items,
437 bool ask, bool showProgress )
438{
439 return del( items, this, ask, showProgress );
440}
441
442TDEIO::DeleteJob * KDirOperator::del( const KFileItemList& items,
443 TQWidget *parent,
444 bool ask, bool showProgress )
445{
446 if ( items.isEmpty() ) {
447 KMessageBox::information( parent,
448 i18n("You did not select a file to delete."),
449 i18n("Nothing to Delete") );
450 return 0L;
451 }
452
453 KURL::List urls;
454 TQStringList files;
455 KFileItemListIterator it( items );
456
457 for ( ; it.current(); ++it ) {
458 KURL url = (*it)->url();
459 urls.append( url );
460 if ( url.isLocalFile() )
461 files.append( url.path() );
462 else
463 files.append( url.prettyURL() );
464 }
465
466 bool doIt = !ask;
467 if ( ask ) {
468 int ret;
469 if ( items.count() == 1 ) {
470 ret = KMessageBox::warningContinueCancel( parent,
471 i18n( "<qt>Do you really want to delete\n <b>'%1'</b>?</qt>" )
472 .arg( files.first() ),
473 i18n("Delete File"),
474 KStdGuiItem::del(), "AskForDelete" );
475 }
476 else
477 ret = KMessageBox::warningContinueCancelList( parent,
478 i18n("Do you really want to delete this item?", "Do you really want to delete these %n items?", items.count() ),
479 files,
480 i18n("Delete Files"),
481 KStdGuiItem::del(), "AskForDelete" );
482 doIt = (ret == KMessageBox::Continue);
483 }
484
485 if ( doIt ) {
486 TDEIO::DeleteJob *job = TDEIO::del( urls, false, showProgress );
487 job->setWindow (topLevelWidget());
488 job->setAutoErrorHandlingEnabled( true, parent );
489 return job;
490 }
491
492 return 0L;
493}
494
495void KDirOperator::deleteSelected()
496{
497 if ( !m_fileView )
498 return;
499
500 const KFileItemList *list = m_fileView->selectedItems();
501 if ( list )
502 del( *list );
503}
504
505TDEIO::CopyJob * KDirOperator::trash( const KFileItemList& items,
506 TQWidget *parent,
507 bool ask, bool showProgress )
508{
509 if ( items.isEmpty() ) {
510 KMessageBox::information( parent,
511 i18n("You did not select a file to trash."),
512 i18n("Nothing to Trash") );
513 return 0L;
514 }
515
516 KURL::List urls;
517 TQStringList files;
518 KFileItemListIterator it( items );
519
520 for ( ; it.current(); ++it ) {
521 KURL url = (*it)->url();
522 urls.append( url );
523 if ( url.isLocalFile() )
524 files.append( url.path() );
525 else
526 files.append( url.prettyURL() );
527 }
528
529 bool doIt = !ask;
530 if ( ask ) {
531 int ret;
532 if ( items.count() == 1 ) {
533 ret = KMessageBox::warningContinueCancel( parent,
534 i18n( "<qt>Do you really want to trash\n <b>'%1'</b>?</qt>" )
535 .arg( files.first() ),
536 i18n("Trash File"),
537 KGuiItem(i18n("to trash", "&Trash"),"edittrash"), "AskForTrash" );
538 }
539 else
540 ret = KMessageBox::warningContinueCancelList( parent,
541 i18n("translators: not called for n == 1", "Do you really want to trash these %n items?", items.count() ),
542 files,
543 i18n("Trash Files"),
544 KGuiItem(i18n("to trash", "&Trash"),"edittrash"), "AskForTrash" );
545 doIt = (ret == KMessageBox::Continue);
546 }
547
548 if ( doIt ) {
549 TDEIO::CopyJob *job = TDEIO::trash( urls, showProgress );
550 job->setWindow (topLevelWidget());
551 job->setAutoErrorHandlingEnabled( true, parent );
552 return job;
553 }
554
555 return 0L;
556}
557
558void KDirOperator::trashSelected(TDEAction::ActivationReason reason, TQt::ButtonState state)
559{
560 if ( !m_fileView )
561 return;
562
563 if ( reason == TDEAction::PopupMenuActivation && ( state & ShiftButton ) ) {
564 deleteSelected();
565 return;
566 }
567
568 const KFileItemList *list = m_fileView->selectedItems();
569 if ( list )
570 trash( *list, this );
571}
572
573void KDirOperator::close()
574{
575 resetCursor();
576 pendingMimeTypes.clear();
577 myCompletion.clear();
578 myDirCompletion.clear();
579 myCompleteListDirty = true;
580 dir->stop();
581}
582
583void KDirOperator::checkPath(const TQString &, bool /*takeFiles*/) // SLOT
584{
585#if 0
586 // copy the argument in a temporary string
587 TQString text = _txt;
588 // it's unlikely to happen, that at the beginning are spaces, but
589 // for the end, it happens quite often, I guess.
590 text = text.stripWhiteSpace();
591 // if the argument is no URL (the check is quite fragil) and it's
592 // no absolute path, we add the current directory to get a correct url
593 if (text.find(':') < 0 && text[0] != '/')
594 text.insert(0, currUrl);
595
596 // in case we have a selection defined and someone patched the file-
597 // name, we check, if the end of the new name is changed.
598 if (!selection.isNull()) {
599 int position = text.findRev('/');
600 ASSERT(position >= 0); // we already inserted the current dir in case
601 TQString filename = text.mid(position + 1, text.length());
602 if (filename != selection)
603 selection = TQString::null;
604 }
605
606 KURL u(text); // I have to take care of entered URLs
607 bool filenameEntered = false;
608
609 if (u.isLocalFile()) {
610 // the empty path is kind of a hack
611 KFileItem i("", u.path());
612 if (i.isDir())
613 setURL(text, true);
614 else {
615 if (takeFiles)
616 if (acceptOnlyExisting && !i.isFile())
617 warning("you entered an invalid URL");
618 else
619 filenameEntered = true;
620 }
621 } else
622 setURL(text, true);
623
624 if (filenameEntered) {
625 filename_ = u.url();
626 emit fileSelected(filename_);
627
628 TQApplication::restoreOverrideCursor();
629
630 accept();
631 }
632#endif
633 kdDebug(tdefile_area) << "TODO KDirOperator::checkPath()" << endl;
634}
635
636void KDirOperator::setURL(const KURL& _newurl, bool clearforward)
637{
638 KURL newurl;
639
640 if ( !_newurl.isValid() )
641 newurl.setPath( TQDir::homeDirPath() );
642 else
643 newurl = _newurl;
644
645 TQString pathstr = newurl.path(+1);
646 newurl.setPath(pathstr);
647
648 // already set
649 if ( newurl.equals( currUrl, true ) )
650 return;
651
652 if ( !isReadable( newurl ) ) {
653 // maybe newurl is a file? check its parent directory
654 newurl.cd(TQString::fromLatin1(".."));
655 if ( !isReadable( newurl ) ) {
656 resetCursor();
657 KMessageBox::error(viewWidget(),
658 i18n("The specified folder does not exist "
659 "or was not readable."));
660 return;
661 }
662 }
663
664 if (clearforward) {
665 // autodelete should remove this one
666 backStack.push(new KURL(currUrl));
667 forwardStack.clear();
668 }
669
670 d->lastURL = currUrl.url(-1);
671 currUrl = newurl;
672
673 pathChanged();
674 emit urlEntered(newurl);
675
676 // enable/disable actions
677 forwardAction->setEnabled( !forwardStack.isEmpty() );
678 backAction->setEnabled( !backStack.isEmpty() );
679 upAction->setEnabled( !isRoot() );
680
681 openURL( newurl );
682}
683
684void KDirOperator::updateDir()
685{
686 dir->emitChanges();
687 if ( m_fileView )
688 m_fileView->listingCompleted();
689}
690
691void KDirOperator::rereadDir()
692{
693 pathChanged();
694 openURL( currUrl, false, true );
695}
696
697
698bool KDirOperator::openURL( const KURL& url, bool keep, bool reload )
699{
700 bool result = dir->openURL( url, keep, reload );
701 if ( !result ) // in that case, neither completed() nor canceled() will be emitted by KDL
702 slotCanceled();
703
704 return result;
705}
706
707// Protected
708void KDirOperator::pathChanged()
709{
710 if (!m_fileView)
711 return;
712
713 pendingMimeTypes.clear();
714 m_fileView->clear();
715 myCompletion.clear();
716 myDirCompletion.clear();
717
718 // it may be, that we weren't ready at this time
719 TQApplication::restoreOverrideCursor();
720
721 // when TDEIO::Job emits finished, the slot will restore the cursor
722 TQApplication::setOverrideCursor( TQt::waitCursor );
723
724 if ( !isReadable( currUrl )) {
725 KMessageBox::error(viewWidget(),
726 i18n("The specified folder does not exist "
727 "or was not readable."));
728 if (backStack.isEmpty())
729 home();
730 else
731 back();
732 }
733}
734
735void KDirOperator::slotRedirected( const KURL& newURL )
736{
737 currUrl = newURL;
738 pendingMimeTypes.clear();
739 myCompletion.clear();
740 myDirCompletion.clear();
741 myCompleteListDirty = true;
742 emit urlEntered( newURL );
743}
744
745// Code pinched from kfm then hacked
746void KDirOperator::back()
747{
748 if ( backStack.isEmpty() )
749 return;
750
751 forwardStack.push( new KURL(currUrl) );
752
753 KURL *s = backStack.pop();
754
755 setURL(*s, false);
756 delete s;
757}
758
759// Code pinched from kfm then hacked
760void KDirOperator::forward()
761{
762 if ( forwardStack.isEmpty() )
763 return;
764
765 backStack.push(new KURL(currUrl));
766
767 KURL *s = forwardStack.pop();
768 setURL(*s, false);
769 delete s;
770}
771
772KURL KDirOperator::url() const
773{
774 return currUrl;
775}
776
777void KDirOperator::cdUp()
778{
779 KURL tmp(currUrl);
780 tmp.cd(TQString::fromLatin1(".."));
781 setURL(tmp, true);
782}
783
784void KDirOperator::home()
785{
786 KURL u;
787 u.setPath( TQDir::homeDirPath() );
788 setURL(u, true);
789}
790
791void KDirOperator::clearFilter()
792{
793 dir->setNameFilter( TQString::null );
794 dir->clearMimeFilter();
795 checkPreviewSupport();
796}
797
798void KDirOperator::setNameFilter(const TQString& filter)
799{
800 dir->setNameFilter(filter);
801 checkPreviewSupport();
802}
803
804void KDirOperator::setMimeFilter( const TQStringList& mimetypes )
805{
806 dir->setMimeFilter( mimetypes );
807 checkPreviewSupport();
808}
809
810bool KDirOperator::checkPreviewSupport()
811{
812 TDEToggleAction *previewAction = static_cast<TDEToggleAction*>( myActionCollection->action( "preview" ));
813
814 bool hasPreviewSupport = false;
815 TDEConfig *kc = TDEGlobal::config();
816 TDEConfigGroupSaver cs( kc, ConfigGroup );
817 if ( kc->readBoolEntry( "Show Default Preview", true ) )
818 hasPreviewSupport = checkPreviewInternal();
819
820 previewAction->setEnabled( hasPreviewSupport );
821 return hasPreviewSupport;
822}
823
824bool KDirOperator::checkPreviewInternal() const
825{
826 TQStringList supported = TDEIO::PreviewJob::supportedMimeTypes();
827 // no preview support for directories?
828 if ( dirOnlyMode() && supported.findIndex( "inode/directory" ) == -1 )
829 return false;
830
831 TQStringList mimeTypes = dir->mimeFilters();
832 TQStringList nameFilter = TQStringList::split( " ", dir->nameFilter() );
833
834 if ( mimeTypes.isEmpty() && nameFilter.isEmpty() && !supported.isEmpty() )
835 return true;
836 else {
837 TQRegExp r;
838 r.setWildcard( true ); // the "mimetype" can be "image/*"
839
840 if ( !mimeTypes.isEmpty() ) {
841 TQStringList::Iterator it = supported.begin();
842
843 for ( ; it != supported.end(); ++it ) {
844 r.setPattern( *it );
845
846 TQStringList result = mimeTypes.grep( r );
847 if ( !result.isEmpty() ) { // matches! -> we want previews
848 return true;
849 }
850 }
851 }
852
853 if ( !nameFilter.isEmpty() ) {
854 // find the mimetypes of all the filter-patterns and
855 KServiceTypeFactory *fac = KServiceTypeFactory::self();
856 TQStringList::Iterator it1 = nameFilter.begin();
857 for ( ; it1 != nameFilter.end(); ++it1 ) {
858 if ( (*it1) == "*" ) {
859 return true;
860 }
861
862 KMimeType *mt = fac->findFromPattern( *it1 );
863 if ( !mt )
864 continue;
865 TQString mime = mt->name();
866 delete mt;
867
868 // the "mimetypes" we get from the PreviewJob can be "image/*"
869 // so we need to check in wildcard mode
870 TQStringList::Iterator it2 = supported.begin();
871 for ( ; it2 != supported.end(); ++it2 ) {
872 r.setPattern( *it2 );
873 if ( r.search( mime ) != -1 ) {
874 return true;
875 }
876 }
877 }
878 }
879 }
880
881 return false;
882}
883
884KFileView* KDirOperator::createView( TQWidget* parent, KFile::FileView view )
885{
886 KFileView* new_view = 0L;
887 bool separateDirs = KFile::isSeparateDirs( view );
888 bool preview = ( KFile::isPreviewInfo(view) || KFile::isPreviewContents( view ) );
889
890 if ( separateDirs || preview ) {
891 KCombiView *combi = 0L;
892 if (separateDirs)
893 {
894 combi = new KCombiView( parent, "combi view" );
895 combi->setOnlyDoubleClickSelectsFiles(d->onlyDoubleClickSelectsFiles);
896 }
897
898 KFileView* v = 0L;
899 if ( KFile::isSimpleView( view ) )
900 v = createView( combi, KFile::Simple );
901 else
902 v = createView( combi, KFile::Detail );
903
904 v->setOnlyDoubleClickSelectsFiles(d->onlyDoubleClickSelectsFiles);
905
906 if (combi)
907 combi->setRight( v );
908
909 if (preview)
910 {
911 KFilePreview* pView = new KFilePreview( combi ? combi : v, parent, "preview" );
912 pView->setOnlyDoubleClickSelectsFiles(d->onlyDoubleClickSelectsFiles);
913 new_view = pView;
914 }
915 else
916 new_view = combi;
917 }
918 else if ( KFile::isDetailView( view ) && !preview ) {
919 new_view = new KFileDetailView( parent, "detail view");
920 new_view->setViewName( i18n("Detailed View") );
921 }
922 else /* if ( KFile::isSimpleView( view ) && !preview ) */ {
923 KFileIconView *iconView = new KFileIconView( parent, "simple view");
924 new_view = iconView;
925 new_view->setViewName( i18n("Short View") );
926 }
927
928 new_view->widget()->setAcceptDrops(acceptDrops());
929 return new_view;
930}
931
932void KDirOperator::setAcceptDrops(bool b)
933{
934 if (m_fileView)
935 m_fileView->widget()->setAcceptDrops(b);
936 TQWidget::setAcceptDrops(b);
937}
938
939void KDirOperator::setDropOptions(int options)
940{
941 d->dropOptions = options;
942 if (m_fileView)
943 m_fileView->setDropOptions(options);
944}
945
946void KDirOperator::setView( KFile::FileView view )
947{
948 bool separateDirs = KFile::isSeparateDirs( view );
949 bool preview=( KFile::isPreviewInfo(view) || KFile::isPreviewContents( view ) );
950
951 if (view == KFile::Default) {
952 if ( KFile::isDetailView( (KFile::FileView) defaultView ) )
953 view = KFile::Detail;
954 else
955 view = KFile::Simple;
956
957 separateDirs = KFile::isSeparateDirs( static_cast<KFile::FileView>(defaultView) );
958 preview = ( KFile::isPreviewInfo( static_cast<KFile::FileView>(defaultView) ) ||
959 KFile::isPreviewContents( static_cast<KFile::FileView>(defaultView) ) )
960 && myActionCollection->action("preview")->isEnabled();
961
962 if ( preview ) { // instantiates KFileMetaPreview and calls setView()
963 m_viewKind = defaultView;
964 slotDefaultPreview();
965 return;
966 }
967 else if ( !separateDirs )
968 separateDirsAction->setChecked(true);
969 }
970
971 // if we don't have any files, we can't separate dirs from files :)
972 if ( (mode() & KFile::File) == 0 &&
973 (mode() & KFile::Files) == 0 ) {
974 separateDirs = false;
975 separateDirsAction->setEnabled( false );
976 }
977
978 m_viewKind = static_cast<int>(view) | (separateDirs ? KFile::SeparateDirs : 0);
979 view = static_cast<KFile::FileView>(m_viewKind);
980
981 KFileView *new_view = createView( this, view );
982 if ( preview ) {
983 // we keep the preview-_widget_ around, but not the KFilePreview.
984 // KFilePreview::setPreviewWidget handles the reparenting for us
985 static_cast<KFilePreview*>(new_view)->setPreviewWidget(myPreview, url());
986 }
987
988 setView( new_view );
989}
990
991
992void KDirOperator::connectView(KFileView *view)
993{
994 // TODO: do a real timer and restart it after that
995 pendingMimeTypes.clear();
996 bool listDir = true;
997
998 if ( dirOnlyMode() )
999 view->setViewMode(KFileView::Directories);
1000 else
1001 view->setViewMode(KFileView::All);
1002
1003 if ( myMode & KFile::Files )
1004 view->setSelectionMode( KFile::Extended );
1005 else
1006 view->setSelectionMode( KFile::Single );
1007
1008 if (m_fileView)
1009 {
1010 if ( d->config ) // save and restore the views' configuration
1011 {
1012 m_fileView->writeConfig( d->config, d->configGroup );
1013 view->readConfig( d->config, d->configGroup );
1014 }
1015
1016 // transfer the state from old view to new view
1017 view->clear();
1018 view->addItemList( *m_fileView->items() );
1019 listDir = false;
1020
1021 if ( m_fileView->widget()->hasFocus() )
1022 view->widget()->setFocus();
1023
1024 KFileItem *oldCurrentItem = m_fileView->currentFileItem();
1025 if ( oldCurrentItem ) {
1026 view->setCurrentItem( oldCurrentItem );
1027 view->setSelected( oldCurrentItem, false );
1028 view->ensureItemVisible( oldCurrentItem );
1029 }
1030
1031 const KFileItemList *oldSelected = m_fileView->selectedItems();
1032 if ( !oldSelected->isEmpty() ) {
1033 KFileItemListIterator it( *oldSelected );
1034 for ( ; it.current(); ++it )
1035 view->setSelected( it.current(), true );
1036 }
1037
1038 m_fileView->widget()->hide();
1039 delete m_fileView;
1040 }
1041
1042 else
1043 {
1044 if ( d->config )
1045 view->readConfig( d->config, d->configGroup );
1046 }
1047
1048 m_fileView = view;
1049 m_fileView->setDropOptions(d->dropOptions);
1050 viewActionCollection = 0L;
1051 KFileViewSignaler *sig = view->signaler();
1052
1053 connect(sig, TQ_SIGNAL( activatedMenu(const KFileItem *, const TQPoint& ) ),
1054 this, TQ_SLOT( activatedMenu(const KFileItem *, const TQPoint& )));
1055 connect(sig, TQ_SIGNAL( dirActivated(const KFileItem *) ),
1056 this, TQ_SLOT( selectDir(const KFileItem*) ) );
1057 connect(sig, TQ_SIGNAL( fileSelected(const KFileItem *) ),
1058 this, TQ_SLOT( selectFile(const KFileItem*) ) );
1059 connect(sig, TQ_SIGNAL( fileHighlighted(const KFileItem *) ),
1060 this, TQ_SLOT( highlightFile(const KFileItem*) ));
1061 connect(sig, TQ_SIGNAL( sortingChanged( TQDir::SortSpec ) ),
1062 this, TQ_SLOT( slotViewSortingChanged( TQDir::SortSpec )));
1063 connect(sig, TQ_SIGNAL( dropped(const KFileItem *, TQDropEvent*, const KURL::List&) ),
1064 this, TQ_SIGNAL( dropped(const KFileItem *, TQDropEvent*, const KURL::List&)) );
1065
1066 if ( reverseAction->isChecked() != m_fileView->isReversed() )
1067 slotSortReversed();
1068
1069 updateViewActions();
1070 m_fileView->widget()->resize(size());
1071 m_fileView->widget()->show();
1072
1073 if ( listDir ) {
1074 TQApplication::setOverrideCursor( TQt::waitCursor );
1075 openURL( currUrl );
1076 }
1077 else
1078 view->listingCompleted();
1079}
1080
1081KFile::Mode KDirOperator::mode() const
1082{
1083 return myMode;
1084}
1085
1086void KDirOperator::setMode(KFile::Mode m)
1087{
1088 if (myMode == m)
1089 return;
1090
1091 myMode = m;
1092
1093 dir->setDirOnlyMode( dirOnlyMode() );
1094
1095 // reset the view with the different mode
1096 setView( static_cast<KFile::FileView>(m_viewKind) );
1097}
1098
1099void KDirOperator::setView(KFileView *view)
1100{
1101 if ( view == m_fileView ) {
1102 return;
1103 }
1104
1105 setFocusProxy(view->widget());
1106 view->setSorting( mySorting );
1107 view->setOnlyDoubleClickSelectsFiles( d->onlyDoubleClickSelectsFiles );
1108 connectView(view); // also deletes the old view
1109
1110 emit viewChanged( view );
1111}
1112
1113void KDirOperator::setDirLister( KDirLister *lister )
1114{
1115 if ( lister == dir ) // sanity check
1116 return;
1117
1118 delete dir;
1119 dir = lister;
1120
1121 dir->setAutoUpdate( true );
1122
1123 TQWidget* mainWidget = topLevelWidget();
1124 dir->setMainWindow (mainWidget);
1125 kdDebug (tdefile_area) << "mainWidget=" << mainWidget << endl;
1126
1127 connect( dir, TQ_SIGNAL( percent( int )),
1128 TQ_SLOT( slotProgress( int ) ));
1129 connect( dir, TQ_SIGNAL(started( const KURL& )), TQ_SLOT(slotStarted()));
1130 connect( dir, TQ_SIGNAL(newItems(const KFileItemList &)),
1131 TQ_SLOT(insertNewFiles(const KFileItemList &)));
1132 connect( dir, TQ_SIGNAL(completed()), TQ_SLOT(slotIOFinished()));
1133 connect( dir, TQ_SIGNAL(canceled()), TQ_SLOT(slotCanceled()));
1134 connect( dir, TQ_SIGNAL(deleteItem(KFileItem *)),
1135 TQ_SLOT(itemDeleted(KFileItem *)));
1136 connect( dir, TQ_SIGNAL(redirection( const KURL& )),
1137 TQ_SLOT( slotRedirected( const KURL& )));
1138 connect( dir, TQ_SIGNAL( clear() ), TQ_SLOT( slotClearView() ));
1139 connect( dir, TQ_SIGNAL( refreshItems( const KFileItemList& ) ),
1140 TQ_SLOT( slotRefreshItems( const KFileItemList& ) ) );
1141}
1142
1143void KDirOperator::insertNewFiles(const KFileItemList &newone)
1144{
1145 if ( newone.isEmpty() || !m_fileView )
1146 return;
1147
1148 myCompleteListDirty = true;
1149 m_fileView->addItemList( newone );
1150 emit updateInformation(m_fileView->numDirs(), m_fileView->numFiles());
1151
1152 KFileItem *item;
1153 KFileItemListIterator it( newone );
1154
1155 while ( (item = it.current()) ) {
1156 // highlight the dir we come from, if possible
1157 if ( d->dirHighlighting && item->isDir() &&
1158 item->url().url(-1) == d->lastURL ) {
1159 m_fileView->setCurrentItem( item );
1160 m_fileView->ensureItemVisible( item );
1161 }
1162
1163 ++it;
1164 }
1165
1166 TQTimer::singleShot(200, this, TQ_SLOT(resetCursor()));
1167}
1168
1169void KDirOperator::selectDir(const KFileItem *item)
1170{
1171 setURL(item->url(), true);
1172}
1173
1174void KDirOperator::itemDeleted(KFileItem *item)
1175{
1176 pendingMimeTypes.removeRef( item );
1177 if ( m_fileView )
1178 {
1179 m_fileView->removeItem( static_cast<KFileItem *>( item ));
1180 emit updateInformation(m_fileView->numDirs(), m_fileView->numFiles());
1181 }
1182}
1183
1184void KDirOperator::selectFile(const KFileItem *item)
1185{
1186 TQApplication::restoreOverrideCursor();
1187
1188 emit fileSelected( item );
1189}
1190
1191void KDirOperator::setCurrentItem( const TQString& filename )
1192{
1193 if ( m_fileView ) {
1194 const KFileItem *item = 0L;
1195
1196 if ( !filename.isNull() )
1197 item = static_cast<KFileItem *>(dir->findByName( filename ));
1198
1199 m_fileView->clearSelection();
1200 if ( item ) {
1201 m_fileView->setCurrentItem( item );
1202 m_fileView->setSelected( item, true );
1203 m_fileView->ensureItemVisible( item );
1204 }
1205 }
1206}
1207
1208TQString KDirOperator::makeCompletion(const TQString& string)
1209{
1210 if ( string.isEmpty() ) {
1211 m_fileView->clearSelection();
1212 return TQString::null;
1213 }
1214
1215 prepareCompletionObjects();
1216 return myCompletion.makeCompletion( string );
1217}
1218
1219TQString KDirOperator::makeDirCompletion(const TQString& string)
1220{
1221 if ( string.isEmpty() ) {
1222 m_fileView->clearSelection();
1223 return TQString::null;
1224 }
1225
1226 prepareCompletionObjects();
1227 return myDirCompletion.makeCompletion( string );
1228}
1229
1230void KDirOperator::prepareCompletionObjects()
1231{
1232 if ( !m_fileView )
1233 return;
1234
1235 if ( myCompleteListDirty ) { // create the list of all possible completions
1236 KFileItemListIterator it( *(m_fileView->items()) );
1237 for( ; it.current(); ++it ) {
1238 KFileItem *item = it.current();
1239
1240 myCompletion.addItem( item->name() );
1241 if ( item->isDir() )
1242 myDirCompletion.addItem( item->name() );
1243 }
1244 myCompleteListDirty = false;
1245 }
1246}
1247
1248void KDirOperator::slotCompletionMatch(const TQString& match)
1249{
1250 setCurrentItem( match );
1251 emit completion( match );
1252}
1253
1254void KDirOperator::setupActions()
1255{
1256 myActionCollection = new TDEActionCollection( topLevelWidget(), this, "KDirOperator::myActionCollection" );
1257
1258 actionMenu = new TDEActionMenu( i18n("Menu"), myActionCollection, "popupMenu" );
1259 upAction = KStdAction::up( this, TQ_SLOT( cdUp() ), myActionCollection, "up" );
1260 upAction->setText( i18n("Parent Folder") );
1261 backAction = KStdAction::back( this, TQ_SLOT( back() ), myActionCollection, "back" );
1262 forwardAction = KStdAction::forward( this, TQ_SLOT(forward()), myActionCollection, "forward" );
1263 homeAction = KStdAction::home( this, TQ_SLOT( home() ), myActionCollection, "home" );
1264 homeAction->setText(i18n("Home Folder"));
1265 reloadAction = KStdAction::redisplay( this, TQ_SLOT(rereadDir()), myActionCollection, "reload" );
1266 actionSeparator = new TDEActionSeparator( myActionCollection, "separator" );
1267 d->viewActionSeparator = new TDEActionSeparator( myActionCollection,
1268 "viewActionSeparator" );
1269 mkdirAction = new TDEAction( i18n("New Folder..."), 0,
1270 this, TQ_SLOT( mkdir() ), myActionCollection, "mkdir" );
1271 TDEAction* trash = new TDEAction( i18n( "Move to Trash" ), "edittrash", Key_Delete, myActionCollection, "trash" );
1272 connect( trash, TQ_SIGNAL( activated( TDEAction::ActivationReason, TQt::ButtonState ) ),
1273 this, TQ_SLOT( trashSelected( TDEAction::ActivationReason, TQt::ButtonState ) ) );
1274 new TDEAction( i18n( "Delete" ), "edit-delete", SHIFT+Key_Delete, this,
1275 TQ_SLOT( deleteSelected() ), myActionCollection, "delete" );
1276 mkdirAction->setIcon( TQString::fromLatin1("folder-new") );
1277 reloadAction->setText( i18n("Reload") );
1278 reloadAction->setShortcut( TDEStdAccel::shortcut( TDEStdAccel::Reload ));
1279
1280
1281 // the sort menu actions
1282 sortActionMenu = new TDEActionMenu( i18n("Sorting"), myActionCollection, "sorting menu");
1283 byNameAction = new TDERadioAction( i18n("By Name"), 0,
1284 this, TQ_SLOT( slotSortByName() ),
1285 myActionCollection, "by name" );
1286 byDateAction = new TDERadioAction( i18n("By Date"), 0,
1287 this, TQ_SLOT( slotSortByDate() ),
1288 myActionCollection, "by date" );
1289 bySizeAction = new TDERadioAction( i18n("By Size"), 0,
1290 this, TQ_SLOT( slotSortBySize() ),
1291 myActionCollection, "by size" );
1292 reverseAction = new TDEToggleAction( i18n("Reverse"), 0,
1293 this, TQ_SLOT( slotSortReversed() ),
1294 myActionCollection, "reversed" );
1295
1296 TQString sortGroup = TQString::fromLatin1("sort");
1297 byNameAction->setExclusiveGroup( sortGroup );
1298 byDateAction->setExclusiveGroup( sortGroup );
1299 bySizeAction->setExclusiveGroup( sortGroup );
1300
1301
1302 dirsFirstAction = new TDEToggleAction( i18n("Folders First"), 0,
1303 myActionCollection, "dirs first");
1304 caseInsensitiveAction = new TDEToggleAction(i18n("Case Insensitive"), 0,
1305 myActionCollection, "case insensitive" );
1306
1307 connect( dirsFirstAction, TQ_SIGNAL( toggled( bool ) ),
1308 TQ_SLOT( slotToggleDirsFirst() ));
1309 connect( caseInsensitiveAction, TQ_SIGNAL( toggled( bool ) ),
1310 TQ_SLOT( slotToggleIgnoreCase() ));
1311
1312
1313
1314 // the view menu actions
1315 viewActionMenu = new TDEActionMenu( i18n("&View"), myActionCollection, "view menu" );
1316 connect( viewActionMenu->popupMenu(), TQ_SIGNAL( aboutToShow() ),
1317 TQ_SLOT( insertViewDependentActions() ));
1318
1319 shortAction = new TDERadioAction( i18n("Short View"), "view_multicolumn",
1320 TDEShortcut(), myActionCollection, "short view" );
1321 detailedAction = new TDERadioAction( i18n("Detailed View"), "view_detailed",
1322 TDEShortcut(), myActionCollection, "detailed view" );
1323
1324 showHiddenAction = new TDEToggleAction( i18n("Show Hidden Files"), TDEShortcut(),
1325 myActionCollection, "show hidden" );
1326// showHiddenAction->setCheckedState( i18n("Hide Hidden Files") );
1327 separateDirsAction = new TDEToggleAction( i18n("Separate Folders"), TDEShortcut(),
1328 this,
1329 TQ_SLOT(slotSeparateDirs()),
1330 myActionCollection, "separate dirs" );
1331 TDEToggleAction *previewAction = new TDEToggleAction(i18n("Show Preview"),
1332 "thumbnail", TDEShortcut(),
1333 myActionCollection,
1334 "preview" );
1335 previewAction->setCheckedState(i18n("Hide Preview"));
1336 connect( previewAction, TQ_SIGNAL( toggled( bool )),
1337 TQ_SLOT( togglePreview( bool )));
1338
1339
1340 TQString viewGroup = TQString::fromLatin1("view");
1341 shortAction->setExclusiveGroup( viewGroup );
1342 detailedAction->setExclusiveGroup( viewGroup );
1343
1344 connect( shortAction, TQ_SIGNAL( activated() ),
1345 TQ_SLOT( slotSimpleView() ));
1346 connect( detailedAction, TQ_SIGNAL( activated() ),
1347 TQ_SLOT( slotDetailedView() ));
1348 connect( showHiddenAction, TQ_SIGNAL( toggled( bool ) ),
1349 TQ_SLOT( slotToggleHidden( bool ) ));
1350
1351 new TDEAction( i18n("Properties"), TDEShortcut(ALT+Key_Return), this,
1352 TQ_SLOT(slotProperties()), myActionCollection, "properties" );
1353}
1354
1355void KDirOperator::setupMenu()
1356{
1357 setupMenu(AllActions);
1358}
1359
1360void KDirOperator::setupMenu(int whichActions)
1361{
1362 // first fill the submenus (sort and view)
1363 sortActionMenu->popupMenu()->clear();
1364 sortActionMenu->insert( byNameAction );
1365 sortActionMenu->insert( byDateAction );
1366 sortActionMenu->insert( bySizeAction );
1367 sortActionMenu->insert( actionSeparator );
1368 sortActionMenu->insert( reverseAction );
1369 sortActionMenu->insert( dirsFirstAction );
1370 sortActionMenu->insert( caseInsensitiveAction );
1371
1372 // now plug everything into the popupmenu
1373 actionMenu->popupMenu()->clear();
1374 if (whichActions & NavActions)
1375 {
1376 actionMenu->insert( upAction );
1377 actionMenu->insert( backAction );
1378 actionMenu->insert( forwardAction );
1379 actionMenu->insert( homeAction );
1380 actionMenu->insert( actionSeparator );
1381 }
1382
1383 if (whichActions & FileActions)
1384 {
1385 actionMenu->insert( mkdirAction );
1386 if (currUrl.isLocalFile() && !(TDEApplication::keyboardMouseState() & TQt::ShiftButton))
1387 actionMenu->insert( myActionCollection->action( "trash" ) );
1388 TDEConfig *globalconfig = TDEGlobal::config();
1389 TDEConfigGroupSaver cs( globalconfig, TQString::fromLatin1("KDE") );
1390 if (!currUrl.isLocalFile() || (TDEApplication::keyboardMouseState() & TQt::ShiftButton) ||
1391 globalconfig->readBoolEntry("ShowDeleteCommand", false))
1392 actionMenu->insert( myActionCollection->action( "delete" ) );
1393 actionMenu->insert( actionSeparator );
1394 }
1395
1396 if (whichActions & SortActions)
1397 {
1398 actionMenu->insert( sortActionMenu );
1399 actionMenu->insert( actionSeparator );
1400 }
1401
1402 if (whichActions & ViewActions)
1403 {
1404 actionMenu->insert( viewActionMenu );
1405 actionMenu->insert( actionSeparator );
1406 }
1407
1408 if (whichActions & FileActions)
1409 {
1410 actionMenu->insert( myActionCollection->action( "properties" ) );
1411 }
1412}
1413
1414void KDirOperator::updateSortActions()
1415{
1416 if ( KFile::isSortByName( mySorting ) )
1417 byNameAction->setChecked( true );
1418 else if ( KFile::isSortByDate( mySorting ) )
1419 byDateAction->setChecked( true );
1420 else if ( KFile::isSortBySize( mySorting ) )
1421 bySizeAction->setChecked( true );
1422
1423 dirsFirstAction->setChecked( KFile::isSortDirsFirst( mySorting ) );
1424 caseInsensitiveAction->setChecked( KFile::isSortCaseInsensitive(mySorting) );
1425 caseInsensitiveAction->setEnabled( KFile::isSortByName( mySorting ) );
1426
1427 if ( m_fileView )
1428 reverseAction->setChecked( m_fileView->isReversed() );
1429}
1430
1431void KDirOperator::updateViewActions()
1432{
1433 KFile::FileView fv = static_cast<KFile::FileView>( m_viewKind );
1434
1435 separateDirsAction->setChecked( KFile::isSeparateDirs( fv ) &&
1436 separateDirsAction->isEnabled() );
1437
1438 shortAction->setChecked( KFile::isSimpleView( fv ));
1439 detailedAction->setChecked( KFile::isDetailView( fv ));
1440}
1441
1442void KDirOperator::readConfig( TDEConfig *kc, const TQString& group )
1443{
1444 if ( !kc )
1445 return;
1446 TQString oldGroup = kc->group();
1447 if ( !group.isEmpty() )
1448 kc->setGroup( group );
1449
1450 defaultView = 0;
1451 int sorting = 0;
1452
1453 TQString viewStyle = kc->readEntry( TQString::fromLatin1("View Style"),
1454 TQString::fromLatin1("Simple") );
1455 if ( viewStyle == TQString::fromLatin1("Detail") )
1456 defaultView |= KFile::Detail;
1457 else
1458 defaultView |= KFile::Simple;
1459 if ( kc->readBoolEntry( TQString::fromLatin1("Separate Directories"),
1460 DefaultMixDirsAndFiles ) )
1461 defaultView |= KFile::SeparateDirs;
1462 if ( kc->readBoolEntry(TQString::fromLatin1("Show Preview"), false))
1463 defaultView |= KFile::PreviewContents;
1464
1465 if ( kc->readBoolEntry( TQString::fromLatin1("Sort case insensitively"),
1466 DefaultCaseInsensitive ) )
1467 sorting |= TQDir::IgnoreCase;
1468 if ( kc->readBoolEntry( TQString::fromLatin1("Sort directories first"),
1469 DefaultDirsFirst ) )
1470 sorting |= TQDir::DirsFirst;
1471
1472
1473 TQString name = TQString::fromLatin1("Name");
1474 TQString sortBy = kc->readEntry( TQString::fromLatin1("Sort by"), name );
1475 if ( sortBy == name )
1476 sorting |= TQDir::Name;
1477 else if ( sortBy == TQString::fromLatin1("Size") )
1478 sorting |= TQDir::Size;
1479 else if ( sortBy == TQString::fromLatin1("Date") )
1480 sorting |= TQDir::Time;
1481
1482 mySorting = static_cast<TQDir::SortSpec>( sorting );
1483 setSorting( mySorting );
1484
1485
1486 if ( kc->readBoolEntry( TQString::fromLatin1("Show hidden files"),
1487 DefaultShowHidden ) ) {
1488 showHiddenAction->setChecked( true );
1489 dir->setShowingDotFiles( true );
1490 }
1491 if ( kc->readBoolEntry( TQString::fromLatin1("Sort reversed"),
1492 DefaultSortReversed ) )
1493 reverseAction->setChecked( true );
1494
1495 kc->setGroup( oldGroup );
1496}
1497
1498void KDirOperator::writeConfig( TDEConfig *kc, const TQString& group )
1499{
1500 if ( !kc )
1501 return;
1502
1503 const TQString oldGroup = kc->group();
1504
1505 if ( !group.isEmpty() )
1506 kc->setGroup( group );
1507
1508 TQString sortBy = TQString::fromLatin1("Name");
1509 if ( KFile::isSortBySize( mySorting ) )
1510 sortBy = TQString::fromLatin1("Size");
1511 else if ( KFile::isSortByDate( mySorting ) )
1512 sortBy = TQString::fromLatin1("Date");
1513 kc->writeEntry( TQString::fromLatin1("Sort by"), sortBy );
1514
1515 kc->writeEntry( TQString::fromLatin1("Sort reversed"),
1516 reverseAction->isChecked() );
1517 kc->writeEntry( TQString::fromLatin1("Sort case insensitively"),
1518 caseInsensitiveAction->isChecked() );
1519 kc->writeEntry( TQString::fromLatin1("Sort directories first"),
1520 dirsFirstAction->isChecked() );
1521
1522 // don't save the separate dirs or preview when an application specific
1523 // preview is in use.
1524 bool appSpecificPreview = false;
1525 if ( myPreview ) {
1526 TQWidget *preview = const_cast<TQWidget*>( myPreview ); // grmbl
1527 KFileMetaPreview *tmp = dynamic_cast<KFileMetaPreview*>( preview );
1528 appSpecificPreview = (tmp == 0L);
1529 }
1530
1531 if ( !appSpecificPreview ) {
1532 if ( separateDirsAction->isEnabled() )
1533 kc->writeEntry( TQString::fromLatin1("Separate Directories"),
1534 separateDirsAction->isChecked() );
1535
1536 TDEToggleAction *previewAction = static_cast<TDEToggleAction*>(myActionCollection->action("preview"));
1537 if ( previewAction->isEnabled() ) {
1538 bool hasPreview = previewAction->isChecked();
1539 kc->writeEntry( TQString::fromLatin1("Show Preview"), hasPreview );
1540 }
1541 }
1542
1543 kc->writeEntry( TQString::fromLatin1("Show hidden files"),
1544 showHiddenAction->isChecked() );
1545
1546 KFile::FileView fv = static_cast<KFile::FileView>( m_viewKind );
1547 TQString style;
1548 if ( KFile::isDetailView( fv ) )
1549 style = TQString::fromLatin1("Detail");
1550 else if ( KFile::isSimpleView( fv ) )
1551 style = TQString::fromLatin1("Simple");
1552 kc->writeEntry( TQString::fromLatin1("View Style"), style );
1553
1554 kc->setGroup( oldGroup );
1555}
1556
1557
1558void KDirOperator::resizeEvent( TQResizeEvent * )
1559{
1560 if (m_fileView)
1561 m_fileView->widget()->resize( size() );
1562
1563 if ( progress->parent() == this ) // might be reparented into a statusbar
1564 progress->move(2, height() - progress->height() -2);
1565}
1566
1567void KDirOperator::setOnlyDoubleClickSelectsFiles( bool enable )
1568{
1569 d->onlyDoubleClickSelectsFiles = enable;
1570 if ( m_fileView )
1571 m_fileView->setOnlyDoubleClickSelectsFiles( enable );
1572}
1573
1574bool KDirOperator::onlyDoubleClickSelectsFiles() const
1575{
1576 return d->onlyDoubleClickSelectsFiles;
1577}
1578
1579void KDirOperator::slotStarted()
1580{
1581 progress->setProgress( 0 );
1582 // delay showing the progressbar for one second
1583 d->progressDelayTimer->start( 1000, true );
1584}
1585
1586void KDirOperator::slotShowProgress()
1587{
1588 progress->raise();
1589 progress->show();
1590 TQApplication::flushX();
1591}
1592
1593void KDirOperator::slotProgress( int percent )
1594{
1595 progress->setProgress( percent );
1596 // we have to redraw this as fast as possible
1597 if ( progress->isVisible() )
1598 TQApplication::flushX();
1599}
1600
1601
1602void KDirOperator::slotIOFinished()
1603{
1604 d->progressDelayTimer->stop();
1605 slotProgress( 100 );
1606 progress->hide();
1607 emit finishedLoading();
1608 resetCursor();
1609
1610 if ( m_fileView )
1611 m_fileView->listingCompleted();
1612}
1613
1614void KDirOperator::slotCanceled()
1615{
1616 emit finishedLoading();
1617 resetCursor();
1618
1619 if ( m_fileView )
1620 m_fileView->listingCompleted();
1621}
1622
1623KProgress * KDirOperator::progressBar() const
1624{
1625 return progress;
1626}
1627
1628void KDirOperator::clearHistory()
1629{
1630 backStack.clear();
1631 backAction->setEnabled( false );
1632 forwardStack.clear();
1633 forwardAction->setEnabled( false );
1634}
1635
1636void KDirOperator::slotViewActionAdded( TDEAction *action )
1637{
1638 if ( viewActionMenu->popupMenu()->count() == 5 ) // need to add a separator
1639 viewActionMenu->insert( d->viewActionSeparator );
1640
1641 viewActionMenu->insert( action );
1642}
1643
1644void KDirOperator::slotViewActionRemoved( TDEAction *action )
1645{
1646 viewActionMenu->remove( action );
1647
1648 if ( viewActionMenu->popupMenu()->count() == 6 ) // remove the separator
1649 viewActionMenu->remove( d->viewActionSeparator );
1650}
1651
1652void KDirOperator::slotViewSortingChanged( TQDir::SortSpec sort )
1653{
1654 mySorting = sort;
1655 updateSortActions();
1656}
1657
1658void KDirOperator::setEnableDirHighlighting( bool enable )
1659{
1660 d->dirHighlighting = enable;
1661}
1662
1663bool KDirOperator::dirHighlighting() const
1664{
1665 return d->dirHighlighting;
1666}
1667
1668void KDirOperator::slotProperties()
1669{
1670 if ( m_fileView ) {
1671 const KFileItemList *list = m_fileView->selectedItems();
1672 if ( !list->isEmpty() )
1673 (void) new KPropertiesDialog( *list, this, "props dlg", true);
1674 }
1675}
1676
1677void KDirOperator::slotClearView()
1678{
1679 if ( m_fileView )
1680 m_fileView->clearView();
1681}
1682
1683// ### temporary code
1684#include <dirent.h>
1685bool KDirOperator::isReadable( const KURL& url )
1686{
1687 if ( !url.isLocalFile() )
1688 return true; // what else can we say?
1689
1690 KDE_struct_stat buf;
1691 TQString ts = url.path(+1);
1692 bool readable = ( KDE_stat( TQFile::encodeName( ts ), &buf) == 0 );
1693 if (readable) { // further checks
1694 DIR *test;
1695 test = opendir( TQFile::encodeName( ts )); // we do it just to test here
1696 readable = (test != 0);
1697 if (test)
1698 closedir(test);
1699 }
1700 return readable;
1701}
1702
1703void KDirOperator::togglePreview( bool on )
1704{
1705 if ( on )
1706 slotDefaultPreview();
1707 else
1708 setView( (KFile::FileView) (m_viewKind & ~(KFile::PreviewContents|KFile::PreviewInfo)) );
1709}
1710
1711void KDirOperator::slotRefreshItems( const KFileItemList& items )
1712{
1713 if ( !m_fileView )
1714 return;
1715
1716 KFileItemListIterator it( items );
1717 for ( ; it.current(); ++it )
1718 m_fileView->updateView( it.current() );
1719}
1720
1721void KDirOperator::setViewConfig( TDEConfig *config, const TQString& group )
1722{
1723 d->config = config;
1724 d->configGroup = group;
1725}
1726
1727TDEConfig * KDirOperator::viewConfig()
1728{
1729 return d->config;
1730}
1731
1732TQString KDirOperator::viewConfigGroup() const
1733{
1734 return d->configGroup;
1735}
1736
1737void KDirOperator::virtual_hook( int, void* )
1738{ /*BASE::virtual_hook( id, data );*/ }
1739
1740#include "tdediroperator.moc"
KCombiView
This view is designed to combine two KFileViews into one widget, to show directories on the left side...
Definition: kcombiview.h:56
KCombiView::setRight
void setRight(KFileView *view)
Sets the view to be shown in the right.
Definition: kcombiview.cpp:68
KDirOperator::setDropOptions
void setDropOptions(int options)
Sets the options for dropping files.
Definition: tdediroperator.cpp:939
KDirOperator::setAcceptDrops
virtual void setAcceptDrops(bool b)
Reimplemented - allow dropping of files if b is true.
Definition: tdediroperator.cpp:932
KDirOperator::createView
virtual KFileView * createView(TQWidget *parent, KFile::FileView view)
A view factory for creating predefined fileviews.
Definition: tdediroperator.cpp:884
KDirOperator::itemDeleted
void itemDeleted(KFileItem *)
Removes the given KFileItem item from the view (usually called from KDirLister).
Definition: tdediroperator.cpp:1174
KDirOperator::dropped
void dropped(const KFileItem *item, TQDropEvent *event, const KURL::List &urls)
Emitted when files are dropped.
KDirOperator::numFiles
int numFiles() const
Definition: tdediroperator.cpp:285
KDirOperator::setPreviewWidget
void setPreviewWidget(const TQWidget *w)
Sets a preview-widget to be shown next to the file-view.
Definition: tdediroperator.cpp:264
KDirOperator::rereadDir
void rereadDir()
Re-reads the current url.
Definition: tdediroperator.cpp:691
KDirOperator::setupActions
void setupActions()
Sets up all the actions.
Definition: tdediroperator.cpp:1254
KDirOperator::progressBar
KProgress * progressBar() const
Definition: tdediroperator.cpp:1623
KDirOperator::updateSortActions
void updateSortActions()
Updates the sorting-related actions to comply with the current sorting.
Definition: tdediroperator.cpp:1414
KDirOperator::trash
TDEIO::CopyJob * trash(const KFileItemList &items, TQWidget *parent, bool ask=true, bool showProgress=true)
Starts and returns a TDEIO::CopyJob to trash the given items.
Definition: tdediroperator.cpp:505
KDirOperator::setMimeFilter
void setMimeFilter(const TQStringList &mimetypes)
Sets a list of mimetypes as filter.
Definition: tdediroperator.cpp:804
KDirOperator::updateSelectionDependentActions
void updateSelectionDependentActions()
Enables/disables actions that are selection dependent.
Definition: tdediroperator.cpp:255
KDirOperator::close
void close()
Stops loading immediately.
Definition: tdediroperator.cpp:573
KDirOperator::KDirOperator
KDirOperator(const KURL &urlName=KURL(), TQWidget *parent=0, const char *name=0)
Constructs the KDirOperator with no initial view.
Definition: tdediroperator.cpp:97
KDirOperator::viewConfigGroup
TQString viewConfigGroup() const
Returns the group name used for saving and restoring view's configuration.
Definition: tdediroperator.cpp:1732
KDirOperator::prepareCompletionObjects
void prepareCompletionObjects()
Synchronizes the completion objects with the entries of the currently listed url.
Definition: tdediroperator.cpp:1230
KDirOperator::updateViewActions
void updateViewActions()
Updates the view-related actions to comply with the current KFile::FileView.
Definition: tdediroperator.cpp:1431
KDirOperator::forward
void forward()
Goes one step forward in the history and opens that url.
Definition: tdediroperator.cpp:760
KDirOperator::setViewConfig
void setViewConfig(TDEConfig *config, const TQString &group)
Sets the config object and the to be used group in KDirOperator.
Definition: tdediroperator.cpp:1721
KDirOperator::back
void back()
Goes one step back in the history and opens that url.
Definition: tdediroperator.cpp:746
KDirOperator::viewConfig
TDEConfig * viewConfig()
Returns the TDEConfig object used for saving and restoring view's configuration.
Definition: tdediroperator.cpp:1727
KDirOperator::setSorting
void setSorting(TQDir::SortSpec)
Sets the way to sort files and directories.
Definition: tdediroperator.cpp:168
KDirOperator::makeCompletion
TQString makeCompletion(const TQString &)
Tries to complete the given string (only completes files).
Definition: tdediroperator.cpp:1208
KDirOperator::clearHistory
void clearHistory()
Clears the forward and backward history.
Definition: tdediroperator.cpp:1628
KDirOperator::viewWidget
TQWidget * viewWidget() const
Returns the widget of the current view.
Definition: tdediroperator.h:232
KDirOperator::cdUp
void cdUp()
Goes one directory up from the current url.
Definition: tdediroperator.cpp:777
KDirOperator::onlyDoubleClickSelectsFiles
bool onlyDoubleClickSelectsFiles() const
Definition: tdediroperator.cpp:1574
KDirOperator::clearFilter
void clearFilter()
Clears both the namefilter and mimetype filter, so that all files and directories will be shown.
Definition: tdediroperator.cpp:791
KDirOperator::selectFile
void selectFile(const KFileItem *item)
Emits fileSelected( item )
Definition: tdediroperator.cpp:1184
KDirOperator::mode
KFile::Mode mode() const
Definition: tdediroperator.cpp:1081
KDirOperator::makeDirCompletion
TQString makeDirCompletion(const TQString &)
Tries to complete the given string (only completes directores).
Definition: tdediroperator.cpp:1219
KDirOperator::setDirLister
void setDirLister(KDirLister *lister)
Sets a custom KDirLister to list directories.
Definition: tdediroperator.cpp:1113
KDirOperator::selectDir
void selectDir(const KFileItem *item)
Enters the directory specified by the given item.
Definition: tdediroperator.cpp:1169
KDirOperator::updateDir
void updateDir()
to update the view after changing the settings
Definition: tdediroperator.cpp:684
KDirOperator::resetCursor
void resetCursor()
Restores the normal cursor after showing the busy-cursor.
Definition: tdediroperator.cpp:176
KDirOperator::mkdir
void mkdir()
Opens a dialog to create a new directory.
Definition: tdediroperator.cpp:385
KDirOperator::actionCollection
TDEActionCollection * actionCollection() const
an accessor to a collection of all available Actions.
Definition: tdediroperator.h:389
KDirOperator::del
TDEIO::DeleteJob * del(const KFileItemList &items, bool ask=true, bool showProgress=true)
Starts and returns a TDEIO::DeleteJob to delete the given items.
Definition: tdediroperator.cpp:436
KDirOperator::isRoot
bool isRoot() const
Definition: tdediroperator.h:254
KDirOperator::deleteSelected
void deleteSelected()
Deletes the currently selected files/directories.
Definition: tdediroperator.cpp:495
KDirOperator::setOnlyDoubleClickSelectsFiles
void setOnlyDoubleClickSelectsFiles(bool enable)
This is a KFileDialog specific hack: we want to select directories with single click,...
Definition: tdediroperator.cpp:1567
KDirOperator::dirHighlighting
bool dirHighlighting() const
Definition: tdediroperator.cpp:1663
KDirOperator::fileHighlighted
void fileHighlighted(const KFileItem *item)
Emitted when a file is highlighted or generally the selection changes in multiselection mode.
KDirOperator::setNameFilter
void setNameFilter(const TQString &filter)
Sets a filter like "*.cpp *.h *.o".
Definition: tdediroperator.cpp:798
KDirOperator::setupMenu
void setupMenu()
Sets up the context-menu with all the necessary actions.
Definition: tdediroperator.cpp:1355
KDirOperator::writeConfig
virtual void writeConfig(TDEConfig *, const TQString &group=TQString::null)
Saves the current settings like sorting, simple or detailed view.
Definition: tdediroperator.cpp:1498
KDirOperator::nameFilter
const TQString & nameFilter() const
Definition: tdediroperator.h:155
KDirOperator::dirOnlyMode
bool dirOnlyMode() const
Definition: tdediroperator.h:537
KDirOperator::setMode
void setMode(KFile::Mode m)
Sets the listing/selection mode for the views, an OR'ed combination of.
Definition: tdediroperator.cpp:1086
KDirOperator::setView
void setView(KFileView *view)
Sets a new KFileView to be used for showing and browsing files.
Definition: tdediroperator.cpp:1099
KDirOperator::url
KURL url() const
Definition: tdediroperator.cpp:772
KDirOperator::readConfig
virtual void readConfig(TDEConfig *, const TQString &group=TQString::null)
Reads the default settings for a view, i.e.
Definition: tdediroperator.cpp:1442
KDirOperator::home
void home()
Enters the home directory.
Definition: tdediroperator.cpp:784
KDirOperator::sorting
TQDir::SortSpec sorting() const
Definition: tdediroperator.h:249
KDirOperator::activatedMenu
virtual void activatedMenu(const KFileItem *, const TQPoint &pos)
Called upon right-click to activate the popupmenu.
Definition: tdediroperator.cpp:247
KDirOperator::pathChanged
void pathChanged()
Called after setURL() to load the directory, update the history, etc.
Definition: tdediroperator.cpp:708
KDirOperator::view
KFileView * view() const
Definition: tdediroperator.h:226
KDirOperator::setURL
void setURL(const KURL &url, bool clearforward)
Sets a new url to list.
Definition: tdediroperator.cpp:636
KDirOperator::~KDirOperator
virtual ~KDirOperator()
Destroys the KDirOperator.
Definition: tdediroperator.cpp:150
KDirOperator::slotCompletionMatch
void slotCompletionMatch(const TQString &match)
Tries to make the given match as current item in the view and emits completion( match )
Definition: tdediroperator.cpp:1248
KDirOperator::insertNewFiles
void insertNewFiles(const KFileItemList &newone)
Adds a new list of KFileItems to the view (coming from KDirLister)
Definition: tdediroperator.cpp:1143
KDirOperator::setCurrentItem
void setCurrentItem(const TQString &filename)
Clears the current selection and attempts to set filename the current file.
Definition: tdediroperator.cpp:1191
KDirOperator::trashSelected
void trashSelected(TDEAction::ActivationReason, TQt::ButtonState)
Trashes the currently selected files/directories.
Definition: tdediroperator.cpp:558
KDirOperator::setEnableDirHighlighting
void setEnableDirHighlighting(bool enable)
When going up in the directory hierarchy, KDirOperator can highlight the directory that was just left...
Definition: tdediroperator.cpp:1658
KDirOperator::numDirs
int numDirs() const
Definition: tdediroperator.cpp:280
KDirOperator::viewChanged
void viewChanged(KFileView *newView)
Emitted whenever the current fileview is changed, either by an explicit call to setView() or by the u...
KDirOperator::highlightFile
void highlightFile(const KFileItem *i)
Emits fileHighlighted( i )
Definition: tdediroperator.h:753
KDirOperator::checkPreviewSupport
bool checkPreviewSupport()
Checks if there support from TDEIO::PreviewJob for the currently shown files, taking mimeFilter() and...
Definition: tdediroperator.cpp:810
KFileDetailView
A list-view capable of showing KFileItem'.
Definition: tdefiledetailview.h:109
KFileIconView
An icon-view capable of showing KFileItem's.
Definition: tdefileiconview.h:83
KFilePreview
Definition: tdefilepreview.h:40
KFileViewSignaler
internal class to make easier to use signals possible
Definition: tdefileview.h:37
KFileView
This class defines an interface to all file views.
Definition: tdefileview.h:97
KFileView::clearSelection
virtual void clearSelection()=0
Clears any selection, unhighlights everything.
KFileView::numFiles
uint numFiles() const
Definition: tdefileview.h:210
KFileView::setViewName
void setViewName(const TQString &name)
Sets the name of the view, which could be displayed somewhere.
Definition: tdefileview.h:239
KFileView::numDirs
uint numDirs() const
Definition: tdefileview.h:215
KFileView::listingCompleted
virtual void listingCompleted()
This hook is called when all items of the currently listed directory are listed and inserted into the...
Definition: tdefileview.cpp:360
KFileView::items
const KFileItemList * items() const
Definition: tdefileview.cpp:283
KFileView::setCurrentItem
void setCurrentItem(const TQString &filename)
Sets filename the current item in the view, if available.
Definition: tdefileview.cpp:268
KFileView::isReversed
bool isReversed() const
Tells whether the current items are in reversed order (shortcut to sorting() & TQDir::Reversed).
Definition: tdefileview.h:198
KFileView::setOnlyDoubleClickSelectsFiles
void setOnlyDoubleClickSelectsFiles(bool enable)
This is a KFileDialog specific hack: we want to select directories with single click,...
Definition: tdefileview.h:320
KFileView::selectedItems
const KFileItemList * selectedItems() const
Definition: tdefileview.cpp:296
KFileView::sorting
TQDir::SortSpec sorting() const
Returns the sorting order of the internal list.
Definition: tdefileview.h:176
KFileView::currentFileItem
virtual KFileItem * currentFileItem() const =0
KFileView::updateView
virtual void updateView(bool f=true)
does a repaint of the view.
Definition: tdefileview.cpp:259
KFileView::setDropOptions
void setDropOptions(int options)
Specify DND options.
Definition: tdefileview.cpp:397
KFileView::widget
virtual TQWidget * widget()=0
a pure virtual function to get a TQWidget, that can be added to other widgets.
KFileView::removeItem
virtual void removeItem(const KFileItem *item)
Removes an item from the list; has to be implemented by the view.
Definition: tdefileview.cpp:346
KFileView::ensureItemVisible
virtual void ensureItemVisible(const KFileItem *i)=0
pure virtual function, that should be implemented to make item i visible, i.e.
KFileView::setSorting
virtual void setSorting(TQDir::SortSpec sort)
Sets the sorting order of the view.
Definition: tdefileview.cpp:151
KFileView::actionCollection
virtual TDEActionCollection * actionCollection() const
Definition: tdefileview.cpp:365
KFileView::clear
virtual void clear()
Clears the view and all item lists.
Definition: tdefileview.cpp:156
KFileView::addItemList
void addItemList(const KFileItemList &list)
inserts a list of items.
Definition: tdefileview.cpp:130
KFileView::setSelected
virtual void setSelected(const KFileItem *, bool enable)=0
Tells the view that it should highlight the item.
KFileView::clearView
virtual void clearView()=0
pure virtual function, that should be implemented to clear the view.
KFile
KFile is a class which provides a namespace for some enumerated values associated with the tdefile li...
Definition: tdefile.h:32
KFile::Mode
Mode
Modes of operation for the dialog.
Definition: tdefile.h:42
KFile::isPreviewInfo
static bool isPreviewInfo(const FileView &view)
Definition: tdefile.h:123
KPropertiesDialog
The main properties dialog class.
Definition: kpropertiesdialog.h:71

tdeio/tdefile

Skip menu "tdeio/tdefile"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeio/tdefile

Skip menu "tdeio/tdefile"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdefile by doxygen 1.9.4
This website is maintained by Timothy Pearson.