Rename KComp to avoid conflicts with KDE4

pull/16/head
Timothy Pearson 12 years ago
parent 696e36a061
commit 546d2312d9

@ -55,7 +55,7 @@
using namespace KABC; using namespace KABC;
KCompletion * AddressLineEdit::s_completion = 0L; TDECompletion * AddressLineEdit::s_completion = 0L;
bool AddressLineEdit::s_addressesDirty = false; bool AddressLineEdit::s_addressesDirty = false;
TQTimer* AddressLineEdit::s_LDAPTimer = 0L; TQTimer* AddressLineEdit::s_LDAPTimer = 0L;
LdapSearch* AddressLineEdit::s_LDAPSearch = 0L; LdapSearch* AddressLineEdit::s_LDAPSearch = 0L;
@ -63,7 +63,7 @@ TQString* AddressLineEdit::s_LDAPText = 0L;
AddressLineEdit* AddressLineEdit::s_LDAPLineEdit = 0L; AddressLineEdit* AddressLineEdit::s_LDAPLineEdit = 0L;
TDEConfig *AddressLineEdit::s_config = 0L; TDEConfig *AddressLineEdit::s_config = 0L;
static KStaticDeleter<KCompletion> completionDeleter; static KStaticDeleter<TDECompletion> completionDeleter;
static KStaticDeleter<TQTimer> ldapTimerDeleter; static KStaticDeleter<TQTimer> ldapTimerDeleter;
static KStaticDeleter<LdapSearch> ldapSearchDeleter; static KStaticDeleter<LdapSearch> ldapSearchDeleter;
static KStaticDeleter<TQString> ldapTextDeleter; static KStaticDeleter<TQString> ldapTextDeleter;
@ -93,8 +93,8 @@ AddressLineEdit::AddressLineEdit(TQWidget* parent,
void AddressLineEdit::init() void AddressLineEdit::init()
{ {
if ( !s_completion ) { if ( !s_completion ) {
completionDeleter.setObject( s_completion, new KCompletion() ); completionDeleter.setObject( s_completion, new TDECompletion() );
s_completion->setOrder( KCompletion::Sorted ); s_completion->setOrder( TDECompletion::Sorted );
s_completion->setIgnoreCase( true ); s_completion->setIgnoreCase( true );
} }
@ -115,7 +115,7 @@ void AddressLineEdit::init()
connect( this, TQT_SIGNAL( completion(const TQString&)), connect( this, TQT_SIGNAL( completion(const TQString&)),
this, TQT_SLOT(slotCompletion() )); this, TQT_SLOT(slotCompletion() ));
KCompletionBox *box = completionBox(); TDECompletionBox *box = completionBox();
connect( box, TQT_SIGNAL( highlighted( const TQString& )), connect( box, TQT_SIGNAL( highlighted( const TQString& )),
this, TQT_SLOT( slotPopupCompletion( const TQString& ) )); this, TQT_SLOT( slotPopupCompletion( const TQString& ) ));
connect( box, TQT_SIGNAL( userCancelled( const TQString& )), connect( box, TQT_SIGNAL( userCancelled( const TQString& )),

@ -107,7 +107,7 @@ private:
TQString m_typedText; // unused TQString m_typedText; // unused
static bool s_addressesDirty; static bool s_addressesDirty;
static KCompletion *s_completion; static TDECompletion *s_completion;
static TQTimer *s_LDAPTimer; static TQTimer *s_LDAPTimer;
static LdapSearch *s_LDAPSearch; static LdapSearch *s_LDAPSearch;
static TQString *s_LDAPText; static TQString *s_LDAPText;

@ -40,7 +40,7 @@
#include <tdeaction.h> #include <tdeaction.h>
class KCompletion; class TDECompletion;
/** /**
* Kate namespace * Kate namespace
@ -146,7 +146,7 @@ class CommandExtension
virtual void flagCompletions( TQStringList& /*list*/ ) {;} 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 * one while typing the first argument to the command. The text will be
* added to the command seperated by one space character. * added to the command seperated by one space character.
* *
@ -154,7 +154,7 @@ class CommandExtension
* *
* @param cmdname The command name associated with this request. * @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. * @return whether this command wants to process text interactively given the @p cmdname.

@ -123,7 +123,7 @@ const TQString KateCmd::fromHistory( uint index ) const
Copyright (C) 2004 Anders Lund <anders@alweb.dk> Copyright (C) 2004 Anders Lund <anders@alweb.dk>
*/ */
KateCmdShellCompletion::KateCmdShellCompletion() KateCmdShellCompletion::KateCmdShellCompletion()
: KCompletion() : TDECompletion()
{ {
m_word_break_char = ' '; m_word_break_char = ' ';
m_quote_char1 = '\"'; m_quote_char1 = '\"';
@ -139,7 +139,7 @@ TQString KateCmdShellCompletion::makeCompletion( const TQString &text )
// Make completion on the last part of 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 void KateCmdShellCompletion::postProcessMatch( TQString *match ) const
@ -158,9 +158,9 @@ void KateCmdShellCompletion::postProcessMatches( TQStringList *matches ) const
(*it).prepend( m_text_start ); (*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++ ) it != matches->end(); it++ )
if ( !(*it).value().isNull() ) if ( !(*it).value().isNull() )
(*it).value().prepend( m_text_start ); (*it).value().prepend( m_text_start );

@ -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 * passed. Dont mistake "shell" for anything related to quoting, this
* simply mimics shell tab completion by completing the last word in the * simply mimics shell tab completion by completing the last word in the
* provided text. * provided text.
*/ */
class KATEPARTINTERFACES_EXPORT KateCmdShellCompletion : public KCompletion class KATEPARTINTERFACES_EXPORT KateCmdShellCompletion : public TDECompletion
{ {
public: public:
KateCmdShellCompletion(); KateCmdShellCompletion();
@ -72,10 +72,10 @@ class KATEPARTINTERFACES_EXPORT KateCmdShellCompletion : public KCompletion
TQString makeCompletion(const TQString &text); TQString makeCompletion(const TQString &text);
protected: protected:
// Called by KCompletion // Called by TDECompletion
void postProcessMatch( TQString *match ) const; void postProcessMatch( TQString *match ) const;
void postProcessMatches( TQStringList *matches ) const; void postProcessMatches( TQStringList *matches ) const;
void postProcessMatches( KCompletionMatches *matches ) const; void postProcessMatches( TDECompletionMatches *matches ) const;
private: private:
/** /**

@ -279,7 +279,7 @@ bool KateCommands::CoreCommands::exec(Kate::View *view,
KCC_ERR( i18n("Unknown command '%1'").arg(cmd) ); 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" ) if ( cmd == "set-highlight" )
{ {

@ -25,7 +25,7 @@
#include "../interfaces/view.h" #include "../interfaces/view.h"
class KateDocument; class KateDocument;
class KCompletion; class TDECompletion;
namespace KateCommands namespace KateCommands
{ {
@ -59,7 +59,7 @@ class CoreCommands : public Kate::Command, public Kate::CommandExtension
/** /**
* override completionObject from interfaces/document.h . * override completionObject from interfaces/document.h .
*/ */
KCompletion *completionObject( const TQString &cmd, Kate::View *view ); TDECompletion *completionObject( const TQString &cmd, Kate::View *view );
}; };
/** /**

@ -272,7 +272,7 @@ class KateCmdLnWhatsThis : public TQWhatsThis
* This class provide completion of flags. It shows a short description of * This class provide completion of flags. It shows a short description of
* each flag, and flags are appended. * each flag, and flags are appended.
*/ */
class KateCmdLineFlagCompletion : public KCompletion class KateCmdLineFlagCompletion : public TDECompletion
{ {
public: public:
KateCmdLineFlagCompletion() {;} KateCmdLineFlagCompletion() {;}
@ -365,7 +365,7 @@ void KateCmdLine::slotReturnPressed ( const TQString& text )
// clean up // clean up
if ( m_oldCompletionObject ) if ( m_oldCompletionObject )
{ {
KCompletion *c = completionObject(); TDECompletion *c = completionObject();
setCompletionObject( m_oldCompletionObject ); setCompletionObject( m_oldCompletionObject );
m_oldCompletionObject = 0; m_oldCompletionObject = 0;
delete c; delete c;
@ -465,7 +465,7 @@ void KateCmdLine::keyPressEvent( TQKeyEvent *ev )
// clean up if needed // clean up if needed
if ( m_oldCompletionObject ) if ( m_oldCompletionObject )
{ {
KCompletion *c = completionObject(); TDECompletion *c = completionObject();
setCompletionObject( m_oldCompletionObject ); setCompletionObject( m_oldCompletionObject );
m_oldCompletionObject = 0; m_oldCompletionObject = 0;
delete c; delete c;
@ -483,7 +483,7 @@ void KateCmdLine::keyPressEvent( TQKeyEvent *ev )
Kate::CommandExtension *ce = dynamic_cast<Kate::CommandExtension*>(m_command); Kate::CommandExtension *ce = dynamic_cast<Kate::CommandExtension*>(m_command);
if ( ce ) 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 ) if ( cmpl )
{ {
// save the old completion object and use what the command provides // save the old completion object and use what the command provides

@ -115,7 +115,7 @@ class KateCmdLine : public KLineEdit
uint m_histpos; ///< position in the history 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. 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 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; class KateCmdLnWhatsThis *m_help;
}; };

@ -354,7 +354,7 @@ void KeramikStyle::polish(const TQStyleControlElementData &ceData, ControlElemen
else if ( widget->parentWidget() && else if ( widget->parentWidget() &&
( ( widget->inherits( TQLISTBOX_OBJECT_NAME_STRING ) && widget->parentWidget()->inherits( TQCOMBOBOX_OBJECT_NAME_STRING ) ) || ( ( widget->inherits( TQLISTBOX_OBJECT_NAME_STRING ) && widget->parentWidget()->inherits( TQCOMBOBOX_OBJECT_NAME_STRING ) ) ||
widget->inherits( "KCompletionBox" ) ) ) { widget->inherits( "TDECompletionBox" ) ) ) {
TQListBox* listbox = (TQListBox*) widget; TQListBox* listbox = (TQListBox*) widget;
listbox->setLineWidth( 4 ); listbox->setLineWidth( 4 );
listbox->setBackgroundMode( NoBackground ); listbox->setBackgroundMode( NoBackground );
@ -399,7 +399,7 @@ void KeramikStyle::unPolish(const TQStyleControlElementData &ceData, ControlElem
else if ( widget->parentWidget() && else if ( widget->parentWidget() &&
( ( widget->inherits( TQLISTBOX_OBJECT_NAME_STRING ) && widget->parentWidget()->inherits( TQCOMBOBOX_OBJECT_NAME_STRING ) ) || ( ( widget->inherits( TQLISTBOX_OBJECT_NAME_STRING ) && widget->parentWidget()->inherits( TQCOMBOBOX_OBJECT_NAME_STRING ) ) ||
widget->inherits( "KCompletionBox" ) ) ) { widget->inherits( "TDECompletionBox" ) ) ) {
TQListBox* listbox = (TQListBox*) widget; TQListBox* listbox = (TQListBox*) widget;
listbox->setLineWidth( 1 ); listbox->setLineWidth( 1 );
listbox->setBackgroundMode( PaletteBackground ); listbox->setBackgroundMode( PaletteBackground );

@ -53,4 +53,4 @@ Thomas Tanner <tanner@gmx.de>
ltdl.c + ltdl.h ltdl.c + ltdl.h
Carsten Pfeiffer <pfeiffer@kde.org> Carsten Pfeiffer <pfeiffer@kde.org>
KCompletion classes TDECompletion classes

@ -30,20 +30,20 @@
#include "kcompletion_private.h" #include "kcompletion_private.h"
class KCompletionPrivate class TDECompletionPrivate
{ {
public: public:
// not a member to avoid #including kcompletion_private.h from kcompletion.h // not a member to avoid #including kcompletion_private.h from kcompletion.h
// list used for nextMatch() and previousMatch() // list used for nextMatch() and previousMatch()
KCompletionMatchesWrapper matches; TDECompletionMatchesWrapper matches;
}; };
KCompletion::KCompletion() TDECompletion::TDECompletion()
{ {
d = new KCompletionPrivate; d = new TDECompletionPrivate;
myCompletionMode = TDEGlobalSettings::completionMode(); myCompletionMode = TDEGlobalSettings::completionMode();
myTreeRoot = new KCompTreeNode; myTreeRoot = new TDECompTreeNode;
myBeep = true; myBeep = true;
myIgnoreCase = false; myIgnoreCase = false;
myHasMultipleMatches = false; myHasMultipleMatches = false;
@ -51,31 +51,31 @@ KCompletion::KCompletion()
setOrder( Insertion ); setOrder( Insertion );
} }
KCompletion::~KCompletion() TDECompletion::~TDECompletion()
{ {
delete d; delete d;
delete myTreeRoot; delete myTreeRoot;
} }
void KCompletion::setOrder( CompOrder order ) void TDECompletion::setOrder( CompOrder order )
{ {
myOrder = order; myOrder = order;
d->matches.setSorting( order == Weighted ); d->matches.setSorting( order == Weighted );
} }
void KCompletion::setIgnoreCase( bool ignoreCase ) void TDECompletion::setIgnoreCase( bool ignoreCase )
{ {
myIgnoreCase = ignoreCase; myIgnoreCase = ignoreCase;
} }
void KCompletion::setItems( const TQStringList& items ) void TDECompletion::setItems( const TQStringList& items )
{ {
clear(); clear();
insertItems( items ); insertItems( items );
} }
void KCompletion::insertItems( const TQStringList& items ) void TDECompletion::insertItems( const TQStringList& items )
{ {
bool weighted = (myOrder == Weighted); bool weighted = (myOrder == Weighted);
TQStringList::ConstIterator it; 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); bool addWeight = (myOrder == Weighted);
extractStringsFromNode( myTreeRoot, TQString::null, &list, addWeight ); extractStringsFromNode( myTreeRoot, TQString::null, &list, addWeight );
return list.list(); return list.list();
} }
bool KCompletion::isEmpty() const bool TDECompletion::isEmpty() const
{ {
return (myTreeRoot->childrenCount() == 0); return (myTreeRoot->childrenCount() == 0);
} }
void KCompletion::addItem( const TQString& item ) void TDECompletion::addItem( const TQString& item )
{ {
d->matches.clear(); d->matches.clear();
myRotationIndex = 0; myRotationIndex = 0;
@ -112,12 +112,12 @@ void KCompletion::addItem( const TQString& item )
addItem( item, 0 ); addItem( item, 0 );
} }
void KCompletion::addItem( const TQString& item, uint weight ) void TDECompletion::addItem( const TQString& item, uint weight )
{ {
if ( item.isEmpty() ) if ( item.isEmpty() )
return; return;
KCompTreeNode *node = myTreeRoot; TDECompTreeNode *node = myTreeRoot;
uint len = item.length(); uint len = item.length();
bool sorted = (myOrder == Sorted); bool sorted = (myOrder == Sorted);
@ -139,7 +139,7 @@ void KCompletion::addItem( const TQString& item, uint weight )
// tqDebug("*** added: %s (%i)", item.latin1(), node->weight()); // tqDebug("*** added: %s (%i)", item.latin1(), node->weight());
} }
void KCompletion::addWeightedItem( const TQString& item ) void TDECompletion::addWeightedItem( const TQString& item )
{ {
if ( myOrder != Weighted ) { if ( myOrder != Weighted ) {
addItem( item, 0 ); 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(); d->matches.clear();
myRotationIndex = 0; myRotationIndex = 0;
@ -175,23 +175,23 @@ void KCompletion::removeItem( const TQString& item )
} }
void KCompletion::clear() void TDECompletion::clear()
{ {
d->matches.clear(); d->matches.clear();
myRotationIndex = 0; myRotationIndex = 0;
myLastString = TQString::null; myLastString = TQString::null;
delete myTreeRoot; delete myTreeRoot;
myTreeRoot = new KCompTreeNode; myTreeRoot = new TDECompTreeNode;
} }
TQString KCompletion::makeCompletion( const TQString& string ) TQString TDECompletion::makeCompletion( const TQString& string )
{ {
if ( myCompletionMode == TDEGlobalSettings::CompletionNone ) if ( myCompletionMode == TDEGlobalSettings::CompletionNone )
return TQString::null; return TQString::null;
//kdDebug(0) << "KCompletion: completing: " << string << endl; //kdDebug(0) << "TDECompletion: completing: " << string << endl;
d->matches.clear(); d->matches.clear();
myRotationIndex = 0; myRotationIndex = 0;
@ -237,7 +237,7 @@ TQString KCompletion::makeCompletion( const TQString& string )
postProcessMatch( &completion ); postProcessMatch( &completion );
if ( !string.isEmpty() ) { // only emit match when string is not empty 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 ); 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 // get all items in the tree, possibly in sorted order
bool sorted = (myOrder == Weighted); bool sorted = (myOrder == Weighted);
KCompletionMatchesWrapper allItems( sorted ); TDECompletionMatchesWrapper allItems( sorted );
extractStringsFromNode( myTreeRoot, TQString::null, &allItems, false ); extractStringsFromNode( myTreeRoot, TQString::null, &allItems, false );
TQStringList list = allItems.list(); 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; myCompletionMode = mode;
} }
TQStringList KCompletion::allMatches() TQStringList TDECompletion::allMatches()
{ {
// Don't use d->matches since calling postProcessMatches() // Don't use d->matches since calling postProcessMatches()
// on d->matches here would interfere with call to // on d->matches here would interfere with call to
// postProcessMatch() during rotation // postProcessMatch() during rotation
KCompletionMatchesWrapper matches( myOrder == Weighted ); TDECompletionMatchesWrapper matches( myOrder == Weighted );
bool dummy; bool dummy;
findAllCompletions( myLastString, &matches, dummy ); findAllCompletions( myLastString, &matches, dummy );
TQStringList l = matches.list(); TQStringList l = matches.list();
@ -306,22 +306,22 @@ TQStringList KCompletion::allMatches()
return l; return l;
} }
KCompletionMatches KCompletion::allWeightedMatches() TDECompletionMatches TDECompletion::allWeightedMatches()
{ {
// Don't use d->matches since calling postProcessMatches() // Don't use d->matches since calling postProcessMatches()
// on d->matches here would interfere with call to // on d->matches here would interfere with call to
// postProcessMatch() during rotation // postProcessMatch() during rotation
KCompletionMatchesWrapper matches( myOrder == Weighted ); TDECompletionMatchesWrapper matches( myOrder == Weighted );
bool dummy; bool dummy;
findAllCompletions( myLastString, &matches, dummy ); findAllCompletions( myLastString, &matches, dummy );
KCompletionMatches ret( matches ); TDECompletionMatches ret( matches );
postProcessMatches( &ret ); postProcessMatches( &ret );
return 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; bool dummy;
findAllCompletions( string, &matches, dummy ); findAllCompletions( string, &matches, dummy );
TQStringList l = matches.list(); TQStringList l = matches.list();
@ -329,12 +329,12 @@ TQStringList KCompletion::allMatches( const TQString &string )
return l; return l;
} }
KCompletionMatches KCompletion::allWeightedMatches( const TQString &string ) TDECompletionMatches TDECompletion::allWeightedMatches( const TQString &string )
{ {
KCompletionMatchesWrapper matches( myOrder == Weighted ); TDECompletionMatchesWrapper matches( myOrder == Weighted );
bool dummy; bool dummy;
findAllCompletions( string, &matches, dummy ); findAllCompletions( string, &matches, dummy );
KCompletionMatches ret( matches ); TDECompletionMatches ret( matches );
postProcessMatches( &ret ); postProcessMatches( &ret );
return ret; return ret;
} }
@ -343,7 +343,7 @@ KCompletionMatches KCompletion::allWeightedMatches( const TQString &string )
///////////////// tree operations /////////////////// ///////////////// tree operations ///////////////////
TQString KCompletion::nextMatch() TQString TDECompletion::nextMatch()
{ {
TQString completion; TQString completion;
myLastMatch = myCurrentMatch; myLastMatch = myCurrentMatch;
@ -376,7 +376,7 @@ TQString KCompletion::nextMatch()
TQString KCompletion::previousMatch() TQString TDECompletion::previousMatch()
{ {
TQString completion; TQString completion;
myLastMatch = myCurrentMatch; myLastMatch = myCurrentMatch;
@ -411,11 +411,11 @@ TQString KCompletion::previousMatch()
// tries to complete "string" from the tree-root // tries to complete "string" from the tree-root
TQString KCompletion::findCompletion( const TQString& string ) TQString TDECompletion::findCompletion( const TQString& string )
{ {
TQChar ch; TQChar ch;
TQString completion; TQString completion;
const KCompTreeNode *node = myTreeRoot; const TDECompTreeNode *node = myTreeRoot;
// start at the tree-root and try to find the search-string // start at the tree-root and try to find the search-string
for( uint i = 0; i < string.length(); i++ ) { 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 // don't just find the "first" match, but the one with the
// highest priority // highest priority
const KCompTreeNode* temp_node = 0L; const TDECompTreeNode* temp_node = 0L;
while(1) { while(1) {
int count = node->childrenCount(); int count = node->childrenCount();
temp_node = node->firstChild(); temp_node = node->firstChild();
uint weight = temp_node->weight(); uint weight = temp_node->weight();
const KCompTreeNode* hit = temp_node; const TDECompTreeNode* hit = temp_node;
for( int i = 1; i < count; i++ ) { for( int i = 1; i < count; i++ ) {
temp_node = node->childAt(i); temp_node = node->childAt(i);
if( temp_node->weight() > weight ) { if( temp_node->weight() > weight ) {
@ -487,8 +487,8 @@ TQString KCompletion::findCompletion( const TQString& string )
} }
void KCompletion::findAllCompletions(const TQString& string, void TDECompletion::findAllCompletions(const TQString& string,
KCompletionMatchesWrapper *matches, TDECompletionMatchesWrapper *matches,
bool& hasMultipleMatches) const bool& hasMultipleMatches) const
{ {
//kdDebug(0) << "*** finding all completions for " << string << endl; //kdDebug(0) << "*** finding all completions for " << string << endl;
@ -504,7 +504,7 @@ void KCompletion::findAllCompletions(const TQString& string,
TQChar ch; TQChar ch;
TQString completion; TQString completion;
const KCompTreeNode *node = myTreeRoot; const TDECompTreeNode *node = myTreeRoot;
// start at the tree-root and try to find the search-string // start at the tree-root and try to find the search-string
for( uint i = 0; i < string.length(); i++ ) { 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, const TQString& beginning,
KCompletionMatchesWrapper *matches, TDECompletionMatchesWrapper *matches,
bool addWeight ) const bool addWeight ) const
{ {
if ( !node || !matches ) if ( !node || !matches )
return; return;
// kDebug() << "Beginning: " << beginning << endl; // kDebug() << "Beginning: " << beginning << endl;
const KCompTreeChildren *list = node->children(); const TDECompTreeChildren *list = node->children();
TQString string; TQString string;
TQString w; TQString w;
// loop thru all children // loop thru all children
for ( KCompTreeNode *cur = list->begin(); cur ; cur = cur->next) { for ( TDECompTreeNode *cur = list->begin(); cur ; cur = cur->next) {
string = beginning; string = beginning;
node = cur; node = cur;
if ( !node->isNull() ) 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& beginning,
const TQString& restString, const TQString& restString,
KCompletionMatchesWrapper *matches ) const TDECompletionMatchesWrapper *matches ) const
{ {
if ( restString.isEmpty() ) { if ( restString.isEmpty() ) {
extractStringsFromNode( node, beginning, matches, false /*noweight*/ ); extractStringsFromNode( node, beginning, matches, false /*noweight*/ );
@ -597,7 +597,7 @@ void KCompletion::extractStringsFromNodeCI( const KCompTreeNode *node,
TQChar ch1 = restString.at(0); TQChar ch1 = restString.at(0);
TQString newRest = restString.mid(1); TQString newRest = restString.mid(1);
KCompTreeNode *child1, *child2; TDECompTreeNode *child1, *child2;
child1 = node->find( ch1 ); // the correct match child1 = node->find( ch1 ); // the correct match
if ( child1 ) 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 ) if ( !myBeep )
return; 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 // TQChar( 0x0 ) is used as the delimiter of a string; the last child of each
// inserted string is 0x0. // inserted string is 0x0.
KCompTreeNode::~KCompTreeNode() TDECompTreeNode::~TDECompTreeNode()
{ {
// delete all children // delete all children
KCompTreeNode *cur = myChildren.begin(); TDECompTreeNode *cur = myChildren.begin();
while (cur) { while (cur) {
KCompTreeNode * next = cur->next; TDECompTreeNode * next = cur->next;
delete myChildren.remove(cur); delete myChildren.remove(cur);
cur = next; cur = next;
} }
@ -674,16 +674,16 @@ KCompTreeNode::~KCompTreeNode()
// Adds a child-node "ch" to this node. If such a node is already existant, // 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. // 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 ) { if ( !child ) {
child = new KCompTreeNode( ch ); child = new TDECompTreeNode( ch );
// FIXME, first (slow) sorted insertion implementation // FIXME, first (slow) sorted insertion implementation
if ( sorted ) { if ( sorted ) {
KCompTreeNode * prev = 0; TDECompTreeNode * prev = 0;
KCompTreeNode * cur = myChildren.begin(); TDECompTreeNode * cur = myChildren.begin();
while ( cur ) { while ( cur ) {
if ( ch > *cur ) { if ( ch > *cur ) {
prev = 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 // Iteratively removes a string from the tree. The nicer recursive
// version apparently was a little memory hungry (see #56757) // version apparently was a little memory hungry (see #56757)
void KCompTreeNode::remove( const TQString& str ) void TDECompTreeNode::remove( const TQString& str )
{ {
TQString string = str; TQString string = str;
string += TQChar(0x0); string += TQChar(0x0);
TQPtrVector<KCompTreeNode> deletables( string.length() + 1 ); TQPtrVector<TDECompTreeNode> deletables( string.length() + 1 );
KCompTreeNode *child = 0L; TDECompTreeNode *child = 0L;
KCompTreeNode *parent = this; TDECompTreeNode *parent = this;
deletables.insert( 0, parent ); deletables.insert( 0, parent );
uint i = 0; uint i = 0;
@ -743,7 +743,7 @@ void KCompTreeNode::remove( const TQString& str )
} }
} }
TQStringList KCompletionMatchesWrapper::list() const TQStringList TDECompletionMatchesWrapper::list() const
{ {
if ( sortedList && dirty ) { if ( sortedList && dirty ) {
sortedList->sort(); sortedList->sort();
@ -760,16 +760,16 @@ TQStringList KCompletionMatchesWrapper::list() const
return stringList; return stringList;
} }
KCompletionMatches::KCompletionMatches( bool sort_P ) TDECompletionMatches::TDECompletionMatches( bool sort_P )
: _sorting( sort_P ) : _sorting( sort_P )
{ {
} }
KCompletionMatches::KCompletionMatches( const KCompletionMatchesWrapper& matches ) TDECompletionMatches::TDECompletionMatches( const TDECompletionMatchesWrapper& matches )
: _sorting( matches.sorting()) : _sorting( matches.sorting())
{ {
if( matches.sortedList != 0L ) if( matches.sortedList != 0L )
KCompletionMatchesList::operator=( *matches.sortedList ); TDECompletionMatchesList::operator=( *matches.sortedList );
else { else {
TQStringList l = matches.list(); TQStringList l = matches.list();
for( TQStringList::ConstIterator it = l.begin(); 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 ) if( _sorting && sort_P )
const_cast< KCompletionMatches* >( this )->sort(); const_cast< TDECompletionMatches* >( this )->sort();
TQStringList stringList; TQStringList stringList;
// high weight == sorted last -> reverse the sorting here // high weight == sorted last -> reverse the sorting here
for ( ConstIterator it = begin(); it != end(); ++it ) for ( ConstIterator it = begin(); it != end(); ++it )
@ -794,7 +794,7 @@ TQStringList KCompletionMatches::list( bool sort_P ) const
return stringList; return stringList;
} }
void KCompletionMatches::removeDuplicates() void TDECompletionMatches::removeDuplicates()
{ {
Iterator it1, it2; Iterator it1, it2;
for ( it1 = begin(); it1 != end(); ++it1 ) { 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++; m_count++;
if (!last) { if (!last) {
@ -824,7 +824,7 @@ void KCompTreeNodeList::append(KCompTreeNode *item)
last = item; last = item;
} }
void KCompTreeNodeList::prepend(KCompTreeNode *item) void TDECompTreeNodeList::prepend(TDECompTreeNode *item)
{ {
m_count++; m_count++;
if (!last) { if (!last) {
@ -837,7 +837,7 @@ void KCompTreeNodeList::prepend(KCompTreeNode *item)
first = item; first = item;
} }
void KCompTreeNodeList::insert(KCompTreeNode *after, KCompTreeNode *item) void TDECompTreeNodeList::insert(TDECompTreeNode *after, TDECompTreeNode *item)
{ {
if (!after) { if (!after) {
append(item); append(item);
@ -853,11 +853,11 @@ void KCompTreeNodeList::insert(KCompTreeNode *after, KCompTreeNode *item)
last = item; last = item;
} }
KCompTreeNode *KCompTreeNodeList::remove(KCompTreeNode *item) TDECompTreeNode *TDECompTreeNodeList::remove(TDECompTreeNode *item)
{ {
if (!first || !item) if (!first || !item)
return 0; return 0;
KCompTreeNode *cur = 0; TDECompTreeNode *cur = 0;
if (item == first) if (item == first)
first = first->next; first = first->next;
@ -874,19 +874,19 @@ KCompTreeNode *KCompTreeNodeList::remove(KCompTreeNode *item)
return 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; while (index-- && cur) cur = cur->next;
return cur; 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 );*/ } { /*BASE::virtual_hook( id, data );*/ }
void KCompletionBase::virtual_hook( int, void* ) void TDECompletionBase::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ } { /*BASE::virtual_hook( id, data );*/ }
#include "kcompletion.moc" #include "kcompletion.moc"

@ -32,11 +32,11 @@
#include <ksortablevaluelist.h> #include <ksortablevaluelist.h>
#include <tdeshortcut.h> #include <tdeshortcut.h>
class KCompTreeNode; class TDECompTreeNode;
class KCompletionPrivate; class TDECompletionPrivate;
class KCompletionBasePrivate; class TDECompletionBasePrivate;
class KCompletionMatchesWrapper; class TDECompletionMatchesWrapper;
class KCompletionMatches; class TDECompletionMatches;
class TQPopupMenu; class TQPopupMenu;
/** /**
@ -49,13 +49,13 @@ class TQPopupMenu;
* The user should be able to complete email-addresses, telephone-numbers, * The user should be able to complete email-addresses, telephone-numbers,
* commands, SQL queries, ... * commands, SQL queries, ...
* Every time your program knows what the user can type into an edit-field, you * 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. * 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(). * and whenever completion should be invoked, you call makeCompletion().
* KLineEdit and (an editable) KComboBox even do this automatically for you. * 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 * all matching strings (when the result is ambiguous) via the method
* allMatches(). * allMatches().
* *
@ -75,11 +75,11 @@ class TQPopupMenu;
* subtle difference is, that it isn't invoked automatically while the user * 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 * 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, * 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 * (shell completion) or whole matches (auto/manual completion), therefore
* TDEGlobalSettings::CompletionMan and * TDEGlobalSettings::CompletionMan and
* TDEGlobalSettings::CompletionAuto have the exact same effect in * TDEGlobalSettings::CompletionAuto have the exact same effect in
* KCompletion. * TDECompletion.
* *
* @li shell completion works like how shells complete filenames: * @li shell completion works like how shells complete filenames:
* when multiple matches are available, the longest possible string of all * 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 * Iterating over all matching items (complete, not partial) is possible
* via nextMatch() and previousMatch(). * 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(). * that for you, according to the setting setCompletionMode().
* The default setting is globally configured by the user and read * The default setting is globally configured by the user and read
* from TDEGlobalSettings::completionMode(). * from TDEGlobalSettings::completionMode().
* *
* A short example: * A short example:
* \code * \code
* KCompletion completion; * TDECompletion completion;
* completion.setOrder( KCompletion::Sorted ); * completion.setOrder( TDECompletion::Sorted );
* completion.addItem( "pfeiffer@kde.org" ); * completion.addItem( "pfeiffer@kde.org" );
* completion.addItem( "coolo@kde.org" ); * completion.addItem( "coolo@kde.org" );
* completion.addItem( "carpdjih@sp.zrz.tu-berlin.de" ); * 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 * You can dynamically update the completable items by removing and adding them
* whenever you want. * 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 * 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. * 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. * (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 * 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. * not necessary.
* *
* *
* @author Carsten Pfeiffer <pfeiffer@kde.org> * @author Carsten Pfeiffer <pfeiffer@kde.org>
*/ */
class TDECORE_EXPORT KCompletion : public TQObject class TDECORE_EXPORT TDECompletion : public TQObject
{ {
TQ_ENUMS( CompOrder ) TQ_ENUMS( CompOrder )
TQ_PROPERTY( CompOrder order READ order WRITE setOrder ) TQ_PROPERTY( CompOrder order READ order WRITE setOrder )
@ -139,7 +139,7 @@ class TDECORE_EXPORT KCompletion : public TQObject
public: public:
/** /**
* Constants that represent the order in which KCompletion performs * Constants that represent the order in which TDECompletion performs
* completion-lookups. * completion-lookups.
*/ */
enum CompOrder { Sorted, ///< Use alphabetically sorted order enum CompOrder { Sorted, ///< Use alphabetically sorted order
@ -150,14 +150,14 @@ public:
/** /**
* Constructor, nothing special here :) * Constructor, nothing special here :)
*/ */
KCompletion(); TDECompletion();
// FIXME: copy constructor, assignment operator... // FIXME: copy constructor, assignment operator...
/** /**
* Destructor, nothing special here, either. * Destructor, nothing special here, either.
*/ */
virtual ~KCompletion(); virtual ~TDECompletion();
/** /**
* Attempts to find an item in the list of available completions, * Attempts to find an item in the list of available completions,
@ -224,8 +224,8 @@ public:
virtual const TQString& lastMatch() const { return myLastMatch; } virtual const TQString& lastMatch() const { return myLastMatch; }
/** /**
* Returns a list of all items inserted into KCompletion. This is useful * Returns a list of all items inserted into TDECompletion. This is useful
* if you need to save the state of a KCompletion object and restore it * if you need to save the state of a TDECompletion object and restore it
* later. * later.
* *
* Important note: when order() == Weighted, then every item in the * 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 * This is necessary so that you can save the items along with its
* weighting on disk and load them back with setItems(), restoring 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 * weight as well. If you really don't want the appended weightings, call
* setOrder( KCompletion::Insertion ) * setOrder( TDECompletion::Insertion )
* before calling items(). * before calling items().
* *
* @return a list of all 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 in the order of insertion
* @li sorted alphabetically * @li sorted alphabetically
* @li weighted * @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 * 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 * bar, where the user enters URLs. The more often a URL is entered, the
* higher priority it gets. * higher priority it gets.
@ -300,7 +300,7 @@ public:
CompOrder order() const { return myOrder; } 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". * E.g. makeCompletion( "CA" ); might return "carp\@cs.tu-berlin.de".
* Default is false (case sensitive). * Default is false (case sensitive).
* @param ignoreCase true to ignore the case * @param ignoreCase true to ignore the case
@ -309,7 +309,7 @@ public:
virtual void setIgnoreCase( bool ignoreCase ); 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). * Default is false (case sensitive).
* @return true if the case will be ignored * @return true if the case will be ignored
* @see setIgnoreCase * @see setIgnoreCase
@ -334,7 +334,7 @@ public:
/** /**
* Returns a list of all items matching the last completed string. * Returns a list of all items matching the last completed string.
* Might take some time, when you have LOTS of items. * 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 * keeps the weight of the matches, allowing
* you to modify some matches or merge them with matches * you to modify some matches or merge them with matches
* from another call to allWeightedMatches(), and sort the matches * from another call to allWeightedMatches(), and sort the matches
@ -343,14 +343,14 @@ public:
* @return a list of all completion matches * @return a list of all completion matches
* @see substringCompletion * @see substringCompletion
*/ */
KCompletionMatches allWeightedMatches(); TDECompletionMatches allWeightedMatches();
/** /**
* Returns a list of all items matching @p string. * Returns a list of all items matching @p string.
* @param string the string to match * @param string the string to match
* @return a list of all matches * @return a list of all matches
*/ */
KCompletionMatches allWeightedMatches( const TQString& string ); TDECompletionMatches allWeightedMatches( const TQString& string );
/** /**
* Enables/disables playing a sound when * Enables/disables playing a sound when
@ -368,7 +368,7 @@ public:
virtual void setEnableSounds( bool enable ) { myBeep = enable; } 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. * Default is enabled.
* @return true if sounds are enabled * @return true if sounds are enabled
* @see enableSounds * @see enableSounds
@ -444,7 +444,7 @@ public slots:
* where number is an unsigned integer, specifying the weighting. * where number is an unsigned integer, specifying the weighting.
* *
* If you don't like this, call * If you don't like this, call
* setOrder( KCompletion::Insertion ) * setOrder( TDECompletion::Insertion )
* before calling setItems(). * before calling setItems().
* *
* @param list the list of items that are available for completion * @param list the list of items that are available for completion
@ -518,7 +518,7 @@ protected:
* string that will be emitted. * string that will be emitted.
* This is necessary e.g. in KURLCompletion(), where files with spaces * This is necessary e.g. in KURLCompletion(), where files with spaces
* in their names are shown escaped ("filename\ with\ spaces"), but stored * in their names are shown escaped ("filename\ with\ spaces"), but stored
* unescaped inside KCompletion. * unescaped inside TDECompletion.
* Never delete that pointer! * Never delete that pointer!
* *
* Default implementation does nothing. * Default implementation does nothing.
@ -549,23 +549,23 @@ protected:
* @param matches the matches to process * @param matches the matches to process
* @see postProcessMatch * @see postProcessMatch
*/ */
virtual void postProcessMatches( KCompletionMatches * matches ) const {Q_UNUSED(matches)} virtual void postProcessMatches( TDECompletionMatches * matches ) const {Q_UNUSED(matches)}
private: private:
void addWeightedItem( const TQString& ); void addWeightedItem( const TQString& );
TQString findCompletion( const TQString& string ); TQString findCompletion( const TQString& string );
void findAllCompletions( const TQString&, void findAllCompletions( const TQString&,
KCompletionMatchesWrapper *matches, TDECompletionMatchesWrapper *matches,
bool& hasMultipleMatches ) const; bool& hasMultipleMatches ) const;
void extractStringsFromNode( const KCompTreeNode *, void extractStringsFromNode( const TDECompTreeNode *,
const TQString& beginning, const TQString& beginning,
KCompletionMatchesWrapper *matches, TDECompletionMatchesWrapper *matches,
bool addWeight = false ) const; bool addWeight = false ) const;
void extractStringsFromNodeCI( const KCompTreeNode *, void extractStringsFromNodeCI( const TDECompTreeNode *,
const TQString& beginning, const TQString& beginning,
const TQString& restString, const TQString& restString,
KCompletionMatchesWrapper *matches) const; TDECompletionMatchesWrapper *matches) const;
enum BeepMode { NoMatch, PartialMatch, Rotation }; enum BeepMode { NoMatch, PartialMatch, Rotation };
void doBeep( BeepMode ) const; void doBeep( BeepMode ) const;
@ -576,7 +576,7 @@ private:
TQString myLastString; TQString myLastString;
TQString myLastMatch; TQString myLastMatch;
TQString myCurrentMatch; TQString myCurrentMatch;
KCompTreeNode * myTreeRoot; TDECompTreeNode * myTreeRoot;
TQStringList myRotations; TQStringList myRotations;
bool myBeep; bool myBeep;
bool myIgnoreCase; bool myIgnoreCase;
@ -587,15 +587,15 @@ private:
protected: protected:
virtual void virtual_hook( int id, void* data ); virtual void virtual_hook( int id, void* data );
private: private:
KCompletionPrivate *d; TDECompletionPrivate *d;
}; };
// some more helper stuff // some more helper stuff
typedef KSortableValueList<TQString> KCompletionMatchesList; typedef KSortableValueList<TQString> TDECompletionMatchesList;
class KCompletionMatchesPrivate; 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 * It also keeps the weight of the matches, allowing
* you to modify some matches or merge them with matches * you to modify some matches or merge them with matches
* from another call to allWeightedMatches(), and sort the 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): * Example (a simplified example of what Konqueror's completion does):
* \code * \code
* KCompletionMatches matches = completion->allWeightedMatches( location ); * TDECompletionMatches matches = completion->allWeightedMatches( location );
* if( !location.startsWith( "www." )) * if( !location.startsWith( "www." ))
matches += completion->allWeightedmatches( "www." + location" ); matches += completion->allWeightedmatches( "www." + location" );
* matches.removeDuplicates(); * matches.removeDuplicates();
* TQStringList list = matches.list(); * TQStringList list = matches.list();
* \endcode * \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: public:
KCompletionMatches( bool sort ); TDECompletionMatches( bool sort );
/** /**
* @internal * @internal
*/ */
KCompletionMatches( const KCompletionMatchesWrapper& matches ); TDECompletionMatches( const TDECompletionMatchesWrapper& matches );
~KCompletionMatches(); ~TDECompletionMatches();
/** /**
* Removes duplicate matches. Needed only when you merged several matches * Removes duplicate matches. Needed only when you merged several matches
* results and there's a possibility of duplicates. * results and there's a possibility of duplicates.
@ -643,7 +643,7 @@ public:
} }
private: private:
bool _sorting; bool _sorting;
KCompletionMatchesPrivate* d; TDECompletionMatchesPrivate* d;
}; };
/** /**
@ -660,7 +660,7 @@ private:
* @short An abstract class for adding text completion support to widgets. * @short An abstract class for adding text completion support to widgets.
* @author Dawit Alemayehu <adawit@kde.org> * @author Dawit Alemayehu <adawit@kde.org>
*/ */
class TDECORE_EXPORT KCompletionBase class TDECORE_EXPORT TDECompletionBase
{ {
public: public:
/** /**
@ -694,12 +694,12 @@ public:
/** /**
* Default constructor. * Default constructor.
*/ */
KCompletionBase(); TDECompletionBase();
/** /**
* Destructor. * Destructor.
*/ */
virtual ~KCompletionBase(); virtual ~TDECompletionBase();
/** /**
* Returns a pointer to the current completion object. * Returns a pointer to the current completion object.
@ -716,7 +716,7 @@ public:
* @param hsig if true, handles completion signals internally. * @param hsig if true, handles completion signals internally.
* @return a pointer the completion object. * @return a pointer the completion object.
*/ */
KCompletion* completionObject( bool hsig = true ); TDECompletion* completionObject( bool hsig = true );
/** /**
* Sets up the completion object to be used. * 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 * after calling this method. Be sure to set the bool argument to false, if
* you want to handle the completion signals yourself. * 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. * @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 * Enables this object to handle completion and rotation
@ -924,7 +924,7 @@ public:
* implementations to set completed text appropriately. It * implementations to set completed text appropriately. It
* is mostly relevant when the completion mode is set to * is mostly relevant when the completion mode is set to
* CompletionAuto and CompletionManual modes. See * CompletionAuto and CompletionManual modes. See
* KCompletionBase::setCompletedText. * TDECompletionBase::setCompletedText.
* Does nothing in CompletionPopup mode, as all available * Does nothing in CompletionPopup mode, as all available
* matches will be shown in the popup. * matches will be shown in the popup.
* *
@ -943,14 +943,14 @@ public:
* Returns a pointer to the completion object. * Returns a pointer to the completion object.
* *
* This method is only different from completionObject() * 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 * the internal pointer is @p NULL. Use this method to get the
* pointer to a completion object when inheriting so that you * pointer to a completion object when inheriting so that you
* won't inadvertently create it!! * won't inadvertently create it!!
* *
* @return the completion object or NULL if one does not exist. * @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: protected:
/** /**
@ -968,14 +968,14 @@ protected:
* set, all function calls will be forwarded to the delegation object. * set, all function calls will be forwarded to the delegation object.
* @param delegate the delegation object, or 0 to remove it * @param delegate the delegation object, or 0 to remove it
*/ */
void setDelegate( KCompletionBase *delegate ); void setDelegate( TDECompletionBase *delegate );
/** /**
* Returns the delegation object. * Returns the delegation object.
* @return the delegation object, or 0 if there is none * @return the delegation object, or 0 if there is none
* @see setDelegate() * @see setDelegate()
*/ */
KCompletionBase *delegate() const { return m_delegate; } TDECompletionBase *delegate() const { return m_delegate; }
private: private:
// This method simply sets the autodelete boolean for // This method simply sets the autodelete boolean for
@ -994,17 +994,17 @@ private:
// Stores the completion mode locally. // Stores the completion mode locally.
TDEGlobalSettings::Completion m_iCompletionMode; TDEGlobalSettings::Completion m_iCompletionMode;
// Pointer to Completion object. // Pointer to Completion object.
TQGuardedPtr<KCompletion> m_pCompObj; TQGuardedPtr<TDECompletion> m_pCompObj;
// Keybindings // Keybindings
KeyBindingMap m_keyMap; KeyBindingMap m_keyMap;
// we may act as a proxy to another KCompletionBase object // we may act as a proxy to another TDECompletionBase object
KCompletionBase *m_delegate; TDECompletionBase *m_delegate;
// BCI // BCI
protected: protected:
virtual void virtual_hook( int id, void* data ); virtual void virtual_hook( int id, void* data );
private: private:
KCompletionBasePrivate *d; TDECompletionBasePrivate *d;
}; };
#endif // KCOMPLETION_H #endif // KCOMPLETION_H

@ -24,36 +24,36 @@
#include <tqstring.h> #include <tqstring.h>
#include <ksortablevaluelist.h> #include <ksortablevaluelist.h>
class KCompTreeNode; class TDECompTreeNode;
#include <kallocator.h> #include <kallocator.h>
/** /**
* @internal * @internal
*/ */
class TDECORE_EXPORT KCompTreeNodeList class TDECORE_EXPORT TDECompTreeNodeList
{ {
public: public:
KCompTreeNodeList() : first(0), last(0), m_count(0) {} TDECompTreeNodeList() : first(0), last(0), m_count(0) {}
KCompTreeNode *begin() const { return first; } TDECompTreeNode *begin() const { return first; }
KCompTreeNode *end() const { return last; } TDECompTreeNode *end() const { return last; }
KCompTreeNode *at(uint index) const; TDECompTreeNode *at(uint index) const;
void append(KCompTreeNode *item); void append(TDECompTreeNode *item);
void prepend(KCompTreeNode *item); void prepend(TDECompTreeNode *item);
void insert(KCompTreeNode *after, KCompTreeNode *item); void insert(TDECompTreeNode *after, TDECompTreeNode *item);
KCompTreeNode *remove(KCompTreeNode *item); TDECompTreeNode *remove(TDECompTreeNode *item);
uint count() const { return m_count; } uint count() const { return m_count; }
private: private:
KCompTreeNode *first, *last; TDECompTreeNode *first, *last;
uint m_count; 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", * The tree looks like this (containing the items "kde", "kde-ui",
* "kde-core" and "pfeiffer". Every item is delimited with TQChar( 0x0 ) * "kde-core" and "pfeiffer". Every item is delimited with TQChar( 0x0 )
@ -81,14 +81,14 @@ typedef KCompTreeNodeList KCompTreeChildren;
* @author Carsten Pfeiffer <pfeiffer@kde.org> * @author Carsten Pfeiffer <pfeiffer@kde.org>
* @internal * @internal
*/ */
class TDECORE_EXPORT KCompTreeNode : public TQChar class TDECORE_EXPORT TDECompTreeNode : public TQChar
{ {
public: public:
KCompTreeNode() : TQChar(), myWeight(0) {} TDECompTreeNode() : TQChar(), myWeight(0) {}
KCompTreeNode( const TQChar& ch, uint weight = 0 ) TDECompTreeNode( const TQChar& ch, uint weight = 0 )
: TQChar( ch ), : TQChar( ch ),
myWeight( weight ) {} myWeight( weight ) {}
~KCompTreeNode(); ~TDECompTreeNode();
void * operator new( size_t s ) { void * operator new( size_t s ) {
return alloc.allocate( s ); return alloc.allocate( s );
@ -99,12 +99,12 @@ public:
// Returns a child of this node matching ch, if available. // Returns a child of this node matching ch, if available.
// Otherwise, returns 0L // Otherwise, returns 0L
inline KCompTreeNode * find( const TQChar& ch ) const { inline TDECompTreeNode * find( const TQChar& ch ) const {
KCompTreeNode * cur = myChildren.begin(); TDECompTreeNode * cur = myChildren.begin();
while (cur && (*cur != ch)) cur = cur->next; while (cur && (*cur != ch)) cur = cur->next;
return cur; return cur;
} }
KCompTreeNode * insert( const TQChar&, bool sorted ); TDECompTreeNode * insert( const TQChar&, bool sorted );
void remove( const TQString& ); void remove( const TQString& );
inline int childrenCount() const { return myChildren.count(); } inline int childrenCount() const { return myChildren.count(); }
@ -115,51 +115,51 @@ public:
inline void decline() { myWeight--; } inline void decline() { myWeight--; }
inline uint weight() const { return myWeight; } inline uint weight() const { return myWeight; }
inline const KCompTreeChildren * children() const { inline const TDECompTreeChildren * children() const {
return &myChildren; return &myChildren;
} }
inline const KCompTreeNode * childAt(int index) const { inline const TDECompTreeNode * childAt(int index) const {
return myChildren.at(index); return myChildren.at(index);
} }
inline const KCompTreeNode * firstChild() const { inline const TDECompTreeNode * firstChild() const {
return myChildren.begin(); return myChildren.begin();
} }
inline const KCompTreeNode * lastChild() const { inline const TDECompTreeNode * lastChild() const {
return myChildren.end(); 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 need to use TQValueList<>. And to make it even more fast we don't
use an accessor, but just a public member. */ use an accessor, but just a public member. */
KCompTreeNode *next; TDECompTreeNode *next;
private: private:
uint myWeight; uint myWeight;
KCompTreeNodeList myChildren; TDECompTreeNodeList myChildren;
static TDEZoneAllocator alloc; static TDEZoneAllocator alloc;
}; };
// some more helper stuff // some more helper stuff
typedef KSortableValueList<TQString> KCompletionMatchesList; typedef KSortableValueList<TQString> TDECompletionMatchesList;
/** /**
* @internal * @internal
*/ */
class TDECORE_EXPORT KCompletionMatchesWrapper class TDECORE_EXPORT TDECompletionMatchesWrapper
{ {
public: public:
KCompletionMatchesWrapper( bool sort = false ) TDECompletionMatchesWrapper( bool sort = false )
: sortedList( sort ? new KCompletionMatchesList : 0L ), : sortedList( sort ? new TDECompletionMatchesList : 0L ),
dirty( false ) dirty( false )
{} {}
~KCompletionMatchesWrapper() { ~TDECompletionMatchesWrapper() {
delete sortedList; delete sortedList;
} }
void setSorting( bool sort ) { void setSorting( bool sort ) {
if ( sort && !sortedList ) if ( sort && !sortedList )
sortedList = new KCompletionMatchesList; sortedList = new TDECompletionMatchesList;
else if ( !sort ) { else if ( !sort ) {
delete sortedList; delete sortedList;
sortedList = 0L; sortedList = 0L;
@ -208,7 +208,7 @@ public:
TQStringList list() const; TQStringList list() const;
mutable TQStringList stringList; mutable TQStringList stringList;
KCompletionMatchesList *sortedList; TDECompletionMatchesList *sortedList;
mutable bool dirty; mutable bool dirty;
}; };

@ -22,7 +22,7 @@
#include <kcompletion.h> #include <kcompletion.h>
KCompletionBase::KCompletionBase() TDECompletionBase::TDECompletionBase()
{ {
m_delegate = 0L; m_delegate = 0L;
// Assign the default completion type to use. // Assign the default completion type to use.
@ -38,7 +38,7 @@ KCompletionBase::KCompletionBase()
setup( false, false, false ); setup( false, false, false );
} }
KCompletionBase::~KCompletionBase() TDECompletionBase::~TDECompletionBase()
{ {
if( m_bAutoDelCompObj && m_pCompObj ) if( m_bAutoDelCompObj && m_pCompObj )
{ {
@ -46,7 +46,7 @@ KCompletionBase::~KCompletionBase()
} }
} }
void KCompletionBase::setDelegate( KCompletionBase *delegate ) void TDECompletionBase::setDelegate( TDECompletionBase *delegate )
{ {
m_delegate = 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 ) if ( m_delegate )
return m_delegate->completionObject( hsig ); return m_delegate->completionObject( hsig );
if ( !m_pCompObj ) if ( !m_pCompObj )
{ {
setCompletionObject( new KCompletion(), hsig ); setCompletionObject( new TDECompletion(), hsig );
m_bAutoDelCompObj = true; m_bAutoDelCompObj = true;
} }
return m_pCompObj; return m_pCompObj;
} }
void KCompletionBase::setCompletionObject( KCompletion* compObj, bool hsig ) void TDECompletionBase::setCompletionObject( TDECompletion* compObj, bool hsig )
{ {
if ( m_delegate ) { if ( m_delegate ) {
m_delegate->setCompletionObject( compObj, hsig ); 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) // BC: Inline this function and possibly rename it to setHandleEvents??? (DA)
void KCompletionBase::setHandleSignals( bool handle ) void TDECompletionBase::setHandleSignals( bool handle )
{ {
if ( m_delegate ) if ( m_delegate )
m_delegate->setHandleSignals( handle ); m_delegate->setHandleSignals( handle );
@ -98,7 +98,7 @@ void KCompletionBase::setHandleSignals( bool handle )
m_bHandleSignals = handle; m_bHandleSignals = handle;
} }
void KCompletionBase::setCompletionMode( TDEGlobalSettings::Completion mode ) void TDECompletionBase::setCompletionMode( TDEGlobalSettings::Completion mode )
{ {
if ( m_delegate ) { if ( m_delegate ) {
m_delegate->setCompletionMode( mode ); m_delegate->setCompletionMode( mode );
@ -106,13 +106,13 @@ void KCompletionBase::setCompletionMode( TDEGlobalSettings::Completion mode )
} }
m_iCompletionMode = 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. // are performing completions.
if( m_pCompObj && m_iCompletionMode != TDEGlobalSettings::CompletionNone ) if( m_pCompObj && m_iCompletionMode != TDEGlobalSettings::CompletionNone )
m_pCompObj->setCompletionMode( m_iCompletionMode ); m_pCompObj->setCompletionMode( m_iCompletionMode );
} }
bool KCompletionBase::setKeyBinding( KeyBindingType item, const TDEShortcut& cut ) bool TDECompletionBase::setKeyBinding( KeyBindingType item, const TDEShortcut& cut )
{ {
if ( m_delegate ) if ( m_delegate )
return m_delegate->setKeyBinding( item, cut ); return m_delegate->setKeyBinding( item, cut );
@ -127,7 +127,7 @@ bool KCompletionBase::setKeyBinding( KeyBindingType item, const TDEShortcut& cut
return true; return true;
} }
void KCompletionBase::useGlobalKeyBindings() void TDECompletionBase::useGlobalKeyBindings()
{ {
if ( m_delegate ) { if ( m_delegate ) {
m_delegate->useGlobalKeyBindings(); m_delegate->useGlobalKeyBindings();
@ -141,7 +141,7 @@ void KCompletionBase::useGlobalKeyBindings()
m_keyMap.insert( SubstringCompletion, 0 ); 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 ) { if ( m_delegate ) {
m_delegate->setup( autodel, hsig, esig ); m_delegate->setup( autodel, hsig, esig );

@ -171,7 +171,7 @@ class TDECORE_EXPORT TDEGlobalSettings
static bool showContextMenusOnPress (); 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"> * See <a href="http://developer.kde.org/documentation/standards/kde/style/keys/completion.html">
* the styleguide</a>. * the styleguide</a>.
**/ **/

@ -505,7 +505,7 @@ void RenderLineEdit::highLightWord( unsigned int length, unsigned int pos )
void RenderLineEdit::slotReturnPressed() void RenderLineEdit::slotReturnPressed()
{ {
// don't submit the form when return was pressed in a completion-popup // 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 ) { if ( box && box->isVisible() && box->currentItem() != -1 ) {
box->hide(); box->hide();

@ -319,27 +319,27 @@ class TDEIO_EXPORT KDirOperator : public TQWidget
int numFiles() const; 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. * directories of the current directory/URL.
* You can use it to insert it into a KLineEdit or KComboBox * You can use it to insert it into a KLineEdit or KComboBox
* Note: it will only contain files, after prepareCompletionObjects() * Note: it will only contain files, after prepareCompletionObjects()
* has been called. It will be implicitly called from makeCompletion() * has been called. It will be implicitly called from makeCompletion()
* or makeDirCompletion() * or makeDirCompletion()
*/ */
KCompletion * completionObject() const { TDECompletion * completionObject() const {
return const_cast<KCompletion *>( &myCompletion ); return const_cast<TDECompletion *>( &myCompletion );
} }
/** /**
* @returns a KCompletion object, containing only all directories of the * @returns a TDECompletion object, containing only all directories of the
* current directory/URL. * current directory/URL.
* You can use it to insert it into a KLineEdit or KComboBox * You can use it to insert it into a KLineEdit or KComboBox
* Note: it will only contain directories, after * Note: it will only contain directories, after
* prepareCompletionObjects() has been called. It will be implicitly * prepareCompletionObjects() has been called. It will be implicitly
* called from makeCompletion() or makeDirCompletion() * called from makeCompletion() or makeDirCompletion()
*/ */
KCompletion *dirCompletionObject() const { TDECompletion *dirCompletionObject() const {
return const_cast<KCompletion *>( &myDirCompletion ); return const_cast<TDECompletion *>( &myDirCompletion );
} }
/** /**
@ -838,8 +838,8 @@ private:
KDirLister *dir; KDirLister *dir;
KURL currUrl; KURL currUrl;
KCompletion myCompletion; TDECompletion myCompletion;
KCompletion myDirCompletion; TDECompletion myDirCompletion;
bool myCompleteListDirty; bool myCompleteListDirty;
TQDir::SortSpec mySorting; TQDir::SortSpec mySorting;

@ -1749,8 +1749,8 @@ KFilePermissionsPropsPlugin::KFilePermissionsPropsPlugin( KPropertiesDialog *_pr
if (IamRoot && isLocal) if (IamRoot && isLocal)
{ {
usrEdit = new KLineEdit( gb ); usrEdit = new KLineEdit( gb );
KCompletion *kcom = usrEdit->completionObject(); TDECompletion *kcom = usrEdit->completionObject();
kcom->setOrder(KCompletion::Sorted); kcom->setOrder(TDECompletion::Sorted);
setpwent(); setpwent();
for (i=0; ((user = getpwent()) != 0L) && (i < maxEntries); i++) for (i=0; ((user = getpwent()) != 0L) && (i < maxEntries); i++)
kcom->addItem(TQString::fromLatin1(user->pw_name)); kcom->addItem(TQString::fromLatin1(user->pw_name));
@ -1829,7 +1829,7 @@ KFilePermissionsPropsPlugin::KFilePermissionsPropsPlugin( KPropertiesDialog *_pr
if (IamRoot && isLocal) if (IamRoot && isLocal)
{ {
grpEdit = new KLineEdit(gb); grpEdit = new KLineEdit(gb);
KCompletion *kcom = new KCompletion; TDECompletion *kcom = new TDECompletion;
kcom->setItems(groupList); kcom->setItems(groupList);
grpEdit->setCompletionObject(kcom, true); grpEdit->setCompletionObject(kcom, true);
grpEdit->setAutoDeleteCompletionObject( true ); grpEdit->setAutoDeleteCompletionObject( true );
@ -3487,8 +3487,8 @@ void KDesktopPropsPlugin::slotAdvanced()
w->dcopCombo->setCurrentItem(0); w->dcopCombo->setCurrentItem(0);
// Provide username completion up to 1000 users. // Provide username completion up to 1000 users.
KCompletion *kcom = new KCompletion; TDECompletion *kcom = new TDECompletion;
kcom->setOrder(KCompletion::Sorted); kcom->setOrder(TDECompletion::Sorted);
struct passwd *pw; struct passwd *pw;
int i, maxEntries = 1000; int i, maxEntries = 1000;
setpwent(); setpwent();
@ -3761,8 +3761,8 @@ KExecPropsPlugin::KExecPropsPlugin( KPropertiesDialog *_props )
enableSuidEdit(); enableSuidEdit();
// Provide username completion up to 1000 users. // Provide username completion up to 1000 users.
KCompletion *kcom = new KCompletion; TDECompletion *kcom = new TDECompletion;
kcom->setOrder(KCompletion::Sorted); kcom->setOrder(TDECompletion::Sorted);
struct passwd *pw; struct passwd *pw;
int i, maxEntries = 1000; int i, maxEntries = 1000;
setpwent(); setpwent();

@ -124,7 +124,7 @@ public:
receiver, TQT_SIGNAL( returnPressed( const TQString& ) )); receiver, TQT_SIGNAL( returnPressed( const TQString& ) ));
} }
void setCompletionObject( KCompletion *comp ) { void setCompletionObject( TDECompletion *comp ) {
if ( combo ) if ( combo )
combo->setCompletionObject( comp ); combo->setCompletionObject( comp );
else else

@ -77,7 +77,7 @@ TQString KShellCompletion::makeCompletion(const TQString &text)
/* /*
* postProcessMatch, postProcessMatches * 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 add the part of the text that was not completed
* Add quotes when needed * 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 ); KURLCompletion::postProcessMatches( matches );
for ( KCompletionMatches::Iterator it = matches->begin(); for ( TDECompletionMatches::Iterator it = matches->begin();
it != matches->end(); it++ ) it != matches->end(); it++ )
{ {
if ( !(*it).value().isNull() ) { if ( !(*it).value().isNull() ) {

@ -56,10 +56,10 @@ public:
TQString makeCompletion(const TQString &text); TQString makeCompletion(const TQString &text);
protected: protected:
// Called by KCompletion // Called by TDECompletion
void postProcessMatch( TQString *match ) const; void postProcessMatch( TQString *match ) const;
void postProcessMatches( TQStringList *matches ) const; void postProcessMatches( TQStringList *matches ) const;
void postProcessMatches( KCompletionMatches *matches ) const; void postProcessMatches( TDECompletionMatches *matches ) const;
private: private:
// Find the part of text that should be completed // Find the part of text that should be completed

@ -462,7 +462,7 @@ public:
TDEIO::ListJob *list_job; // kio job to list directories TDEIO::ListJob *list_job; // kio job to list directories
TQString prepend; // text to prepend to listed items 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 // Filters for files read with kio
bool list_urls_only_exe; // true = only list executables bool list_urls_only_exe; // true = only list executables
@ -486,13 +486,13 @@ KURLCompletionPrivate::~KURLCompletionPrivate()
// KURLCompletion // KURLCompletion
// //
KURLCompletion::KURLCompletion() : KCompletion() KURLCompletion::KURLCompletion() : TDECompletion()
{ {
init(); init();
} }
KURLCompletion::KURLCompletion( Mode mode ) : KCompletion() KURLCompletion::KURLCompletion( Mode mode ) : TDECompletion()
{ {
init(); init();
setMode ( mode ); setMode ( mode );
@ -653,15 +653,15 @@ TQString KURLCompletion::makeCompletion(const TQString &text)
/* /*
* finished * finished
* *
* Go on and call KCompletion. * Go on and call TDECompletion.
* Called when all matches have been added * Called when all matches have been added
*/ */
TQString KURLCompletion::finished() TQString KURLCompletion::finished()
{ {
if ( d->last_compl_type == CTInfo ) if ( d->last_compl_type == CTInfo )
return KCompletion::makeCompletion( d->compl_text.lower() ); return TDECompletion::makeCompletion( d->compl_text.lower() );
else 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 * addMatches
* *
* Called to add matches to KCompletion * Called to add matches to TDECompletion
*/ */
void KURLCompletion::addMatches( const TQStringList &matches ) void KURLCompletion::addMatches( const TQStringList &matches )
{ {
@ -1311,7 +1311,7 @@ void KURLCompletion::slotIOFinished( TDEIO::Job * job )
d->list_job = 0L; d->list_job = 0L;
finished(); // will call KCompletion::makeCompletion() finished(); // will call TDECompletion::makeCompletion()
} }
else { else {
@ -1345,7 +1345,7 @@ void KURLCompletion::slotIOFinished( TDEIO::Job * job )
/* /*
* postProcessMatch, postProcessMatches * 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 * Append '/' to directories for file completion. This is
* done here to avoid stat()'ing a lot of files * 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 ) { if ( !matches->isEmpty() && d->last_compl_type == CTFile ) {
KCompletionMatches::Iterator it = matches->begin(); TDECompletionMatches::Iterator it = matches->begin();
for (; it != matches->end(); ++it ) { for (; it != matches->end(); ++it ) {
adjustMatch( (*it).value() ); adjustMatch( (*it).value() );
} }
@ -1598,7 +1598,7 @@ static TQString unescape(const TQString &text)
} }
void KURLCompletion::virtual_hook( int id, void* data ) void KURLCompletion::virtual_hook( int id, void* data )
{ KCompletion::virtual_hook( id, data ); } { TDECompletion::virtual_hook( id, data ); }
#include "kurlcompletion.moc" #include "kurlcompletion.moc"

@ -38,7 +38,7 @@ class KURLCompletionPrivate;
* @short Completion of a single URL * @short Completion of a single URL
* @author David Smith <dsmith@algonet.se> * @author David Smith <dsmith@algonet.se>
*/ */
class TDEIO_EXPORT KURLCompletion : public KCompletion class TDEIO_EXPORT KURLCompletion : public TDECompletion
{ {
Q_OBJECT Q_OBJECT
@ -168,10 +168,10 @@ public:
class MyURL; class MyURL;
protected: protected:
// Called by KCompletion, adds '/' to directories // Called by TDECompletion, adds '/' to directories
void postProcessMatch( TQString *match ) const; void postProcessMatch( TQString *match ) const;
void postProcessMatches( TQStringList *matches ) const; void postProcessMatches( TQStringList *matches ) const;
void postProcessMatches( KCompletionMatches* matches ) const; void postProcessMatches( TDECompletionMatches* matches ) const;
virtual void customEvent( TQCustomEvent *e ); virtual void customEvent( TQCustomEvent *e );

@ -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 ) if ( d->klineEdit )
d->klineEdit->rotateText( type ); d->klineEdit->rotateText( type );
@ -226,7 +226,7 @@ void KComboBox::setCompletedItems( const TQStringList& items )
d->klineEdit->setCompletedItems( items ); d->klineEdit->setCompletedItems( items );
} }
KCompletionBox * KComboBox::completionBox( bool create ) TDECompletionBox * KComboBox::completionBox( bool create )
{ {
if ( d->klineEdit ) if ( d->klineEdit )
return d->klineEdit->completionBox( create ); return d->klineEdit->completionBox( create );
@ -271,7 +271,7 @@ void KComboBox::setLineEdit( TQLineEdit *edit )
if ( d->klineEdit ) if ( d->klineEdit )
{ {
// someone calling KComboBox::setEditable( false ) destroys our // 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 // be a dangling pointer then, so prevent that. Note: only do this
// when it is a KLineEdit! // when it is a KLineEdit!
connect( edit, TQT_SIGNAL( destroyed() ), TQT_SLOT( lineEditDeleted() )); connect( edit, TQT_SIGNAL( destroyed() ), TQT_SLOT( lineEditDeleted() ));
@ -286,8 +286,8 @@ void KComboBox::setLineEdit( TQLineEdit *edit )
TQT_SIGNAL( substringCompletion( const TQString& )) ); TQT_SIGNAL( substringCompletion( const TQString& )) );
connect( d->klineEdit, connect( d->klineEdit,
TQT_SIGNAL( textRotation( KCompletionBase::KeyBindingType )), TQT_SIGNAL( textRotation( TDECompletionBase::KeyBindingType )),
TQT_SIGNAL( textRotation( KCompletionBase::KeyBindingType )) ); TQT_SIGNAL( textRotation( TDECompletionBase::KeyBindingType )) );
connect( d->klineEdit, connect( d->klineEdit,
TQT_SIGNAL( completionModeChanged( TDEGlobalSettings::Completion )), TQT_SIGNAL( completionModeChanged( TDEGlobalSettings::Completion )),
@ -333,7 +333,7 @@ void KComboBox::lineEditDeleted()
// yes, we need those ugly casts due to the multiple inheritance // yes, we need those ugly casts due to the multiple inheritance
// sender() is guaranteed to be a KLineEdit (see the connect() to the // sender() is guaranteed to be a KLineEdit (see the connect() to the
// destroyed() signal // destroyed() signal
const KCompletionBase *base = static_cast<const KCompletionBase*>( static_cast<const KLineEdit*>( sender() )); const TDECompletionBase *base = static_cast<const TDECompletionBase*>( static_cast<const KLineEdit*>( sender() ));
// is it our delegate, that is destroyed? // is it our delegate, that is destroyed?
if ( base == delegate() ) if ( base == delegate() )
@ -378,7 +378,7 @@ void KHistoryCombo::init( bool useCompletion )
setMaxCount( 50 ); setMaxCount( 50 );
if ( useCompletion ) if ( useCompletion )
completionObject()->setOrder( KCompletion::Weighted ); completionObject()->setOrder( TDECompletion::Weighted );
setInsertionPolicy( NoInsertion ); setInsertionPolicy( NoInsertion );
myIterateIndex = -1; myIterateIndex = -1;
@ -421,10 +421,10 @@ void KHistoryCombo::setHistoryItems( TQStringList items,
if ( setCompletionList && useCompletion() ) { if ( setCompletionList && useCompletion() ) {
// we don't have any weighting information here ;( // we don't have any weighting information here ;(
KCompletion *comp = completionObject(); TDECompletion *comp = completionObject();
comp->setOrder( KCompletion::Insertion ); comp->setOrder( TDECompletion::Insertion );
comp->setItems( items ); comp->setItems( items );
comp->setOrder( KCompletion::Weighted ); comp->setOrder( TDECompletion::Weighted );
} }
clearEdit(); clearEdit();
@ -718,7 +718,7 @@ bool KHistoryCombo::isHistoryEditorEnabled() const
} }
void KComboBox::virtual_hook( int id, void* data ) 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 ) void KHistoryCombo::virtual_hook( int id, void* data )
{ KComboBox::virtual_hook( id, data ); } { KComboBox::virtual_hook( id, data ); }

@ -38,7 +38,7 @@ class TQListBoxItem;
class TQPopupMenu; class TQPopupMenu;
class TQLineEdit; class TQLineEdit;
class KCompletionBox; class TDECompletionBox;
class KURL; class KURL;
/** /**
@ -64,7 +64,7 @@ class KURL;
* *
* KCombobox by default creates a completion object when you invoke the * KCombobox by default creates a completion object when you invoke the
* completionObject( bool ) member function for the first time or * 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, * own completion object. Additionally, to make this widget more functional,
* KComboBox will by default handle text rotation and completion events * KComboBox will by default handle text rotation and completion events
* internally whenever a completion object is created through either one of the * 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 * 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, * such as setEditable(false) is made. Store the pointer at your own risk,
* and consider using TQGuardedPtr<KCompletion>. * and consider using TQGuardedPtr<TDECompletion>.
* *
* The default key-bindings for completion and rotation is determined from the * The default key-bindings for completion and rotation is determined from the
* global settings in TDEStdAccel. These values, however, can be overridden * 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 * easily be reverted back to the default setting, by simply calling
* useGlobalSettings(). An alternate method would be to default individual * useGlobalSettings(). An alternate method would be to default individual
* key-bindings by usning setKeyBinding() with the default second argument. * key-bindings by usning setKeyBinding() with the default second argument.
@ -93,8 +93,8 @@ class KURL;
* words do not do the following: * words do not do the following:
* *
* \code * \code
* KComboBox* combo = new KCompletionBox(true, this, "mywidget"); * KComboBox* combo = new TDECompletionBox(true, this, "mywidget");
* KCompletion* comp = combo->completionObject(); * TDECompletion* comp = combo->completionObject();
* combo->setEditable( false ); * combo->setEditable( false );
* comp->clear(); // CRASH: completion object does not exist anymore. * comp->clear(); // CRASH: completion object does not exist anymore.
* \endcode * \endcode
@ -112,7 +112,7 @@ class KURL;
* *
* \code * \code
* KComboBox *combo = new KComboBox( true, this, "mywidget" ); * KComboBox *combo = new KComboBox( true, this, "mywidget" );
* KCompletion *comp = combo->completionObject(); * TDECompletion *comp = combo->completionObject();
* // Connect to the return pressed signal - optional * // Connect to the return pressed signal - optional
* connect(combo,TQT_SIGNAL(returnPressed(const TQString&)),comp,TQT_SLOT(addItem(const TQString&))); * 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 * // Tell the widget not to handle completion and rotation
* combo->setHandleSignals( false ); * combo->setHandleSignals( false );
* // Set your own completion key for manual completions. * // 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 * // Hide the context (popup) menu
* combo->setContextMenuEnabled( false ); * combo->setContextMenuEnabled( false );
* \endcode * \endcode
* *
* @author Dawit Alemayehu <adawit@kde.org> * @author Dawit Alemayehu <adawit@kde.org>
*/ */
class TDEUI_EXPORT KComboBox : public TQComboBox, public KCompletionBase class TDEUI_EXPORT KComboBox : public TQComboBox, public TDECompletionBase
{ {
Q_OBJECT Q_OBJECT
TQ_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion ) 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 * @param create Set this to false if you don't want the box to be created
* i.e. to test if it is available. * 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. * Re-implemented for internal reasons. API remains unaffected.
@ -393,7 +393,7 @@ signals:
* Note that this signal is @em NOT emitted if the completion * Note that this signal is @em NOT emitted if the completion
* mode is set to CompletionNone. * mode is set to CompletionNone.
*/ */
void textRotation( KCompletionBase::KeyBindingType ); void textRotation( TDECompletionBase::KeyBindingType );
/** /**
* Emitted whenever the completion mode is changed by the user * Emitted whenever the completion mode is changed by the user
@ -431,7 +431,7 @@ public slots:
* *
* @param type The key-binding invoked. * @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. * Sets the completed text in the line-edit appropriately.
@ -622,13 +622,13 @@ public:
* than one KHistoryCombo. * than one KHistoryCombo.
* *
* Note: When @p setCompletionList is true, the items are inserted into the * Note: When @p setCompletionList is true, the items are inserted into the
* KCompletion object with mode KCompletion::Insertion and the mode is set * TDECompletion object with mode TDECompletion::Insertion and the mode is set
* to KCompletion::Weighted afterwards. * to TDECompletion::Weighted afterwards.
* *
* @see historyItems * @see historyItems
* @see KComboBox::completionObject * @see KComboBox::completionObject
* @see KCompletion::setItems * @see TDECompletion::setItems
* @see KCompletion::items * @see TDECompletion::items
*/ */
void setHistoryItems( TQStringList items, bool setCompletionList ); void setHistoryItems( TQStringList items, bool setCompletionList );

@ -33,7 +33,7 @@
#include "kcompletionbox.h" #include "kcompletionbox.h"
class KCompletionBox::KCompletionBoxPrivate class TDECompletionBox::TDECompletionBoxPrivate
{ {
public: public:
TQWidget *m_parent; // necessary to set the focus back TQWidget *m_parent; // necessary to set the focus back
@ -44,8 +44,8 @@ public:
bool emitSelected; bool emitSelected;
}; };
KCompletionBox::KCompletionBox( TQWidget *parent, const char *name ) TDECompletionBox::TDECompletionBox( TQWidget *parent, const char *name )
:TDEListBox( parent, name, (WFlags)WType_Popup ), d(new KCompletionBoxPrivate) :TDEListBox( parent, name, (WFlags)WType_Popup ), d(new TDECompletionBoxPrivate)
{ {
d->m_parent = parent; d->m_parent = parent;
@ -76,13 +76,13 @@ KCompletionBox::KCompletionBox( TQWidget *parent, const char *name )
TQT_SLOT( slotItemClicked( TQListBoxItem * )) ); TQT_SLOT( slotItemClicked( TQListBoxItem * )) );
} }
KCompletionBox::~KCompletionBox() TDECompletionBox::~TDECompletionBox()
{ {
d->m_parent = 0L; d->m_parent = 0L;
delete d; delete d;
} }
TQStringList KCompletionBox::items() const TQStringList TDECompletionBox::items() const
{ {
TQStringList list; TQStringList list;
@ -96,7 +96,7 @@ TQStringList KCompletionBox::items() const
return list; return list;
} }
void KCompletionBox::slotActivated( TQListBoxItem *item ) void TDECompletionBox::slotActivated( TQListBoxItem *item )
{ {
if ( !item ) if ( !item )
return; return;
@ -105,7 +105,7 @@ void KCompletionBox::slotActivated( TQListBoxItem *item )
emit activated( item->text() ); emit activated( item->text() );
} }
bool KCompletionBox::eventFilter( TQObject *o, TQEvent *e ) bool TDECompletionBox::eventFilter( TQObject *o, TQEvent *e )
{ {
int type = e->type(); int type = e->type();
@ -247,7 +247,7 @@ bool KCompletionBox::eventFilter( TQObject *o, TQEvent *e )
} }
void KCompletionBox::popup() void TDECompletionBox::popup()
{ {
if ( count() == 0 ) if ( count() == 0 )
hide(); hide();
@ -265,7 +265,7 @@ void KCompletionBox::popup()
} }
} }
void KCompletionBox::sizeAndPosition() void TDECompletionBox::sizeAndPosition()
{ {
int currentGeom = height(); int currentGeom = height();
TQPoint currentPos = pos(); TQPoint currentPos = pos();
@ -297,7 +297,7 @@ void KCompletionBox::sizeAndPosition()
} }
} }
void KCompletionBox::show() void TDECompletionBox::show()
{ {
d->upwardBox = false; d->upwardBox = false;
if ( d->m_parent ) { if ( d->m_parent ) {
@ -309,19 +309,19 @@ void KCompletionBox::show()
// are pretty b0rked. // are pretty b0rked.
//triggerUpdate( true ); //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 // is in a layout, that layout will detect inserting new child (posted
// ChildInserted event), and will trigger relayout (post LayoutHint event). // ChildInserted event), and will trigger relayout (post LayoutHint event).
// TQWidget::show() sends also posted ChildInserted events for the parent, // TQWidget::show() sends also posted ChildInserted events for the parent,
// and later all LayoutHint events, which causes layout updating. // 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 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. // of show(), causing inconsistent state. I'll try to submit a Qt patch too.
tqApp->sendPostedEvents(); tqApp->sendPostedEvents();
TDEListBox::show(); TDEListBox::show();
} }
void KCompletionBox::hide() void TDECompletionBox::hide()
{ {
if ( d->m_parent ) if ( d->m_parent )
tqApp->removeEventFilter( this ); tqApp->removeEventFilter( this );
@ -329,7 +329,7 @@ void KCompletionBox::hide()
TDEListBox::hide(); TDEListBox::hide();
} }
TQRect KCompletionBox::calculateGeometry() const TQRect TDECompletionBox::calculateGeometry() const
{ {
int x = 0, y = 0; int x = 0, y = 0;
int ih = itemHeight(); int ih = itemHeight();
@ -373,12 +373,12 @@ TQRect KCompletionBox::calculateGeometry() const
return TQRect(x, y, w, h); return TQRect(x, y, w, h);
} }
TQSize KCompletionBox::sizeHint() const TQSize TDECompletionBox::sizeHint() const
{ {
return calculateGeometry().size(); return calculateGeometry().size();
} }
void KCompletionBox::down() void TDECompletionBox::down()
{ {
int i = currentItem(); int i = currentItem();
@ -393,57 +393,57 @@ void KCompletionBox::down()
setCurrentItem( i + 1 ); setCurrentItem( i + 1 );
} }
void KCompletionBox::up() void TDECompletionBox::up()
{ {
if ( currentItem() > 0 ) if ( currentItem() > 0 )
setCurrentItem( currentItem() - 1 ); setCurrentItem( currentItem() - 1 );
} }
void KCompletionBox::pageDown() void TDECompletionBox::pageDown()
{ {
int i = currentItem() + numItemsVisible(); int i = currentItem() + numItemsVisible();
i = i > (int)count() - 1 ? (int)count() - 1 : i; i = i > (int)count() - 1 ? (int)count() - 1 : i;
setCurrentItem( i ); setCurrentItem( i );
} }
void KCompletionBox::pageUp() void TDECompletionBox::pageUp()
{ {
int i = currentItem() - numItemsVisible(); int i = currentItem() - numItemsVisible();
i = i < 0 ? 0 : i; i = i < 0 ? 0 : i;
setCurrentItem( i ); setCurrentItem( i );
} }
void KCompletionBox::home() void TDECompletionBox::home()
{ {
setCurrentItem( 0 ); setCurrentItem( 0 );
} }
void KCompletionBox::end() void TDECompletionBox::end()
{ {
setCurrentItem( count() -1 ); setCurrentItem( count() -1 );
} }
void KCompletionBox::setTabHandling( bool enable ) void TDECompletionBox::setTabHandling( bool enable )
{ {
d->tabHandling = enable; d->tabHandling = enable;
} }
bool KCompletionBox::isTabHandling() const bool TDECompletionBox::isTabHandling() const
{ {
return d->tabHandling; return d->tabHandling;
} }
void KCompletionBox::setCancelledText( const TQString& text ) void TDECompletionBox::setCancelledText( const TQString& text )
{ {
d->cancelText = text; d->cancelText = text;
} }
TQString KCompletionBox::cancelledText() const TQString TDECompletionBox::cancelledText() const
{ {
return d->cancelText; return d->cancelText;
} }
void KCompletionBox::canceled() void TDECompletionBox::canceled()
{ {
if ( !d->cancelText.isNull() ) if ( !d->cancelText.isNull() )
emit userCancelled( d->cancelText ); emit userCancelled( d->cancelText );
@ -451,7 +451,7 @@ void KCompletionBox::canceled()
hide(); hide();
} }
class KCompletionBoxItem : public TQListBoxItem class TDECompletionBoxItem : public TQListBoxItem
{ {
public: public:
//Returns true if dirty. //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(); bool block = signalsBlocked();
blockSignals( true ); blockSignals( true );
@ -474,7 +474,7 @@ void KCompletionBox::insertItems( const TQStringList& items, int index )
d->down_workaround = true; d->down_workaround = true;
} }
void KCompletionBox::setItems( const TQStringList& items ) void TDECompletionBox::setItems( const TQStringList& items )
{ {
bool block = signalsBlocked(); bool block = signalsBlocked();
blockSignals( true ); blockSignals( true );
@ -494,7 +494,7 @@ void KCompletionBox::setItems( const TQStringList& items )
for ( ; it != itEnd; ++it) { for ( ; it != itEnd; ++it) {
if ( item ) { if ( item ) {
const bool changed = ((KCompletionBoxItem*)item)->reuse( *it ); const bool changed = ((TDECompletionBoxItem*)item)->reuse( *it );
dirty = dirty || changed; dirty = dirty || changed;
item = item->next(); item = item->next();
} }
@ -527,12 +527,12 @@ void KCompletionBox::setItems( const TQStringList& items )
d->down_workaround = true; d->down_workaround = true;
} }
void KCompletionBox::slotCurrentChanged() void TDECompletionBox::slotCurrentChanged()
{ {
d->down_workaround = false; d->down_workaround = false;
} }
void KCompletionBox::slotItemClicked( TQListBoxItem *item ) void TDECompletionBox::slotItemClicked( TQListBoxItem *item )
{ {
if ( 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; d->emitSelected = state;
} }
bool KCompletionBox::activateOnSelect() const bool TDECompletionBox::activateOnSelect() const
{ {
return d->emitSelected; return d->emitSelected;
} }
void KCompletionBox::virtual_hook( int id, void* data ) void TDECompletionBox::virtual_hook( int id, void* data )
{ TDEListBox::virtual_hook( id, data ); } { TDEListBox::virtual_hook( id, data ); }
#include "kcompletionbox.moc" #include "kcompletionbox.moc"

@ -31,7 +31,7 @@ class TQEvent;
* @short A helper widget for "completion-widgets" (KLineEdit, KComboBox)) * @short A helper widget for "completion-widgets" (KLineEdit, KComboBox))
* *
* A little utility class for "completion-widgets", like KLineEdit or * 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. * any window decoration, usually directly under the lineedit or combobox.
* It is filled with all possible matches for a completion, so the user * It is filled with all possible matches for a completion, so the user
* can select the one he wants. * can select the one he wants.
@ -40,7 +40,7 @@ class TQEvent;
* *
* @author Carsten Pfeiffer <pfeiffer@kde.org> * @author Carsten Pfeiffer <pfeiffer@kde.org>
*/ */
class TDEUI_EXPORT KCompletionBox : public TDEListBox class TDEUI_EXPORT TDECompletionBox : public TDEListBox
{ {
Q_OBJECT Q_OBJECT
TQ_PROPERTY( bool isTabHandling READ isTabHandling WRITE setTabHandling ) TQ_PROPERTY( bool isTabHandling READ isTabHandling WRITE setTabHandling )
@ -49,17 +49,17 @@ class TDEUI_EXPORT KCompletionBox : public TDEListBox
public: public:
/** /**
* Constructs a KCompletionBox. * Constructs a TDECompletionBox.
* *
* The parent widget is used to give the focus back when pressing the * The parent widget is used to give the focus back when pressing the
* up-button on the very first item. * up-button on the very first item.
*/ */
KCompletionBox( TQWidget *parent, const char *name = 0 ); TDECompletionBox( TQWidget *parent, const char *name = 0 );
/** /**
* Destroys the box * Destroys the box
*/ */
~KCompletionBox(); ~TDECompletionBox();
virtual TQSize sizeHint() const; virtual TQSize sizeHint() const;
@ -238,8 +238,8 @@ protected:
virtual void virtual_hook( int id, void* data ); virtual void virtual_hook( int id, void* data );
private: private:
class KCompletionBoxPrivate; class TDECompletionBoxPrivate;
KCompletionBoxPrivate* const d; TDECompletionBoxPrivate* const d;
}; };

@ -93,7 +93,7 @@ public:
int squeezedStart; int squeezedStart;
BackgroundMode bgMode; BackgroundMode bgMode;
TQString squeezedText; TQString squeezedText;
KCompletionBox *completionBox; TDECompletionBox *completionBox;
TQString clickMessage; TQString clickMessage;
bool drawClickMsg:1; bool drawClickMsg:1;
@ -171,7 +171,7 @@ void KLineEdit::setCompletionMode( TDEGlobalSettings::Completion mode )
else else
d->autoSuggest = false; d->autoSuggest = false;
KCompletionBase::setCompletionMode( mode ); TDECompletionBase::setCompletionMode( mode );
} }
void KLineEdit::setCompletedText( const TQString& t, bool marked ) void KLineEdit::setCompletedText( const TQString& t, bool marked )
@ -202,16 +202,16 @@ void KLineEdit::setCompletedText( const TQString& text )
setCompletedText( text, marked ); setCompletedText( text, marked );
} }
void KLineEdit::rotateText( KCompletionBase::KeyBindingType type ) void KLineEdit::rotateText( TDECompletionBase::KeyBindingType type )
{ {
KCompletion* comp = compObj(); TDECompletion* comp = compObj();
if ( comp && if ( comp &&
(type == KCompletionBase::PrevCompletionMatch || (type == TDECompletionBase::PrevCompletionMatch ||
type == KCompletionBase::NextCompletionMatch ) ) type == TDECompletionBase::NextCompletionMatch ) )
{ {
TQString input; TQString input;
if (type == KCompletionBase::PrevCompletionMatch) if (type == TDECompletionBase::PrevCompletionMatch)
comp->previousMatch(); comp->previousMatch();
else else
comp->nextMatch(); comp->nextMatch();
@ -225,7 +225,7 @@ void KLineEdit::rotateText( KCompletionBase::KeyBindingType type )
void KLineEdit::makeCompletion( const TQString& text ) void KLineEdit::makeCompletion( const TQString& text )
{ {
KCompletion *comp = compObj(); TDECompletion *comp = compObj();
TDEGlobalSettings::Completion mode = completionMode(); TDEGlobalSettings::Completion mode = completionMode();
if ( !comp || mode == TDEGlobalSettings::CompletionNone ) if ( !comp || mode == TDEGlobalSettings::CompletionNone )
@ -761,9 +761,9 @@ void KLineEdit::keyPressEvent( TQKeyEvent *e )
if ( cut.contains( key ) ) if ( cut.contains( key ) )
{ {
if ( emitSignals() ) if ( emitSignals() )
emit textRotation( KCompletionBase::PrevCompletionMatch ); emit textRotation( TDECompletionBase::PrevCompletionMatch );
if ( handleSignals() ) if ( handleSignals() )
rotateText( KCompletionBase::PrevCompletionMatch ); rotateText( TDECompletionBase::PrevCompletionMatch );
return; return;
} }
@ -776,9 +776,9 @@ void KLineEdit::keyPressEvent( TQKeyEvent *e )
if ( cut.contains( key ) ) if ( cut.contains( key ) )
{ {
if ( emitSignals() ) if ( emitSignals() )
emit textRotation( KCompletionBase::NextCompletionMatch ); emit textRotation( TDECompletionBase::NextCompletionMatch );
if ( handleSignals() ) if ( handleSignals() )
rotateText( KCompletionBase::NextCompletionMatch ); rotateText( TDECompletionBase::NextCompletionMatch );
return; return;
} }
} }
@ -1080,7 +1080,7 @@ void KLineEdit::setURL( const KURL& url )
setText( url.prettyURL() ); setText( url.prettyURL() );
} }
void KLineEdit::setCompletionBox( KCompletionBox *box ) void KLineEdit::setCompletionBox( TDECompletionBox *box )
{ {
if ( d->completionBox ) if ( d->completionBox )
return; 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 ) { if ( create && !d->completionBox ) {
setCompletionBox( new KCompletionBox( this, "completion box" ) ); setCompletionBox( new TDECompletionBox( this, "completion box" ) );
d->completionBox->setFont(font()); d->completionBox->setFont(font());
} }
return d->completionBox; 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() ) if ( oldComp && handleSignals() )
disconnect( oldComp, TQT_SIGNAL( matches( const TQStringList& )), disconnect( oldComp, TQT_SIGNAL( matches( const TQStringList& )),
this, TQT_SLOT( setCompletedItems( 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& )), connect( comp, TQT_SIGNAL( matches( const TQStringList& )),
this, TQT_SLOT( setCompletedItems( 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 // 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 ) void KLineEdit::virtual_hook( int id, void* data )
{ KCompletionBase::virtual_hook( id, data ); } { TDECompletionBase::virtual_hook( id, data ); }

@ -35,7 +35,7 @@
class TQPopupMenu; class TQPopupMenu;
class KCompletionBox; class TDECompletionBox;
class KURL; class KURL;
/** /**
@ -63,7 +63,7 @@ class KURL;
* *
* This widget by default creates a completion object when you invoke * This widget by default creates a completion object when you invoke
* the completionObject( bool ) member function for the first time or * 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, * completion object. Additionally, to make this widget more functional,
* KLineEdit will by default handle the text rotation and completion * KLineEdit will by default handle the text rotation and completion
* events internally when a completion object is created through either one * 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, * 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. * the completion mode will always be defaulted to TDEGlobalSettings::CompletionNone.
* This is done purposefully to guard against protected entries such as passwords being * 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. * completion mode is automatically disabled.
* *
* A read-only KLineEdit will have the same background color as a * A read-only KLineEdit will have the same background color as a
@ -97,7 +97,7 @@ class KURL;
* *
* \code * \code
* KLineEdit *edit = new KLineEdit( this, "mywidget" ); * KLineEdit *edit = new KLineEdit( this, "mywidget" );
* KCompletion *comp = edit->completionObject(); * TDECompletion *comp = edit->completionObject();
* // Connect to the return pressed signal - optional * // Connect to the return pressed signal - optional
* connect(edit,TQT_SIGNAL(returnPressed(const TQString&)),comp,TQT_SLOT(addItem(const TQString&))); * connect(edit,TQT_SIGNAL(returnPressed(const TQString&)),comp,TQT_SLOT(addItem(const TQString&)));
* \endcode * \endcode
@ -127,7 +127,7 @@ class KURL;
* edit->setHandleSignals( false ); * edit->setHandleSignals( false );
* *
* // Set your own key-bindings for a text completion mode. * // 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 * // Hide the context (popup) menu
* edit->setContextMenuEnabled( false ); * edit->setContextMenuEnabled( false );
@ -142,7 +142,7 @@ class KURL;
* @author Dawit Alemayehu <adawit@kde.org> * @author Dawit Alemayehu <adawit@kde.org>
*/ */
class TDEUI_EXPORT KLineEdit : public TQLineEdit, public KCompletionBase class TDEUI_EXPORT KLineEdit : public TQLineEdit, public TDECompletionBase
{ {
friend class KComboBox; friend class KComboBox;
@ -197,12 +197,12 @@ public:
void cursorAtEnd() { end( false ); } 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 * This function is re-implemented in order to make sure that
* the EchoMode is acceptable before we set the completion mode. * the EchoMode is acceptable before we set the completion mode.
* *
* See KCompletionBase::setCompletionMode * See TDECompletionBase::setCompletionMode
*/ */
virtual void setCompletionMode( TDEGlobalSettings::Completion mode ); 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 * @param create Set this to false if you don't want the box to be created
* i.e. to test if it is available. * 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. * 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. * Reimplemented for internal reasons, the API is not affected.
@ -323,10 +323,10 @@ public:
* TDEGlobalSettings::CompletionPopup. * TDEGlobalSettings::CompletionPopup.
* This will do nothing if a completion-box already exists. * 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 * @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 * 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 * mode is set to @p TDEGlobalSettings::CompletionNone or
* @p echoMode() is @em not normal. * @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 * Emitted when the user changed the completion mode by using the
@ -424,10 +424,10 @@ public slots:
* *
* @param type The key-binding invoked. * @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& ); virtual void setCompletedText( const TQString& );

@ -194,7 +194,7 @@ public:
/** /**
* @return the lineedit used for inline renaming. * @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 * @since 3.2
*/ */

@ -139,8 +139,8 @@ KComboBoxTest::KComboBoxTest(TQWidget* widget, const char* name )
// Setup konq's combobox // Setup konq's combobox
KSimpleConfig historyConfig( "konq_history" ); KSimpleConfig historyConfig( "konq_history" );
historyConfig.setGroup( "Location Bar" ); historyConfig.setGroup( "Location Bar" );
KCompletion * s_pCompletion = new KCompletion; TDECompletion * s_pCompletion = new TDECompletion;
s_pCompletion->setOrder( KCompletion::Weighted ); s_pCompletion->setOrder( TDECompletion::Weighted );
s_pCompletion->setItems( historyConfig.readListEntry( "ComboContents" ) ); s_pCompletion->setItems( historyConfig.readListEntry( "ComboContents" ) );
s_pCompletion->setCompletionMode( TDEGlobalSettings::completionMode() ); s_pCompletion->setCompletionMode( TDEGlobalSettings::completionMode() );
m_konqc->setCompletionObject( s_pCompletion ); m_konqc->setCompletionObject( s_pCompletion );

Loading…
Cancel
Save