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

List:       kde-commits
Subject:    kdenonbeta/kmobiletools/kmobiletools
From:       Alexander Rensmann <zerraxys () gmx ! net>
Date:       2005-03-28 15:00:04
Message-ID: 20050328150004.820644A6 () office ! kde ! org
[Download RAW message or body]

CVS commit by arensmann: 

Added character encoding for phonebook parsing.


  M +13 -1     engines/at_engine/at_jobs.cpp   1.13
  M +3 -0      engines/at_engine/at_jobs.h   1.13
  M +1 -0      libkmobiletoolsprivate/kmobiletoolsengine.h   1.5


--- kdenonbeta/kmobiletools/kmobiletools/engines/at_engine/at_jobs.cpp  #1.12:1.13
@@ -145,4 +145,16 @@ QString kmobiletoolsATJob::decodeGSM( QS
     }
 
+    return res;
+}
+
+QString kmobiletoolsATJob::decodeString( QString text )
+{
+    QString encoding = engine->getConfig()->at_encoding();
+    if ( encoding.length()==3 && encoding.contains( "GSM", false ) )
+        return decodeGSM( text );
+    else if ( encoding.length()==4 && encoding.contains( "UCS2", false ))
+        return decodeUCS2( text );
+
+    kdDebug() << "Fixme: Unsupported character encoding ("+encoding+")" << endl;
     return text;
 }
@@ -320,5 +332,5 @@ void FetchAddressee::run()
         KABC::Addressee *addr = new KABC::Addressee();
         addr->insertPhoneNumber( KABC::PhoneNumber( expr.cap( 1 ), KABC::PhoneNumber::Cell ) );
-        addr->setGivenName( expr.cap( 2 ) );
+        addr->setGivenName( decodeString( expr.cap( 2 ) ) );
         addresseeList.append( addr );
         kdDebug() << "new addressee!" << addr->assembledName() << endl;

--- kdenonbeta/kmobiletools/kmobiletools/engines/at_engine/at_jobs.h  #1.12:1.13
@@ -54,4 +54,7 @@ class kmobiletoolsATJob : public kmobile
          */
         QString decodeUCS2( QString text );
+        /** Decoes a string using the character encoding given in the configuration.
+        */
+        QString decodeString( QString text );
         static QString parseInfo( QString buffer );
     protected:

--- kdenonbeta/kmobiletools/kmobiletools/libkmobiletoolsprivate/kmobiletoolsengine.h  #1.4:1.5
@@ -67,4 +67,5 @@ Q_OBJECT
         QString revision() const { return s_revision; }
         int getManufacturer() { return i_manufacturer; };
+        DevicesConfig * getConfig() const { return Config; };
     protected:
         SMSList *p_smsList;


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

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