|
|
@ -170,7 +170,7 @@ void AddresseeLineEdit::init()
|
|
|
|
connect( this, TQT_SIGNAL( returnPressed( const TQString& ) ),
|
|
|
|
connect( this, TQT_SIGNAL( returnPressed( const TQString& ) ),
|
|
|
|
this, TQT_SLOT( slotReturnPressed( const TQString& ) ) );
|
|
|
|
this, TQT_SLOT( slotReturnPressed( const TQString& ) ) );
|
|
|
|
|
|
|
|
|
|
|
|
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& ) ),
|
|
|
@ -757,7 +757,7 @@ void AddresseeLineEdit::addContact( const KABC::Addressee& addr, int weight, int
|
|
|
|
void AddresseeLineEdit::addCompletionItem( const TQString& string, int weight, int completionItemSource, const TQStringList * 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.
|
|
|
|
// 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 TQMap
|
|
|
|
// Since there's no way to get the information from TDECompletion, we have to keep our own TQMap
|
|
|
|
CompletionItemsMap::iterator it = s_completionItemMap->find( string );
|
|
|
|
CompletionItemsMap::iterator it = s_completionItemMap->find( string );
|
|
|
|
if ( it != s_completionItemMap->end() ) {
|
|
|
|
if ( it != s_completionItemMap->end() ) {
|
|
|
|
weight = TQMAX( ( *it ).first, weight );
|
|
|
|
weight = TQMAX( ( *it ).first, weight );
|
|
|
@ -840,7 +840,7 @@ void AddresseeLineEdit::slotLDAPSearchData( const KPIM::LdapResultList& adrs )
|
|
|
|
|
|
|
|
|
|
|
|
void AddresseeLineEdit::setCompletedItems( const TQStringList& items, bool autoSuggest )
|
|
|
|
void AddresseeLineEdit::setCompletedItems( const TQStringList& items, bool autoSuggest )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KCompletionBox* completionBox = this->completionBox();
|
|
|
|
TDECompletionBox* completionBox = this->completionBox();
|
|
|
|
|
|
|
|
|
|
|
|
if ( !items.isEmpty() &&
|
|
|
|
if ( !items.isEmpty() &&
|
|
|
|
!(items.count() == 1 && m_searchString == items.first()) )
|
|
|
|
!(items.count() == 1 && m_searchString == items.first()) )
|
|
|
@ -862,9 +862,9 @@ void AddresseeLineEdit::setCompletedItems( const TQStringList& items, bool autoS
|
|
|
|
completionBox->setCancelledText( m_searchString );
|
|
|
|
completionBox->setCancelledText( m_searchString );
|
|
|
|
completionBox->popup();
|
|
|
|
completionBox->popup();
|
|
|
|
// we have to install the event filter after popup(), since that
|
|
|
|
// we have to install the event filter after popup(), since that
|
|
|
|
// calls show(), and that's where KCompletionBox installs its filter.
|
|
|
|
// calls show(), and that's where TDECompletionBox installs its filter.
|
|
|
|
// We want to be first, though, so do it now.
|
|
|
|
// We want to be first, though, so do it now.
|
|
|
|
if ( s_completion->order() == KCompletion::Weighted )
|
|
|
|
if ( s_completion->order() == TDECompletion::Weighted )
|
|
|
|
tqApp->installEventFilter( this );
|
|
|
|
tqApp->installEventFilter( this );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1006,16 +1006,16 @@ void KPIM::AddresseeLineEdit::slotCompletion()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// not cached, to make sure we get an up-to-date value when it changes
|
|
|
|
// not cached, to make sure we get an up-to-date value when it changes
|
|
|
|
KCompletion::CompOrder KPIM::AddresseeLineEdit::completionOrder()
|
|
|
|
TDECompletion::CompOrder KPIM::AddresseeLineEdit::completionOrder()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TDEConfig config( "kpimcompletionorder" );
|
|
|
|
TDEConfig config( "kpimcompletionorder" );
|
|
|
|
config.setGroup( "General" );
|
|
|
|
config.setGroup( "General" );
|
|
|
|
const TQString order = config.readEntry( "CompletionOrder", "Weighted" );
|
|
|
|
const TQString order = config.readEntry( "CompletionOrder", "Weighted" );
|
|
|
|
|
|
|
|
|
|
|
|
if ( order == "Weighted" )
|
|
|
|
if ( order == "Weighted" )
|
|
|
|
return KCompletion::Weighted;
|
|
|
|
return TDECompletion::Weighted;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return KCompletion::Sorted;
|
|
|
|
return TDECompletion::Sorted;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int KPIM::AddresseeLineEdit::addCompletionSource( const TQString &source, int weight )
|
|
|
|
int KPIM::AddresseeLineEdit::addCompletionSource( const TQString &source, int weight )
|
|
|
@ -1133,7 +1133,7 @@ bool KPIM::AddresseeLineEdit::eventFilter(TQObject *obj, TQEvent *e)
|
|
|
|
completionBox()->setSelected( currentIndex, true );
|
|
|
|
completionBox()->setSelected( currentIndex, true );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// special case of the initial selection, which is unfortunately a header.
|
|
|
|
// special case of the initial selection, which is unfortunately a header.
|
|
|
|
// Setting it to selected tricks KCompletionBox into not treating is special
|
|
|
|
// Setting it to selected tricks TDECompletionBox into not treating is special
|
|
|
|
// and selecting making it current, instead of the one below.
|
|
|
|
// and selecting making it current, instead of the one below.
|
|
|
|
TQListBoxItem *item = completionBox()->item( currentIndex );
|
|
|
|
TQListBoxItem *item = completionBox()->item( currentIndex );
|
|
|
|
if ( item && itemIsHeader(item) ) {
|
|
|
|
if ( item && itemIsHeader(item) ) {
|
|
|
@ -1233,7 +1233,7 @@ const TQStringList KPIM::AddresseeLineEdit::getAdjustedCompletionItems( bool ful
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
int idx = (*cit).second;
|
|
|
|
int idx = (*cit).second;
|
|
|
|
|
|
|
|
|
|
|
|
if ( s_completion->order() == KCompletion::Weighted ) {
|
|
|
|
if ( s_completion->order() == TDECompletion::Weighted ) {
|
|
|
|
if ( lastSourceIndex == -1 || lastSourceIndex != idx ) {
|
|
|
|
if ( lastSourceIndex == -1 || lastSourceIndex != idx ) {
|
|
|
|
const TQString sourceLabel( (*s_completionSources)[idx] );
|
|
|
|
const TQString sourceLabel( (*s_completionSources)[idx] );
|
|
|
|
if ( sections.find(idx) == sections.end() ) {
|
|
|
|
if ( sections.find(idx) == sections.end() ) {
|
|
|
@ -1247,12 +1247,12 @@ const TQStringList KPIM::AddresseeLineEdit::getAdjustedCompletionItems( bool ful
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sections[idx].append( *it );
|
|
|
|
sections[idx].append( *it );
|
|
|
|
|
|
|
|
|
|
|
|
if ( s_completion->order() == KCompletion::Sorted ) {
|
|
|
|
if ( s_completion->order() == TDECompletion::Sorted ) {
|
|
|
|
sortedItems.append( *it );
|
|
|
|
sortedItems.append( *it );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ( s_completion->order() == KCompletion::Weighted ) {
|
|
|
|
if ( s_completion->order() == TDECompletion::Weighted ) {
|
|
|
|
|
|
|
|
|
|
|
|
// Sort the sections
|
|
|
|
// Sort the sections
|
|
|
|
TQValueList<SourceWithWeight> sourcesAndWeights;
|
|
|
|
TQValueList<SourceWithWeight> sourcesAndWeights;
|
|
|
|