224
224
m_completionInitialized( false ),
225
225
m_smartPaste( false ),
226
226
m_addressBookConnected( false ),
227
m_lastSearchMode( false ),
227
228
m_searchExtended( false ),
228
229
m_useSemicolonAsSeparator( false )
231
m_delayedQueryTimer.setSingleShot(true);
232
connect( &m_delayedQueryTimer, SIGNAL(timeout()), q, SLOT(slotTriggerDelayedQueries()) );
258
261
void stopNepomukSearch();
259
262
void slotNepomukHits( const QList<Nepomuk2::Query::Result>& result );
260
263
void slotNepomukSearchFinished();
264
void slotTriggerDelayedQueries();
261
265
static KCompletion::CompOrder completionOrder();
263
267
AddresseeLineEdit *q;
347
352
static const char* sparqlquery =
348
//"select distinct ?email where { ?r a nco:Contact . ?r nco:hasEmailAddress ?v . ?v nco:emailAddress ?email . FILTER regex(str(?email), \"\\\\b%1\", \"i\")}";
349
"select distinct ?email ?fullname where { ?r a nco:Contact . ?r nco:hasEmailAddress ?v . ?v nco:emailAddress ?email . "
350
"{ FILTER regex( str(?email), \"\\\\b%1\", \"i\") . ?r nco:fullname ?fullname } "
352
"{ ?r nco:fullname ?fullname . FILTER regex( str(?fullname), \"\\\\b%1\", \"i\") } "
354
"{ ?r nco:fullname ?fullname . ?r nco:nameFamily ?family . FILTER regex( str(?family), \"\\\\b%1\", \"i\") } "
356
"{ ?r nco:fullname ?fullname . ?r nco:nameGiven ?given . FILTER regex( str(?given), \"\\\\b%1\", \"i\") } "
353
"select distinct ?email ?fullname where {"
355
"?r nco:hasEmailAddress ?em ."
356
"?em nco:emailAddress ?email ."
358
"FILTER( ?p in (nco:fullname, nco:nameFamily, nco:nameGiven) )."
359
"FILTER( bif:contains(?fullname, \"'%1*'\") )."
361
"?r nco:hasEmailAddress ?em ."
362
"?em nco:emailAddress ?email ."
363
"FILTER( bif:contains(?email, \"'%1*'\") )."
364
"?r nco:fullname ?fullname ."
359
368
void AddresseeLineEdit::Private::startNepomukSearch()
633
void AddresseeLineEdit::Private::slotTriggerDelayedQueries()
635
if (m_searchString.isEmpty())
638
// If Nepomuk is running, we send a ContactSearch job to
639
// Akonadi, which will forward the query to Nepomuk, be
640
// notified of matching items and return those to us.
641
akonadiPerformSearch();
642
// additionally, we ask Nepomuk directly, to get hits that
643
// did not come in through Akonadi
644
startNepomukSearch();
624
647
void AddresseeLineEdit::Private::startSearches()
626
649
if ( Nepomuk2::ResourceManager::instance()->initialized() ) {
627
// If Nepomuk is running, we send a ContactSearch job to
628
// Akonadi, which will forward the query to Nepomuk, be
629
// notified of matching items and return those to us.
630
akonadiPerformSearch();
631
// additionally, we ask Nepomuk directly, to get hits that
632
// did not come in through Akonadi
633
startNepomukSearch();
650
if (!m_delayedQueryTimer.isActive())
651
m_delayedQueryTimer.start(500);
635
653
// If Nepomuk is not available, we instead simply fetch
636
654
// all contacts from Akonadi and filter them ourselves.