[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kmail-devel
Subject:    Re: Address completion (Re: Duplicates)
From:       Christian Schaarschmidt <schaarsc () gmx ! de>
Date:       2006-10-31 20:26:09
Message-ID: 200610312126.10138.schaarsc () gmx ! de
[Download RAW message or body]

On 2006-09-29 20:58:32   Carsten Pfeiffer wrote:
> > > but then all the matches will be lower case as well ...
> > > there must be an other way...
> >
> > Fix KCompletion.ignoreCase. :-)

> KCompletion only performs the *matching* case insensitively, the matches 
> themselves are kept and returned in their original case.

KCompletion::makeCompletion must use findAllCompletions in IgnorCase mode, 
otherwise IgnoreCase will not work for CompleteAuto. 
Patch is attached.

To finish the "Address completion Patch" I have one wish for KLineEdit. I need 
a way to access menu items in "text completion" submenu to hide some of its 
entries. Either by adding a member function or, as demostrated in the patch, 
by using MenuID.
PopupAuto will be disabled for addresseelineedit by my patch (if it gets ever 
commited :-) because popup items are in  addr.fullEmail format and lookup is 
done on e.g. nickname. It does not make sense to autocomplete the nickname in 
this case. 
@Carsten: What is your opinion on this? Could you commit that change?
    or is it better to add a new method disableCompletionMenuItem(..)?
    in KDE4 will there be QAction or still menuItems?

I have also attached a patch for kabc/scripts/addressee.src.cpp, it would be 
great if this could be commited as well.

Regards
Christian

["addressee.src.diff" (text/x-diff)]

Index: kabc/scripts/addressee.src.cpp
===================================================================
--- kabc/scripts/addressee.src.cpp	(revision 599111)
+++ kabc/scripts/addressee.src.cpp	(working copy)
@@ -182,8 +182,13 @@
 
 --DEFINITIONS--
 
-void Addressee::setNameFromString( const QString &str )
+void Addressee::setNameFromString( const QString &s )
 {
+  QString str = s;
+  //remove enclosing quotes from string
+  if ( str.length() > 1  && s[ 0 ] == '"' && s[ s.length() - 1 ] == '"' )
+    str = s.mid( 1, s.length() - 2 );
+
   setFormattedName( str );
   setName( str );
 

["kcompletion.diff" (text/x-diff)]

Index: kdecore/kcompletion.cpp
===================================================================
--- kdecore/kcompletion.cpp	(revision 599111)
+++ kdecore/kcompletion.cpp	(working copy)
@@ -219,7 +219,8 @@
 
     QString completion;
     // in case-insensitive popup mode, we search all completions at once
-    if ( myCompletionMode == KGlobalSettings::CompletionPopup ||
+    if ( myIgnoreCase ||
+         myCompletionMode == KGlobalSettings::CompletionPopup ||
          myCompletionMode == KGlobalSettings::CompletionPopupAuto ) {
         findAllCompletions( string, &d->matches, myHasMultipleMatches );
         if ( !d->matches.isEmpty() )

["klineedit.diff" (text/x-diff)]

Index: kdeui/klineedit.h
===================================================================
--- kdeui/klineedit.h	(revision 599111)
+++ kdeui/klineedit.h	(working copy)
@@ -602,7 +602,7 @@
     void slotRestoreSelectionColors();
     void setTextWorkaround( const QString& text );
 
-private:
+protected:
 
     // Constants that represent the ID's of the popup menu.
     enum MenuID
@@ -616,6 +616,8 @@
         PopupAutoCompletion
     };
 
+private:
+
     /**
      * Initializes variables.  Called from the constructors.
      */


_______________________________________________
KMail developers mailing list
KMail-devel@kde.org
https://mail.kde.org/mailman/listinfo/kmail-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic