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

List:       kde-commits
Subject:    KDE/kdepimlibs/kabc
From:       Tobias Koenig <tokoe () kde ! org>
Date:       2010-02-14 10:13:49
Message-ID: 1266142429.792955.23172.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1089884 by tokoe:

Add new method fullTypeLabel() that returns the
i18n'ed label of all types concatenated with '/'


 M  +24 -19    phonenumber.cpp  
 M  +13 -0     phonenumber.h  


--- trunk/KDE/kdepimlibs/kabc/phonenumber.cpp #1089883:1089884
@@ -142,25 +142,7 @@
 
 QString PhoneNumber::typeLabel() const
 {
-  QString label;
-  bool first = true;
-
-  const TypeList list = typeList();
-
-  TypeList::ConstIterator it;
-  for ( it = list.begin(); it != list.end(); ++it ) {
-    if ( ( type() & (*it) ) && ( (*it) != Pref ) ) {
-      if ( !first ) {
-        label.append( QLatin1Char( '/' ) );
-      }
-      label.append( typeLabel( *it ) );
-      if ( first ) {
-        first = false;
-      }
-    }
-  }
-
-  return label;
+  return fullTypeLabel( type() );
 }
 
 PhoneNumber::TypeList PhoneNumber::typeList()
@@ -235,6 +217,29 @@
   }
 }
 
+QString PhoneNumber::fullTypeLabel( Type type )
+{
+  QString label;
+  bool first = true;
+
+  const TypeList list = typeList();
+
+  TypeList::ConstIterator it;
+  for ( it = list.begin(); it != list.end(); ++it ) {
+    if ( ( type & (*it) ) && ( (*it) != Pref ) ) {
+      if ( !first )
+        label.append( QLatin1Char( '/' ) );
+
+      label.append( typeLabel( *it ) );
+
+      if ( first )
+        first = false;
+    }
+  }
+
+  return label;
+}
+
 QString PhoneNumber::toString() const
 {
   QString str;
--- trunk/KDE/kdepimlibs/kabc/phonenumber.h #1089883:1089884
@@ -184,6 +184,19 @@
     static QString typeLabel( Type type );
 
     /**
+     * Returns the translated label for phone number @p type.
+     *
+     * In opposite to typeLabel( Type type ), it returns all types
+     * of the phone number concatenated by '/'.
+     *
+     * @param type An OR'ed combination of #TypeFlag
+     *
+     * @see type()
+     * @since 4.5
+     */
+    static QString fullTypeLabel( Type type );
+
+    /**
      * Returns a string representation of the phone number.
      */
     QString toString() const;
[prev in list] [next in list] [prev in thread] [next in thread] 

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