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

tdeio/tdeio

  • tdeio
  • tdeio
kurlcompletion.cpp
1/*
2 This file is part of the KDE libraries
3 Copyright (C) 2000 David Smith <dsmith@algonet.se>
4 Copyright (C) 2004 Scott Wheeler <wheeler@kde.org>
5
6 This class was inspired by a previous KURLCompletion by
7 Henner Zeller <zeller@think.de>
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public
11 License as published by the Free Software Foundation; either
12 version 2 of the License, or (at your option) any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Library General Public License for more details.
18
19 You should have received a copy of the GNU Library General Public License
20 along with this library; see the file COPYING.LIB. If not, write to
21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 Boston, MA 02110-1301, USA.
23*/
24
25#include <config.h>
26#include <stdlib.h>
27#include <assert.h>
28#include <limits.h>
29
30#include <tqstring.h>
31#include <tqstringlist.h>
32#include <tqvaluelist.h>
33#include <tqregexp.h>
34#include <tqtimer.h>
35#include <tqdir.h>
36#include <tqfile.h>
37#include <tqtextstream.h>
38#include <tqdeepcopy.h>
39#include <tqthread.h>
40
41#include <tdeapplication.h>
42#include <kdebug.h>
43#include <kcompletion.h>
44#include <kurl.h>
45#include <tdeio/jobclasses.h>
46#include <tdeio/job.h>
47#include <kprotocolinfo.h>
48#include <tdeconfig.h>
49#include <tdeglobal.h>
50#include <tdelocale.h>
51#include <kde_file.h>
52
53#include <sys/types.h>
54#include <dirent.h>
55#include <unistd.h>
56#include <sys/stat.h>
57#include <pwd.h>
58#include <time.h>
59#include <sys/param.h>
60
61#include "kurlcompletion.h"
62
63static bool expandTilde(TQString &);
64static bool expandEnv(TQString &);
65
66static TQString unescape(const TQString &text);
67
68// Permission mask for files that are executable by
69// user, group or other
70#define MODE_EXE (S_IXUSR | S_IXGRP | S_IXOTH)
71
72// Constants for types of completion
73enum ComplType {CTNone=0, CTEnv, CTUser, CTMan, CTExe, CTFile, CTUrl, CTInfo};
74
75class CompletionThread;
76
82class CompletionMatchEvent : public TQCustomEvent
83{
84public:
85 CompletionMatchEvent( CompletionThread *thread ) :
86 TQCustomEvent( uniqueType() ),
87 m_completionThread( thread )
88 {}
89
90 CompletionThread *completionThread() const { return m_completionThread; }
91 static int uniqueType() { return User + 61080; }
92
93private:
94 CompletionThread *m_completionThread;
95};
96
97class CompletionThread : public TQThread
98{
99protected:
100 CompletionThread( KURLCompletion *receiver ) :
101 TQThread(),
102 m_receiver( receiver ),
103 m_terminationRequested( false )
104 {}
105
106public:
107 void requestTermination() { m_terminationRequested = true; }
108 TQDeepCopy<TQStringList> matches() const { return m_matches; }
109
110protected:
111 void addMatch( const TQString &match ) { m_matches.append( match ); }
112 bool terminationRequested() const { return m_terminationRequested; }
113 void done()
114 {
115 if ( !m_terminationRequested )
116 kapp->postEvent( m_receiver, new CompletionMatchEvent( this ) );
117 else
118 delete this;
119 }
120
121private:
122 KURLCompletion *m_receiver;
123 TQStringList m_matches;
124 bool m_terminationRequested;
125};
126
132class UserListThread : public CompletionThread
133{
134public:
135 UserListThread( KURLCompletion *receiver ) :
136 CompletionThread( receiver )
137 {}
138
139protected:
140 virtual void run()
141 {
142 static const TQChar tilde = '~';
143
144 struct passwd *pw;
145 while ( ( pw = ::getpwent() ) && !terminationRequested() )
146 addMatch( tilde + TQString::fromLocal8Bit( pw->pw_name ) );
147
148 ::endpwent();
149
150 addMatch( tilde );
151
152 done();
153 }
154};
155
156class DirectoryListThread : public CompletionThread
157{
158public:
159 DirectoryListThread( KURLCompletion *receiver,
160 const TQStringList &dirList,
161 const TQString &filter,
162 bool onlyExe,
163 bool onlyDir,
164 bool noHidden,
165 bool appendSlashToDir ) :
166 CompletionThread( receiver ),
167 m_dirList( TQDeepCopy<TQStringList>( dirList ) ),
168 m_filter( TQDeepCopy<TQString>( filter ) ),
169 m_onlyExe( onlyExe ),
170 m_onlyDir( onlyDir ),
171 m_noHidden( noHidden ),
172 m_appendSlashToDir( appendSlashToDir )
173 {}
174
175 virtual void run();
176
177private:
178 TQStringList m_dirList;
179 TQString m_filter;
180 bool m_onlyExe;
181 bool m_onlyDir;
182 bool m_noHidden;
183 bool m_appendSlashToDir;
184};
185
186void DirectoryListThread::run()
187{
188 // Thread safety notes:
189 //
190 // There very possibly may be thread safety issues here, but I've done a check
191 // of all of the things that would seem to be problematic. Here are a few
192 // things that I have checked to be safe here (some used indirectly):
193 //
194 // TQDir::currentDirPath(), TQDir::setCurrent(), TQFile::decodeName(), TQFile::encodeName()
195 // TQString::fromLocal8Bit(), TQString::local8Bit(), TQTextCodec::codecForLocale()
196 //
197 // Also see (for POSIX functions):
198 // http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_09.html
199
200 DIR *dir = 0;
201
202 for ( TQStringList::ConstIterator it = m_dirList.begin();
203 it != m_dirList.end() && !terminationRequested();
204 ++it )
205 {
206 // Open the next directory
207
208 if ( !dir ) {
209 dir = ::opendir( TQFile::encodeName( *it ) );
210 if ( ! dir ) {
211 kdDebug() << "Failed to open dir: " << *it << endl;
212 done();
213 return;
214 }
215 }
216
217 // A trick from TDEIO that helps performance by a little bit:
218 // chdir to the directroy so we won't have to deal with full paths
219 // with stat()
220
221 TQString path = TQDir::currentDirPath();
222 TQDir::setCurrent( *it );
223
224 // Loop through all directory entries
225 // Solaris and IRIX dirent structures do not allocate space for d_name. On
226 // systems that do (HP-UX, Linux, Tru64 UNIX), we overallocate space but
227 // that's ok.
228#ifndef HAVE_READDIR_R
229 struct dirent *dirEntry = 0;
230 while ( !terminationRequested() &&
231 (dirEntry = ::readdir( dir)))
232#else
233#if !defined(MAXPATHLEN) && defined(__GNU__)
234#define MAXPATHLEN UCHAR_MAX
235#endif
236 struct dirent *dirPosition = (struct dirent *) malloc( sizeof( struct dirent ) + MAXPATHLEN + 1 );
237 struct dirent *dirEntry = 0;
238 while ( !terminationRequested() &&
239 ::readdir_r( dir, dirPosition, &dirEntry ) == 0 && dirEntry )
240#endif
241
242 {
243 // Skip hidden files if m_noHidden is true
244
245 if ( dirEntry->d_name[0] == '.' && m_noHidden )
246 continue;
247
248 // Skip "."
249
250 if ( dirEntry->d_name[0] == '.' && dirEntry->d_name[1] == '\0' )
251 continue;
252
253 // Skip ".."
254
255 if ( dirEntry->d_name[0] == '.' && dirEntry->d_name[1] == '.' && dirEntry->d_name[2] == '\0' )
256 continue;
257
258 TQString file = TQFile::decodeName( dirEntry->d_name );
259
260 if ( m_filter.isEmpty() || file.startsWith( m_filter ) ) {
261
262 if ( m_onlyExe || m_onlyDir || m_appendSlashToDir ) {
263 KDE_struct_stat sbuff;
264
265 if ( KDE_stat( dirEntry->d_name, &sbuff ) == 0 ) {
266
267 // Verify executable
268
269 if ( m_onlyExe && ( sbuff.st_mode & MODE_EXE ) == 0 )
270 continue;
271
272 // Verify directory
273
274 if ( m_onlyDir && !S_ISDIR( sbuff.st_mode ) )
275 continue;
276
277 // Add '/' to directories
278
279 if ( m_appendSlashToDir && S_ISDIR( sbuff.st_mode ) )
280 file.append( '/' );
281
282 }
283 else {
284 kdDebug() << "Could not stat file " << file << endl;
285 continue;
286 }
287 }
288
289 addMatch( file );
290 }
291 }
292
293 // chdir to the original directory
294
295 TQDir::setCurrent( path );
296
297 ::closedir( dir );
298 dir = 0;
299#ifdef HAVE_READDIR_R
300 free( dirPosition );
301#endif
302 }
303
304 done();
305}
306
309// MyURL - wrapper for KURL with some different functionality
310//
311
312class KURLCompletion::MyURL
313{
314public:
315 MyURL(const TQString &url, const TQString &cwd);
316 MyURL(const MyURL &url);
317 ~MyURL();
318
319 KURL *kurl() const { return m_kurl; }
320
321 TQString protocol() const { return m_kurl->protocol(); }
322 // The directory with a trailing '/'
323 TQString dir() const { return m_kurl->directory(false, false); }
324 TQString file() const { return m_kurl->fileName(false); }
325
326 // The initial, unparsed, url, as a string.
327 TQString url() const { return m_url; }
328
329 // Is the initial string a URL, or just a path (whether absolute or relative)
330 bool isURL() const { return m_isURL; }
331
332 void filter( bool replace_user_dir, bool replace_env );
333
334private:
335 void init(const TQString &url, const TQString &cwd);
336
337 KURL *m_kurl;
338 TQString m_url;
339 bool m_isURL;
340};
341
342KURLCompletion::MyURL::MyURL(const TQString &url, const TQString &cwd)
343{
344 init(url, cwd);
345}
346
347KURLCompletion::MyURL::MyURL(const MyURL &url)
348{
349 m_kurl = new KURL( *(url.m_kurl) );
350 m_url = url.m_url;
351 m_isURL = url.m_isURL;
352}
353
354void KURLCompletion::MyURL::init(const TQString &url, const TQString &cwd)
355{
356 // Save the original text
357 m_url = url;
358
359 // Non-const copy
360 TQString url_copy = url;
361
362 // Special shortcuts for "man:" and "info:"
363 if ( url_copy[0] == '#' ) {
364 if ( url_copy[1] == '#' )
365 url_copy.replace( 0, 2, TQString("info:") );
366 else
367 url_copy.replace( 0, 1, TQString("man:") );
368 }
369
370 // Look for a protocol in 'url'
371 TQRegExp protocol_regex = TQRegExp( "^[^/\\s\\\\]*:" );
372
373 // Assume "file:" or whatever is given by 'cwd' if there is
374 // no protocol. (KURL does this only for absoute paths)
375 if ( protocol_regex.search( url_copy ) == 0 )
376 {
377 m_kurl = new KURL( url_copy );
378 m_isURL = true;
379 }
380 else // relative path or ~ or $something
381 {
382 m_isURL = false;
383 if ( cwd.isEmpty() )
384 {
385 m_kurl = new KURL();
386 if ( !TQDir::isRelativePath(url_copy) || url_copy[0] == '$' || url_copy[0] == '~' )
387 m_kurl->setPath( url_copy );
388 else
389 *m_kurl = url_copy;
390 }
391 else
392 {
393 KURL base = KURL::fromPathOrURL( cwd );
394 base.adjustPath(+1);
395
396 if ( !TQDir::isRelativePath(url_copy) || url_copy[0] == '~' || url_copy[0] == '$' )
397 {
398 m_kurl = new KURL();
399 m_kurl->setPath( url_copy );
400 }
401 else // relative path
402 {
403 //m_kurl = new KURL( base, url_copy );
404 m_kurl = new KURL( base );
405 m_kurl->addPath( url_copy );
406 }
407 }
408 }
409}
410
411KURLCompletion::MyURL::~MyURL()
412{
413 delete m_kurl;
414}
415
416void KURLCompletion::MyURL::filter( bool replace_user_dir, bool replace_env )
417{
418 TQString d = dir() + file();
419 if ( replace_user_dir ) expandTilde( d );
420 if ( replace_env ) expandEnv( d );
421 m_kurl->setPath( d );
422}
423
426// KURLCompletionPrivate
427//
428class KURLCompletionPrivate
429{
430public:
431 KURLCompletionPrivate() : url_auto_completion(true),
432 userListThread(0),
433 dirListThread(0) {}
434 ~KURLCompletionPrivate();
435
436 TQValueList<KURL*> list_urls;
437
438 bool onlyLocalProto;
439
440 // urlCompletion() in Auto/Popup mode?
441 bool url_auto_completion;
442
443 // Append '/' to directories in Popup mode?
444 // Doing that stat's all files and is slower
445 bool popup_append_slash;
446
447 // Keep track of currently listed files to avoid reading them again
448 TQString last_path_listed;
449 TQString last_file_listed;
450 TQString last_prepend;
451 int last_compl_type;
452 int last_no_hidden;
453
454 TQString cwd; // "current directory" = base dir for completion
455
456 KURLCompletion::Mode mode; // ExeCompletion, FileCompletion, DirCompletion
457 bool replace_env;
458 bool replace_home;
459 bool complete_url; // if true completing a URL (i.e. 'prepend' is a URL), otherwise a path
460
461 TDEIO::ListJob *list_job; // tdeio job to list directories
462
463 TQString prepend; // text to prepend to listed items
464 TQString compl_text; // text to pass on to TDECompletion
465
466 // Filters for files read with tdeio
467 bool list_urls_only_exe; // true = only list executables
468 bool list_urls_no_hidden;
469 TQString list_urls_filter; // filter for listed files
470
471 CompletionThread *userListThread;
472 CompletionThread *dirListThread;
473};
474
475KURLCompletionPrivate::~KURLCompletionPrivate()
476{
477 if ( userListThread )
478 userListThread->requestTermination();
479 if ( dirListThread )
480 dirListThread->requestTermination();
481}
482
485// KURLCompletion
486//
487
488KURLCompletion::KURLCompletion() : TDECompletion()
489{
490 init();
491}
492
493
494KURLCompletion::KURLCompletion( Mode mode ) : TDECompletion()
495{
496 init();
497 setMode ( mode );
498}
499
500KURLCompletion::~KURLCompletion()
501{
502 stop();
503 delete d;
504}
505
506
507void KURLCompletion::init()
508{
509 d = new KURLCompletionPrivate;
510
511 d->cwd = TQDir::homeDirPath();
512
513 d->replace_home = true;
514 d->replace_env = true;
515 d->last_no_hidden = false;
516 d->last_compl_type = 0;
517 d->list_job = 0L;
518 d->mode = KURLCompletion::FileCompletion;
519
520 // Read settings
521 TDEConfig *c = TDEGlobal::config();
522 TDEConfigGroupSaver cgs( c, "URLCompletion" );
523
524 d->url_auto_completion = c->readBoolEntry("alwaysAutoComplete", true);
525 d->popup_append_slash = c->readBoolEntry("popupAppendSlash", true);
526 d->onlyLocalProto = c->readBoolEntry("LocalProtocolsOnly", false);
527}
528
529void KURLCompletion::setDir(const TQString &dir)
530{
531 d->cwd = dir;
532}
533
534TQString KURLCompletion::dir() const
535{
536 return d->cwd;
537}
538
539KURLCompletion::Mode KURLCompletion::mode() const
540{
541 return d->mode;
542}
543
544void KURLCompletion::setMode( Mode mode )
545{
546 d->mode = mode;
547}
548
549bool KURLCompletion::replaceEnv() const
550{
551 return d->replace_env;
552}
553
554void KURLCompletion::setReplaceEnv( bool replace )
555{
556 d->replace_env = replace;
557}
558
559bool KURLCompletion::replaceHome() const
560{
561 return d->replace_home;
562}
563
564void KURLCompletion::setReplaceHome( bool replace )
565{
566 d->replace_home = replace;
567}
568
569/*
570 * makeCompletion()
571 *
572 * Entry point for file name completion
573 */
574TQString KURLCompletion::makeCompletion(const TQString &text)
575{
576 //kdDebug() << "KURLCompletion::makeCompletion: " << text << " d->cwd=" << d->cwd << endl;
577
578 MyURL url(text, d->cwd);
579
580 d->compl_text = text;
581
582 // Set d->prepend to the original URL, with the filename [and ref/query] stripped.
583 // This is what gets prepended to the directory-listing matches.
584 int toRemove = url.file().length() - url.kurl()->query().length();
585 if ( url.kurl()->hasRef() )
586 toRemove += url.kurl()->ref().length() + 1;
587 d->prepend = text.left( text.length() - toRemove );
588 d->complete_url = url.isURL();
589
590 TQString match;
591
592 // Environment variables
593 //
594 if ( d->replace_env && envCompletion( url, &match ) )
595 return match;
596
597 // User directories
598 //
599 if ( d->replace_home && userCompletion( url, &match ) )
600 return match;
601
602 // Replace user directories and variables
603 url.filter( d->replace_home, d->replace_env );
604
605 //kdDebug() << "Filtered: proto=" << url.protocol()
606 // << ", dir=" << url.dir()
607 // << ", file=" << url.file()
608 // << ", kurl url=" << *url.kurl() << endl;
609
610 if ( d->mode == ExeCompletion ) {
611 // Executables
612 //
613 if ( exeCompletion( url, &match ) )
614 return match;
615
616 // KRun can run "man:" and "info:" etc. so why not treat them
617 // as executables...
618
619 if ( urlCompletion( url, &match ) )
620 return match;
621 }
622 else if ( d->mode == SystemExeCompletion ) {
623 // Executables
624 //
625 if ( systemexeCompletion( url, &match ) )
626 return match;
627
628 // KRun can run "man:" and "info:" etc. so why not treat them
629 // as executables...
630
631 if ( urlCompletion( url, &match ) )
632 return match;
633 }
634 else {
635 // Local files, directories
636 //
637 if ( fileCompletion( url, &match ) )
638 return match;
639
640 // All other...
641 //
642 if ( urlCompletion( url, &match ) )
643 return match;
644 }
645
646 setListedURL( CTNone );
647 stop();
648
649 return TQString::null;
650}
651
652/*
653 * finished
654 *
655 * Go on and call TDECompletion.
656 * Called when all matches have been added
657 */
658TQString KURLCompletion::finished()
659{
660 if ( d->last_compl_type == CTInfo )
661 return TDECompletion::makeCompletion( d->compl_text.lower() );
662 else
663 return TDECompletion::makeCompletion( d->compl_text );
664}
665
666/*
667 * isRunning
668 *
669 * Return true if either a TDEIO job or the DirLister
670 * is running
671 */
672bool KURLCompletion::isRunning() const
673{
674 return d->list_job || (d->dirListThread && !d->dirListThread->finished());
675}
676
677/*
678 * stop
679 *
680 * Stop and delete a running TDEIO job or the DirLister
681 */
682void KURLCompletion::stop()
683{
684 if ( d->list_job ) {
685 d->list_job->kill();
686 d->list_job = 0L;
687 }
688
689 if ( !d->list_urls.isEmpty() ) {
690 TQValueList<KURL*>::Iterator it = d->list_urls.begin();
691 for ( ; it != d->list_urls.end(); it++ )
692 delete (*it);
693 d->list_urls.clear();
694 }
695
696 if ( d->dirListThread ) {
697 d->dirListThread->requestTermination();
698 d->dirListThread = 0;
699 }
700}
701
702/*
703 * Keep track of the last listed directory
704 */
705void KURLCompletion::setListedURL( int complType,
706 const TQString& dir,
707 const TQString& filter,
708 bool no_hidden )
709{
710 d->last_compl_type = complType;
711 d->last_path_listed = dir;
712 d->last_file_listed = filter;
713 d->last_no_hidden = (int)no_hidden;
714 d->last_prepend = d->prepend;
715}
716
717bool KURLCompletion::isListedURL( int complType,
718 const TQString& dir,
719 const TQString& filter,
720 bool no_hidden )
721{
722 return d->last_compl_type == complType
723 && ( d->last_path_listed == dir
724 || (dir.isEmpty() && d->last_path_listed.isEmpty()) )
725 && ( filter.startsWith(d->last_file_listed)
726 || (filter.isEmpty() && d->last_file_listed.isEmpty()) )
727 && d->last_no_hidden == (int)no_hidden
728 && d->last_prepend == d->prepend; // e.g. relative path vs absolute
729}
730
731/*
732 * isAutoCompletion
733 *
734 * Returns true if completion mode is Auto or Popup
735 */
736bool KURLCompletion::isAutoCompletion()
737{
738 return completionMode() == TDEGlobalSettings::CompletionAuto
739 || completionMode() == TDEGlobalSettings::CompletionPopup
740 || completionMode() == TDEGlobalSettings::CompletionMan
741 || completionMode() == TDEGlobalSettings::CompletionPopupAuto;
742}
745// User directories
746//
747
748bool KURLCompletion::userCompletion(const MyURL &url, TQString *match)
749{
750 if ( url.protocol() != "file"
751 || !url.dir().isEmpty()
752 || url.file().at(0) != '~' )
753 return false;
754
755 if ( !isListedURL( CTUser ) ) {
756 stop();
757 clear();
758
759 if ( !d->userListThread ) {
760 d->userListThread = new UserListThread( this );
761 d->userListThread->start();
762
763 // If the thread finishes quickly make sure that the results
764 // are added to the first matching case.
765
766 d->userListThread->wait( 200 );
767 TQStringList l = d->userListThread->matches();
768 addMatches( l );
769 }
770 }
771 *match = finished();
772 return true;
773}
774
777// Environment variables
778//
779
780#if !defined(__OpenBSD__) && !defined(__FreeBSD__)
781extern char **environ; // Array of environment variables
782#endif
783
784bool KURLCompletion::envCompletion(const MyURL &url, TQString *match)
785{
786#if defined(__OpenBSD__) || defined(__FreeBSD__)
787 return false;
788#else
789 if ( url.file().at(0) != '$' )
790 return false;
791
792 if ( !isListedURL( CTEnv ) ) {
793 stop();
794 clear();
795
796 char **env = environ;
797
798 TQString dollar = TQString("$");
799
800 TQStringList l;
801
802 while ( *env ) {
803 TQString s = TQString::fromLocal8Bit( *env );
804
805 int pos = s.find('=');
806
807 if ( pos == -1 )
808 pos = s.length();
809
810 if ( pos > 0 )
811 l.append( dollar + s.left(pos) );
812
813 env++;
814 }
815
816 addMatches( l );
817 }
818
819 setListedURL( CTEnv );
820
821 *match = finished();
822 return true;
823#endif
824}
825
828// Executables
829//
830
831bool KURLCompletion::exeCompletion(const MyURL &url, TQString *match)
832{
833 if ( url.protocol() != "file" )
834 return false;
835
836 TQString dir = url.dir();
837
838 dir = unescape( dir ); // remove escapes
839
840 // Find directories to search for completions, either
841 //
842 // 1. complete path given in url
843 // 2. current directory (d->cwd)
844 // 3. $PATH
845 // 4. no directory at all
846
847 TQStringList dirList;
848
849 if ( !TQDir::isRelativePath(dir) ) {
850 // complete path in url
851 dirList.append( dir );
852 }
853 else if ( !dir.isEmpty() && !d->cwd.isEmpty() ) {
854 // current directory
855 dirList.append( d->cwd + '/' + dir );
856 }
857 else if ( !url.file().isEmpty() ) {
858 // $PATH
859 dirList = TQStringList::split(KPATH_SEPARATOR,
860 TQString::fromLocal8Bit(::getenv("PATH")));
861
862 TQStringList::Iterator it = dirList.begin();
863
864 for ( ; it != dirList.end(); it++ )
865 (*it).append('/');
866 }
867
868 // No hidden files unless the user types "."
869 bool no_hidden_files = url.file().at(0) != '.';
870
871 // List files if needed
872 //
873 if ( !isListedURL( CTExe, dir, url.file(), no_hidden_files ) )
874 {
875 stop();
876 clear();
877
878 setListedURL( CTExe, dir, url.file(), no_hidden_files );
879
880 *match = listDirectories( dirList, url.file(), true, false, no_hidden_files );
881 }
882 else if ( !isRunning() ) {
883 *match = finished();
884 }
885 else {
886 if ( d->dirListThread )
887 setListedURL( CTExe, dir, url.file(), no_hidden_files );
888 *match = TQString::null;
889 }
890
891 return true;
892}
893
896// System Executables
897//
898
899bool KURLCompletion::systemexeCompletion(const MyURL &url, TQString *match)
900{
901 if ( url.protocol() != "file" )
902 return false;
903
904 TQString dir = url.dir();
905
906 dir = unescape( dir ); // remove escapes
907
908 // Find directories to search for completions, either
909 //
910 // 1. complete path given in url
911 // 2. current directory (d->cwd)
912 // 3. $PATH
913 // 4. no directory at all
914
915 TQStringList dirList;
916
917 if ( !url.file().isEmpty() ) {
918 // $PATH
919 dirList = TQStringList::split(KPATH_SEPARATOR,
920 TQString::fromLocal8Bit(::getenv("PATH")));
921
922 TQStringList::Iterator it = dirList.begin();
923
924 for ( ; it != dirList.end(); it++ )
925 (*it).append('/');
926 }
927
928 // No hidden files unless the user types "."
929 bool no_hidden_files = url.file().at(0) != '.';
930
931 // List files if needed
932 //
933 if ( !isListedURL( CTExe, dir, url.file(), no_hidden_files ) )
934 {
935 stop();
936 clear();
937
938 setListedURL( CTExe, dir, url.file(), no_hidden_files );
939
940 *match = listDirectories( dirList, url.file(), true, false, no_hidden_files );
941 }
942 else if ( !isRunning() ) {
943 *match = finished();
944 }
945 else {
946 if ( d->dirListThread )
947 setListedURL( CTExe, dir, url.file(), no_hidden_files );
948 *match = TQString::null;
949 }
950
951 return true;
952}
953
956// Local files
957//
958
959bool KURLCompletion::fileCompletion(const MyURL &url, TQString *match)
960{
961 if ( url.protocol() != "file" )
962 return false;
963
964 TQString dir = url.dir();
965
966 if (url.url()[0] == '.')
967 {
968 if (url.url().length() == 1)
969 {
970 *match =
971 ( completionMode() == TDEGlobalSettings::CompletionMan )? "." : "..";
972 return true;
973 }
974 if (url.url().length() == 2 && url.url()[1]=='.')
975 {
976 *match="..";
977 return true;
978 }
979 }
980
981 //kdDebug() << "fileCompletion " << url.url() << " dir=" << dir << endl;
982
983 dir = unescape( dir ); // remove escapes
984
985 // Find directories to search for completions, either
986 //
987 // 1. complete path given in url
988 // 2. current directory (d->cwd)
989 // 3. no directory at all
990
991 TQStringList dirList;
992
993 if ( !TQDir::isRelativePath(dir) ) {
994 // complete path in url
995 dirList.append( dir );
996 }
997 else if ( !d->cwd.isEmpty() ) {
998 // current directory
999 dirList.append( d->cwd + '/' + dir );
1000 }
1001
1002 // No hidden files unless the user types "."
1003 bool no_hidden_files = ( url.file().at(0) != '.' );
1004
1005 // List files if needed
1006 //
1007 if ( !isListedURL( CTFile, dir, "", no_hidden_files ) )
1008 {
1009 stop();
1010 clear();
1011
1012 setListedURL( CTFile, dir, "", no_hidden_files );
1013
1014 // Append '/' to directories in Popup mode?
1015 bool append_slash = ( d->popup_append_slash
1016 && (completionMode() == TDEGlobalSettings::CompletionPopup ||
1017 completionMode() == TDEGlobalSettings::CompletionPopupAuto ) );
1018
1019 bool only_dir = ( d->mode == DirCompletion );
1020
1021 *match = listDirectories( dirList, "", false, only_dir, no_hidden_files,
1022 append_slash );
1023 }
1024 else if ( !isRunning() ) {
1025 *match = finished();
1026 }
1027 else {
1028 *match = TQString::null;
1029 }
1030
1031 return true;
1032}
1033
1036// URLs not handled elsewhere...
1037//
1038
1039bool KURLCompletion::urlCompletion(const MyURL &url, TQString *match)
1040{
1041 //kdDebug() << "urlCompletion: url = " << *url.kurl() << endl;
1042 if (d->onlyLocalProto && KProtocolInfo::protocolClass(url.protocol()) != ":local")
1043 return false;
1044
1045 // Use d->cwd as base url in case url is not absolute
1046 KURL url_cwd = KURL::fromPathOrURL( d->cwd );
1047
1048 // Create an URL with the directory to be listed
1049 KURL url_dir( url_cwd, url.kurl()->url() );
1050
1051 // Don't try url completion if
1052 // 1. malformed url
1053 // 2. protocol that doesn't have listDir()
1054 // 3. there is no directory (e.g. "ftp://ftp.kd" shouldn't do anything)
1055 // 4. auto or popup completion mode depending on settings
1056
1057 bool man_or_info = ( url_dir.protocol() == TQString("man")
1058 || url_dir.protocol() == TQString("info") );
1059
1060 if ( !url_dir.isValid()
1061 || !KProtocolInfo::supportsListing( url_dir )
1062 || ( !man_or_info
1063 && ( url_dir.directory(false,false).isEmpty()
1064 || ( isAutoCompletion()
1065 && !d->url_auto_completion ) ) ) ) {
1066 return false;
1067 }
1068
1069 url_dir.setFileName(""); // not really nesseccary, but clear the filename anyway...
1070
1071 // Remove escapes
1072 TQString dir = url_dir.directory( false, false );
1073
1074 dir = unescape( dir );
1075
1076 url_dir.setPath( dir );
1077
1078 // List files if needed
1079 //
1080 if ( !isListedURL( CTUrl, url_dir.prettyURL(), url.file() ) )
1081 {
1082 stop();
1083 clear();
1084
1085 setListedURL( CTUrl, url_dir.prettyURL(), "" );
1086
1087 TQValueList<KURL*> url_list;
1088 url_list.append( new KURL( url_dir ) );
1089
1090 listURLs( url_list, "", false );
1091
1092 *match = TQString::null;
1093 }
1094 else if ( !isRunning() ) {
1095 *match = finished();
1096 }
1097 else {
1098 *match = TQString::null;
1099 }
1100
1101 return true;
1102}
1103
1106// Directory and URL listing
1107//
1108
1109/*
1110 * addMatches
1111 *
1112 * Called to add matches to TDECompletion
1113 */
1114void KURLCompletion::addMatches( const TQStringList &matches )
1115{
1116 TQStringList::ConstIterator it = matches.begin();
1117 TQStringList::ConstIterator end = matches.end();
1118
1119 if ( d->complete_url )
1120 for ( ; it != end; it++ )
1121 addItem( d->prepend + KURL::encode_string(*it));
1122 else
1123 for ( ; it != end; it++ )
1124 addItem( d->prepend + (*it));
1125}
1126
1127/*
1128 * listDirectories
1129 *
1130 * List files starting with 'filter' in the given directories,
1131 * either using DirLister or listURLs()
1132 *
1133 * In either case, addMatches() is called with the listed
1134 * files, and eventually finished() when the listing is done
1135 *
1136 * Returns the match if available, or TQString::null if
1137 * DirLister timed out or using tdeio
1138 */
1139TQString KURLCompletion::listDirectories(
1140 const TQStringList &dirList,
1141 const TQString &filter,
1142 bool only_exe,
1143 bool only_dir,
1144 bool no_hidden,
1145 bool append_slash_to_dir)
1146{
1147 assert( !isRunning() );
1148
1149 if ( !::getenv("KURLCOMPLETION_LOCAL_TDEIO") ) {
1150
1151 //kdDebug() << "Listing (listDirectories): " << dirList << " filter=" << filter << " without TDEIO" << endl;
1152
1153 // Don't use TDEIO
1154
1155 if ( d->dirListThread )
1156 d->dirListThread->requestTermination();
1157
1158 TQStringList dirs;
1159
1160 for ( TQStringList::ConstIterator it = dirList.begin();
1161 it != dirList.end();
1162 ++it )
1163 {
1164 KURL url;
1165 url.setPath(*it);
1166 if ( kapp->authorizeURLAction( "list", KURL(), url ) )
1167 dirs.append( *it );
1168 }
1169
1170 d->dirListThread = new DirectoryListThread( this, dirs, filter, only_exe, only_dir,
1171 no_hidden, append_slash_to_dir );
1172 d->dirListThread->start();
1173 d->dirListThread->wait( 200 );
1174 addMatches( d->dirListThread->matches() );
1175
1176 return finished();
1177 }
1178 else {
1179
1180 // Use TDEIO
1181 //kdDebug() << "Listing (listDirectories): " << dirList << " with TDEIO" << endl;
1182
1183 TQValueList<KURL*> url_list;
1184
1185 TQStringList::ConstIterator it = dirList.begin();
1186
1187 for ( ; it != dirList.end(); it++ )
1188 url_list.append( new KURL(*it) );
1189
1190 listURLs( url_list, filter, only_exe, no_hidden );
1191 // Will call addMatches() and finished()
1192
1193 return TQString::null;
1194 }
1195}
1196
1197/*
1198 * listURLs
1199 *
1200 * Use TDEIO to list the given urls
1201 *
1202 * addMatches() is called with the listed files
1203 * finished() is called when the listing is done
1204 */
1205void KURLCompletion::listURLs(
1206 const TQValueList<KURL *> &urls,
1207 const TQString &filter,
1208 bool only_exe,
1209 bool no_hidden )
1210{
1211 assert( d->list_urls.isEmpty() );
1212 assert( d->list_job == 0L );
1213
1214 d->list_urls = urls;
1215 d->list_urls_filter = filter;
1216 d->list_urls_only_exe = only_exe;
1217 d->list_urls_no_hidden = no_hidden;
1218
1219// kdDebug() << "Listing URLs: " << urls[0]->prettyURL() << ",..." << endl;
1220
1221 // Start it off by calling slotIOFinished
1222 //
1223 // This will start a new list job as long as there
1224 // are urls in d->list_urls
1225 //
1226 slotIOFinished(0L);
1227}
1228
1229/*
1230 * slotEntries
1231 *
1232 * Receive files listed by TDEIO and call addMatches()
1233 */
1234void KURLCompletion::slotEntries(TDEIO::Job*, const TDEIO::UDSEntryList& entries)
1235{
1236 TQStringList matches;
1237
1238 TDEIO::UDSEntryListConstIterator it = entries.begin();
1239 TDEIO::UDSEntryListConstIterator end = entries.end();
1240
1241 TQString filter = d->list_urls_filter;
1242
1243 int filter_len = filter.length();
1244
1245 // Iterate over all files
1246 //
1247 for (; it != end; ++it) {
1248 TQString name;
1249 TQString url;
1250 bool is_exe = false;
1251 bool is_dir = false;
1252
1253 TDEIO::UDSEntry e = *it;
1254 TDEIO::UDSEntry::ConstIterator it_2 = e.begin();
1255
1256 for( ; it_2 != e.end(); it_2++ ) {
1257 switch ( (*it_2).m_uds ) {
1258 case TDEIO::UDS_NAME:
1259 name = (*it_2).m_str;
1260 break;
1261 case TDEIO::UDS_ACCESS:
1262 is_exe = ((*it_2).m_long & MODE_EXE) != 0;
1263 break;
1264 case TDEIO::UDS_FILE_TYPE:
1265 is_dir = ((*it_2).m_long & S_IFDIR) != 0;
1266 break;
1267 case TDEIO::UDS_URL:
1268 url = (*it_2).m_str;
1269 break;
1270 }
1271 }
1272
1273 if (!url.isEmpty()) {
1274 // kdDebug() << "KURLCompletion::slotEntries url: " << url << endl;
1275 name = KURL(url).fileName();
1276 }
1277
1278 // kdDebug() << "KURLCompletion::slotEntries name: " << name << endl;
1279
1280 if ( name[0] == '.' &&
1281 ( d->list_urls_no_hidden ||
1282 name.length() == 1 ||
1283 ( name.length() == 2 && name[1] == '.' ) ) )
1284 continue;
1285
1286 if ( d->mode == DirCompletion && !is_dir )
1287 continue;
1288
1289 if ( filter_len == 0 || name.left(filter_len) == filter ) {
1290 if ( is_dir )
1291 name.append( '/' );
1292
1293 if ( is_exe || !d->list_urls_only_exe )
1294 matches.append( name );
1295 }
1296 }
1297
1298 addMatches( matches );
1299}
1300
1301/*
1302 * slotIOFinished
1303 *
1304 * Called when a TDEIO job is finished.
1305 *
1306 * Start a new list job if there are still urls in
1307 * d->list_urls, otherwise call finished()
1308 */
1309void KURLCompletion::slotIOFinished( TDEIO::Job * job )
1310{
1311// kdDebug() << "slotIOFinished() " << endl;
1312
1313 assert( job == d->list_job );
1314
1315 if ( d->list_urls.isEmpty() ) {
1316
1317 d->list_job = 0L;
1318
1319 finished(); // will call TDECompletion::makeCompletion()
1320
1321 }
1322 else {
1323
1324 KURL *kurl = d->list_urls.first();
1325
1326 d->list_urls.remove( kurl );
1327
1328// kdDebug() << "Start TDEIO: " << kurl->prettyURL() << endl;
1329
1330 d->list_job = TDEIO::listDir( *kurl, false );
1331 d->list_job->addMetaData("no-auth-prompt", "true");
1332
1333 assert( d->list_job );
1334
1335 connect( d->list_job,
1336 TQ_SIGNAL(result(TDEIO::Job*)),
1337 TQ_SLOT(slotIOFinished(TDEIO::Job*)) );
1338
1339 connect( d->list_job,
1340 TQ_SIGNAL( entries( TDEIO::Job*, const TDEIO::UDSEntryList&)),
1341 TQ_SLOT( slotEntries( TDEIO::Job*, const TDEIO::UDSEntryList&)) );
1342
1343 delete kurl;
1344 }
1345}
1346
1349
1350/*
1351 * postProcessMatch, postProcessMatches
1352 *
1353 * Called by TDECompletion before emitting match() and matches()
1354 *
1355 * Append '/' to directories for file completion. This is
1356 * done here to avoid stat()'ing a lot of files
1357 */
1358void KURLCompletion::postProcessMatch( TQString *match ) const
1359{
1360// kdDebug() << "KURLCompletion::postProcess: " << *match << endl;
1361
1362 if ( !match->isEmpty() ) {
1363
1364 // Add '/' to directories in file completion mode
1365 // unless it has already been done
1366 if ( d->last_compl_type == CTFile )
1367 adjustMatch( *match );
1368 }
1369}
1370
1371void KURLCompletion::adjustMatch( TQString& match ) const
1372{
1373 if ( match.at( match.length()-1 ) != '/' )
1374 {
1375 TQString copy;
1376
1377 if ( match.startsWith( TQString("file:") ) )
1378 copy = KURL(match).path();
1379 else
1380 copy = match;
1381
1382 expandTilde( copy );
1383 expandEnv( copy );
1384 if ( TQDir::isRelativePath(copy) )
1385 copy.prepend( d->cwd + '/' );
1386
1387// kdDebug() << "postProcess: stating " << copy << endl;
1388
1389 KDE_struct_stat sbuff;
1390
1391 TQCString file = TQFile::encodeName( copy );
1392
1393 if ( KDE_stat( (const char*)file, &sbuff ) == 0 ) {
1394 if ( S_ISDIR ( sbuff.st_mode ) )
1395 match.append( '/' );
1396 }
1397 else {
1398 kdDebug() << "Could not stat file " << copy << endl;
1399 }
1400 }
1401}
1402
1403void KURLCompletion::postProcessMatches( TQStringList * matches ) const
1404{
1405 if ( !matches->isEmpty() && d->last_compl_type == CTFile ) {
1406 TQStringList::Iterator it = matches->begin();
1407 for (; it != matches->end(); ++it ) {
1408 adjustMatch( (*it) );
1409 }
1410 }
1411}
1412
1413void KURLCompletion::postProcessMatches( TDECompletionMatches * matches ) const
1414{
1415 if ( !matches->isEmpty() && d->last_compl_type == CTFile ) {
1416 TDECompletionMatches::Iterator it = matches->begin();
1417 for (; it != matches->end(); ++it ) {
1418 adjustMatch( (*it).value() );
1419 }
1420 }
1421}
1422
1423void KURLCompletion::customEvent(TQCustomEvent *e)
1424{
1425 if ( e->type() == CompletionMatchEvent::uniqueType() ) {
1426
1427 CompletionMatchEvent *event = static_cast<CompletionMatchEvent *>( e );
1428
1429 event->completionThread()->wait();
1430
1431 if ( !isListedURL( CTUser ) ) {
1432 stop();
1433 clear();
1434 addMatches( event->completionThread()->matches() );
1435 }
1436
1437 setListedURL( CTUser );
1438
1439 if ( d->userListThread == event->completionThread() )
1440 d->userListThread = 0;
1441
1442 if ( d->dirListThread == event->completionThread() )
1443 d->dirListThread = 0;
1444
1445 delete event->completionThread();
1446 }
1447}
1448
1449// static
1450TQString KURLCompletion::replacedPath( const TQString& text, bool replaceHome, bool replaceEnv )
1451{
1452 if ( text.isEmpty() )
1453 return text;
1454
1455 MyURL url( text, TQString::null ); // no need to replace something of our current cwd
1456 if ( !url.kurl()->isLocalFile() )
1457 return text;
1458
1459 url.filter( replaceHome, replaceEnv );
1460 return url.dir() + url.file();
1461}
1462
1463
1464TQString KURLCompletion::replacedPath( const TQString& text )
1465{
1466 return replacedPath( text, d->replace_home, d->replace_env );
1467}
1468
1471// Static functions
1472
1473/*
1474 * expandEnv
1475 *
1476 * Expand environment variables in text. Escaped '$' are ignored.
1477 * Return true if expansion was made.
1478 */
1479static bool expandEnv( TQString &text )
1480{
1481 // Find all environment variables beginning with '$'
1482 //
1483 int pos = 0;
1484
1485 bool expanded = false;
1486
1487 while ( (pos = text.find('$', pos)) != -1 ) {
1488
1489 // Skip escaped '$'
1490 //
1491 if ( text[pos-1] == '\\' ) {
1492 pos++;
1493 }
1494 // Variable found => expand
1495 //
1496 else {
1497 // Find the end of the variable = next '/' or ' '
1498 //
1499 int pos2 = text.find( ' ', pos+1 );
1500 int pos_tmp = text.find( '/', pos+1 );
1501
1502 if ( pos2 == -1 || (pos_tmp != -1 && pos_tmp < pos2) )
1503 pos2 = pos_tmp;
1504
1505 if ( pos2 == -1 )
1506 pos2 = text.length();
1507
1508 // Replace if the variable is terminated by '/' or ' '
1509 // and defined
1510 //
1511 if ( pos2 >= 0 ) {
1512 int len = pos2 - pos;
1513 TQString key = text.mid( pos+1, len-1);
1514 TQString value =
1515 TQString::fromLocal8Bit( ::getenv(key.local8Bit()) );
1516
1517 if ( !value.isEmpty() ) {
1518 expanded = true;
1519 text.replace( pos, len, value );
1520 pos = pos + value.length();
1521 }
1522 else {
1523 pos = pos2;
1524 }
1525 }
1526 }
1527 }
1528
1529 return expanded;
1530}
1531
1532/*
1533 * expandTilde
1534 *
1535 * Replace "~user" with the users home directory
1536 * Return true if expansion was made.
1537 */
1538static bool expandTilde(TQString &text)
1539{
1540 if ( text[0] != '~' )
1541 return false;
1542
1543 bool expanded = false;
1544
1545 // Find the end of the user name = next '/' or ' '
1546 //
1547 int pos2 = text.find( ' ', 1 );
1548 int pos_tmp = text.find( '/', 1 );
1549
1550 if ( pos2 == -1 || (pos_tmp != -1 && pos_tmp < pos2) )
1551 pos2 = pos_tmp;
1552
1553 if ( pos2 == -1 )
1554 pos2 = text.length();
1555
1556 // Replace ~user if the user name is terminated by '/' or ' '
1557 //
1558 if ( pos2 >= 0 ) {
1559
1560 TQString user = text.mid( 1, pos2-1 );
1561 TQString dir;
1562
1563 // A single ~ is replaced with $HOME
1564 //
1565 if ( user.isEmpty() ) {
1566 dir = TQDir::homeDirPath();
1567 }
1568 // ~user is replaced with the dir from passwd
1569 //
1570 else {
1571 struct passwd *pw = ::getpwnam( user.local8Bit() );
1572
1573 if ( pw )
1574 dir = TQFile::decodeName( pw->pw_dir );
1575
1576 ::endpwent();
1577 }
1578
1579 if ( !dir.isEmpty() ) {
1580 expanded = true;
1581 text.replace(0, pos2, dir);
1582 }
1583 }
1584
1585 return expanded;
1586}
1587
1588/*
1589 * unescape
1590 *
1591 * Remove escapes and return the result in a new string
1592 *
1593 */
1594static TQString unescape(const TQString &text)
1595{
1596 TQString result;
1597
1598 for (uint pos = 0; pos < text.length(); pos++)
1599 if ( text[pos] != '\\' )
1600 result.insert( result.length(), text[pos] );
1601
1602 return result;
1603}
1604
1605void KURLCompletion::virtual_hook( int id, void* data )
1606{ TDECompletion::virtual_hook( id, data ); }
1607
1608#include "kurlcompletion.moc"
1609
KProtocolInfo::protocolClass
static TQString protocolClass(const TQString &protocol)
Returns the protocol class for the specified protocol.
KProtocolInfo::supportsListing
static bool supportsListing(const KURL &url)
Returns whether the protocol can list files/objects.
Definition kprotocolinfo.cpp:121
KURLCompletion
This class does completion of URLs including user directories (~user) and environment variables.
Definition kurlcompletion.h:42
KURLCompletion::replacedPath
TQString replacedPath(const TQString &text)
Replaces username and/or environment variables, depending on the current settings and returns the fil...
Definition kurlcompletion.cpp:1464
KURLCompletion::Mode
Mode
Determines how completion is done.
Definition kurlcompletion.h:53
KURLCompletion::isRunning
virtual bool isRunning() const
Check whether asynchronous completion is in progress.
Definition kurlcompletion.cpp:672
KURLCompletion::setReplaceHome
virtual void setReplaceHome(bool replace)
Enables/disables completion of ~username and replacement (internally) of ~username with the user's ho...
Definition kurlcompletion.cpp:564
KURLCompletion::setReplaceEnv
virtual void setReplaceEnv(bool replace)
Enables/disables completion and replacement (internally) of environment variables in URLs.
Definition kurlcompletion.cpp:554
KURLCompletion::setDir
virtual void setDir(const TQString &dir)
Sets the current directory (used as base for completion).
Definition kurlcompletion.cpp:529
KURLCompletion::~KURLCompletion
virtual ~KURLCompletion()
Destructs the KURLCompletion object.
Definition kurlcompletion.cpp:500
KURLCompletion::dir
virtual TQString dir() const
Returns the current directory, as it was given in setDir.
Definition kurlcompletion.cpp:534
KURLCompletion::stop
virtual void stop()
Stops asynchronous completion.
Definition kurlcompletion.cpp:682
KURLCompletion::replaceEnv
virtual bool replaceEnv() const
Checks whether environment variables are completed and whether they are replaced internally while fin...
Definition kurlcompletion.cpp:549
KURLCompletion::mode
virtual Mode mode() const
Returns the completion mode: exe or file completion (default FileCompletion).
Definition kurlcompletion.cpp:539
KURLCompletion::KURLCompletion
KURLCompletion()
Constructs a KURLCompletion object in FileCompletion mode.
Definition kurlcompletion.cpp:488
KURLCompletion::setMode
virtual void setMode(Mode mode)
Changes the completion mode: exe or file completion.
Definition kurlcompletion.cpp:544
KURLCompletion::makeCompletion
virtual TQString makeCompletion(const TQString &text)
Finds completions to the given text.
Definition kurlcompletion.cpp:574
KURLCompletion::replaceHome
virtual bool replaceHome() const
Returns whether ~username is completed and whether ~username is replaced internally with the user's h...
Definition kurlcompletion.cpp:559
TDEIO::Job
The base class for all jobs.
Definition jobclasses.h:67
TDEIO::ListJob
A ListJob is allows you to get the get the content of a directory.
Definition jobclasses.h:1391
TDEIO::UDS_URL
@ UDS_URL
An alternative URL (If different from the caption)
Definition global.h:371
TDEIO::UDS_FILE_TYPE
@ UDS_FILE_TYPE
File type, part of the mode returned by stat (for a link, this returns the file type of the pointed i...
Definition global.h:366
TDEIO::UDS_ACCESS
@ UDS_ACCESS
Access permissions (part of the mode returned by stat)
Definition global.h:356
TDEIO::UDS_NAME
@ UDS_NAME
Filename - as displayed in directory listings etc.
Definition global.h:335
TDEIO::UDSEntry
TQValueList< UDSAtom > UDSEntry
An entry is the list of atoms containing all the information for a file or URL.
Definition global.h:507
TDEIO::listDir
TDEIO_EXPORT ListJob * listDir(const KURL &url, bool showProgressInfo=true, bool includeHidden=true)
List the contents of url, which is assumed to be a directory.
Definition job.cpp:2216
TDEIO::copy
TDEIO_EXPORT CopyJob * copy(const KURL &src, const KURL &dest, bool showProgressInfo=true)
Copy a file or directory src into the destination dest, which can be a file (including the final file...
Definition job.cpp:3950

tdeio/tdeio

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

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • 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/tdeio by doxygen 1.9.8
This website is maintained by Timothy Pearson.