• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

libkdepim

  • sources
  • kde-4.14
  • kdepim
  • libkdepim
  • addressline
  • addresslineedit
addresseelineedit.cpp
Go to the documentation of this file.
1 /*
2  This file is part of libkdepim.
3 
4  Copyright (c) 2002 Helge Deller <deller@gmx.de>
5  Copyright (c) 2002 Lubos Lunak <llunak@suse.cz>
6  Copyright (c) 2001,2003 Carsten Pfeiffer <pfeiffer@kde.org>
7  Copyright (c) 2001 Waldo Bastian <bastian@kde.org>
8  Copyright (c) 2004 Daniel Molkentin <danimo@klaralvdalens-datakonsult.se>
9  Copyright (c) 2004 Karl-Heinz Zimmer <khz@klaralvdalens-datakonsult.se>
10 
11  This library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU Library General Public
13  License as published by the Free Software Foundation; either
14  version 2 of the License, or (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  Library General Public License for more details.
20 
21  You should have received a copy of the GNU Library General Public License
22  along with this library; see the file COPYING.LIB. If not, write to
23  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24  Boston, MA 02110-1301, USA.
25 */
26 
27 #include "addresseelineedit.h"
28 #include "addresseelineedit_p.h"
29 #include "ldap/ldapclientsearch.h"
30 #include "kmailcompletion.h"
31 #include "baloocompletionemail.h"
32 
33 #include <KABC/Addressee>
34 #include <KABC/ContactGroup>
35 #include <KPIMUtils/Email>
36 
37 #include <KLDAP/LdapServer>
38 
39 #include <KMime/Util>
40 
41 #include <KCompletionBox>
42 #include <KDebug>
43 #include <KLocale>
44 #include <KStandardDirs>
45 #include <KStandardShortcut>
46 #include <KUrl>
47 
48 #include <QApplication>
49 #include <QCursor>
50 #include <QObject>
51 #include <QRegExp>
52 #include <QEvent>
53 #include <QClipboard>
54 #include <QKeyEvent>
55 #include <QDropEvent>
56 #include <QMouseEvent>
57 #include <QMenu>
58 #include <QTimer>
59 
60 using namespace KPIM;
61 
62 inline bool itemIsHeader( const QListWidgetItem *item )
63 {
64  return item && !item->text().startsWith( QLatin1String(" ") );
65 }
66 
67 // needs to be unique, but the actual name doesn't matter much
68 static QString newLineEditObjectName()
69 {
70  static int s_count = 0;
71  QString name( QLatin1String("KPIM::AddresseeLineEdit") );
72  if ( s_count++ ) {
73  name += QLatin1Char('-');
74  name += QString::number( s_count );
75  }
76  return name;
77 }
78 
79 AddresseeLineEdit::AddresseeLineEdit( QWidget *parent, bool enableCompletion )
80  : KLineEdit( parent ), d( new AddresseeLineEditPrivate( this, enableCompletion ) )
81 {
82  setObjectName( newLineEditObjectName() );
83  setClickMessage( QString() );
84 
85  d->init();
86 }
87 
88 AddresseeLineEdit::~AddresseeLineEdit()
89 {
90  delete d;
91 }
92 
93 void AddresseeLineEdit::setFont( const QFont &font )
94 {
95  KLineEdit::setFont( font );
96 
97  if ( d->useCompletion() ) {
98  completionBox()->setFont( font );
99  }
100 }
101 
102 void AddresseeLineEdit::setEnableBalooSearch(bool enable)
103 {
104  d->setEnableBalooSearch(enable);
105 }
106 
107 void AddresseeLineEdit::allowSemicolonAsSeparator( bool useSemicolonAsSeparator )
108 {
109  d->setUseSemicolonAsSeparator(useSemicolonAsSeparator);
110 }
111 
112 void AddresseeLineEdit::keyPressEvent( QKeyEvent *event )
113 {
114  bool accept = false;
115 
116  const int key = event->key() | event->modifiers();
117 
118  if ( KStandardShortcut::shortcut( KStandardShortcut::SubstringCompletion ).contains( key ) ) {
119  //TODO: add LDAP substring lookup, when it becomes available in KPIM::LDAPSearch
120  d->updateSearchString();
121  d->startSearches();
122  d->doCompletion( true );
123  accept = true;
124  } else if ( KStandardShortcut::shortcut( KStandardShortcut::TextCompletion ).contains( key ) ) {
125  const int len = text().length();
126 
127  if ( len == cursorPosition() ) { // at End?
128  d->updateSearchString();
129  d->startSearches();
130  d->doCompletion( true );
131  accept = true;
132  }
133  }
134 
135  const QString oldContent = text();
136  if ( !accept ) {
137  KLineEdit::keyPressEvent( event );
138  }
139 
140  // if the text didn't change (eg. because a cursor navigation key was pressed)
141  // we don't need to trigger a new search
142  if ( oldContent == text() ) {
143  return;
144  }
145 
146  if ( event->isAccepted() ) {
147  d->updateSearchString();
148 
149  QString searchString( d->searchString() );
150  //LDAP does not know about our string manipulation, remove it
151  if ( d->searchExtended() ) {
152  searchString = d->searchString().mid( 1 );
153  }
154 
155  d->restartTime(searchString);
156  }
157 }
158 
159 void AddresseeLineEdit::insert( const QString &t )
160 {
161  if ( !d->smartPaste() ) {
162  KLineEdit::insert( t );
163  return;
164  }
165 
166  QString newText = t.trimmed();
167  if ( newText.isEmpty() ) {
168  return;
169  }
170 
171  // remove newlines in the to-be-pasted string
172  QStringList lines = newText.split( QRegExp( QLatin1String( "\r?\n" ) ), QString::SkipEmptyParts );
173  QStringList::iterator end( lines.end() );
174  for ( QStringList::iterator it = lines.begin(); it != end; ++it ) {
175  // remove trailing commas and whitespace
176  (*it).remove( QRegExp( QLatin1String( ",?\\s*$" ) ) );
177  }
178  newText = lines.join( QLatin1String( ", " ) );
179 
180  if ( newText.startsWith( QLatin1String( "mailto:" ) ) ) {
181  const KUrl url( newText );
182  newText = url.path();
183  } else if ( newText.indexOf( QLatin1String( " at " ) ) != -1 ) {
184  // Anti-spam stuff
185  newText.replace( QLatin1String( " at " ), QLatin1String( "@" ) );
186  newText.replace( QLatin1String( " dot " ), QLatin1String( "." ) );
187  } else if ( newText.indexOf( QLatin1String( "(at)" ) ) != -1 ) {
188  newText.replace( QRegExp( QLatin1String( "\\s*\\(at\\)\\s*" ) ), QLatin1String( "@" ) );
189  }
190 
191  QString contents = text();
192  int start_sel = 0;
193  int pos = cursorPosition();
194 
195  if ( hasSelectedText() ) {
196  // Cut away the selection.
197  start_sel = selectionStart();
198  pos = start_sel;
199  contents = contents.left( start_sel ) + contents.mid( start_sel + selectedText().length() );
200  }
201 
202  int eot = contents.length();
203  while ( ( eot > 0 ) && contents.at( eot - 1 ).isSpace() ) {
204  --eot;
205  }
206  if ( eot == 0 ) {
207  contents.clear();
208  } else if ( pos >= eot ) {
209  if ( contents.at( eot - 1 ) == QLatin1Char( ',' ) ) {
210  --eot;
211  }
212  contents.truncate( eot );
213  contents += QLatin1String( ", " );
214  pos = eot + 2;
215  }
216 
217  contents = contents.left( pos ) + newText + contents.mid( pos );
218  setText( contents );
219  setModified( true );
220  setCursorPosition( pos + newText.length() );
221 }
222 
223 void AddresseeLineEdit::setText( const QString & text )
224 {
225  const int cursorPos = cursorPosition();
226  KLineEdit::setText( text.trimmed() );
227  setCursorPosition( cursorPos );
228 }
229 
230 void AddresseeLineEdit::paste()
231 {
232  if ( d->useCompletion() ) {
233  d->setSmartPaste(true);
234  }
235 
236  KLineEdit::paste();
237  d->setSmartPaste(false);
238 }
239 
240 void AddresseeLineEdit::mouseReleaseEvent( QMouseEvent *event )
241 {
242  // reimplemented from QLineEdit::mouseReleaseEvent()
243 #ifndef QT_NO_CLIPBOARD
244  if ( d->useCompletion() &&
245  QApplication::clipboard()->supportsSelection() &&
246  !isReadOnly() &&
247  event->button() == Qt::MidButton ) {
248  d->setSmartPaste(true);
249  }
250 #endif
251 
252  KLineEdit::mouseReleaseEvent( event );
253  d->setSmartPaste(false);
254 }
255 
256 #ifndef QT_NO_DRAGANDDROP
257 void AddresseeLineEdit::dropEvent( QDropEvent *event )
258 {
259  if ( !isReadOnly() ) {
260  const KUrl::List uriList = KUrl::List::fromMimeData( event->mimeData() );
261  if ( !uriList.isEmpty() ) {
262  QString contents = text();
263  // remove trailing white space and comma
264  int eot = contents.length();
265  while ( ( eot > 0 ) && contents.at( eot - 1 ).isSpace() ) {
266  --eot;
267  }
268  if ( eot == 0 ) {
269  contents.clear();
270  } else if ( contents.at( eot - 1 ) == QLatin1Char(',') ) {
271  --eot;
272  contents.truncate( eot );
273  }
274  bool mailtoURL = false;
275  // append the mailto URLs
276  foreach ( const KUrl &url, uriList ) {
277  if ( url.protocol() == QLatin1String( "mailto" ) ) {
278  mailtoURL = true;
279  QString address;
280  address = KUrl::fromPercentEncoding( url.path().toLatin1() );
281  address = KMime::decodeRFC2047String( address.toLatin1() );
282  if ( !contents.isEmpty() ) {
283  contents.append( QLatin1String( ", " ) );
284  }
285  contents.append( address );
286  }
287  }
288  if ( mailtoURL ) {
289  setText( contents );
290  setModified( true );
291  return;
292  }
293  } else {
294  // Let's see if this drop contains a comma separated list of emails
295  const QString dropData = QString::fromUtf8( event->encodedData( "text/plain" ) );
296  const QStringList addrs = KPIMUtils::splitAddressList( dropData );
297  if ( !addrs.isEmpty() ) {
298  setText( KPIMUtils::normalizeAddressesAndDecodeIdn( dropData ) );
299  setModified( true );
300  return;
301  }
302  }
303  }
304 
305  if ( d->useCompletion() ) {
306  d->setSmartPaste(true);
307  }
308 
309  QLineEdit::dropEvent( event );
310  d->setSmartPaste(false);
311 }
312 #endif // QT_NO_DRAGANDDROP
313 
314 void AddresseeLineEdit::cursorAtEnd()
315 {
316  setCursorPosition( text().length() );
317 }
318 
319 void AddresseeLineEdit::enableCompletion( bool enable )
320 {
321  d->setUseCompletion(enable);
322 }
323 
324 bool AddresseeLineEdit::isCompletionEnabled() const
325 {
326  return d->useCompletion();
327 }
328 
329 void AddresseeLineEdit::addItem( const Akonadi::Item &item, int weight, int source )
330 {
331  //Let Akonadi results always have a higher weight than baloo results
332  if ( item.hasPayload<KABC::Addressee>() ) {
333  addContact( item.payload<KABC::Addressee>(), weight + 1, source );
334  } else if ( item.hasPayload<KABC::ContactGroup>() ) {
335  addContactGroup( item.payload<KABC::ContactGroup>(), weight + 1, source );
336  }
337 }
338 
339 void AddresseeLineEdit::addContactGroup( const KABC::ContactGroup &group, int weight, int source )
340 {
341  d->addCompletionItem( group.name(), weight, source );
342 }
343 
344 void AddresseeLineEdit::addContact( const KABC::Addressee &addr, int weight, int source, QString append )
345 {
346  const QStringList emails = addr.emails();
347  QStringList::ConstIterator it;
348  int isPrefEmail = 1; //first in list is preferredEmail
349  QStringList::ConstIterator end( emails.constEnd() );
350  for ( it = emails.constBegin(); it != end; ++it ) {
351  //TODO: highlight preferredEmail
352  const QString email( (*it) );
353  const QString givenName = addr.givenName();
354  const QString familyName= addr.familyName();
355  const QString nickName = addr.nickName();
356  QString fullEmail = addr.fullEmail( email );
357 
358  QString appendix;
359 
360  if ( !append.isEmpty() ) {
361  appendix = QLatin1String( " (%1)" );
362  append = append.replace( QLatin1String("("), QLatin1String("[") );
363  append = append.replace( QLatin1String(")"), QLatin1String("]") );
364  appendix = appendix.arg( append );
365  }
366 
367  // Prepare "givenName" + ' ' + "familyName"
368  QString fullName = givenName;
369  if (!familyName.isEmpty()) {
370  if (!fullName.isEmpty())
371  fullName += QLatin1Char(' ');
372  fullName += familyName;
373  }
374 
375  // Finally, we can add the completion items
376  if (!fullName.isEmpty()) {
377  const QString address = KPIMUtils::normalizedAddress(fullName, email, QString());
378  if (fullEmail != address) {
379  // This happens when fullEmail contains a middle name, while our own fullName+email only has "first last".
380  // Let's offer both, the fullEmail with 3 parts, looks a tad formal.
381  d->addCompletionItem(address + appendix, weight + isPrefEmail, source);
382  }
383  }
384 
385  QStringList keyWords;
386  if (!nickName.isEmpty()) {
387  keyWords.append(nickName);
388  }
389 
390  d->addCompletionItem( fullEmail + appendix, weight + isPrefEmail, source, &keyWords );
391 
392  isPrefEmail = 0;
393  }
394 }
395 
396 #ifndef QT_NO_CONTEXTMENU
397 void AddresseeLineEdit::contextMenuEvent( QContextMenuEvent *event )
398 {
399  QMenu *menu = createStandardContextMenu();
400  if ( menu ) { // can be 0 on platforms with only a touch interface
401  menu->exec( event->globalPos() );
402  delete menu;
403  }
404 }
405 
406 QMenu *AddresseeLineEdit::createStandardContextMenu()
407 {
408  // disable modes not supported by KMailCompletion
409  setCompletionModeDisabled( KGlobalSettings::CompletionMan );
410  setCompletionModeDisabled( KGlobalSettings::CompletionPopupAuto );
411 
412  QMenu *menu = KLineEdit::createStandardContextMenu();
413  if ( !menu ) {
414  return 0;
415  }
416 
417  configureCompletionOrder(menu);
418  return menu;
419 }
420 #endif
421 
422 void KPIM::AddresseeLineEdit::configureCompletionOrder(QMenu *menu)
423 {
424  if ( d->useCompletion() ) {
425  menu->addAction( i18n( "Configure Completion Order..." ),
426  d, SLOT(slotEditCompletionOrder()) );
427 
428  QAction *showOU = new QAction(i18n( "Show Organization Unit for LDAP results" ),menu);
429  showOU->setCheckable(true);
430 
431  showOU->setChecked( d->showOU() );
432  connect(showOU, SIGNAL(triggered(bool)), d, SLOT(slotShowOUChanged(bool)));
433  menu->addAction(showOU);
434  //Add i18n in kf5
435  QAction *configureBalooBlackList = new QAction(QLatin1String( "Configure Email Blacklist..." ),menu);
436  connect(configureBalooBlackList, SIGNAL(triggered(bool)), d, SLOT(slotConfigureBalooBlackList()));
437  menu->addAction(configureBalooBlackList);
438  }
439 }
440 
441 void KPIM::AddresseeLineEdit::removeCompletionSource(const QString &source)
442 {
443  d->removeCompletionSource(source);
444 }
445 
446 int KPIM::AddresseeLineEdit::addCompletionSource( const QString &source, int weight )
447 {
448  return d->addCompletionSource(source,weight);
449 }
450 
451 bool KPIM::AddresseeLineEdit::eventFilter( QObject *object, QEvent *event )
452 {
453  if ( d->completionInitialized() &&
454  ( object == completionBox() ||
455  completionBox()->findChild<QWidget*>( object->objectName() ) == object ) ) {
456  if ( event->type() == QEvent::MouseButtonPress ||
457  event->type() == QEvent::MouseMove ||
458  event->type() == QEvent::MouseButtonRelease ||
459  event->type() == QEvent::MouseButtonDblClick ) {
460 
461  const QMouseEvent* mouseEvent = static_cast<QMouseEvent*>( event );
462  // find list box item at the event position
463  QListWidgetItem *item = completionBox()->itemAt( mouseEvent->pos() );
464  if ( !item ) {
465  // In the case of a mouse move outside of the box we don't want
466  // the parent to fuzzy select a header by mistake.
467  const bool eat = event->type() == QEvent::MouseMove;
468  return eat;
469  }
470  // avoid selection of headers on button press, or move or release while
471  // a button is pressed
472  const Qt::MouseButtons buttons = mouseEvent->buttons();
473  if ( event->type() == QEvent::MouseButtonPress ||
474  event->type() == QEvent::MouseButtonDblClick ||
475  buttons & Qt::LeftButton || buttons & Qt::MidButton ||
476  buttons & Qt::RightButton ) {
477  if ( itemIsHeader( item ) ) {
478  return true; // eat the event, we don't want anything to happen
479  } else {
480  // if we are not on one of the group heading, make sure the item
481  // below or above is selected, not the heading, inadvertedly, due
482  // to fuzzy auto-selection from QListBox
483  completionBox()->setCurrentItem( item );
484  item->setSelected( true );
485  if ( event->type() == QEvent::MouseMove ) {
486  return true; // avoid fuzzy selection behavior
487  }
488  }
489  }
490  }
491  }
492 
493  if ( ( object == this ) &&
494  ( event->type() == QEvent::ShortcutOverride ) ) {
495  QKeyEvent *keyEvent = static_cast<QKeyEvent*>( event );
496  if ( keyEvent->key() == Qt::Key_Up || keyEvent->key() == Qt::Key_Down ||
497  keyEvent->key() == Qt::Key_Tab ) {
498  keyEvent->accept();
499  return true;
500  }
501  }
502 
503  if ( ( object == this ) &&
504  ( event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease ) &&
505  completionBox()->isVisible() ) {
506  const QKeyEvent *keyEvent = static_cast<QKeyEvent*>( event );
507  int currentIndex = completionBox()->currentRow();
508  if ( currentIndex < 0 ) {
509  return true;
510  }
511  if ( keyEvent->key() == Qt::Key_Up ) {
512  //kDebug() <<"EVENTFILTER: Qt::Key_Up currentIndex=" << currentIndex;
513  // figure out if the item we would be moving to is one we want
514  // to ignore. If so, go one further
515  const QListWidgetItem *itemAbove = completionBox()->item( currentIndex );
516  if ( itemAbove && itemIsHeader( itemAbove ) ) {
517  // there is a header above is, check if there is even further up
518  // and if so go one up, so it'll be selected
519  if ( currentIndex > 0 && completionBox()->item( currentIndex - 1 ) ) {
520  //kDebug() <<"EVENTFILTER: Qt::Key_Up -> skipping" << currentIndex - 1;
521  completionBox()->setCurrentRow( currentIndex - 1 );
522  completionBox()->item( currentIndex - 1 )->setSelected( true );
523  } else if ( currentIndex == 0 ) {
524  // nothing to skip to, let's stay where we are, but make sure the
525  // first header becomes visible, if we are the first real entry
526  completionBox()->scrollToItem( completionBox()->item( 0 ) );
527  QListWidgetItem *item = completionBox()->item( currentIndex );
528  if ( item ) {
529  if ( itemIsHeader( item ) ) {
530  currentIndex++;
531  item = completionBox()->item( currentIndex );
532  }
533  completionBox()->setCurrentItem( item );
534  item->setSelected( true );
535  }
536  }
537 
538  return true;
539  }
540  } else if ( keyEvent->key() == Qt::Key_Down ) {
541  // same strategy for downwards
542  //kDebug() <<"EVENTFILTER: Qt::Key_Down. currentIndex=" << currentIndex;
543  const QListWidgetItem *itemBelow = completionBox()->item( currentIndex );
544  if ( itemBelow && itemIsHeader( itemBelow ) ) {
545  if ( completionBox()->item( currentIndex + 1 ) ) {
546  //kDebug() <<"EVENTFILTER: Qt::Key_Down -> skipping" << currentIndex+1;
547  completionBox()->setCurrentRow( currentIndex + 1 );
548  completionBox()->item( currentIndex + 1 )->setSelected( true );
549  } else {
550  // nothing to skip to, let's stay where we are
551  QListWidgetItem *item = completionBox()->item( currentIndex );
552  if ( item ) {
553  completionBox()->setCurrentItem( item );
554  item->setSelected( true );
555  }
556  }
557 
558  return true;
559  }
560  // special case of the initial selection, which is unfortunately a header.
561  // Setting it to selected tricks KCompletionBox into not treating is special
562  // and selecting making it current, instead of the one below.
563  QListWidgetItem *item = completionBox()->item( currentIndex );
564  if ( item && itemIsHeader( item ) ) {
565  completionBox()->setCurrentItem( item );
566  item->setSelected( true );
567  }
568  } else if ( event->type() == QEvent::KeyRelease &&
569  ( keyEvent->key() == Qt::Key_Tab || keyEvent->key() == Qt::Key_Backtab ) ) {
571  QListWidgetItem *myHeader = 0;
572  int myHeaderIndex = -1;
573  const int iterationStep = keyEvent->key() == Qt::Key_Tab ? 1 : -1;
574  int index = qMin( qMax( currentIndex - iterationStep, 0 ), completionBox()->count() - 1 );
575  while ( index >= 0 ) {
576  if ( itemIsHeader( completionBox()->item( index ) ) ) {
577  myHeader = completionBox()->item( index );
578  myHeaderIndex = index;
579  break;
580  }
581 
582  index--;
583  }
584  Q_ASSERT( myHeader ); // we should always be able to find a header
585 
586  // find the next header (searching backwards, for Qt::Key_Backtab)
587  QListWidgetItem *nextHeader = 0;
588 
589  // when iterating forward, start at the currentindex, when backwards,
590  // one up from our header, or at the end
591  uint j;
592  if ( keyEvent->key() == Qt::Key_Tab ) {
593  j = currentIndex;
594  } else {
595  index = myHeaderIndex;
596  if ( index == 0 ) {
597  j = completionBox()->count() - 1;
598  } else {
599  j = ( index - 1 ) % completionBox()->count();
600  }
601  }
602  while ( ( nextHeader = completionBox()->item( j ) ) && nextHeader != myHeader ) {
603  if ( itemIsHeader( nextHeader ) ) {
604  break;
605  }
606  j = ( j + iterationStep ) % completionBox()->count();
607  }
608 
609  if ( nextHeader && nextHeader != myHeader ) {
610  QListWidgetItem *item = completionBox()->item( j + 1 );
611  if ( item && !itemIsHeader( item ) ) {
612  completionBox()->setCurrentItem( item );
613  item->setSelected( true );
614  }
615  }
616 
617  return true;
618  }
619  }
620 
621  return KLineEdit::eventFilter( object, event );
622 }
623 
624 void AddresseeLineEdit::emitTextCompleted()
625 {
626  emit textCompleted();
627 }
628 
629 void AddresseeLineEdit::callUserCancelled(const QString &str)
630 {
631  userCancelled(str);
632 }
633 
634 void AddresseeLineEdit::callSetCompletedText(const QString &text, bool marked)
635 {
636  setCompletedText(text, marked);
637 }
638 
639 void AddresseeLineEdit::callSetCompletedText( const QString& text)
640 {
641  setCompletedText(text);
642 }
643 
644 void AddresseeLineEdit::callSetUserSelection(bool b)
645 {
646  setUserSelection(b);
647 }
KPIM::AddresseeLineEdit::addContact
void addContact(const KABC::Addressee &contact, int weight, int source=-1, QString append=QString())
Adds a new contact to the completion with a given weight source index append is added to completion s...
Definition: addresseelineedit.cpp:344
QString::indexOf
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
QEvent
QWidget
QString::append
QString & append(QChar ch)
QEvent::type
Type type() const
KPIM::AddresseeLineEdit::contextMenuEvent
virtual void contextMenuEvent(QContextMenuEvent *)
Reimplemented for internal reasons.
Definition: addresseelineedit.cpp:397
KPIM::AddresseeLineEdit::dropEvent
virtual void dropEvent(QDropEvent *)
Reimplemented for smart insertion of dragged email addresses.
Definition: addresseelineedit.cpp:257
QString::truncate
void truncate(int position)
KPIM::AddresseeLineEdit::allowSemicolonAsSeparator
void allowSemicolonAsSeparator(bool allow)
Sets whether semicolons are allowed as separators.
Definition: addresseelineedit.cpp:107
QDropEvent::mimeData
const QMimeData * mimeData() const
KPIM::AddresseeLineEditPrivate::smartPaste
bool smartPaste() const
ldapclientsearch.h
KPIM::AddresseeLineEditPrivate::init
void init()
newLineEditObjectName
static QString newLineEditObjectName()
Definition: addresseelineedit.cpp:68
KPIM::AddresseeLineEdit::callUserCancelled
void callUserCancelled(const QString &str)
Definition: addresseelineedit.cpp:629
QString::split
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
QAction::setChecked
void setChecked(bool)
QFont
KPIM::AddresseeLineEdit::textCompleted
void textCompleted()
QMenu::addAction
void addAction(QAction *action)
QListWidgetItem
QListWidgetItem::type
int type() const
QMouseEvent
QStringList::join
QString join(const QString &separator) const
QMouseEvent::buttons
Qt::MouseButtons buttons() const
KPIM::AddresseeLineEditPrivate::useCompletion
bool useCompletion() const
QContextMenuEvent::globalPos
const QPoint & globalPos() const
kmailcompletion.h
KPIM::AddresseeLineEdit::addItem
void addItem(const Akonadi::Item &item, int weight, int source=-1)
Definition: addresseelineedit.cpp:329
KPIM::AddresseeLineEdit::~AddresseeLineEdit
virtual ~AddresseeLineEdit()
Destroys the addressee line edit.
Definition: addresseelineedit.cpp:88
QString::clear
void clear()
QRegExp
itemIsHeader
bool itemIsHeader(const QListWidgetItem *item)
Definition: addresseelineedit.cpp:62
KPIM::AddresseeLineEditPrivate::updateSearchString
void updateSearchString()
QString::number
QString number(int n, int base)
KPIM::AddresseeLineEdit::keyPressEvent
virtual void keyPressEvent(QKeyEvent *)
Reimplemented for internal reasons.
Definition: addresseelineedit.cpp:112
QList::append
void append(const T &value)
QString::fromUtf8
QString fromUtf8(const char *str, int size)
QChar::isSpace
bool isSpace() const
QEvent::isAccepted
bool isAccepted() const
KPIM::AddresseeLineEditPrivate
Definition: addresseelineedit_p.h:33
QApplication::clipboard
QClipboard * clipboard()
addresseelineedit.h
QContextMenuEvent
QObject
KPIM::AddresseeLineEdit::removeCompletionSource
void removeCompletionSource(const QString &source)
Definition: addresseelineedit.cpp:441
KPIM::AddresseeLineEdit::createStandardContextMenu
virtual QMenu * createStandardContextMenu()
Reimplemented for subclass access to menu.
Definition: addresseelineedit.cpp:406
KPIM::AddresseeLineEdit::insert
virtual void insert(const QString &)
Reimplemented for smart insertion of email addresses.
Definition: addresseelineedit.cpp:159
QDropEvent
QString::isEmpty
bool isEmpty() const
QString::trimmed
QString trimmed() const
KPIM::AddresseeLineEditPrivate::searchExtended
bool searchExtended() const
KPIM::AddresseeLineEditPrivate::setUseSemicolonAsSeparator
void setUseSemicolonAsSeparator(bool useSemicolonAsSeparator)
QString::startsWith
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
addresseelineedit_p.h
KPIM::AddresseeLineEdit::setText
virtual void setText(const QString &text)
Reimplemented for stripping whitespace after completion Danger: This is not virtual in the base class...
Definition: addresseelineedit.cpp:223
KPIM::AddresseeLineEdit::callSetUserSelection
void callSetUserSelection(bool)
Definition: addresseelineedit.cpp:644
KPIM::AddresseeLineEdit::isCompletionEnabled
bool isCompletionEnabled() const
Definition: addresseelineedit.cpp:324
KPIM::AddresseeLineEdit::cursorAtEnd
void cursorAtEnd()
Moves the cursor at the end of the line edit.
Definition: addresseelineedit.cpp:314
KPIM::AddresseeLineEdit::addCompletionSource
int addCompletionSource(const QString &name, int weight)
Adds the name of a completion source and its weight to the internal list of completion sources and re...
Definition: addresseelineedit.cpp:446
KPIM::AddresseeLineEdit::AddresseeLineEdit
AddresseeLineEdit(QWidget *parent, bool enableCompletion=true)
Creates a new addressee line edit.
Definition: addresseelineedit.cpp:79
QString
KPIM::AddresseeLineEditPrivate::doCompletion
void doCompletion(bool ctrlT)
KPIM::AddresseeLineEditPrivate::restartTime
void restartTime(const QString &searchString)
QMenu::exec
QAction * exec()
QList::iterator
baloocompletionemail.h
QStringList
KPIM::AddresseeLineEdit::emitTextCompleted
void emitTextCompleted()
Definition: addresseelineedit.cpp:624
QList::end
iterator end()
KPIM::AddresseeLineEdit::setEnableBalooSearch
void setEnableBalooSearch(bool enable)
Definition: addresseelineedit.cpp:102
QKeyEvent::key
int key() const
QMenu
QEvent::accept
void accept()
KPIM::AddresseeLineEditPrivate::startSearches
void startSearches()
QDropEvent::encodedData
virtual QByteArray encodedData(const char *format) const
QLatin1Char
KPIM::AddresseeLineEdit::configureCompletionOrder
virtual void configureCompletionOrder(QMenu *menu)
Definition: addresseelineedit.cpp:422
QAction::setCheckable
void setCheckable(bool)
QString::replace
QString & replace(int position, int n, QChar after)
KPIM::AddresseeLineEditPrivate::searchString
QString searchString() const
QKeyEvent
KPIM::AddresseeLineEdit::mouseReleaseEvent
virtual void mouseReleaseEvent(QMouseEvent *)
Reimplemented for smart insertion with middle mouse button.
Definition: addresseelineedit.cpp:240
KLineEdit
Qt::MouseButtons
typedef MouseButtons
QString::mid
QString mid(int position, int n) const
KPIM::AddresseeLineEdit::paste
virtual void paste()
Reimplemented for smart insertion of pasted email addresses.
Definition: addresseelineedit.cpp:230
QLatin1String
KPIM::AddresseeLineEdit::callSetCompletedText
void callSetCompletedText(const QString &, bool)
Definition: addresseelineedit.cpp:634
QString::at
const QChar at(int position) const
QAction
QList::ConstIterator
typedef ConstIterator
KPIM::AddresseeLineEdit::setFont
void setFont(const QFont &font)
Reimplemented for setting the font for line edit and completion box.
Definition: addresseelineedit.cpp:93
KPIM::AddresseeLineEditPrivate::setUseCompletion
void setUseCompletion(bool useCompletion)
QClipboard::supportsSelection
bool supportsSelection() const
QString::length
int length() const
QString::left
QString left(int n) const
KPIM::AddresseeLineEditPrivate::addCompletionItem
void addCompletionItem(const QString &string, int weight, int source, const QStringList *keyWords=0)
QMouseEvent::pos
const QPoint & pos() const
QList::constEnd
const_iterator constEnd() const
QList::constBegin
const_iterator constBegin() const
KPIM::AddresseeLineEditPrivate::setEnableBalooSearch
void setEnableBalooSearch(bool enableBalooSearch)
QString::arg
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
KPIM::AddresseeLineEdit::enableCompletion
void enableCompletion(bool enable)
Sets whether autocompletion shall be enabled.
Definition: addresseelineedit.cpp:319
QListWidgetItem::setSelected
void setSelected(bool select)
QList::begin
iterator begin()
QListWidgetItem::text
QString text() const
KPIM::AddresseeLineEditPrivate::setSmartPaste
void setSmartPaste(bool smartPaste)
KPIM::AddresseeLineEdit::addContactGroup
void addContactGroup(const KABC::ContactGroup &group, int weight, int source=-1)
Same as the above, but this time with contact groups.
Definition: addresseelineedit.cpp:339
QLineEdit::dropEvent
virtual void dropEvent(QDropEvent *e)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:33:50 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkdepim

Skip menu "libkdepim"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal