diff options
Diffstat (limited to 'tdecore')
-rw-r--r-- | tdecore/AUTHORS | 2 | ||||
-rw-r--r-- | tdecore/kcompletion.cpp | 166 | ||||
-rw-r--r-- | tdecore/kcompletion.h | 136 | ||||
-rw-r--r-- | tdecore/kcompletion_private.h | 70 | ||||
-rw-r--r-- | tdecore/kcompletionbase.cpp | 24 | ||||
-rw-r--r-- | tdecore/kglobalsettings.h | 2 |
6 files changed, 200 insertions, 200 deletions
diff --git a/tdecore/AUTHORS b/tdecore/AUTHORS index dbe44b9ca..57935fce7 100644 --- a/tdecore/AUTHORS +++ b/tdecore/AUTHORS @@ -53,4 +53,4 @@ Thomas Tanner <tanner@gmx.de> ltdl.c + ltdl.h Carsten Pfeiffer <pfeiffer@kde.org> -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<KCompTreeNode> deletables( string.length() + 1 ); + TQPtrVector<TDECompTreeNode> 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 <ksortablevaluelist.h> #include <tdeshortcut.h> -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 <pfeiffer@kde.org> */ -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<TQString> KCompletionMatchesList; -class KCompletionMatchesPrivate; +typedef KSortableValueList<TQString> 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 <adawit@kde.org> */ -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<KCompletion> m_pCompObj; + TQGuardedPtr<TDECompletion> 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 <tqstring.h> #include <ksortablevaluelist.h> -class KCompTreeNode; +class TDECompTreeNode; #include <kallocator.h> /** * @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 <pfeiffer@kde.org> * @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<TQString> KCompletionMatchesList; +typedef KSortableValueList<TQString> 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 <kcompletion.h> -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 <a href="http://developer.kde.org/documentation/standards/kde/style/keys/completion.html"> * the styleguide</a>. **/ |