diff --git a/kabc/addresslineedit.cpp b/kabc/addresslineedit.cpp index 88703094b..cd6820fcd 100644 --- a/kabc/addresslineedit.cpp +++ b/kabc/addresslineedit.cpp @@ -55,7 +55,7 @@ using namespace KABC; -KCompletion * AddressLineEdit::s_completion = 0L; +TDECompletion * AddressLineEdit::s_completion = 0L; bool AddressLineEdit::s_addressesDirty = false; TQTimer* AddressLineEdit::s_LDAPTimer = 0L; LdapSearch* AddressLineEdit::s_LDAPSearch = 0L; @@ -63,7 +63,7 @@ TQString* AddressLineEdit::s_LDAPText = 0L; AddressLineEdit* AddressLineEdit::s_LDAPLineEdit = 0L; TDEConfig *AddressLineEdit::s_config = 0L; -static KStaticDeleter completionDeleter; +static KStaticDeleter completionDeleter; static KStaticDeleter ldapTimerDeleter; static KStaticDeleter ldapSearchDeleter; static KStaticDeleter ldapTextDeleter; @@ -93,8 +93,8 @@ AddressLineEdit::AddressLineEdit(TQWidget* parent, void AddressLineEdit::init() { if ( !s_completion ) { - completionDeleter.setObject( s_completion, new KCompletion() ); - s_completion->setOrder( KCompletion::Sorted ); + completionDeleter.setObject( s_completion, new TDECompletion() ); + s_completion->setOrder( TDECompletion::Sorted ); s_completion->setIgnoreCase( true ); } @@ -115,7 +115,7 @@ void AddressLineEdit::init() connect( this, TQT_SIGNAL( completion(const TQString&)), this, TQT_SLOT(slotCompletion() )); - KCompletionBox *box = completionBox(); + TDECompletionBox *box = completionBox(); connect( box, TQT_SIGNAL( highlighted( const TQString& )), this, TQT_SLOT( slotPopupCompletion( const TQString& ) )); connect( box, TQT_SIGNAL( userCancelled( const TQString& )), diff --git a/kabc/addresslineedit.h b/kabc/addresslineedit.h index 0cbd5dd43..f81ffbfe4 100644 --- a/kabc/addresslineedit.h +++ b/kabc/addresslineedit.h @@ -107,7 +107,7 @@ private: TQString m_typedText; // unused static bool s_addressesDirty; - static KCompletion *s_completion; + static TDECompletion *s_completion; static TQTimer *s_LDAPTimer; static LdapSearch *s_LDAPSearch; static TQString *s_LDAPText; diff --git a/kate/interfaces/document.h b/kate/interfaces/document.h index 06c8c4133..381e32fa2 100644 --- a/kate/interfaces/document.h +++ b/kate/interfaces/document.h @@ -40,7 +40,7 @@ #include -class KCompletion; +class TDECompletion; /** * Kate namespace @@ -146,7 +146,7 @@ class CommandExtension virtual void flagCompletions( TQStringList& /*list*/ ) {;} /** - * @return a KCompletion object that will substitute the command line default + * @return a TDECompletion object that will substitute the command line default * one while typing the first argument to the command. The text will be * added to the command seperated by one space character. * @@ -154,7 +154,7 @@ class CommandExtension * * @param cmdname The command name associated with this request. */ - virtual KCompletion *completionObject( const TQString & cmdname, Kate::View * /*view*/ ) { Q_UNUSED(cmdname); return 0L; } + virtual TDECompletion *completionObject( const TQString & cmdname, Kate::View * /*view*/ ) { Q_UNUSED(cmdname); return 0L; } /** * @return whether this command wants to process text interactively given the @p cmdname. diff --git a/kate/interfaces/katecmd.cpp b/kate/interfaces/katecmd.cpp index 2104ef157..ef356a6bb 100644 --- a/kate/interfaces/katecmd.cpp +++ b/kate/interfaces/katecmd.cpp @@ -123,7 +123,7 @@ const TQString KateCmd::fromHistory( uint index ) const Copyright (C) 2004 Anders Lund */ KateCmdShellCompletion::KateCmdShellCompletion() - : KCompletion() + : TDECompletion() { m_word_break_char = ' '; m_quote_char1 = '\"'; @@ -139,7 +139,7 @@ TQString KateCmdShellCompletion::makeCompletion( const TQString &text ) // Make completion on the last part of text // - return KCompletion::makeCompletion( m_text_compl ); + return TDECompletion::makeCompletion( m_text_compl ); } void KateCmdShellCompletion::postProcessMatch( TQString *match ) const @@ -158,9 +158,9 @@ void KateCmdShellCompletion::postProcessMatches( TQStringList *matches ) const (*it).prepend( m_text_start ); } -void KateCmdShellCompletion::postProcessMatches( KCompletionMatches *matches ) const +void KateCmdShellCompletion::postProcessMatches( TDECompletionMatches *matches ) const { - for ( KCompletionMatches::Iterator it = matches->begin(); + for ( TDECompletionMatches::Iterator it = matches->begin(); it != matches->end(); it++ ) if ( !(*it).value().isNull() ) (*it).value().prepend( m_text_start ); diff --git a/kate/interfaces/katecmd.h b/kate/interfaces/katecmd.h index b01f6dafb..262781aa3 100644 --- a/kate/interfaces/katecmd.h +++ b/kate/interfaces/katecmd.h @@ -53,12 +53,12 @@ class KATEPARTINTERFACES_EXPORT KateCmd }; /** - * A KCompletion object that completes last ?unquoted? word in the string + * A TDECompletion object that completes last ?unquoted? word in the string * passed. Dont mistake "shell" for anything related to quoting, this * simply mimics shell tab completion by completing the last word in the * provided text. */ -class KATEPARTINTERFACES_EXPORT KateCmdShellCompletion : public KCompletion +class KATEPARTINTERFACES_EXPORT KateCmdShellCompletion : public TDECompletion { public: KateCmdShellCompletion(); @@ -72,10 +72,10 @@ class KATEPARTINTERFACES_EXPORT KateCmdShellCompletion : public KCompletion TQString makeCompletion(const TQString &text); protected: - // Called by KCompletion + // Called by TDECompletion void postProcessMatch( TQString *match ) const; void postProcessMatches( TQStringList *matches ) const; - void postProcessMatches( KCompletionMatches *matches ) const; + void postProcessMatches( TDECompletionMatches *matches ) const; private: /** diff --git a/kate/part/katecmds.cpp b/kate/part/katecmds.cpp index c5feb5071..ad8943328 100644 --- a/kate/part/katecmds.cpp +++ b/kate/part/katecmds.cpp @@ -279,7 +279,7 @@ bool KateCommands::CoreCommands::exec(Kate::View *view, KCC_ERR( i18n("Unknown command '%1'").arg(cmd) ); } -KCompletion *KateCommands::CoreCommands::completionObject( const TQString &cmd, Kate::View *view ) +TDECompletion *KateCommands::CoreCommands::completionObject( const TQString &cmd, Kate::View *view ) { if ( cmd == "set-highlight" ) { diff --git a/kate/part/katecmds.h b/kate/part/katecmds.h index 55c8d807b..d313be91d 100644 --- a/kate/part/katecmds.h +++ b/kate/part/katecmds.h @@ -25,7 +25,7 @@ #include "../interfaces/view.h" class KateDocument; -class KCompletion; +class TDECompletion; namespace KateCommands { @@ -59,7 +59,7 @@ class CoreCommands : public Kate::Command, public Kate::CommandExtension /** * override completionObject from interfaces/document.h . */ - KCompletion *completionObject( const TQString &cmd, Kate::View *view ); + TDECompletion *completionObject( const TQString &cmd, Kate::View *view ); }; /** diff --git a/kate/part/kateviewhelpers.cpp b/kate/part/kateviewhelpers.cpp index 72b7be0f5..ef70e3449 100644 --- a/kate/part/kateviewhelpers.cpp +++ b/kate/part/kateviewhelpers.cpp @@ -272,7 +272,7 @@ class KateCmdLnWhatsThis : public TQWhatsThis * This class provide completion of flags. It shows a short description of * each flag, and flags are appended. */ -class KateCmdLineFlagCompletion : public KCompletion +class KateCmdLineFlagCompletion : public TDECompletion { public: KateCmdLineFlagCompletion() {;} @@ -365,7 +365,7 @@ void KateCmdLine::slotReturnPressed ( const TQString& text ) // clean up if ( m_oldCompletionObject ) { - KCompletion *c = completionObject(); + TDECompletion *c = completionObject(); setCompletionObject( m_oldCompletionObject ); m_oldCompletionObject = 0; delete c; @@ -465,7 +465,7 @@ void KateCmdLine::keyPressEvent( TQKeyEvent *ev ) // clean up if needed if ( m_oldCompletionObject ) { - KCompletion *c = completionObject(); + TDECompletion *c = completionObject(); setCompletionObject( m_oldCompletionObject ); m_oldCompletionObject = 0; delete c; @@ -483,7 +483,7 @@ void KateCmdLine::keyPressEvent( TQKeyEvent *ev ) Kate::CommandExtension *ce = dynamic_cast(m_command); if ( ce ) { - KCompletion *cmpl = ce->completionObject( text().left( m_cmdend ).stripWhiteSpace(), m_view ); + TDECompletion *cmpl = ce->completionObject( text().left( m_cmdend ).stripWhiteSpace(), m_view ); if ( cmpl ) { // save the old completion object and use what the command provides diff --git a/kate/part/kateviewhelpers.h b/kate/part/kateviewhelpers.h index 0ff59352e..980d4d1cd 100644 --- a/kate/part/kateviewhelpers.h +++ b/kate/part/kateviewhelpers.h @@ -115,7 +115,7 @@ class KateCmdLine : public KLineEdit uint m_histpos; ///< position in the history uint m_cmdend; ///< the point where a command ends in the text, if we have a valid one. Kate::Command *m_command; ///< For completing flags/args and interactiveness - class KCompletion *m_oldCompletionObject; ///< save while completing command args. + class TDECompletion *m_oldCompletionObject; ///< save while completing command args. class KateCmdLnWhatsThis *m_help; }; diff --git a/kstyles/keramik/keramik.cpp b/kstyles/keramik/keramik.cpp index d04c9abd8..fa1848203 100644 --- a/kstyles/keramik/keramik.cpp +++ b/kstyles/keramik/keramik.cpp @@ -354,7 +354,7 @@ void KeramikStyle::polish(const TQStyleControlElementData &ceData, ControlElemen else if ( widget->parentWidget() && ( ( widget->inherits( TQLISTBOX_OBJECT_NAME_STRING ) && widget->parentWidget()->inherits( TQCOMBOBOX_OBJECT_NAME_STRING ) ) || - widget->inherits( "KCompletionBox" ) ) ) { + widget->inherits( "TDECompletionBox" ) ) ) { TQListBox* listbox = (TQListBox*) widget; listbox->setLineWidth( 4 ); listbox->setBackgroundMode( NoBackground ); @@ -399,7 +399,7 @@ void KeramikStyle::unPolish(const TQStyleControlElementData &ceData, ControlElem else if ( widget->parentWidget() && ( ( widget->inherits( TQLISTBOX_OBJECT_NAME_STRING ) && widget->parentWidget()->inherits( TQCOMBOBOX_OBJECT_NAME_STRING ) ) || - widget->inherits( "KCompletionBox" ) ) ) { + widget->inherits( "TDECompletionBox" ) ) ) { TQListBox* listbox = (TQListBox*) widget; listbox->setLineWidth( 1 ); listbox->setBackgroundMode( PaletteBackground ); diff --git a/tdecore/AUTHORS b/tdecore/AUTHORS index dbe44b9ca..57935fce7 100644 --- a/tdecore/AUTHORS +++ b/tdecore/AUTHORS @@ -53,4 +53,4 @@ Thomas Tanner ltdl.c + ltdl.h Carsten Pfeiffer -KCompletion classes +TDECompletion classes diff --git a/tdecore/kcompletion.cpp b/tdecore/kcompletion.cpp index 6e64c573b..730eadbf9 100644 --- a/tdecore/kcompletion.cpp +++ b/tdecore/kcompletion.cpp @@ -30,20 +30,20 @@ #include "kcompletion_private.h" -class KCompletionPrivate +class TDECompletionPrivate { public: // not a member to avoid #including kcompletion_private.h from kcompletion.h // list used for nextMatch() and previousMatch() - KCompletionMatchesWrapper matches; + TDECompletionMatchesWrapper matches; }; -KCompletion::KCompletion() +TDECompletion::TDECompletion() { - d = new KCompletionPrivate; + d = new TDECompletionPrivate; myCompletionMode = TDEGlobalSettings::completionMode(); - myTreeRoot = new KCompTreeNode; + myTreeRoot = new TDECompTreeNode; myBeep = true; myIgnoreCase = false; myHasMultipleMatches = false; @@ -51,31 +51,31 @@ KCompletion::KCompletion() setOrder( Insertion ); } -KCompletion::~KCompletion() +TDECompletion::~TDECompletion() { delete d; delete myTreeRoot; } -void KCompletion::setOrder( CompOrder order ) +void TDECompletion::setOrder( CompOrder order ) { myOrder = order; d->matches.setSorting( order == Weighted ); } -void KCompletion::setIgnoreCase( bool ignoreCase ) +void TDECompletion::setIgnoreCase( bool ignoreCase ) { myIgnoreCase = ignoreCase; } -void KCompletion::setItems( const TQStringList& items ) +void TDECompletion::setItems( const TQStringList& items ) { clear(); insertItems( items ); } -void KCompletion::insertItems( const TQStringList& items ) +void TDECompletion::insertItems( const TQStringList& items ) { bool weighted = (myOrder == Weighted); TQStringList::ConstIterator it; @@ -89,21 +89,21 @@ void KCompletion::insertItems( const TQStringList& items ) } } -TQStringList KCompletion::items() const +TQStringList TDECompletion::items() const { - KCompletionMatchesWrapper list; // unsorted + TDECompletionMatchesWrapper list; // unsorted bool addWeight = (myOrder == Weighted); extractStringsFromNode( myTreeRoot, TQString::null, &list, addWeight ); return list.list(); } -bool KCompletion::isEmpty() const +bool TDECompletion::isEmpty() const { return (myTreeRoot->childrenCount() == 0); } -void KCompletion::addItem( const TQString& item ) +void TDECompletion::addItem( const TQString& item ) { d->matches.clear(); myRotationIndex = 0; @@ -112,12 +112,12 @@ void KCompletion::addItem( const TQString& item ) addItem( item, 0 ); } -void KCompletion::addItem( const TQString& item, uint weight ) +void TDECompletion::addItem( const TQString& item, uint weight ) { if ( item.isEmpty() ) return; - KCompTreeNode *node = myTreeRoot; + TDECompTreeNode *node = myTreeRoot; uint len = item.length(); bool sorted = (myOrder == Sorted); @@ -139,7 +139,7 @@ void KCompletion::addItem( const TQString& item, uint weight ) // tqDebug("*** added: %s (%i)", item.latin1(), node->weight()); } -void KCompletion::addWeightedItem( const TQString& item ) +void TDECompletion::addWeightedItem( const TQString& item ) { if ( myOrder != Weighted ) { addItem( item, 0 ); @@ -165,7 +165,7 @@ void KCompletion::addWeightedItem( const TQString& item ) } -void KCompletion::removeItem( const TQString& item ) +void TDECompletion::removeItem( const TQString& item ) { d->matches.clear(); myRotationIndex = 0; @@ -175,23 +175,23 @@ void KCompletion::removeItem( const TQString& item ) } -void KCompletion::clear() +void TDECompletion::clear() { d->matches.clear(); myRotationIndex = 0; myLastString = TQString::null; delete myTreeRoot; - myTreeRoot = new KCompTreeNode; + myTreeRoot = new TDECompTreeNode; } -TQString KCompletion::makeCompletion( const TQString& string ) +TQString TDECompletion::makeCompletion( const TQString& string ) { if ( myCompletionMode == TDEGlobalSettings::CompletionNone ) return TQString::null; - //kdDebug(0) << "KCompletion: completing: " << string << endl; + //kdDebug(0) << "TDECompletion: completing: " << string << endl; d->matches.clear(); myRotationIndex = 0; @@ -237,7 +237,7 @@ TQString KCompletion::makeCompletion( const TQString& string ) postProcessMatch( &completion ); if ( !string.isEmpty() ) { // only emit match when string is not empty - //kdDebug(0) << "KCompletion: Match: " << completion << endl; + //kdDebug(0) << "TDECompletion: Match: " << completion << endl; emit match( completion ); } @@ -248,11 +248,11 @@ TQString KCompletion::makeCompletion( const TQString& string ) } -TQStringList KCompletion::substringCompletion( const TQString& string ) const +TQStringList TDECompletion::substringCompletion( const TQString& string ) const { // get all items in the tree, possibly in sorted order bool sorted = (myOrder == Weighted); - KCompletionMatchesWrapper allItems( sorted ); + TDECompletionMatchesWrapper allItems( sorted ); extractStringsFromNode( myTreeRoot, TQString::null, &allItems, false ); TQStringList list = allItems.list(); @@ -288,17 +288,17 @@ TQStringList KCompletion::substringCompletion( const TQString& string ) const } -void KCompletion::setCompletionMode( TDEGlobalSettings::Completion mode ) +void TDECompletion::setCompletionMode( TDEGlobalSettings::Completion mode ) { myCompletionMode = mode; } -TQStringList KCompletion::allMatches() +TQStringList TDECompletion::allMatches() { // Don't use d->matches since calling postProcessMatches() // on d->matches here would interfere with call to // postProcessMatch() during rotation - KCompletionMatchesWrapper matches( myOrder == Weighted ); + TDECompletionMatchesWrapper matches( myOrder == Weighted ); bool dummy; findAllCompletions( myLastString, &matches, dummy ); TQStringList l = matches.list(); @@ -306,22 +306,22 @@ TQStringList KCompletion::allMatches() return l; } -KCompletionMatches KCompletion::allWeightedMatches() +TDECompletionMatches TDECompletion::allWeightedMatches() { // Don't use d->matches since calling postProcessMatches() // on d->matches here would interfere with call to // postProcessMatch() during rotation - KCompletionMatchesWrapper matches( myOrder == Weighted ); + TDECompletionMatchesWrapper matches( myOrder == Weighted ); bool dummy; findAllCompletions( myLastString, &matches, dummy ); - KCompletionMatches ret( matches ); + TDECompletionMatches ret( matches ); postProcessMatches( &ret ); return ret; } -TQStringList KCompletion::allMatches( const TQString &string ) +TQStringList TDECompletion::allMatches( const TQString &string ) { - KCompletionMatchesWrapper matches( myOrder == Weighted ); + TDECompletionMatchesWrapper matches( myOrder == Weighted ); bool dummy; findAllCompletions( string, &matches, dummy ); TQStringList l = matches.list(); @@ -329,12 +329,12 @@ TQStringList KCompletion::allMatches( const TQString &string ) return l; } -KCompletionMatches KCompletion::allWeightedMatches( const TQString &string ) +TDECompletionMatches TDECompletion::allWeightedMatches( const TQString &string ) { - KCompletionMatchesWrapper matches( myOrder == Weighted ); + TDECompletionMatchesWrapper matches( myOrder == Weighted ); bool dummy; findAllCompletions( string, &matches, dummy ); - KCompletionMatches ret( matches ); + TDECompletionMatches ret( matches ); postProcessMatches( &ret ); return ret; } @@ -343,7 +343,7 @@ KCompletionMatches KCompletion::allWeightedMatches( const TQString &string ) ///////////////// tree operations /////////////////// -TQString KCompletion::nextMatch() +TQString TDECompletion::nextMatch() { TQString completion; myLastMatch = myCurrentMatch; @@ -376,7 +376,7 @@ TQString KCompletion::nextMatch() -TQString KCompletion::previousMatch() +TQString TDECompletion::previousMatch() { TQString completion; myLastMatch = myCurrentMatch; @@ -411,11 +411,11 @@ TQString KCompletion::previousMatch() // tries to complete "string" from the tree-root -TQString KCompletion::findCompletion( const TQString& string ) +TQString TDECompletion::findCompletion( const TQString& string ) { TQChar ch; TQString completion; - const KCompTreeNode *node = myTreeRoot; + const TDECompTreeNode *node = myTreeRoot; // start at the tree-root and try to find the search-string for( uint i = 0; i < string.length(); i++ ) { @@ -456,12 +456,12 @@ TQString KCompletion::findCompletion( const TQString& string ) // don't just find the "first" match, but the one with the // highest priority - const KCompTreeNode* temp_node = 0L; + const TDECompTreeNode* temp_node = 0L; while(1) { int count = node->childrenCount(); temp_node = node->firstChild(); uint weight = temp_node->weight(); - const KCompTreeNode* hit = temp_node; + const TDECompTreeNode* hit = temp_node; for( int i = 1; i < count; i++ ) { temp_node = node->childAt(i); if( temp_node->weight() > weight ) { @@ -487,8 +487,8 @@ TQString KCompletion::findCompletion( const TQString& string ) } -void KCompletion::findAllCompletions(const TQString& string, - KCompletionMatchesWrapper *matches, +void TDECompletion::findAllCompletions(const TQString& string, + TDECompletionMatchesWrapper *matches, bool& hasMultipleMatches) const { //kdDebug(0) << "*** finding all completions for " << string << endl; @@ -504,7 +504,7 @@ void KCompletion::findAllCompletions(const TQString& string, TQChar ch; TQString completion; - const KCompTreeNode *node = myTreeRoot; + const TDECompTreeNode *node = myTreeRoot; // start at the tree-root and try to find the search-string for( uint i = 0; i < string.length(); i++ ) { @@ -542,21 +542,21 @@ void KCompletion::findAllCompletions(const TQString& string, } -void KCompletion::extractStringsFromNode( const KCompTreeNode *node, +void TDECompletion::extractStringsFromNode( const TDECompTreeNode *node, const TQString& beginning, - KCompletionMatchesWrapper *matches, + TDECompletionMatchesWrapper *matches, bool addWeight ) const { if ( !node || !matches ) return; // kDebug() << "Beginning: " << beginning << endl; - const KCompTreeChildren *list = node->children(); + const TDECompTreeChildren *list = node->children(); TQString string; TQString w; // loop thru all children - for ( KCompTreeNode *cur = list->begin(); cur ; cur = cur->next) { + for ( TDECompTreeNode *cur = list->begin(); cur ; cur = cur->next) { string = beginning; node = cur; if ( !node->isNull() ) @@ -585,10 +585,10 @@ void KCompletion::extractStringsFromNode( const KCompTreeNode *node, } } -void KCompletion::extractStringsFromNodeCI( const KCompTreeNode *node, +void TDECompletion::extractStringsFromNodeCI( const TDECompTreeNode *node, const TQString& beginning, const TQString& restString, - KCompletionMatchesWrapper *matches ) const + TDECompletionMatchesWrapper *matches ) const { if ( restString.isEmpty() ) { extractStringsFromNode( node, beginning, matches, false /*noweight*/ ); @@ -597,7 +597,7 @@ void KCompletion::extractStringsFromNodeCI( const KCompTreeNode *node, TQChar ch1 = restString.at(0); TQString newRest = restString.mid(1); - KCompTreeNode *child1, *child2; + TDECompTreeNode *child1, *child2; child1 = node->find( ch1 ); // the correct match if ( child1 ) @@ -619,7 +619,7 @@ void KCompletion::extractStringsFromNodeCI( const KCompTreeNode *node, } } -void KCompletion::doBeep( BeepMode mode ) const +void TDECompletion::doBeep( BeepMode mode ) const { if ( !myBeep ) return; @@ -660,12 +660,12 @@ void KCompletion::doBeep( BeepMode mode ) const // TQChar( 0x0 ) is used as the delimiter of a string; the last child of each // inserted string is 0x0. -KCompTreeNode::~KCompTreeNode() +TDECompTreeNode::~TDECompTreeNode() { // delete all children - KCompTreeNode *cur = myChildren.begin(); + TDECompTreeNode *cur = myChildren.begin(); while (cur) { - KCompTreeNode * next = cur->next; + TDECompTreeNode * next = cur->next; delete myChildren.remove(cur); cur = next; } @@ -674,16 +674,16 @@ KCompTreeNode::~KCompTreeNode() // Adds a child-node "ch" to this node. If such a node is already existant, // it will not be created. Returns the new/existing node. -KCompTreeNode * KCompTreeNode::insert( const TQChar& ch, bool sorted ) +TDECompTreeNode * TDECompTreeNode::insert( const TQChar& ch, bool sorted ) { - KCompTreeNode *child = find( ch ); + TDECompTreeNode *child = find( ch ); if ( !child ) { - child = new KCompTreeNode( ch ); + child = new TDECompTreeNode( ch ); // FIXME, first (slow) sorted insertion implementation if ( sorted ) { - KCompTreeNode * prev = 0; - KCompTreeNode * cur = myChildren.begin(); + TDECompTreeNode * prev = 0; + TDECompTreeNode * cur = myChildren.begin(); while ( cur ) { if ( ch > *cur ) { prev = cur; @@ -711,15 +711,15 @@ KCompTreeNode * KCompTreeNode::insert( const TQChar& ch, bool sorted ) // Iteratively removes a string from the tree. The nicer recursive // version apparently was a little memory hungry (see #56757) -void KCompTreeNode::remove( const TQString& str ) +void TDECompTreeNode::remove( const TQString& str ) { TQString string = str; string += TQChar(0x0); - TQPtrVector deletables( string.length() + 1 ); + TQPtrVector deletables( string.length() + 1 ); - KCompTreeNode *child = 0L; - KCompTreeNode *parent = this; + TDECompTreeNode *child = 0L; + TDECompTreeNode *parent = this; deletables.insert( 0, parent ); uint i = 0; @@ -743,7 +743,7 @@ void KCompTreeNode::remove( const TQString& str ) } } -TQStringList KCompletionMatchesWrapper::list() const +TQStringList TDECompletionMatchesWrapper::list() const { if ( sortedList && dirty ) { sortedList->sort(); @@ -760,16 +760,16 @@ TQStringList KCompletionMatchesWrapper::list() const return stringList; } -KCompletionMatches::KCompletionMatches( bool sort_P ) +TDECompletionMatches::TDECompletionMatches( bool sort_P ) : _sorting( sort_P ) { } -KCompletionMatches::KCompletionMatches( const KCompletionMatchesWrapper& matches ) +TDECompletionMatches::TDECompletionMatches( const TDECompletionMatchesWrapper& matches ) : _sorting( matches.sorting()) { if( matches.sortedList != 0L ) - KCompletionMatchesList::operator=( *matches.sortedList ); + TDECompletionMatchesList::operator=( *matches.sortedList ); else { TQStringList l = matches.list(); for( TQStringList::ConstIterator it = l.begin(); @@ -779,14 +779,14 @@ KCompletionMatches::KCompletionMatches( const KCompletionMatchesWrapper& matches } } -KCompletionMatches::~KCompletionMatches() +TDECompletionMatches::~TDECompletionMatches() { } -TQStringList KCompletionMatches::list( bool sort_P ) const +TQStringList TDECompletionMatches::list( bool sort_P ) const { if( _sorting && sort_P ) - const_cast< KCompletionMatches* >( this )->sort(); + const_cast< TDECompletionMatches* >( this )->sort(); TQStringList stringList; // high weight == sorted last -> reverse the sorting here for ( ConstIterator it = begin(); it != end(); ++it ) @@ -794,7 +794,7 @@ TQStringList KCompletionMatches::list( bool sort_P ) const return stringList; } -void KCompletionMatches::removeDuplicates() +void TDECompletionMatches::removeDuplicates() { Iterator it1, it2; for ( it1 = begin(); it1 != end(); ++it1 ) { @@ -810,7 +810,7 @@ void KCompletionMatches::removeDuplicates() } } -void KCompTreeNodeList::append(KCompTreeNode *item) +void TDECompTreeNodeList::append(TDECompTreeNode *item) { m_count++; if (!last) { @@ -824,7 +824,7 @@ void KCompTreeNodeList::append(KCompTreeNode *item) last = item; } -void KCompTreeNodeList::prepend(KCompTreeNode *item) +void TDECompTreeNodeList::prepend(TDECompTreeNode *item) { m_count++; if (!last) { @@ -837,7 +837,7 @@ void KCompTreeNodeList::prepend(KCompTreeNode *item) first = item; } -void KCompTreeNodeList::insert(KCompTreeNode *after, KCompTreeNode *item) +void TDECompTreeNodeList::insert(TDECompTreeNode *after, TDECompTreeNode *item) { if (!after) { append(item); @@ -853,11 +853,11 @@ void KCompTreeNodeList::insert(KCompTreeNode *after, KCompTreeNode *item) last = item; } -KCompTreeNode *KCompTreeNodeList::remove(KCompTreeNode *item) +TDECompTreeNode *TDECompTreeNodeList::remove(TDECompTreeNode *item) { if (!first || !item) return 0; - KCompTreeNode *cur = 0; + TDECompTreeNode *cur = 0; if (item == first) first = first->next; @@ -874,19 +874,19 @@ KCompTreeNode *KCompTreeNodeList::remove(KCompTreeNode *item) return item; } -KCompTreeNode *KCompTreeNodeList::at(uint index) const +TDECompTreeNode *TDECompTreeNodeList::at(uint index) const { - KCompTreeNode *cur = first; + TDECompTreeNode *cur = first; while (index-- && cur) cur = cur->next; return cur; } -TDEZoneAllocator KCompTreeNode::alloc(8192); +TDEZoneAllocator TDECompTreeNode::alloc(8192); -void KCompletion::virtual_hook( int, void* ) +void TDECompletion::virtual_hook( int, void* ) { /*BASE::virtual_hook( id, data );*/ } -void KCompletionBase::virtual_hook( int, void* ) +void TDECompletionBase::virtual_hook( int, void* ) { /*BASE::virtual_hook( id, data );*/ } #include "kcompletion.moc" diff --git a/tdecore/kcompletion.h b/tdecore/kcompletion.h index d88a3d6fc..e6d7f5314 100644 --- a/tdecore/kcompletion.h +++ b/tdecore/kcompletion.h @@ -32,11 +32,11 @@ #include #include -class KCompTreeNode; -class KCompletionPrivate; -class KCompletionBasePrivate; -class KCompletionMatchesWrapper; -class KCompletionMatches; +class TDECompTreeNode; +class TDECompletionPrivate; +class TDECompletionBasePrivate; +class TDECompletionMatchesWrapper; +class TDECompletionMatches; class TQPopupMenu; /** @@ -49,13 +49,13 @@ class TQPopupMenu; * The user should be able to complete email-addresses, telephone-numbers, * commands, SQL queries, ... * Every time your program knows what the user can type into an edit-field, you - * should offer completion. With KCompletion, this is very easy, and if you are + * should offer completion. With TDECompletion, this is very easy, and if you are * using a line edit widget ( KLineEdit), it is even more easy. - * Basically, you tell a KCompletion object what strings should be completable + * Basically, you tell a TDECompletion object what strings should be completable * and whenever completion should be invoked, you call makeCompletion(). * KLineEdit and (an editable) KComboBox even do this automatically for you. * - * KCompletion offers the completed string via the signal match() and + * TDECompletion offers the completed string via the signal match() and * all matching strings (when the result is ambiguous) via the method * allMatches(). * @@ -75,11 +75,11 @@ class TQPopupMenu; * subtle difference is, that it isn't invoked automatically while the user * is typing, but only when the user presses a special key. The difference * of manual and auto-completion is therefore only visible in UI classes, - * KCompletion needs to know whether to deliver partial matches + * TDECompletion needs to know whether to deliver partial matches * (shell completion) or whole matches (auto/manual completion), therefore * TDEGlobalSettings::CompletionMan and * TDEGlobalSettings::CompletionAuto have the exact same effect in - * KCompletion. + * TDECompletion. * * @li shell completion works like how shells complete filenames: * when multiple matches are available, the longest possible string of all @@ -87,15 +87,15 @@ class TQPopupMenu; * Iterating over all matching items (complete, not partial) is possible * via nextMatch() and previousMatch(). * - * You don't have to worry much about that though, KCompletion handles + * You don't have to worry much about that though, TDECompletion handles * that for you, according to the setting setCompletionMode(). * The default setting is globally configured by the user and read * from TDEGlobalSettings::completionMode(). * * A short example: * \code - * KCompletion completion; - * completion.setOrder( KCompletion::Sorted ); + * TDECompletion completion; + * completion.setOrder( TDECompletion::Sorted ); * completion.addItem( "pfeiffer@kde.org" ); * completion.addItem( "coolo@kde.org" ); * completion.addItem( "carpdjih@sp.zrz.tu-berlin.de" ); @@ -113,23 +113,23 @@ class TQPopupMenu; * * You can dynamically update the completable items by removing and adding them * whenever you want. - * For advanced usage, you could even use multiple KCompletion objects. E.g. + * For advanced usage, you could even use multiple TDECompletion objects. E.g. * imagine an editor like kwrite with multiple open files. You could store - * items of each file in a different KCompletion object, so that you know (and + * items of each file in a different TDECompletion object, so that you know (and * tell the user) where a completion comes from. * - * Note: KCompletion does not work with strings that contain 0x0 characters + * Note: TDECompletion does not work with strings that contain 0x0 characters * (unicode nul), as this is used internally as a delimiter. * - * You may inherit from KCompletion and override makeCompletion() in + * You may inherit from TDECompletion and override makeCompletion() in * special cases (like reading directories/urls and then supplying the - * contents to KCompletion, as KURLCompletion does), but generally, this is + * contents to TDECompletion, as KURLCompletion does), but generally, this is * not necessary. * * * @author Carsten Pfeiffer */ -class TDECORE_EXPORT KCompletion : public TQObject +class TDECORE_EXPORT TDECompletion : public TQObject { TQ_ENUMS( CompOrder ) TQ_PROPERTY( CompOrder order READ order WRITE setOrder ) @@ -139,7 +139,7 @@ class TDECORE_EXPORT KCompletion : public TQObject public: /** - * Constants that represent the order in which KCompletion performs + * Constants that represent the order in which TDECompletion performs * completion-lookups. */ enum CompOrder { Sorted, ///< Use alphabetically sorted order @@ -150,14 +150,14 @@ public: /** * Constructor, nothing special here :) */ - KCompletion(); + TDECompletion(); // FIXME: copy constructor, assignment operator... /** * Destructor, nothing special here, either. */ - virtual ~KCompletion(); + virtual ~TDECompletion(); /** * Attempts to find an item in the list of available completions, @@ -224,8 +224,8 @@ public: virtual const TQString& lastMatch() const { return myLastMatch; } /** - * Returns a list of all items inserted into KCompletion. This is useful - * if you need to save the state of a KCompletion object and restore it + * Returns a list of all items inserted into TDECompletion. This is useful + * if you need to save the state of a TDECompletion object and restore it * later. * * Important note: when order() == Weighted, then every item in the @@ -235,7 +235,7 @@ public: * This is necessary so that you can save the items along with its * weighting on disk and load them back with setItems(), restoring its * weight as well. If you really don't want the appended weightings, call - * setOrder( KCompletion::Insertion ) + * setOrder( TDECompletion::Insertion ) * before calling items(). * * @return a list of all items @@ -271,12 +271,12 @@ public: } /** - * KCompletion offers three different ways in which it offers its items: + * TDECompletion offers three different ways in which it offers its items: * @li in the order of insertion * @li sorted alphabetically * @li weighted * - * Choosing weighted makes KCompletion perform an implicit weighting based + * Choosing weighted makes TDECompletion perform an implicit weighting based * on how often an item is inserted. Imagine a web browser with a location * bar, where the user enters URLs. The more often a URL is entered, the * higher priority it gets. @@ -300,7 +300,7 @@ public: CompOrder order() const { return myOrder; } /** - * Setting this to true makes KCompletion behave case insensitively. + * Setting this to true makes TDECompletion behave case insensitively. * E.g. makeCompletion( "CA" ); might return "carp\@cs.tu-berlin.de". * Default is false (case sensitive). * @param ignoreCase true to ignore the case @@ -309,7 +309,7 @@ public: virtual void setIgnoreCase( bool ignoreCase ); /** - * Return whether KCompletion acts case insensitively or not. + * Return whether TDECompletion acts case insensitively or not. * Default is false (case sensitive). * @return true if the case will be ignored * @see setIgnoreCase @@ -334,7 +334,7 @@ public: /** * Returns a list of all items matching the last completed string. * Might take some time, when you have LOTS of items. - * The matches are returned as KCompletionMatches, which also + * The matches are returned as TDECompletionMatches, which also * keeps the weight of the matches, allowing * you to modify some matches or merge them with matches * from another call to allWeightedMatches(), and sort the matches @@ -343,14 +343,14 @@ public: * @return a list of all completion matches * @see substringCompletion */ - KCompletionMatches allWeightedMatches(); + TDECompletionMatches allWeightedMatches(); /** * Returns a list of all items matching @p string. * @param string the string to match * @return a list of all matches */ - KCompletionMatches allWeightedMatches( const TQString& string ); + TDECompletionMatches allWeightedMatches( const TQString& string ); /** * Enables/disables playing a sound when @@ -368,7 +368,7 @@ public: virtual void setEnableSounds( bool enable ) { myBeep = enable; } /** - * Tells you whether KCompletion will play sounds on certain occasions. + * Tells you whether TDECompletion will play sounds on certain occasions. * Default is enabled. * @return true if sounds are enabled * @see enableSounds @@ -444,7 +444,7 @@ public slots: * where number is an unsigned integer, specifying the weighting. * * If you don't like this, call - * setOrder( KCompletion::Insertion ) + * setOrder( TDECompletion::Insertion ) * before calling setItems(). * * @param list the list of items that are available for completion @@ -518,7 +518,7 @@ protected: * string that will be emitted. * This is necessary e.g. in KURLCompletion(), where files with spaces * in their names are shown escaped ("filename\ with\ spaces"), but stored - * unescaped inside KCompletion. + * unescaped inside TDECompletion. * Never delete that pointer! * * Default implementation does nothing. @@ -549,23 +549,23 @@ protected: * @param matches the matches to process * @see postProcessMatch */ - virtual void postProcessMatches( KCompletionMatches * matches ) const {Q_UNUSED(matches)} + virtual void postProcessMatches( TDECompletionMatches * matches ) const {Q_UNUSED(matches)} private: void addWeightedItem( const TQString& ); TQString findCompletion( const TQString& string ); void findAllCompletions( const TQString&, - KCompletionMatchesWrapper *matches, + TDECompletionMatchesWrapper *matches, bool& hasMultipleMatches ) const; - void extractStringsFromNode( const KCompTreeNode *, + void extractStringsFromNode( const TDECompTreeNode *, const TQString& beginning, - KCompletionMatchesWrapper *matches, + TDECompletionMatchesWrapper *matches, bool addWeight = false ) const; - void extractStringsFromNodeCI( const KCompTreeNode *, + void extractStringsFromNodeCI( const TDECompTreeNode *, const TQString& beginning, const TQString& restString, - KCompletionMatchesWrapper *matches) const; + TDECompletionMatchesWrapper *matches) const; enum BeepMode { NoMatch, PartialMatch, Rotation }; void doBeep( BeepMode ) const; @@ -576,7 +576,7 @@ private: TQString myLastString; TQString myLastMatch; TQString myCurrentMatch; - KCompTreeNode * myTreeRoot; + TDECompTreeNode * myTreeRoot; TQStringList myRotations; bool myBeep; bool myIgnoreCase; @@ -587,15 +587,15 @@ private: protected: virtual void virtual_hook( int id, void* data ); private: - KCompletionPrivate *d; + TDECompletionPrivate *d; }; // some more helper stuff -typedef KSortableValueList KCompletionMatchesList; -class KCompletionMatchesPrivate; +typedef KSortableValueList TDECompletionMatchesList; +class TDECompletionMatchesPrivate; /** - * This structure is returned by KCompletion::allWeightedMatches . + * This structure is returned by TDECompletion::allWeightedMatches . * It also keeps the weight of the matches, allowing * you to modify some matches or merge them with matches * from another call to allWeightedMatches(), and sort the matches @@ -603,24 +603,24 @@ class KCompletionMatchesPrivate; * * Example (a simplified example of what Konqueror's completion does): * \code - * KCompletionMatches matches = completion->allWeightedMatches( location ); + * TDECompletionMatches matches = completion->allWeightedMatches( location ); * if( !location.startsWith( "www." )) matches += completion->allWeightedmatches( "www." + location" ); * matches.removeDuplicates(); * TQStringList list = matches.list(); * \endcode * - * @short List for keeping matches returned from KCompletion + * @short List for keeping matches returned from TDECompletion */ -class TDECORE_EXPORT KCompletionMatches : public KCompletionMatchesList +class TDECORE_EXPORT TDECompletionMatches : public TDECompletionMatchesList { public: - KCompletionMatches( bool sort ); + TDECompletionMatches( bool sort ); /** * @internal */ - KCompletionMatches( const KCompletionMatchesWrapper& matches ); - ~KCompletionMatches(); + TDECompletionMatches( const TDECompletionMatchesWrapper& matches ); + ~TDECompletionMatches(); /** * Removes duplicate matches. Needed only when you merged several matches * results and there's a possibility of duplicates. @@ -643,7 +643,7 @@ public: } private: bool _sorting; - KCompletionMatchesPrivate* d; + TDECompletionMatchesPrivate* d; }; /** @@ -660,7 +660,7 @@ private: * @short An abstract class for adding text completion support to widgets. * @author Dawit Alemayehu */ -class TDECORE_EXPORT KCompletionBase +class TDECORE_EXPORT TDECompletionBase { public: /** @@ -694,12 +694,12 @@ public: /** * Default constructor. */ - KCompletionBase(); + TDECompletionBase(); /** * Destructor. */ - virtual ~KCompletionBase(); + virtual ~TDECompletionBase(); /** * Returns a pointer to the current completion object. @@ -716,7 +716,7 @@ public: * @param hsig if true, handles completion signals internally. * @return a pointer the completion object. */ - KCompletion* completionObject( bool hsig = true ); + TDECompletion* completionObject( bool hsig = true ); /** * Sets up the completion object to be used. @@ -731,10 +731,10 @@ public: * after calling this method. Be sure to set the bool argument to false, if * you want to handle the completion signals yourself. * - * @param compObj a KCompletion() or a derived child object. + * @param compObj a TDECompletion() or a derived child object. * @param hsig if true, handles completion signals internally. */ - virtual void setCompletionObject( KCompletion* compObj, bool hsig = true ); + virtual void setCompletionObject( TDECompletion* compObj, bool hsig = true ); /** * Enables this object to handle completion and rotation @@ -924,7 +924,7 @@ public: * implementations to set completed text appropriately. It * is mostly relevant when the completion mode is set to * CompletionAuto and CompletionManual modes. See - * KCompletionBase::setCompletedText. + * TDECompletionBase::setCompletedText. * Does nothing in CompletionPopup mode, as all available * matches will be shown in the popup. * @@ -943,14 +943,14 @@ public: * Returns a pointer to the completion object. * * This method is only different from completionObject() - * in that it does not create a new KCompletion object even if + * in that it does not create a new TDECompletion object even if * the internal pointer is @p NULL. Use this method to get the * pointer to a completion object when inheriting so that you * won't inadvertently create it!! * * @return the completion object or NULL if one does not exist. */ - KCompletion* compObj() const { return m_delegate ? m_delegate->compObj() : (KCompletion*) m_pCompObj; } + TDECompletion* compObj() const { return m_delegate ? m_delegate->compObj() : (TDECompletion*) m_pCompObj; } protected: /** @@ -968,14 +968,14 @@ protected: * set, all function calls will be forwarded to the delegation object. * @param delegate the delegation object, or 0 to remove it */ - void setDelegate( KCompletionBase *delegate ); + void setDelegate( TDECompletionBase *delegate ); /** * Returns the delegation object. * @return the delegation object, or 0 if there is none * @see setDelegate() */ - KCompletionBase *delegate() const { return m_delegate; } + TDECompletionBase *delegate() const { return m_delegate; } private: // This method simply sets the autodelete boolean for @@ -994,17 +994,17 @@ private: // Stores the completion mode locally. TDEGlobalSettings::Completion m_iCompletionMode; // Pointer to Completion object. - TQGuardedPtr m_pCompObj; + TQGuardedPtr m_pCompObj; // Keybindings KeyBindingMap m_keyMap; - // we may act as a proxy to another KCompletionBase object - KCompletionBase *m_delegate; + // we may act as a proxy to another TDECompletionBase object + TDECompletionBase *m_delegate; // BCI protected: virtual void virtual_hook( int id, void* data ); private: - KCompletionBasePrivate *d; + TDECompletionBasePrivate *d; }; #endif // KCOMPLETION_H diff --git a/tdecore/kcompletion_private.h b/tdecore/kcompletion_private.h index e0d85fbff..3d956f29d 100644 --- a/tdecore/kcompletion_private.h +++ b/tdecore/kcompletion_private.h @@ -24,36 +24,36 @@ #include #include -class KCompTreeNode; +class TDECompTreeNode; #include /** * @internal */ -class TDECORE_EXPORT KCompTreeNodeList +class TDECORE_EXPORT TDECompTreeNodeList { public: - KCompTreeNodeList() : first(0), last(0), m_count(0) {} - KCompTreeNode *begin() const { return first; } - KCompTreeNode *end() const { return last; } - - KCompTreeNode *at(uint index) const; - void append(KCompTreeNode *item); - void prepend(KCompTreeNode *item); - void insert(KCompTreeNode *after, KCompTreeNode *item); - KCompTreeNode *remove(KCompTreeNode *item); + TDECompTreeNodeList() : first(0), last(0), m_count(0) {} + TDECompTreeNode *begin() const { return first; } + TDECompTreeNode *end() const { return last; } + + TDECompTreeNode *at(uint index) const; + void append(TDECompTreeNode *item); + void prepend(TDECompTreeNode *item); + void insert(TDECompTreeNode *after, TDECompTreeNode *item); + TDECompTreeNode *remove(TDECompTreeNode *item); uint count() const { return m_count; } private: - KCompTreeNode *first, *last; + TDECompTreeNode *first, *last; uint m_count; }; -typedef KCompTreeNodeList KCompTreeChildren; +typedef TDECompTreeNodeList TDECompTreeChildren; /** - * A helper class for KCompletion. Implements a tree of TQChar. + * A helper class for TDECompletion. Implements a tree of TQChar. * * The tree looks like this (containing the items "kde", "kde-ui", * "kde-core" and "pfeiffer". Every item is delimited with TQChar( 0x0 ) @@ -81,14 +81,14 @@ typedef KCompTreeNodeList KCompTreeChildren; * @author Carsten Pfeiffer * @internal */ -class TDECORE_EXPORT KCompTreeNode : public TQChar +class TDECORE_EXPORT TDECompTreeNode : public TQChar { public: - KCompTreeNode() : TQChar(), myWeight(0) {} - KCompTreeNode( const TQChar& ch, uint weight = 0 ) + TDECompTreeNode() : TQChar(), myWeight(0) {} + TDECompTreeNode( const TQChar& ch, uint weight = 0 ) : TQChar( ch ), myWeight( weight ) {} - ~KCompTreeNode(); + ~TDECompTreeNode(); void * operator new( size_t s ) { return alloc.allocate( s ); @@ -99,12 +99,12 @@ public: // Returns a child of this node matching ch, if available. // Otherwise, returns 0L - inline KCompTreeNode * find( const TQChar& ch ) const { - KCompTreeNode * cur = myChildren.begin(); + inline TDECompTreeNode * find( const TQChar& ch ) const { + TDECompTreeNode * cur = myChildren.begin(); while (cur && (*cur != ch)) cur = cur->next; return cur; } - KCompTreeNode * insert( const TQChar&, bool sorted ); + TDECompTreeNode * insert( const TQChar&, bool sorted ); void remove( const TQString& ); inline int childrenCount() const { return myChildren.count(); } @@ -115,51 +115,51 @@ public: inline void decline() { myWeight--; } inline uint weight() const { return myWeight; } - inline const KCompTreeChildren * children() const { + inline const TDECompTreeChildren * children() const { return &myChildren; } - inline const KCompTreeNode * childAt(int index) const { + inline const TDECompTreeNode * childAt(int index) const { return myChildren.at(index); } - inline const KCompTreeNode * firstChild() const { + inline const TDECompTreeNode * firstChild() const { return myChildren.begin(); } - inline const KCompTreeNode * lastChild() const { + inline const TDECompTreeNode * lastChild() const { return myChildren.end(); } - /* We want to handle a list of KCompTreeNodes on our own, to not + /* We want to handle a list of TDECompTreeNodes on our own, to not need to use TQValueList<>. And to make it even more fast we don't use an accessor, but just a public member. */ - KCompTreeNode *next; + TDECompTreeNode *next; private: uint myWeight; - KCompTreeNodeList myChildren; + TDECompTreeNodeList myChildren; static TDEZoneAllocator alloc; }; // some more helper stuff -typedef KSortableValueList KCompletionMatchesList; +typedef KSortableValueList TDECompletionMatchesList; /** * @internal */ -class TDECORE_EXPORT KCompletionMatchesWrapper +class TDECORE_EXPORT TDECompletionMatchesWrapper { public: - KCompletionMatchesWrapper( bool sort = false ) - : sortedList( sort ? new KCompletionMatchesList : 0L ), + TDECompletionMatchesWrapper( bool sort = false ) + : sortedList( sort ? new TDECompletionMatchesList : 0L ), dirty( false ) {} - ~KCompletionMatchesWrapper() { + ~TDECompletionMatchesWrapper() { delete sortedList; } void setSorting( bool sort ) { if ( sort && !sortedList ) - sortedList = new KCompletionMatchesList; + sortedList = new TDECompletionMatchesList; else if ( !sort ) { delete sortedList; sortedList = 0L; @@ -208,7 +208,7 @@ public: TQStringList list() const; mutable TQStringList stringList; - KCompletionMatchesList *sortedList; + TDECompletionMatchesList *sortedList; mutable bool dirty; }; diff --git a/tdecore/kcompletionbase.cpp b/tdecore/kcompletionbase.cpp index 676448428..8a67f4647 100644 --- a/tdecore/kcompletionbase.cpp +++ b/tdecore/kcompletionbase.cpp @@ -22,7 +22,7 @@ #include -KCompletionBase::KCompletionBase() +TDECompletionBase::TDECompletionBase() { m_delegate = 0L; // Assign the default completion type to use. @@ -38,7 +38,7 @@ KCompletionBase::KCompletionBase() setup( false, false, false ); } -KCompletionBase::~KCompletionBase() +TDECompletionBase::~TDECompletionBase() { if( m_bAutoDelCompObj && m_pCompObj ) { @@ -46,7 +46,7 @@ KCompletionBase::~KCompletionBase() } } -void KCompletionBase::setDelegate( KCompletionBase *delegate ) +void TDECompletionBase::setDelegate( TDECompletionBase *delegate ) { m_delegate = delegate; @@ -59,20 +59,20 @@ void KCompletionBase::setDelegate( KCompletionBase *delegate ) } } -KCompletion* KCompletionBase::completionObject( bool hsig ) +TDECompletion* TDECompletionBase::completionObject( bool hsig ) { if ( m_delegate ) return m_delegate->completionObject( hsig ); if ( !m_pCompObj ) { - setCompletionObject( new KCompletion(), hsig ); + setCompletionObject( new TDECompletion(), hsig ); m_bAutoDelCompObj = true; } return m_pCompObj; } -void KCompletionBase::setCompletionObject( KCompletion* compObj, bool hsig ) +void TDECompletionBase::setCompletionObject( TDECompletion* compObj, bool hsig ) { if ( m_delegate ) { m_delegate->setCompletionObject( compObj, hsig ); @@ -90,7 +90,7 @@ void KCompletionBase::setCompletionObject( KCompletion* compObj, bool hsig ) } // BC: Inline this function and possibly rename it to setHandleEvents??? (DA) -void KCompletionBase::setHandleSignals( bool handle ) +void TDECompletionBase::setHandleSignals( bool handle ) { if ( m_delegate ) m_delegate->setHandleSignals( handle ); @@ -98,7 +98,7 @@ void KCompletionBase::setHandleSignals( bool handle ) m_bHandleSignals = handle; } -void KCompletionBase::setCompletionMode( TDEGlobalSettings::Completion mode ) +void TDECompletionBase::setCompletionMode( TDEGlobalSettings::Completion mode ) { if ( m_delegate ) { m_delegate->setCompletionMode( mode ); @@ -106,13 +106,13 @@ void KCompletionBase::setCompletionMode( TDEGlobalSettings::Completion mode ) } m_iCompletionMode = mode; - // Always sync up KCompletion mode with ours as long as we + // Always sync up TDECompletion mode with ours as long as we // are performing completions. if( m_pCompObj && m_iCompletionMode != TDEGlobalSettings::CompletionNone ) m_pCompObj->setCompletionMode( m_iCompletionMode ); } -bool KCompletionBase::setKeyBinding( KeyBindingType item, const TDEShortcut& cut ) +bool TDECompletionBase::setKeyBinding( KeyBindingType item, const TDEShortcut& cut ) { if ( m_delegate ) return m_delegate->setKeyBinding( item, cut ); @@ -127,7 +127,7 @@ bool KCompletionBase::setKeyBinding( KeyBindingType item, const TDEShortcut& cut return true; } -void KCompletionBase::useGlobalKeyBindings() +void TDECompletionBase::useGlobalKeyBindings() { if ( m_delegate ) { m_delegate->useGlobalKeyBindings(); @@ -141,7 +141,7 @@ void KCompletionBase::useGlobalKeyBindings() m_keyMap.insert( SubstringCompletion, 0 ); } -void KCompletionBase::setup( bool autodel, bool hsig, bool esig ) +void TDECompletionBase::setup( bool autodel, bool hsig, bool esig ) { if ( m_delegate ) { m_delegate->setup( autodel, hsig, esig ); diff --git a/tdecore/kglobalsettings.h b/tdecore/kglobalsettings.h index ee893f97e..0e11426d2 100644 --- a/tdecore/kglobalsettings.h +++ b/tdecore/kglobalsettings.h @@ -171,7 +171,7 @@ class TDECORE_EXPORT TDEGlobalSettings static bool showContextMenusOnPress (); /** - * This enum describes the completion mode used for by the KCompletion class. + * This enum describes the completion mode used for by the TDECompletion class. * See * the styleguide. **/ diff --git a/tdehtml/rendering/render_form.cpp b/tdehtml/rendering/render_form.cpp index ce6debcbc..2309ff5d7 100644 --- a/tdehtml/rendering/render_form.cpp +++ b/tdehtml/rendering/render_form.cpp @@ -505,7 +505,7 @@ void RenderLineEdit::highLightWord( unsigned int length, unsigned int pos ) void RenderLineEdit::slotReturnPressed() { // don't submit the form when return was pressed in a completion-popup - KCompletionBox *box = widget()->completionBox(false); + TDECompletionBox *box = widget()->completionBox(false); if ( box && box->isVisible() && box->currentItem() != -1 ) { box->hide(); diff --git a/tdeio/tdefile/kdiroperator.h b/tdeio/tdefile/kdiroperator.h index ca850b733..95bf5c5ba 100644 --- a/tdeio/tdefile/kdiroperator.h +++ b/tdeio/tdefile/kdiroperator.h @@ -319,27 +319,27 @@ class TDEIO_EXPORT KDirOperator : public TQWidget int numFiles() const; /** - * @returns a KCompletion object, containing all filenames and + * @returns a TDECompletion object, containing all filenames and * directories of the current directory/URL. * You can use it to insert it into a KLineEdit or KComboBox * Note: it will only contain files, after prepareCompletionObjects() * has been called. It will be implicitly called from makeCompletion() * or makeDirCompletion() */ - KCompletion * completionObject() const { - return const_cast( &myCompletion ); + TDECompletion * completionObject() const { + return const_cast( &myCompletion ); } /** - * @returns a KCompletion object, containing only all directories of the + * @returns a TDECompletion object, containing only all directories of the * current directory/URL. * You can use it to insert it into a KLineEdit or KComboBox * Note: it will only contain directories, after * prepareCompletionObjects() has been called. It will be implicitly * called from makeCompletion() or makeDirCompletion() */ - KCompletion *dirCompletionObject() const { - return const_cast( &myDirCompletion ); + TDECompletion *dirCompletionObject() const { + return const_cast( &myDirCompletion ); } /** @@ -838,8 +838,8 @@ private: KDirLister *dir; KURL currUrl; - KCompletion myCompletion; - KCompletion myDirCompletion; + TDECompletion myCompletion; + TDECompletion myDirCompletion; bool myCompleteListDirty; TQDir::SortSpec mySorting; diff --git a/tdeio/tdefile/kpropertiesdialog.cpp b/tdeio/tdefile/kpropertiesdialog.cpp index 2b8fd1814..9d4ee6534 100644 --- a/tdeio/tdefile/kpropertiesdialog.cpp +++ b/tdeio/tdefile/kpropertiesdialog.cpp @@ -1749,8 +1749,8 @@ KFilePermissionsPropsPlugin::KFilePermissionsPropsPlugin( KPropertiesDialog *_pr if (IamRoot && isLocal) { usrEdit = new KLineEdit( gb ); - KCompletion *kcom = usrEdit->completionObject(); - kcom->setOrder(KCompletion::Sorted); + TDECompletion *kcom = usrEdit->completionObject(); + kcom->setOrder(TDECompletion::Sorted); setpwent(); for (i=0; ((user = getpwent()) != 0L) && (i < maxEntries); i++) kcom->addItem(TQString::fromLatin1(user->pw_name)); @@ -1829,7 +1829,7 @@ KFilePermissionsPropsPlugin::KFilePermissionsPropsPlugin( KPropertiesDialog *_pr if (IamRoot && isLocal) { grpEdit = new KLineEdit(gb); - KCompletion *kcom = new KCompletion; + TDECompletion *kcom = new TDECompletion; kcom->setItems(groupList); grpEdit->setCompletionObject(kcom, true); grpEdit->setAutoDeleteCompletionObject( true ); @@ -3487,8 +3487,8 @@ void KDesktopPropsPlugin::slotAdvanced() w->dcopCombo->setCurrentItem(0); // Provide username completion up to 1000 users. - KCompletion *kcom = new KCompletion; - kcom->setOrder(KCompletion::Sorted); + TDECompletion *kcom = new TDECompletion; + kcom->setOrder(TDECompletion::Sorted); struct passwd *pw; int i, maxEntries = 1000; setpwent(); @@ -3761,8 +3761,8 @@ KExecPropsPlugin::KExecPropsPlugin( KPropertiesDialog *_props ) enableSuidEdit(); // Provide username completion up to 1000 users. - KCompletion *kcom = new KCompletion; - kcom->setOrder(KCompletion::Sorted); + TDECompletion *kcom = new TDECompletion; + kcom->setOrder(TDECompletion::Sorted); struct passwd *pw; int i, maxEntries = 1000; setpwent(); diff --git a/tdeio/tdefile/kurlrequester.cpp b/tdeio/tdefile/kurlrequester.cpp index 1d5bf009e..9a76a69a6 100644 --- a/tdeio/tdefile/kurlrequester.cpp +++ b/tdeio/tdefile/kurlrequester.cpp @@ -124,7 +124,7 @@ public: receiver, TQT_SIGNAL( returnPressed( const TQString& ) )); } - void setCompletionObject( KCompletion *comp ) { + void setCompletionObject( TDECompletion *comp ) { if ( combo ) combo->setCompletionObject( comp ); else diff --git a/tdeio/tdeio/kshellcompletion.cpp b/tdeio/tdeio/kshellcompletion.cpp index 2fb67a31f..789a5ce05 100644 --- a/tdeio/tdeio/kshellcompletion.cpp +++ b/tdeio/tdeio/kshellcompletion.cpp @@ -77,7 +77,7 @@ TQString KShellCompletion::makeCompletion(const TQString &text) /* * postProcessMatch, postProcessMatches * - * Called by KCompletion before emitting match() and matches() + * Called by TDECompletion before emitting match() and matches() * * Add add the part of the text that was not completed * Add quotes when needed @@ -121,11 +121,11 @@ void KShellCompletion::postProcessMatches( TQStringList *matches ) const } } -void KShellCompletion::postProcessMatches( KCompletionMatches *matches ) const +void KShellCompletion::postProcessMatches( TDECompletionMatches *matches ) const { KURLCompletion::postProcessMatches( matches ); - for ( KCompletionMatches::Iterator it = matches->begin(); + for ( TDECompletionMatches::Iterator it = matches->begin(); it != matches->end(); it++ ) { if ( !(*it).value().isNull() ) { diff --git a/tdeio/tdeio/kshellcompletion.h b/tdeio/tdeio/kshellcompletion.h index fa90c509e..a23fbe78e 100644 --- a/tdeio/tdeio/kshellcompletion.h +++ b/tdeio/tdeio/kshellcompletion.h @@ -56,10 +56,10 @@ public: TQString makeCompletion(const TQString &text); protected: - // Called by KCompletion + // Called by TDECompletion void postProcessMatch( TQString *match ) const; void postProcessMatches( TQStringList *matches ) const; - void postProcessMatches( KCompletionMatches *matches ) const; + void postProcessMatches( TDECompletionMatches *matches ) const; private: // Find the part of text that should be completed diff --git a/tdeio/tdeio/kurlcompletion.cpp b/tdeio/tdeio/kurlcompletion.cpp index 22bbe147a..dc6581ce6 100644 --- a/tdeio/tdeio/kurlcompletion.cpp +++ b/tdeio/tdeio/kurlcompletion.cpp @@ -462,7 +462,7 @@ public: TDEIO::ListJob *list_job; // kio job to list directories TQString prepend; // text to prepend to listed items - TQString compl_text; // text to pass on to KCompletion + TQString compl_text; // text to pass on to TDECompletion // Filters for files read with kio bool list_urls_only_exe; // true = only list executables @@ -486,13 +486,13 @@ KURLCompletionPrivate::~KURLCompletionPrivate() // KURLCompletion // -KURLCompletion::KURLCompletion() : KCompletion() +KURLCompletion::KURLCompletion() : TDECompletion() { init(); } -KURLCompletion::KURLCompletion( Mode mode ) : KCompletion() +KURLCompletion::KURLCompletion( Mode mode ) : TDECompletion() { init(); setMode ( mode ); @@ -653,15 +653,15 @@ TQString KURLCompletion::makeCompletion(const TQString &text) /* * finished * - * Go on and call KCompletion. + * Go on and call TDECompletion. * Called when all matches have been added */ TQString KURLCompletion::finished() { if ( d->last_compl_type == CTInfo ) - return KCompletion::makeCompletion( d->compl_text.lower() ); + return TDECompletion::makeCompletion( d->compl_text.lower() ); else - return KCompletion::makeCompletion( d->compl_text ); + return TDECompletion::makeCompletion( d->compl_text ); } /* @@ -1104,7 +1104,7 @@ bool KURLCompletion::urlCompletion(const MyURL &url, TQString *match) /* * addMatches * - * Called to add matches to KCompletion + * Called to add matches to TDECompletion */ void KURLCompletion::addMatches( const TQStringList &matches ) { @@ -1311,7 +1311,7 @@ void KURLCompletion::slotIOFinished( TDEIO::Job * job ) d->list_job = 0L; - finished(); // will call KCompletion::makeCompletion() + finished(); // will call TDECompletion::makeCompletion() } else { @@ -1345,7 +1345,7 @@ void KURLCompletion::slotIOFinished( TDEIO::Job * job ) /* * postProcessMatch, postProcessMatches * - * Called by KCompletion before emitting match() and matches() + * Called by TDECompletion before emitting match() and matches() * * Append '/' to directories for file completion. This is * done here to avoid stat()'ing a lot of files @@ -1405,10 +1405,10 @@ void KURLCompletion::postProcessMatches( TQStringList * matches ) const } } -void KURLCompletion::postProcessMatches( KCompletionMatches * matches ) const +void KURLCompletion::postProcessMatches( TDECompletionMatches * matches ) const { if ( !matches->isEmpty() && d->last_compl_type == CTFile ) { - KCompletionMatches::Iterator it = matches->begin(); + TDECompletionMatches::Iterator it = matches->begin(); for (; it != matches->end(); ++it ) { adjustMatch( (*it).value() ); } @@ -1598,7 +1598,7 @@ static TQString unescape(const TQString &text) } void KURLCompletion::virtual_hook( int id, void* data ) -{ KCompletion::virtual_hook( id, data ); } +{ TDECompletion::virtual_hook( id, data ); } #include "kurlcompletion.moc" diff --git a/tdeio/tdeio/kurlcompletion.h b/tdeio/tdeio/kurlcompletion.h index 30a825d3d..a5b075f3b 100644 --- a/tdeio/tdeio/kurlcompletion.h +++ b/tdeio/tdeio/kurlcompletion.h @@ -38,7 +38,7 @@ class KURLCompletionPrivate; * @short Completion of a single URL * @author David Smith */ -class TDEIO_EXPORT KURLCompletion : public KCompletion +class TDEIO_EXPORT KURLCompletion : public TDECompletion { Q_OBJECT @@ -168,10 +168,10 @@ public: class MyURL; protected: - // Called by KCompletion, adds '/' to directories + // Called by TDECompletion, adds '/' to directories void postProcessMatch( TQString *match ) const; void postProcessMatches( TQStringList *matches ) const; - void postProcessMatches( KCompletionMatches* matches ) const; + void postProcessMatches( TDECompletionMatches* matches ) const; virtual void customEvent( TQCustomEvent *e ); diff --git a/tdeui/kcombobox.cpp b/tdeui/kcombobox.cpp index e5b8c3043..c79284717 100644 --- a/tdeui/kcombobox.cpp +++ b/tdeui/kcombobox.cpp @@ -169,7 +169,7 @@ void KComboBox::makeCompletion( const TQString& text ) } } -void KComboBox::rotateText( KCompletionBase::KeyBindingType type ) +void KComboBox::rotateText( TDECompletionBase::KeyBindingType type ) { if ( d->klineEdit ) d->klineEdit->rotateText( type ); @@ -226,7 +226,7 @@ void KComboBox::setCompletedItems( const TQStringList& items ) d->klineEdit->setCompletedItems( items ); } -KCompletionBox * KComboBox::completionBox( bool create ) +TDECompletionBox * KComboBox::completionBox( bool create ) { if ( d->klineEdit ) return d->klineEdit->completionBox( create ); @@ -271,7 +271,7 @@ void KComboBox::setLineEdit( TQLineEdit *edit ) if ( d->klineEdit ) { // someone calling KComboBox::setEditable( false ) destroys our - // lineedit without us noticing. And KCompletionBase::delegate would + // lineedit without us noticing. And TDECompletionBase::delegate would // be a dangling pointer then, so prevent that. Note: only do this // when it is a KLineEdit! connect( edit, TQT_SIGNAL( destroyed() ), TQT_SLOT( lineEditDeleted() )); @@ -286,8 +286,8 @@ void KComboBox::setLineEdit( TQLineEdit *edit ) TQT_SIGNAL( substringCompletion( const TQString& )) ); connect( d->klineEdit, - TQT_SIGNAL( textRotation( KCompletionBase::KeyBindingType )), - TQT_SIGNAL( textRotation( KCompletionBase::KeyBindingType )) ); + TQT_SIGNAL( textRotation( TDECompletionBase::KeyBindingType )), + TQT_SIGNAL( textRotation( TDECompletionBase::KeyBindingType )) ); connect( d->klineEdit, TQT_SIGNAL( completionModeChanged( TDEGlobalSettings::Completion )), @@ -333,7 +333,7 @@ void KComboBox::lineEditDeleted() // yes, we need those ugly casts due to the multiple inheritance // sender() is guaranteed to be a KLineEdit (see the connect() to the // destroyed() signal - const KCompletionBase *base = static_cast( static_cast( sender() )); + const TDECompletionBase *base = static_cast( static_cast( sender() )); // is it our delegate, that is destroyed? if ( base == delegate() ) @@ -378,7 +378,7 @@ void KHistoryCombo::init( bool useCompletion ) setMaxCount( 50 ); if ( useCompletion ) - completionObject()->setOrder( KCompletion::Weighted ); + completionObject()->setOrder( TDECompletion::Weighted ); setInsertionPolicy( NoInsertion ); myIterateIndex = -1; @@ -421,10 +421,10 @@ void KHistoryCombo::setHistoryItems( TQStringList items, if ( setCompletionList && useCompletion() ) { // we don't have any weighting information here ;( - KCompletion *comp = completionObject(); - comp->setOrder( KCompletion::Insertion ); + TDECompletion *comp = completionObject(); + comp->setOrder( TDECompletion::Insertion ); comp->setItems( items ); - comp->setOrder( KCompletion::Weighted ); + comp->setOrder( TDECompletion::Weighted ); } clearEdit(); @@ -718,7 +718,7 @@ bool KHistoryCombo::isHistoryEditorEnabled() const } void KComboBox::virtual_hook( int id, void* data ) -{ KCompletionBase::virtual_hook( id, data ); } +{ TDECompletionBase::virtual_hook( id, data ); } void KHistoryCombo::virtual_hook( int id, void* data ) { KComboBox::virtual_hook( id, data ); } diff --git a/tdeui/kcombobox.h b/tdeui/kcombobox.h index 5d849b190..e0c2e2704 100644 --- a/tdeui/kcombobox.h +++ b/tdeui/kcombobox.h @@ -38,7 +38,7 @@ class TQListBoxItem; class TQPopupMenu; class TQLineEdit; -class KCompletionBox; +class TDECompletionBox; class KURL; /** @@ -64,7 +64,7 @@ class KURL; * * KCombobox by default creates a completion object when you invoke the * completionObject( bool ) member function for the first time or - * explicitly use setCompletionObject( KCompletion*, bool ) to assign your + * explicitly use setCompletionObject( TDECompletion*, bool ) to assign your * own completion object. Additionally, to make this widget more functional, * KComboBox will by default handle text rotation and completion events * internally whenever a completion object is created through either one of the @@ -74,11 +74,11 @@ class KURL; * * Beware: The completion object can be deleted on you, especially if a call * such as setEditable(false) is made. Store the pointer at your own risk, - * and consider using TQGuardedPtr. + * and consider using TQGuardedPtr. * * The default key-bindings for completion and rotation is determined from the * global settings in TDEStdAccel. These values, however, can be overridden - * locally by invoking KCompletionBase::setKeyBinding(). The values can + * locally by invoking TDECompletionBase::setKeyBinding(). The values can * easily be reverted back to the default setting, by simply calling * useGlobalSettings(). An alternate method would be to default individual * key-bindings by usning setKeyBinding() with the default second argument. @@ -93,8 +93,8 @@ class KURL; * words do not do the following: * * \code - * KComboBox* combo = new KCompletionBox(true, this, "mywidget"); - * KCompletion* comp = combo->completionObject(); + * KComboBox* combo = new TDECompletionBox(true, this, "mywidget"); + * TDECompletion* comp = combo->completionObject(); * combo->setEditable( false ); * comp->clear(); // CRASH: completion object does not exist anymore. * \endcode @@ -112,7 +112,7 @@ class KURL; * * \code * KComboBox *combo = new KComboBox( true, this, "mywidget" ); - * KCompletion *comp = combo->completionObject(); + * TDECompletion *comp = combo->completionObject(); * // Connect to the return pressed signal - optional * connect(combo,TQT_SIGNAL(returnPressed(const TQString&)),comp,TQT_SLOT(addItem(const TQString&))); * @@ -141,14 +141,14 @@ class KURL; * // Tell the widget not to handle completion and rotation * combo->setHandleSignals( false ); * // Set your own completion key for manual completions. - * combo->setKeyBinding( KCompletionBase::TextCompletion, Qt::End ); + * combo->setKeyBinding( TDECompletionBase::TextCompletion, Qt::End ); * // Hide the context (popup) menu * combo->setContextMenuEnabled( false ); * \endcode * * @author Dawit Alemayehu */ -class TDEUI_EXPORT KComboBox : public TQComboBox, public KCompletionBase +class TDEUI_EXPORT KComboBox : public TQComboBox, public TDECompletionBase { Q_OBJECT TQ_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion ) @@ -338,7 +338,7 @@ public: * @param create Set this to false if you don't want the box to be created * i.e. to test if it is available. */ - KCompletionBox * completionBox( bool create = true ); + TDECompletionBox * completionBox( bool create = true ); /** * Re-implemented for internal reasons. API remains unaffected. @@ -393,7 +393,7 @@ signals: * Note that this signal is @em NOT emitted if the completion * mode is set to CompletionNone. */ - void textRotation( KCompletionBase::KeyBindingType ); + void textRotation( TDECompletionBase::KeyBindingType ); /** * Emitted whenever the completion mode is changed by the user @@ -431,7 +431,7 @@ public slots: * * @param type The key-binding invoked. */ - void rotateText( KCompletionBase::KeyBindingType type ); + void rotateText( TDECompletionBase::KeyBindingType type ); /** * Sets the completed text in the line-edit appropriately. @@ -622,13 +622,13 @@ public: * than one KHistoryCombo. * * Note: When @p setCompletionList is true, the items are inserted into the - * KCompletion object with mode KCompletion::Insertion and the mode is set - * to KCompletion::Weighted afterwards. + * TDECompletion object with mode TDECompletion::Insertion and the mode is set + * to TDECompletion::Weighted afterwards. * * @see historyItems * @see KComboBox::completionObject - * @see KCompletion::setItems - * @see KCompletion::items + * @see TDECompletion::setItems + * @see TDECompletion::items */ void setHistoryItems( TQStringList items, bool setCompletionList ); diff --git a/tdeui/kcompletionbox.cpp b/tdeui/kcompletionbox.cpp index 086df247c..2dd4e9ccf 100644 --- a/tdeui/kcompletionbox.cpp +++ b/tdeui/kcompletionbox.cpp @@ -33,7 +33,7 @@ #include "kcompletionbox.h" -class KCompletionBox::KCompletionBoxPrivate +class TDECompletionBox::TDECompletionBoxPrivate { public: TQWidget *m_parent; // necessary to set the focus back @@ -44,8 +44,8 @@ public: bool emitSelected; }; -KCompletionBox::KCompletionBox( TQWidget *parent, const char *name ) - :TDEListBox( parent, name, (WFlags)WType_Popup ), d(new KCompletionBoxPrivate) +TDECompletionBox::TDECompletionBox( TQWidget *parent, const char *name ) + :TDEListBox( parent, name, (WFlags)WType_Popup ), d(new TDECompletionBoxPrivate) { d->m_parent = parent; @@ -76,13 +76,13 @@ KCompletionBox::KCompletionBox( TQWidget *parent, const char *name ) TQT_SLOT( slotItemClicked( TQListBoxItem * )) ); } -KCompletionBox::~KCompletionBox() +TDECompletionBox::~TDECompletionBox() { d->m_parent = 0L; delete d; } -TQStringList KCompletionBox::items() const +TQStringList TDECompletionBox::items() const { TQStringList list; @@ -96,7 +96,7 @@ TQStringList KCompletionBox::items() const return list; } -void KCompletionBox::slotActivated( TQListBoxItem *item ) +void TDECompletionBox::slotActivated( TQListBoxItem *item ) { if ( !item ) return; @@ -105,7 +105,7 @@ void KCompletionBox::slotActivated( TQListBoxItem *item ) emit activated( item->text() ); } -bool KCompletionBox::eventFilter( TQObject *o, TQEvent *e ) +bool TDECompletionBox::eventFilter( TQObject *o, TQEvent *e ) { int type = e->type(); @@ -247,7 +247,7 @@ bool KCompletionBox::eventFilter( TQObject *o, TQEvent *e ) } -void KCompletionBox::popup() +void TDECompletionBox::popup() { if ( count() == 0 ) hide(); @@ -265,7 +265,7 @@ void KCompletionBox::popup() } } -void KCompletionBox::sizeAndPosition() +void TDECompletionBox::sizeAndPosition() { int currentGeom = height(); TQPoint currentPos = pos(); @@ -297,7 +297,7 @@ void KCompletionBox::sizeAndPosition() } } -void KCompletionBox::show() +void TDECompletionBox::show() { d->upwardBox = false; if ( d->m_parent ) { @@ -309,19 +309,19 @@ void KCompletionBox::show() // are pretty b0rked. //triggerUpdate( true ); - // Workaround for I'm not sure whose bug - if this KCompletionBox' parent + // Workaround for I'm not sure whose bug - if this TDECompletionBox' parent // is in a layout, that layout will detect inserting new child (posted // ChildInserted event), and will trigger relayout (post LayoutHint event). // TQWidget::show() sends also posted ChildInserted events for the parent, // and later all LayoutHint events, which causes layout updating. - // The problem is, KCompletionBox::eventFilter() detects resizing + // The problem is, TDECompletionBox::eventFilter() detects resizing // of the parent, and calls hide() - and this hide() happen in the middle // of show(), causing inconsistent state. I'll try to submit a Qt patch too. tqApp->sendPostedEvents(); TDEListBox::show(); } -void KCompletionBox::hide() +void TDECompletionBox::hide() { if ( d->m_parent ) tqApp->removeEventFilter( this ); @@ -329,7 +329,7 @@ void KCompletionBox::hide() TDEListBox::hide(); } -TQRect KCompletionBox::calculateGeometry() const +TQRect TDECompletionBox::calculateGeometry() const { int x = 0, y = 0; int ih = itemHeight(); @@ -373,12 +373,12 @@ TQRect KCompletionBox::calculateGeometry() const return TQRect(x, y, w, h); } -TQSize KCompletionBox::sizeHint() const +TQSize TDECompletionBox::sizeHint() const { return calculateGeometry().size(); } -void KCompletionBox::down() +void TDECompletionBox::down() { int i = currentItem(); @@ -393,57 +393,57 @@ void KCompletionBox::down() setCurrentItem( i + 1 ); } -void KCompletionBox::up() +void TDECompletionBox::up() { if ( currentItem() > 0 ) setCurrentItem( currentItem() - 1 ); } -void KCompletionBox::pageDown() +void TDECompletionBox::pageDown() { int i = currentItem() + numItemsVisible(); i = i > (int)count() - 1 ? (int)count() - 1 : i; setCurrentItem( i ); } -void KCompletionBox::pageUp() +void TDECompletionBox::pageUp() { int i = currentItem() - numItemsVisible(); i = i < 0 ? 0 : i; setCurrentItem( i ); } -void KCompletionBox::home() +void TDECompletionBox::home() { setCurrentItem( 0 ); } -void KCompletionBox::end() +void TDECompletionBox::end() { setCurrentItem( count() -1 ); } -void KCompletionBox::setTabHandling( bool enable ) +void TDECompletionBox::setTabHandling( bool enable ) { d->tabHandling = enable; } -bool KCompletionBox::isTabHandling() const +bool TDECompletionBox::isTabHandling() const { return d->tabHandling; } -void KCompletionBox::setCancelledText( const TQString& text ) +void TDECompletionBox::setCancelledText( const TQString& text ) { d->cancelText = text; } -TQString KCompletionBox::cancelledText() const +TQString TDECompletionBox::cancelledText() const { return d->cancelText; } -void KCompletionBox::canceled() +void TDECompletionBox::canceled() { if ( !d->cancelText.isNull() ) emit userCancelled( d->cancelText ); @@ -451,7 +451,7 @@ void KCompletionBox::canceled() hide(); } -class KCompletionBoxItem : public TQListBoxItem +class TDECompletionBoxItem : public TQListBoxItem { public: //Returns true if dirty. @@ -465,7 +465,7 @@ public: }; -void KCompletionBox::insertItems( const TQStringList& items, int index ) +void TDECompletionBox::insertItems( const TQStringList& items, int index ) { bool block = signalsBlocked(); blockSignals( true ); @@ -474,7 +474,7 @@ void KCompletionBox::insertItems( const TQStringList& items, int index ) d->down_workaround = true; } -void KCompletionBox::setItems( const TQStringList& items ) +void TDECompletionBox::setItems( const TQStringList& items ) { bool block = signalsBlocked(); blockSignals( true ); @@ -494,7 +494,7 @@ void KCompletionBox::setItems( const TQStringList& items ) for ( ; it != itEnd; ++it) { if ( item ) { - const bool changed = ((KCompletionBoxItem*)item)->reuse( *it ); + const bool changed = ((TDECompletionBoxItem*)item)->reuse( *it ); dirty = dirty || changed; item = item->next(); } @@ -527,12 +527,12 @@ void KCompletionBox::setItems( const TQStringList& items ) d->down_workaround = true; } -void KCompletionBox::slotCurrentChanged() +void TDECompletionBox::slotCurrentChanged() { d->down_workaround = false; } -void KCompletionBox::slotItemClicked( TQListBoxItem *item ) +void TDECompletionBox::slotItemClicked( TQListBoxItem *item ) { if ( item ) { @@ -546,17 +546,17 @@ void KCompletionBox::slotItemClicked( TQListBoxItem *item ) } } -void KCompletionBox::setActivateOnSelect(bool state) +void TDECompletionBox::setActivateOnSelect(bool state) { d->emitSelected = state; } -bool KCompletionBox::activateOnSelect() const +bool TDECompletionBox::activateOnSelect() const { return d->emitSelected; } -void KCompletionBox::virtual_hook( int id, void* data ) +void TDECompletionBox::virtual_hook( int id, void* data ) { TDEListBox::virtual_hook( id, data ); } #include "kcompletionbox.moc" diff --git a/tdeui/kcompletionbox.h b/tdeui/kcompletionbox.h index 76f868dea..b874fec99 100644 --- a/tdeui/kcompletionbox.h +++ b/tdeui/kcompletionbox.h @@ -31,7 +31,7 @@ class TQEvent; * @short A helper widget for "completion-widgets" (KLineEdit, KComboBox)) * * A little utility class for "completion-widgets", like KLineEdit or - * KComboBox. KCompletionBox is a listbox, displayed as a rectangle without + * KComboBox. TDECompletionBox is a listbox, displayed as a rectangle without * any window decoration, usually directly under the lineedit or combobox. * It is filled with all possible matches for a completion, so the user * can select the one he wants. @@ -40,7 +40,7 @@ class TQEvent; * * @author Carsten Pfeiffer */ -class TDEUI_EXPORT KCompletionBox : public TDEListBox +class TDEUI_EXPORT TDECompletionBox : public TDEListBox { Q_OBJECT TQ_PROPERTY( bool isTabHandling READ isTabHandling WRITE setTabHandling ) @@ -49,17 +49,17 @@ class TDEUI_EXPORT KCompletionBox : public TDEListBox public: /** - * Constructs a KCompletionBox. + * Constructs a TDECompletionBox. * * The parent widget is used to give the focus back when pressing the * up-button on the very first item. */ - KCompletionBox( TQWidget *parent, const char *name = 0 ); + TDECompletionBox( TQWidget *parent, const char *name = 0 ); /** * Destroys the box */ - ~KCompletionBox(); + ~TDECompletionBox(); virtual TQSize sizeHint() const; @@ -238,8 +238,8 @@ protected: virtual void virtual_hook( int id, void* data ); private: - class KCompletionBoxPrivate; - KCompletionBoxPrivate* const d; + class TDECompletionBoxPrivate; + TDECompletionBoxPrivate* const d; }; diff --git a/tdeui/klineedit.cpp b/tdeui/klineedit.cpp index fa7648dfc..66230b4a9 100644 --- a/tdeui/klineedit.cpp +++ b/tdeui/klineedit.cpp @@ -93,7 +93,7 @@ public: int squeezedStart; BackgroundMode bgMode; TQString squeezedText; - KCompletionBox *completionBox; + TDECompletionBox *completionBox; TQString clickMessage; bool drawClickMsg:1; @@ -171,7 +171,7 @@ void KLineEdit::setCompletionMode( TDEGlobalSettings::Completion mode ) else d->autoSuggest = false; - KCompletionBase::setCompletionMode( mode ); + TDECompletionBase::setCompletionMode( mode ); } void KLineEdit::setCompletedText( const TQString& t, bool marked ) @@ -202,16 +202,16 @@ void KLineEdit::setCompletedText( const TQString& text ) setCompletedText( text, marked ); } -void KLineEdit::rotateText( KCompletionBase::KeyBindingType type ) +void KLineEdit::rotateText( TDECompletionBase::KeyBindingType type ) { - KCompletion* comp = compObj(); + TDECompletion* comp = compObj(); if ( comp && - (type == KCompletionBase::PrevCompletionMatch || - type == KCompletionBase::NextCompletionMatch ) ) + (type == TDECompletionBase::PrevCompletionMatch || + type == TDECompletionBase::NextCompletionMatch ) ) { TQString input; - if (type == KCompletionBase::PrevCompletionMatch) + if (type == TDECompletionBase::PrevCompletionMatch) comp->previousMatch(); else comp->nextMatch(); @@ -225,7 +225,7 @@ void KLineEdit::rotateText( KCompletionBase::KeyBindingType type ) void KLineEdit::makeCompletion( const TQString& text ) { - KCompletion *comp = compObj(); + TDECompletion *comp = compObj(); TDEGlobalSettings::Completion mode = completionMode(); if ( !comp || mode == TDEGlobalSettings::CompletionNone ) @@ -761,9 +761,9 @@ void KLineEdit::keyPressEvent( TQKeyEvent *e ) if ( cut.contains( key ) ) { if ( emitSignals() ) - emit textRotation( KCompletionBase::PrevCompletionMatch ); + emit textRotation( TDECompletionBase::PrevCompletionMatch ); if ( handleSignals() ) - rotateText( KCompletionBase::PrevCompletionMatch ); + rotateText( TDECompletionBase::PrevCompletionMatch ); return; } @@ -776,9 +776,9 @@ void KLineEdit::keyPressEvent( TQKeyEvent *e ) if ( cut.contains( key ) ) { if ( emitSignals() ) - emit textRotation( KCompletionBase::NextCompletionMatch ); + emit textRotation( TDECompletionBase::NextCompletionMatch ); if ( handleSignals() ) - rotateText( KCompletionBase::NextCompletionMatch ); + rotateText( TDECompletionBase::NextCompletionMatch ); return; } } @@ -1080,7 +1080,7 @@ void KLineEdit::setURL( const KURL& url ) setText( url.prettyURL() ); } -void KLineEdit::setCompletionBox( KCompletionBox *box ) +void KLineEdit::setCompletionBox( TDECompletionBox *box ) { if ( d->completionBox ) return; @@ -1259,19 +1259,19 @@ void KLineEdit::setCompletedItems( const TQStringList& items, bool autoSuggest ) } } -KCompletionBox * KLineEdit::completionBox( bool create ) +TDECompletionBox * KLineEdit::completionBox( bool create ) { if ( create && !d->completionBox ) { - setCompletionBox( new KCompletionBox( this, "completion box" ) ); + setCompletionBox( new TDECompletionBox( this, "completion box" ) ); d->completionBox->setFont(font()); } return d->completionBox; } -void KLineEdit::setCompletionObject( KCompletion* comp, bool hsig ) +void KLineEdit::setCompletionObject( TDECompletion* comp, bool hsig ) { - KCompletion *oldComp = compObj(); + TDECompletion *oldComp = compObj(); if ( oldComp && handleSignals() ) disconnect( oldComp, TQT_SIGNAL( matches( const TQStringList& )), this, TQT_SLOT( setCompletedItems( const TQStringList& ))); @@ -1280,7 +1280,7 @@ void KLineEdit::setCompletionObject( KCompletion* comp, bool hsig ) connect( comp, TQT_SIGNAL( matches( const TQStringList& )), this, TQT_SLOT( setCompletedItems( const TQStringList& ))); - KCompletionBase::setCompletionObject( comp, hsig ); + TDECompletionBase::setCompletionObject( comp, hsig ); } // TQWidget::create() turns off mouse-Tracking which would break auto-hiding @@ -1379,4 +1379,4 @@ TQString KLineEdit::clickMessage() const void KLineEdit::virtual_hook( int id, void* data ) -{ KCompletionBase::virtual_hook( id, data ); } +{ TDECompletionBase::virtual_hook( id, data ); } diff --git a/tdeui/klineedit.h b/tdeui/klineedit.h index be25a35d9..82179fa05 100644 --- a/tdeui/klineedit.h +++ b/tdeui/klineedit.h @@ -35,7 +35,7 @@ class TQPopupMenu; -class KCompletionBox; +class TDECompletionBox; class KURL; /** @@ -63,7 +63,7 @@ class KURL; * * This widget by default creates a completion object when you invoke * the completionObject( bool ) member function for the first time or - * use setCompletionObject( KCompletion*, bool ) to assign your own + * use setCompletionObject( TDECompletion*, bool ) to assign your own * completion object. Additionally, to make this widget more functional, * KLineEdit will by default handle the text rotation and completion * events internally when a completion object is created through either one @@ -82,7 +82,7 @@ class KURL; * If @p EchoMode for this widget is set to something other than @p TQLineEdit::Normal, * the completion mode will always be defaulted to TDEGlobalSettings::CompletionNone. * This is done purposefully to guard against protected entries such as passwords being - * cached in KCompletion's list. Hence, if the @p EchoMode is not TQLineEdit::Normal, the + * cached in TDECompletion's list. Hence, if the @p EchoMode is not TQLineEdit::Normal, the * completion mode is automatically disabled. * * A read-only KLineEdit will have the same background color as a @@ -97,7 +97,7 @@ class KURL; * * \code * KLineEdit *edit = new KLineEdit( this, "mywidget" ); - * KCompletion *comp = edit->completionObject(); + * TDECompletion *comp = edit->completionObject(); * // Connect to the return pressed signal - optional * connect(edit,TQT_SIGNAL(returnPressed(const TQString&)),comp,TQT_SLOT(addItem(const TQString&))); * \endcode @@ -127,7 +127,7 @@ class KURL; * edit->setHandleSignals( false ); * * // Set your own key-bindings for a text completion mode. - * edit->setKeyBinding( KCompletionBase::TextCompletion, Qt::End ); + * edit->setKeyBinding( TDECompletionBase::TextCompletion, Qt::End ); * * // Hide the context (popup) menu * edit->setContextMenuEnabled( false ); @@ -142,7 +142,7 @@ class KURL; * @author Dawit Alemayehu */ -class TDEUI_EXPORT KLineEdit : public TQLineEdit, public KCompletionBase +class TDEUI_EXPORT KLineEdit : public TQLineEdit, public TDECompletionBase { friend class KComboBox; @@ -197,12 +197,12 @@ public: void cursorAtEnd() { end( false ); } /** - * Re-implemented from KCompletionBase for internal reasons. + * Re-implemented from TDECompletionBase for internal reasons. * * This function is re-implemented in order to make sure that * the EchoMode is acceptable before we set the completion mode. * - * See KCompletionBase::setCompletionMode + * See TDECompletionBase::setCompletionMode */ virtual void setCompletionMode( TDEGlobalSettings::Completion mode ); @@ -275,12 +275,12 @@ public: * @param create Set this to false if you don't want the box to be created * i.e. to test if it is available. */ - KCompletionBox * completionBox( bool create = true ); + TDECompletionBox * completionBox( bool create = true ); /** * Reimplemented for internal reasons, the API is not affected. */ - virtual void setCompletionObject( KCompletion *, bool hsig = true ); + virtual void setCompletionObject( TDECompletion *, bool hsig = true ); /** * Reimplemented for internal reasons, the API is not affected. @@ -323,10 +323,10 @@ public: * TDEGlobalSettings::CompletionPopup. * This will do nothing if a completion-box already exists. * - * @param box The KCompletionBox to set + * @param box The TDECompletionBox to set * @since 3.4 */ - void setCompletionBox( KCompletionBox *box ); + void setCompletionBox( TDECompletionBox *box ); /** * This makes the line edit display a grayed-out hinting text as long as @@ -385,7 +385,7 @@ signals: * mode is set to @p TDEGlobalSettings::CompletionNone or * @p echoMode() is @em not normal. */ - void textRotation( KCompletionBase::KeyBindingType ); + void textRotation( TDECompletionBase::KeyBindingType ); /** * Emitted when the user changed the completion mode by using the @@ -424,10 +424,10 @@ public slots: * * @param type The key-binding invoked. */ - void rotateText( KCompletionBase::KeyBindingType type ); + void rotateText( TDECompletionBase::KeyBindingType type ); /** - * See KCompletionBase::setCompletedText. + * See TDECompletionBase::setCompletedText. */ virtual void setCompletedText( const TQString& ); diff --git a/tdeui/tdelistview.h b/tdeui/tdelistview.h index 7c01b6c29..995e2b678 100644 --- a/tdeui/tdelistview.h +++ b/tdeui/tdelistview.h @@ -194,7 +194,7 @@ public: /** * @return the lineedit used for inline renaming. - * Use that to setup a KCompletion or TQValidator for the lineedit + * Use that to setup a TDECompletion or TQValidator for the lineedit * * @since 3.2 */ diff --git a/tdeui/tests/kcomboboxtest.cpp b/tdeui/tests/kcomboboxtest.cpp index 94314ffbc..701710891 100644 --- a/tdeui/tests/kcomboboxtest.cpp +++ b/tdeui/tests/kcomboboxtest.cpp @@ -139,8 +139,8 @@ KComboBoxTest::KComboBoxTest(TQWidget* widget, const char* name ) // Setup konq's combobox KSimpleConfig historyConfig( "konq_history" ); historyConfig.setGroup( "Location Bar" ); - KCompletion * s_pCompletion = new KCompletion; - s_pCompletion->setOrder( KCompletion::Weighted ); + TDECompletion * s_pCompletion = new TDECompletion; + s_pCompletion->setOrder( TDECompletion::Weighted ); s_pCompletion->setItems( historyConfig.readListEntry( "ComboContents" ) ); s_pCompletion->setCompletionMode( TDEGlobalSettings::completionMode() ); m_konqc->setCompletionObject( s_pCompletion );