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

List:       kde-commits
Subject:    KDE/kdepim/kmail
From:       Ingo Klöcker <kloecker () kde ! org>
Date:       2005-09-30 21:04:54
Message-ID: 1128114294.787690.26277.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 465790 by kloecker:

Get rid of KPIM::kFileToString.


 M  +2 -1      kmedit.cpp  
 M  +3 -3      kmfoldermaildir.cpp  
 M  +6 -13     kmkernel.cpp  
 M  +1 -1      kmreaderwin.cpp  


--- trunk/KDE/kdepim/kmail/kmedit.cpp #465789:465790
@@ -510,7 +510,8 @@
   setAutoUpdate(false);
   clear();
 
-  insertLine(QString::fromLocal8Bit(KPIM::kFileToString( fileName, true, false )), \
-1); +  QByteArray ba = KPIM::kFileToByteArray( fileName, true, false );
+  insertLine( QString::fromLocal8Bit( ba.data(), ba.size() ), -1 );
   setAutoUpdate(true);
   repaint();
 }
--- trunk/KDE/kdepim/kmail/kmfoldermaildir.cpp #465789:465790
@@ -613,9 +613,9 @@
 
   QFileInfo fi( abs_file );
   mDest.resize(fi.size()+2);
-  mDest = KPIM::kFileToString(abs_file, false, false);
-  size_t newMsgSize = KMail::Util::crlf2lf( mDest.data(), fi.size() );
-  mDest[newMsgSize] = '\0';
+  mDest = KPIM::kFileToByteArray( abs_file, false, false );
+  const size_t newMsgSize = KMail::Util::crlf2lf( mDest.data(), fi.size() );
+  mDest.truncate( newMsgSize );
   return mDest;
 }
 
--- trunk/KDE/kdepim/kmail/kmkernel.cpp #465789:465790
@@ -384,9 +384,9 @@
     msg->setBcc( KMMsgBase::decodeRFC2047String( bcc.latin1() ) );
   if (!subject.isEmpty()) msg->setSubject(subject);
   if (!messageFile.isEmpty() && messageFile.isLocalFile()) {
-    Q3CString str = KPIM::kFileToString( messageFile.path(), true, false );
+    QByteArray str = KPIM::kFileToByteArray( messageFile.path(), true, false );
     if( !str.isEmpty() )
-      msg->setBody( QString::fromLocal8Bit( str ).utf8() );
+      msg->setBody( QString::fromLocal8Bit( str.data(), str.size() ).utf8() );
   }
   else if (!body.isEmpty())
     msg->setBody(body.utf8());
@@ -728,15 +728,8 @@
 
   if (!msgUrl.isEmpty() && msgUrl.isLocalFile()) {
 
-    // This is a proposed change by Daniel Andor.
-    // He proposed to change from the fopen(blah)
-    // to a KPIM::kFileToString(blah).
-    // Although it assigns a QString to a QString,
-    // because of the implicit sharing this poses
-    // no memory or performance penalty.
-
-    const Q3CString messageText =
-      KPIM::kFileToString( msgUrl.path(), true, false );
+    const QByteArray messageText =
+      KPIM::kFileToByteArray( msgUrl.path(), true, false );
     if ( messageText.isEmpty() )
       return -2;
 
@@ -915,8 +908,8 @@
 
 
   if ( !msgUrl.isEmpty() && msgUrl.isLocalFile() ) {
-    const Q3CString messageText =
-      KPIM::kFileToString( msgUrl.path(), true, false );
+    const QByteArray messageText =
+      KPIM::kFileToByteArray( msgUrl.path(), true, false );
     if ( messageText.isEmpty() )
       return -2;
 
--- trunk/KDE/kdepim/kmail/kmreaderwin.cpp #465789:465790
@@ -1283,7 +1283,7 @@
   adjustLayout();
 
   QString location = locate("data", "kmail/about/main.html");
-  QString content = KPIM::kFileToString(location);
+  QString content = KPIM::kFileToByteArray( location );
   content = content.arg( locate( "data", "libkdepim/about/kde_infopage.css" ) );
   if ( kapp->reverseLayout() )
     content = content.arg( "@import \"%1\";" ).arg( locate( "data", \
"libkdepim/about/kde_infopage_rtl.css" ) );


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

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