diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
commit | 7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch) | |
tree | 8474f9b444b2756228600050f07a7ff25de532b2 /libkdepim/addresseelineedit.cpp | |
parent | f587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff) | |
download | tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkdepim/addresseelineedit.cpp')
-rw-r--r-- | libkdepim/addresseelineedit.cpp | 300 |
1 files changed, 150 insertions, 150 deletions
diff --git a/libkdepim/addresseelineedit.cpp b/libkdepim/addresseelineedit.cpp index a40ad3551..7031a83eb 100644 --- a/libkdepim/addresseelineedit.cpp +++ b/libkdepim/addresseelineedit.cpp @@ -50,57 +50,57 @@ #include <kurldrag.h> #include <klocale.h> -#include <qpopupmenu.h> -#include <qapplication.h> -#include <qobject.h> -#include <qptrlist.h> -#include <qregexp.h> -#include <qevent.h> -#include <qdragobject.h> -#include <qclipboard.h> +#include <tqpopupmenu.h> +#include <tqapplication.h> +#include <tqobject.h> +#include <tqptrlist.h> +#include <tqregexp.h> +#include <tqevent.h> +#include <tqdragobject.h> +#include <tqclipboard.h> using namespace KPIM; KMailCompletion * AddresseeLineEdit::s_completion = 0L; KPIM::CompletionItemsMap* AddresseeLineEdit::s_completionItemMap = 0L; -QStringList* AddresseeLineEdit::s_completionSources = 0L; +TQStringList* AddresseeLineEdit::s_completionSources = 0L; bool AddresseeLineEdit::s_addressesDirty = false; -QTimer* AddresseeLineEdit::s_LDAPTimer = 0L; +TQTimer* AddresseeLineEdit::s_LDAPTimer = 0L; KPIM::LdapSearch* AddresseeLineEdit::s_LDAPSearch = 0L; -QString* AddresseeLineEdit::s_LDAPText = 0L; +TQString* AddresseeLineEdit::s_LDAPText = 0L; AddresseeLineEdit* AddresseeLineEdit::s_LDAPLineEdit = 0L; static KStaticDeleter<KMailCompletion> completionDeleter; static KStaticDeleter<KPIM::CompletionItemsMap> completionItemsDeleter; -static KStaticDeleter<QTimer> ldapTimerDeleter; +static KStaticDeleter<TQTimer> ldapTimerDeleter; static KStaticDeleter<KPIM::LdapSearch> ldapSearchDeleter; -static KStaticDeleter<QString> ldapTextDeleter; -static KStaticDeleter<QStringList> completionSourcesDeleter; +static KStaticDeleter<TQString> ldapTextDeleter; +static KStaticDeleter<TQStringList> completionSourcesDeleter; // needs to be unique, but the actual name doesn't matter much -static QCString newLineEditDCOPObjectName() +static TQCString newLineEditDCOPObjectName() { static int s_count = 0; - QCString name( "KPIM::AddresseeLineEdit" ); + TQCString name( "KPIM::AddresseeLineEdit" ); if ( s_count++ ) { name += '-'; - name += QCString().setNum( s_count ); + name += TQCString().setNum( s_count ); } return name; } -static const QString s_completionItemIndentString = " "; +static const TQString s_completionItemIndentString = " "; -static bool itemIsHeader( const QListBoxItem* item ) +static bool itemIsHeader( const TQListBoxItem* item ) { return item && !item->text().startsWith( s_completionItemIndentString ); } -AddresseeLineEdit::AddresseeLineEdit( QWidget* parent, bool useCompletion, +AddresseeLineEdit::AddresseeLineEdit( TQWidget* parent, bool useCompletion, const char *name ) - : ClickLineEdit( parent, QString::null, name ), DCOPObject( newLineEditDCOPObjectName() ) + : ClickLineEdit( parent, TQString::null, name ), DCOPObject( newLineEditDCOPObjectName() ) { m_useCompletion = useCompletion; m_completionInitialized = false; @@ -123,46 +123,46 @@ void AddresseeLineEdit::init() s_completion->setIgnoreCase( true ); completionItemsDeleter.setObject( s_completionItemMap, new KPIM::CompletionItemsMap() ); - completionSourcesDeleter.setObject( s_completionSources, new QStringList() ); + completionSourcesDeleter.setObject( s_completionSources, new TQStringList() ); } -// connect( s_completion, SIGNAL( match( const QString& ) ), -// this, SLOT( slotMatched( const QString& ) ) ); +// connect( s_completion, TQT_SIGNAL( match( const TQString& ) ), +// this, TQT_SLOT( slotMatched( const TQString& ) ) ); if ( m_useCompletion ) { if ( !s_LDAPTimer ) { - ldapTimerDeleter.setObject( s_LDAPTimer, new QTimer( 0, "ldapTimerDeleter" ) ); + ldapTimerDeleter.setObject( s_LDAPTimer, new TQTimer( 0, "ldapTimerDeleter" ) ); ldapSearchDeleter.setObject( s_LDAPSearch, new KPIM::LdapSearch ); - ldapTextDeleter.setObject( s_LDAPText, new QString ); + ldapTextDeleter.setObject( s_LDAPText, new TQString ); /* Add completion sources for all ldap server, 0 to n. Added first so * that they map to the ldapclient::clientNumber() */ - QValueList< LdapClient* > clients = s_LDAPSearch->clients(); - for ( QValueList<LdapClient*>::iterator it = clients.begin(); it != clients.end(); ++it ) { + TQValueList< LdapClient* > clients = s_LDAPSearch->clients(); + for ( TQValueList<LdapClient*>::iterator it = clients.begin(); it != clients.end(); ++it ) { addCompletionSource( "LDAP server: " + (*it)->server().host() ); } } if ( !m_completionInitialized ) { setCompletionObject( s_completion, false ); - connect( this, SIGNAL( completion( const QString& ) ), - this, SLOT( slotCompletion() ) ); - connect( this, SIGNAL( returnPressed( const QString& ) ), - this, SLOT( slotReturnPressed( const QString& ) ) ); + connect( this, TQT_SIGNAL( completion( const TQString& ) ), + this, TQT_SLOT( slotCompletion() ) ); + connect( this, TQT_SIGNAL( returnPressed( const TQString& ) ), + this, TQT_SLOT( slotReturnPressed( const TQString& ) ) ); KCompletionBox *box = completionBox(); - connect( box, SIGNAL( highlighted( const QString& ) ), - this, SLOT( slotPopupCompletion( const QString& ) ) ); - connect( box, SIGNAL( userCancelled( const QString& ) ), - SLOT( slotUserCancelled( const QString& ) ) ); + connect( box, TQT_SIGNAL( highlighted( const TQString& ) ), + this, TQT_SLOT( slotPopupCompletion( const TQString& ) ) ); + connect( box, TQT_SIGNAL( userCancelled( const TQString& ) ), + TQT_SLOT( slotUserCancelled( const TQString& ) ) ); // The emitter is always called KPIM::IMAPCompletionOrder by contract if ( !connectDCOPSignal( 0, "KPIM::IMAPCompletionOrder", "orderChanged()", "slotIMAPCompletionOrderChanged()", false ) ) kdError() << "AddresseeLineEdit: connection to orderChanged() failed" << endl; - connect( s_LDAPTimer, SIGNAL( timeout() ), SLOT( slotStartLDAPLookup() ) ); - connect( s_LDAPSearch, SIGNAL( searchData( const KPIM::LdapResultList& ) ), - SLOT( slotLDAPSearchData( const KPIM::LdapResultList& ) ) ); + connect( s_LDAPTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( slotStartLDAPLookup() ) ); + connect( s_LDAPSearch, TQT_SIGNAL( searchData( const KPIM::LdapResultList& ) ), + TQT_SLOT( slotLDAPSearchData( const KPIM::LdapResultList& ) ) ); m_completionInitialized = true; } @@ -175,7 +175,7 @@ AddresseeLineEdit::~AddresseeLineEdit() stopLDAPLookup(); } -void AddresseeLineEdit::setFont( const QFont& font ) +void AddresseeLineEdit::setFont( const TQFont& font ) { KLineEdit::setFont( font ); if ( m_useCompletion ) @@ -187,7 +187,7 @@ void AddresseeLineEdit::allowSemiColonAsSeparator( bool useSemiColonAsSeparator m_useSemiColonAsSeparator = useSemiColonAsSeparator; } -void AddresseeLineEdit::keyPressEvent( QKeyEvent *e ) +void AddresseeLineEdit::keyPressEvent( TQKeyEvent *e ) { bool accept = false; @@ -211,7 +211,7 @@ void AddresseeLineEdit::keyPressEvent( QKeyEvent *e ) if ( e->isAccepted() ) { updateSearchString(); - QString searchString( m_searchString ); + TQString searchString( m_searchString ); //LDAP does not know about our string manipulation, remove it if ( m_searchExtended ) searchString = m_searchString.mid( 1 ); @@ -227,7 +227,7 @@ void AddresseeLineEdit::keyPressEvent( QKeyEvent *e ) } } -void AddresseeLineEdit::insert( const QString &t ) +void AddresseeLineEdit::insert( const TQString &t ) { if ( !m_smartPaste ) { KLineEdit::insert( t ); @@ -236,16 +236,16 @@ void AddresseeLineEdit::insert( const QString &t ) //kdDebug(5300) << " AddresseeLineEdit::insert( \"" << t << "\" )" << endl; - QString newText = t.stripWhiteSpace(); + TQString newText = t.stripWhiteSpace(); if ( newText.isEmpty() ) return; // remove newlines in the to-be-pasted string - QStringList lines = QStringList::split( QRegExp("\r?\n"), newText, false ); - for ( QStringList::iterator it = lines.begin(); + TQStringList lines = TQStringList::split( TQRegExp("\r?\n"), newText, false ); + for ( TQStringList::iterator it = lines.begin(); it != lines.end(); ++it ) { // remove trailing commas and whitespace - (*it).remove( QRegExp(",?\\s*$") ); + (*it).remove( TQRegExp(",?\\s*$") ); } newText = lines.join( ", " ); @@ -259,10 +259,10 @@ void AddresseeLineEdit::insert( const QString &t ) newText.replace( " dot ", "." ); } else if ( newText.find("(at)") != -1 ) { - newText.replace( QRegExp("\\s*\\(at\\)\\s*"), "@" ); + newText.replace( TQRegExp("\\s*\\(at\\)\\s*"), "@" ); } - QString contents = text(); + TQString contents = text(); int start_sel = 0; int end_sel = 0; int pos = cursorPosition( ); @@ -278,7 +278,7 @@ void AddresseeLineEdit::insert( const QString &t ) int eot = contents.length(); while ((eot > 0) && contents[ eot - 1 ].isSpace() ) eot--; if ( eot == 0 ) - contents = QString::null; + contents = TQString::null; else if ( pos >= eot ) { if ( contents[ eot - 1 ] == ',' ) eot--; @@ -293,7 +293,7 @@ void AddresseeLineEdit::insert( const QString &t ) setCursorPosition( pos + newText.length() ); } -void AddresseeLineEdit::setText( const QString & text ) +void AddresseeLineEdit::setText( const TQString & text ) { ClickLineEdit::setText( text.stripWhiteSpace() ); } @@ -307,11 +307,11 @@ void AddresseeLineEdit::paste() m_smartPaste = false; } -void AddresseeLineEdit::mouseReleaseEvent( QMouseEvent *e ) +void AddresseeLineEdit::mouseReleaseEvent( TQMouseEvent *e ) { - // reimplemented from QLineEdit::mouseReleaseEvent() + // reimplemented from TQLineEdit::mouseReleaseEvent() if ( m_useCompletion - && QApplication::clipboard()->supportsSelection() + && TQApplication::clipboard()->supportsSelection() && !isReadOnly() && e->button() == MidButton ) { m_smartPaste = true; @@ -321,18 +321,18 @@ void AddresseeLineEdit::mouseReleaseEvent( QMouseEvent *e ) m_smartPaste = false; } -void AddresseeLineEdit::dropEvent( QDropEvent *e ) +void AddresseeLineEdit::dropEvent( TQDropEvent *e ) { KURL::List uriList; if ( !isReadOnly() && KURLDrag::canDecode(e) && KURLDrag::decode( e, uriList ) ) { - QString contents = text(); + TQString contents = text(); // remove trailing white space and comma int eot = contents.length(); while ( ( eot > 0 ) && contents[ eot - 1 ].isSpace() ) eot--; if ( eot == 0 ) - contents = QString::null; + contents = TQString::null; else if ( contents[ eot - 1 ] == ',' ) { eot--; contents.truncate( eot ); @@ -358,7 +358,7 @@ void AddresseeLineEdit::dropEvent( QDropEvent *e ) if ( m_useCompletion ) m_smartPaste = true; - QLineEdit::dropEvent( e ); + TQLineEdit::dropEvent( e ); m_smartPaste = false; } @@ -388,7 +388,7 @@ void AddresseeLineEdit::doCompletion( bool ctrlT ) // cursor at end of string - or Ctrl+T pressed for substring completion? if ( ctrlT ) { - const QStringList completions = getAdjustedCompletionItems( false ); + const TQStringList completions = getAdjustedCompletionItems( false ); if ( completions.count() > 1 ) ; //m_previousAddresses = prevAddr; @@ -412,14 +412,14 @@ void AddresseeLineEdit::doCompletion( bool ctrlT ) case KGlobalSettings::CompletionPopup: { - const QStringList items = getAdjustedCompletionItems( true ); + const TQStringList items = getAdjustedCompletionItems( true ); setCompletedItems( items, false ); break; } case KGlobalSettings::CompletionShell: { - QString match = s_completion->makeCompletion( m_searchString ); + TQString match = s_completion->makeCompletion( m_searchString ); if ( !match.isNull() && match != m_searchString ) { setText( m_previousAddresses + match ); setEdited( true ); @@ -439,16 +439,16 @@ void AddresseeLineEdit::doCompletion( bool ctrlT ) //if only our \" is left, remove it since user has not typed it either if ( m_searchExtended && m_searchString == "\"" ){ m_searchExtended = false; - m_searchString = QString::null; + m_searchString = TQString::null; setText( m_previousAddresses ); break; } - QString match = s_completion->makeCompletion( m_searchString ); + TQString match = s_completion->makeCompletion( m_searchString ); if ( !match.isEmpty() ) { if ( match != m_searchString ) { - QString adds = m_previousAddresses + match; + TQString adds = m_previousAddresses + match; setCompletedText( adds ); } } else { @@ -469,7 +469,7 @@ void AddresseeLineEdit::doCompletion( bool ctrlT ) //now try again match = s_completion->makeCompletion( m_searchString ); if ( !match.isEmpty() && match != m_searchString ) { - QString adds = m_previousAddresses + match; + TQString adds = m_previousAddresses + match; setCompletedText( adds ); } } @@ -484,7 +484,7 @@ void AddresseeLineEdit::doCompletion( bool ctrlT ) } } -void AddresseeLineEdit::slotPopupCompletion( const QString& completion ) +void AddresseeLineEdit::slotPopupCompletion( const TQString& completion ) { setText( m_previousAddresses + completion.stripWhiteSpace() ); cursorAtEnd(); @@ -492,10 +492,10 @@ void AddresseeLineEdit::slotPopupCompletion( const QString& completion ) updateSearchString(); } -void AddresseeLineEdit::slotReturnPressed( const QString& item ) +void AddresseeLineEdit::slotReturnPressed( const TQString& item ) { Q_UNUSED( item ); - QListBoxItem* i = completionBox()->selectedItem(); + TQListBoxItem* i = completionBox()->selectedItem(); if ( i != 0 ) slotPopupCompletion( i->text() ); } @@ -507,7 +507,7 @@ void AddresseeLineEdit::loadContacts() s_addressesDirty = false; //m_contactMap.clear(); - QApplication::setOverrideCursor( KCursor::waitCursor() ); // loading might take a while + TQApplication::setOverrideCursor( KCursor::waitCursor() ); // loading might take a while KConfig config( "kpimcompletionorder" ); // The weights for non-imap kabc resources is there. config.setGroup( "CompletionWeights" ); @@ -515,17 +515,17 @@ void AddresseeLineEdit::loadContacts() KABC::AddressBook *addressBook = KABC::StdAddressBook::self( true ); // Can't just use the addressbook's iterator, we need to know which subresource // is behind which contact. - QPtrList<KABC::Resource> resources( addressBook->resources() ); - for( QPtrListIterator<KABC::Resource> resit( resources ); *resit; ++resit ) { + TQPtrList<KABC::Resource> resources( addressBook->resources() ); + for( TQPtrListIterator<KABC::Resource> resit( resources ); *resit; ++resit ) { KABC::Resource* resource = *resit; KPIM::ResourceABC* resabc = dynamic_cast<ResourceABC *>( resource ); if ( resabc ) { // IMAP KABC resource; need to associate each contact with the subresource - const QMap<QString, QString> uidToResourceMap = resabc->uidToResourceMap(); + const TQMap<TQString, TQString> uidToResourceMap = resabc->uidToResourceMap(); KABC::Resource::Iterator it; for ( it = resource->begin(); it != resource->end(); ++it ) { - QString uid = (*it).uid(); - QMap<QString, QString>::const_iterator wit = uidToResourceMap.find( uid ); - const QString subresourceLabel = resabc->subresourceLabel( *wit ); + TQString uid = (*it).uid(); + TQMap<TQString, TQString>::const_iterator wit = uidToResourceMap.find( uid ); + const TQString subresourceLabel = resabc->subresourceLabel( *wit ); int idx = s_completionSources->findIndex( subresourceLabel ); if ( idx == -1 ) { s_completionSources->append( subresourceLabel ); @@ -548,8 +548,8 @@ void AddresseeLineEdit::loadContacts() int weight = config.readNumEntry( "DistributionLists", 60 ); KABC::DistributionListManager manager( addressBook ); manager.load(); - const QStringList distLists = manager.listNames(); - QStringList::const_iterator listIt; + const TQStringList distLists = manager.listNames(); + TQStringList::const_iterator listIt; int idx = addCompletionSource( i18n( "Distribution Lists" ) ); for ( listIt = distLists.begin(); listIt != distLists.end(); ++listIt ) { @@ -557,16 +557,16 @@ void AddresseeLineEdit::loadContacts() addCompletionItem( (*listIt).simplifyWhiteSpace(), weight, idx ); //for CompletionShell, CompletionPopup - QStringList sl( (*listIt).simplifyWhiteSpace() ); + TQStringList sl( (*listIt).simplifyWhiteSpace() ); addCompletionItem( (*listIt).simplifyWhiteSpace(), weight, idx, &sl ); } #endif - QApplication::restoreOverrideCursor(); + TQApplication::restoreOverrideCursor(); if ( !m_addressBookConnected ) { - connect( addressBook, SIGNAL( addressBookChanged( AddressBook* ) ), SLOT( loadContacts() ) ); + connect( addressBook, TQT_SIGNAL( addressBookChanged( AddressBook* ) ), TQT_SLOT( loadContacts() ) ); m_addressBookConnected = true; } } @@ -581,33 +581,33 @@ void AddresseeLineEdit::addContact( const KABC::Addressee& addr, int weight, int addCompletionItem( addr.formattedName(), weight, source ); //for CompletionShell, CompletionPopup - QStringList sl( addr.formattedName() ); + TQStringList sl( addr.formattedName() ); addCompletionItem( addr.formattedName(), weight, source, &sl ); return; } #endif //m_contactMap.insert( addr.realName(), addr ); - const QStringList emails = addr.emails(); - QStringList::ConstIterator it; + const TQStringList emails = addr.emails(); + TQStringList::ConstIterator it; const int prefEmailWeight = 1; //increment weight by prefEmailWeight int isPrefEmail = prefEmailWeight; //first in list is preferredEmail for ( it = emails.begin(); it != emails.end(); ++it ) { //TODO: highlight preferredEmail - const QString email( (*it) ); - const QString givenName = addr.givenName(); - const QString familyName= addr.familyName(); - const QString nickName = addr.nickName(); - const QString domain = email.mid( email.find( '@' ) + 1 ); - QString fullEmail = addr.fullEmail( email ); + const TQString email( (*it) ); + const TQString givenName = addr.givenName(); + const TQString familyName= addr.familyName(); + const TQString nickName = addr.nickName(); + const TQString domain = email.mid( email.find( '@' ) + 1 ); + TQString fullEmail = addr.fullEmail( email ); //TODO: let user decide what fields to use in lookup, e.g. company, city, ... //for CompletionAuto if ( givenName.isEmpty() && familyName.isEmpty() ) { addCompletionItem( fullEmail, weight + isPrefEmail, source ); // use whatever is there } else { - const QString byFirstName= "\"" + givenName + " " + familyName + "\" <" + email + ">"; - const QString byLastName = "\"" + familyName + ", " + givenName + "\" <" + email + ">"; + const TQString byFirstName= "\"" + givenName + " " + familyName + "\" <" + email + ">"; + const TQString byLastName = "\"" + familyName + ", " + givenName + "\" <" + email + ">"; addCompletionItem( byFirstName, weight + isPrefEmail, source ); addCompletionItem( byLastName, weight + isPrefEmail, source ); } @@ -615,18 +615,18 @@ void AddresseeLineEdit::addContact( const KABC::Addressee& addr, int weight, int addCompletionItem( email, weight + isPrefEmail, source ); if ( !nickName.isEmpty() ){ - const QString byNick = "\"" + nickName + "\" <" + email + ">"; + const TQString byNick = "\"" + nickName + "\" <" + email + ">"; addCompletionItem( byNick, weight + isPrefEmail, source ); } if ( !domain.isEmpty() ){ - const QString byDomain = "\"" + domain + " " + familyName + " " + givenName + "\" <" + email + ">"; + const TQString byDomain = "\"" + domain + " " + familyName + " " + givenName + "\" <" + email + ">"; addCompletionItem( byDomain, weight + isPrefEmail, source ); } //for CompletionShell, CompletionPopup - QStringList keyWords; - const QString realName = addr.realName(); + TQStringList keyWords; + const TQString realName = addr.realName(); if ( !givenName.isEmpty() && !familyName.isEmpty() ) { keyWords.append( givenName + " " + familyName ); @@ -665,14 +665,14 @@ void AddresseeLineEdit::addContact( const KABC::Addressee& addr, int weight, int if ( len == 0 ) continue; if( '\0' == (*it)[len-1] ) --len; - const QString tmp = (*it).left( len ); - const QString fullEmail = addr.fullEmail( tmp ); + const TQString tmp = (*it).left( len ); + const TQString fullEmail = addr.fullEmail( tmp ); //kdDebug(5300) << "AddresseeLineEdit::addContact() \"" << fullEmail << "\" weight=" << weight << endl; addCompletionItem( fullEmail.simplifyWhiteSpace(), weight, source ); // Try to guess the last name: if found, we add an extra // entry to the list to make sure completion works even // if the user starts by typing in the last name. - QString name( addr.realName().simplifyWhiteSpace() ); + TQString name( addr.realName().simplifyWhiteSpace() ); if( name.endsWith("\"") ) name.truncate( name.length()-1 ); if( name.startsWith("\"") ) @@ -685,7 +685,7 @@ void AddresseeLineEdit::addContact( const KABC::Addressee& addr, int weight, int bool bDone = false; int i = -1; while( ( i = name.findRev(' ') ) > 1 && !bDone ) { - QString sLastName( name.mid( i+1 ) ); + TQString sLastName( name.mid( i+1 ) ); if( ! sLastName.isEmpty() && 2 <= sLastName.length() && // last names must be at least 2 chars long ! sLastName.endsWith(".") ) { // last names must not end with a dot (like "Jr." or "Sr.") @@ -694,7 +694,7 @@ void AddresseeLineEdit::addContact( const KABC::Addressee& addr, int weight, int sLastName.prepend( "\"" ); sLastName.append( ", " + name + "\" <" ); } - QString sExtraEntry( sLastName ); + TQString sExtraEntry( sLastName ); sExtraEntry.append( tmp.isEmpty() ? addr.preferredEmail() : tmp ); sExtraEntry.append( ">" ); //kdDebug(5300) << "AddresseeLineEdit::addContact() added extra \"" << sExtraEntry.simplifyWhiteSpace() << "\" weight=" << weight << endl; @@ -711,7 +711,7 @@ void AddresseeLineEdit::addContact( const KABC::Addressee& addr, int weight, int } } -void AddresseeLineEdit::addCompletionItem( const QString& string, int weight, int completionItemSource, const QStringList * keyWords ) +void AddresseeLineEdit::addCompletionItem( const TQString& string, int weight, int completionItemSource, const TQStringList * keyWords ) { // Check if there is an exact match for item already, and use the max weight if so. // Since there's no way to get the information from KCompletion, we have to keep our own QMap @@ -747,9 +747,9 @@ void AddresseeLineEdit::stopLDAPLookup() void AddresseeLineEdit::startLoadingLDAPEntries() { - QString s( *s_LDAPText ); + TQString s( *s_LDAPText ); // TODO cache last? - QString prevAddr; + TQString prevAddr; int n = s.findRev( ',' ); if ( n >= 0 ) { prevAddr = s.left( n + 1 ) + ' '; @@ -784,18 +784,18 @@ void AddresseeLineEdit::slotLDAPSearchData( const KPIM::LdapResultList& adrs ) } } -void AddresseeLineEdit::setCompletedItems( const QStringList& items, bool autoSuggest ) +void AddresseeLineEdit::setCompletedItems( const TQStringList& items, bool autoSuggest ) { KCompletionBox* completionBox = this->completionBox(); if ( !items.isEmpty() && !(items.count() == 1 && m_searchString == items.first()) ) { - QString oldCurrentText = completionBox->currentText(); - QListBoxItem *itemUnderMouse = completionBox->itemAt( - completionBox->viewport()->mapFromGlobal(QCursor::pos()) ); - QString oldTextUnderMouse; - QPoint oldPosOfItemUnderMouse; + TQString oldCurrentText = completionBox->currentText(); + TQListBoxItem *itemUnderMouse = completionBox->itemAt( + completionBox->viewport()->mapFromGlobal(TQCursor::pos()) ); + TQString oldTextUnderMouse; + TQPoint oldPosOfItemUnderMouse; if ( itemUnderMouse ) { oldTextUnderMouse = itemUnderMouse->text(); oldPosOfItemUnderMouse = completionBox->itemRect( itemUnderMouse ).topLeft(); @@ -816,7 +816,7 @@ void AddresseeLineEdit::setCompletedItems( const QStringList& items, bool autoSu // Try to re-select what was selected before, otherrwise use the first // item, if there is one - QListBoxItem* item = 0; + TQListBoxItem* item = 0; if ( oldCurrentText.isEmpty() || ( item = completionBox->findItem( oldCurrentText ) ) == 0 ) { item = completionBox->item( 1 ); @@ -824,15 +824,15 @@ void AddresseeLineEdit::setCompletedItems( const QStringList& items, bool autoSu if ( item ) { if ( itemUnderMouse ) { - QListBoxItem *newItemUnderMouse = completionBox->findItem( oldTextUnderMouse ); + TQListBoxItem *newItemUnderMouse = completionBox->findItem( oldTextUnderMouse ); // if the mouse was over an item, before, but now that's elsewhere, // move the cursor, so folks don't accidently click the wrong item if ( newItemUnderMouse ) { - QRect r = completionBox->itemRect( newItemUnderMouse ); - QPoint target = r.topLeft(); + TQRect r = completionBox->itemRect( newItemUnderMouse ); + TQPoint target = r.topLeft(); if ( oldPosOfItemUnderMouse != target ) { target.setX( target.x() + r.width()/2 ); - QCursor::setPos( completionBox->viewport()->mapToGlobal(target) ); + TQCursor::setPos( completionBox->viewport()->mapToGlobal(target) ); } } } @@ -847,7 +847,7 @@ void AddresseeLineEdit::setCompletedItems( const QStringList& items, bool autoSu if ( autoSuggest ) { int index = items.first().find( m_searchString ); - QString newText = items.first().mid( index ); + TQString newText = items.first().mid( index ); setUserSelection(false); setCompletedText(newText,true); } @@ -856,14 +856,14 @@ void AddresseeLineEdit::setCompletedItems( const QStringList& items, bool autoSu { if ( completionBox && completionBox->isVisible() ) { completionBox->hide(); - completionBox->setItems( QStringList() ); + completionBox->setItems( TQStringList() ); } } } -QPopupMenu* AddresseeLineEdit::createPopupMenu() +TQPopupMenu* AddresseeLineEdit::createPopupMenu() { - QPopupMenu *menu = KLineEdit::createPopupMenu(); + TQPopupMenu *menu = KLineEdit::createPopupMenu(); if ( !menu ) return 0; @@ -871,7 +871,7 @@ QPopupMenu* AddresseeLineEdit::createPopupMenu() menu->setItemVisible( ShortAutoCompletion, false ); menu->setItemVisible( PopupAutoCompletion, false ); menu->insertItem( i18n( "Configure Completion Order..." ), - this, SLOT( slotEditCompletionOrder() ) ); + this, TQT_SLOT( slotEditCompletionOrder() ) ); } return menu; } @@ -889,7 +889,7 @@ void KPIM::AddresseeLineEdit::slotIMAPCompletionOrderChanged() s_addressesDirty = true; } -void KPIM::AddresseeLineEdit::slotUserCancelled( const QString& cancelText ) +void KPIM::AddresseeLineEdit::slotUserCancelled( const TQString& cancelText ) { if ( s_LDAPSearch && s_LDAPLineEdit == this ) stopLDAPLookup(); @@ -927,7 +927,7 @@ void AddresseeLineEdit::updateSearchString() } else { - m_previousAddresses = QString::null; + m_previousAddresses = TQString::null; } } @@ -946,7 +946,7 @@ KCompletion::CompOrder KPIM::AddresseeLineEdit::completionOrder() { KConfig config( "kpimcompletionorder" ); config.setGroup( "General" ); - const QString order = config.readEntry( "CompletionOrder", "Weighted" ); + const TQString order = config.readEntry( "CompletionOrder", "Weighted" ); if ( order == "Weighted" ) return KCompletion::Weighted; @@ -954,30 +954,30 @@ KCompletion::CompOrder KPIM::AddresseeLineEdit::completionOrder() return KCompletion::Sorted; } -int KPIM::AddresseeLineEdit::addCompletionSource( const QString &source ) +int KPIM::AddresseeLineEdit::addCompletionSource( const TQString &source ) { s_completionSources->append( source ); return s_completionSources->size()-1; } -bool KPIM::AddresseeLineEdit::eventFilter(QObject *obj, QEvent *e) +bool KPIM::AddresseeLineEdit::eventFilter(TQObject *obj, TQEvent *e) { if ( obj == completionBox() ) { - if ( e->type() == QEvent::MouseButtonPress - || e->type() == QEvent::MouseMove - || e->type() == QEvent::MouseButtonRelease ) { - QMouseEvent* me = static_cast<QMouseEvent*>( e ); + if ( e->type() == TQEvent::MouseButtonPress + || e->type() == TQEvent::MouseMove + || e->type() == TQEvent::MouseButtonRelease ) { + TQMouseEvent* me = static_cast<TQMouseEvent*>( e ); // find list box item at the event position - QListBoxItem *item = completionBox()->itemAt( me->pos() ); + TQListBoxItem *item = completionBox()->itemAt( me->pos() ); if ( !item ) { // In the case of a mouse move outside of the box we don't want // the parent to fuzzy select a header by mistake. - bool eat = e->type() == QEvent::MouseMove; + bool eat = e->type() == TQEvent::MouseMove; return eat; } // avoid selection of headers on button press, or move or release while // a button is pressed - if ( e->type() == QEvent::MouseButtonPress + if ( e->type() == TQEvent::MouseButtonPress || me->state() & LeftButton || me->state() & MidButton || me->state() & RightButton ) { if ( itemIsHeader(item) ) { @@ -988,30 +988,30 @@ bool KPIM::AddresseeLineEdit::eventFilter(QObject *obj, QEvent *e) // to fuzzy auto-selection from QListBox completionBox()->setCurrentItem( item ); completionBox()->setSelected( completionBox()->index( item ), true ); - if ( e->type() == QEvent::MouseMove ) + if ( e->type() == TQEvent::MouseMove ) return true; // avoid fuzzy selection behavior } } } } if ( ( obj == this ) && - ( e->type() == QEvent::AccelOverride ) ) { - QKeyEvent *ke = static_cast<QKeyEvent*>( e ); + ( e->type() == TQEvent::AccelOverride ) ) { + TQKeyEvent *ke = static_cast<TQKeyEvent*>( e ); if ( ke->key() == Key_Up || ke->key() == Key_Down || ke->key() == Key_Tab ) { ke->accept(); return true; } } if ( ( obj == this ) && - ( e->type() == QEvent::KeyPress ) && + ( e->type() == TQEvent::KeyPress ) && completionBox()->isVisible() ) { - QKeyEvent *ke = static_cast<QKeyEvent*>( e ); + TQKeyEvent *ke = static_cast<TQKeyEvent*>( e ); unsigned int currentIndex = completionBox()->currentItem(); if ( ke->key() == Key_Up ) { //kdDebug() << "EVENTFILTER: Key_Up currentIndex=" << currentIndex << endl; // figure out if the item we would be moving to is one we want // to ignore. If so, go one further - QListBoxItem *itemAbove = completionBox()->item( currentIndex - 1 ); + TQListBoxItem *itemAbove = completionBox()->item( currentIndex - 1 ); if ( itemAbove && itemIsHeader(itemAbove) ) { // there is a header above us, check if there is even further up // and if so go one up, so it'll be selected @@ -1030,7 +1030,7 @@ bool KPIM::AddresseeLineEdit::eventFilter(QObject *obj, QEvent *e) } else if ( ke->key() == Key_Down ) { // same strategy for downwards //kdDebug() << "EVENTFILTER: Key_Down. currentIndex=" << currentIndex << endl; - QListBoxItem *itemBelow = completionBox()->item( currentIndex + 1 ); + TQListBoxItem *itemBelow = completionBox()->item( currentIndex + 1 ); if ( itemBelow && itemIsHeader( itemBelow ) ) { if ( completionBox()->item( currentIndex + 2 ) ) { //kdDebug() << "EVENTFILTER: Key_Down -> skipping " << currentIndex+1 << endl; @@ -1049,13 +1049,13 @@ bool KPIM::AddresseeLineEdit::eventFilter(QObject *obj, QEvent *e) // special case of the initial selection, which is unfortunately a header. // Setting it to selected tricks KCompletionBox into not treating is special // and selecting making it current, instead of the one below. - QListBoxItem *item = completionBox()->item( currentIndex ); + TQListBoxItem *item = completionBox()->item( currentIndex ); if ( item && itemIsHeader(item) ) { completionBox()->setSelected( currentIndex, true ); } } else if ( ke->key() == Key_Tab || ke->key() == Key_Backtab ) { /// first, find the header of teh current section - QListBoxItem *myHeader = 0; + TQListBoxItem *myHeader = 0; int i = currentIndex; while ( i>=0 ) { if ( itemIsHeader( completionBox()->item(i) ) ) { @@ -1067,7 +1067,7 @@ bool KPIM::AddresseeLineEdit::eventFilter(QObject *obj, QEvent *e) Q_ASSERT( myHeader ); // we should always be able to find a header // find the next header (searching backwards, for Key_Backtab - QListBoxItem *nextHeader = 0; + TQListBoxItem *nextHeader = 0; const int iterationstep = ke->key() == Key_Tab ? 1 : -1; // when iterating forward, start at the currentindex, when backwards, // one up from our header, or at the end @@ -1079,7 +1079,7 @@ bool KPIM::AddresseeLineEdit::eventFilter(QObject *obj, QEvent *e) j = (j + iterationstep) % completionBox()->count(); } if ( nextHeader && nextHeader != myHeader ) { - QListBoxItem *item = completionBox()->item( j + 1 ); + TQListBoxItem *item = completionBox()->item( j + 1 ); if ( item && !itemIsHeader(item) ) { completionBox()->setSelected( j+1, true ); completionBox()->setCurrentItem( item ); @@ -1092,23 +1092,23 @@ bool KPIM::AddresseeLineEdit::eventFilter(QObject *obj, QEvent *e) return ClickLineEdit::eventFilter( obj, e ); } -const QStringList KPIM::AddresseeLineEdit::getAdjustedCompletionItems( bool fullSearch ) +const TQStringList KPIM::AddresseeLineEdit::getAdjustedCompletionItems( bool fullSearch ) { - QStringList items = fullSearch ? + TQStringList items = fullSearch ? s_completion->allMatches( m_searchString ) : s_completion->substringCompletion( m_searchString ); int lastSourceIndex = -1; unsigned int i = 0; - QMap<int, QStringList> sections; - QStringList sortedItems; - for ( QStringList::Iterator it = items.begin(); it != items.end(); ++it, ++i ) { + TQMap<int, TQStringList> sections; + TQStringList sortedItems; + for ( TQStringList::Iterator it = items.begin(); it != items.end(); ++it, ++i ) { CompletionItemsMap::const_iterator cit = s_completionItemMap->find(*it); if ( cit == s_completionItemMap->end() )continue; int idx = (*cit).second; if ( s_completion->order() == KCompletion::Weighted ) { if ( lastSourceIndex == -1 || lastSourceIndex != idx ) { - const QString sourceLabel( (*s_completionSources)[idx] ); + const TQString sourceLabel( (*s_completionSources)[idx] ); if ( sections.find(idx) == sections.end() ) { items.insert( it, sourceLabel ); } @@ -1125,9 +1125,9 @@ const QStringList KPIM::AddresseeLineEdit::getAdjustedCompletionItems( bool full } } if ( s_completion->order() == KCompletion::Weighted ) { - for ( QMap<int, QStringList>::Iterator it( sections.begin() ), end( sections.end() ); it != end; ++it ) { + for ( TQMap<int, TQStringList>::Iterator it( sections.begin() ), end( sections.end() ); it != end; ++it ) { sortedItems.append( (*s_completionSources)[it.key()] ); - for ( QStringList::Iterator sit( (*it).begin() ), send( (*it).end() ); sit != send; ++sit ) { + for ( TQStringList::Iterator sit( (*it).begin() ), send( (*it).end() ); sit != send; ++sit ) { sortedItems.append( *sit ); } } |