kshellcompletion.h
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2000 David Smith <dsmith@algonet.se> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KSHELLCOMPLETION_H 00021 #define KSHELLCOMPLETION_H 00022 00023 #include <tqstring.h> 00024 #include <tqstringlist.h> 00025 00026 #include "kurlcompletion.h" 00027 00028 class KShellCompletionPrivate; 00029 00040 class TDEIO_EXPORT KShellCompletion : public KURLCompletion 00041 { 00042 Q_OBJECT 00043 00044 public: 00048 KShellCompletion(); 00049 00056 TQString makeCompletion(const TQString &text); 00057 00058 protected: 00059 // Called by TDECompletion 00060 void postProcessMatch( TQString *match ) const; 00061 void postProcessMatches( TQStringList *matches ) const; 00062 void postProcessMatches( TDECompletionMatches *matches ) const; 00063 00064 private: 00065 // Find the part of text that should be completed 00066 void splitText(const TQString &text, TQString &text_start, TQString &text_compl) const; 00067 // Insert quotes and neseccary escapes 00068 bool quoteText(TQString *text, bool force, bool skip_last) const; 00069 TQString unquote(const TQString &text) const; 00070 00071 TQString m_text_start; // part of the text that was not completed 00072 TQString m_text_compl; // part of the text that was completed (unchanged) 00073 00074 TQChar m_word_break_char; 00075 TQChar m_quote_char1; 00076 TQChar m_quote_char2; 00077 TQChar m_escape_char; 00078 00079 protected: 00080 virtual void virtual_hook( int id, void* data ); 00081 private: 00082 KShellCompletionPrivate *d; 00083 }; 00084 00085 #endif // KSHELLCOMPLETION_H