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

List:       kde-commits
Subject:    kdepim/kmail
From:       Till Adam <adam () kde ! org>
Date:       2005-01-17 10:37:24
Message-ID: 20050117103724.A7B811CF53 () office ! kde ! org
[Download RAW message or body]

CVS commit by tilladam: 

Forward port proko2 fix for stripping the encoding from the filename
when attaching files.


  M +4 -10     kmcomposewin.cpp   1.913


--- kdepim/kmail/kmcomposewin.cpp  #1.912:1.913
@@ -2371,6 +2371,4 @@ void KMComposeWin::slotAttachFileResult(
     return;
   }
-  QString name;
-  const QString urlStr = (*it).url.prettyURL();
   const QCString partCharset = (*it).url.fileEncoding().isEmpty()
                              ? mCharset
@@ -2378,17 +2376,11 @@ void KMComposeWin::slotAttachFileResult(
 
   KMMessagePart* msgPart;
-  int i;
 
   KCursorSaver busy(KBusyPtr::busy());
-
+  QString name( (*it).url.fileName() );
   // ask the job for the mime type of the file
   QString mimeType = static_cast<KIO::MimetypeJob*>(job)->mimetype();
 
-  i = urlStr.findRev('/');
-  if( i == -1 )
-    name = urlStr;
-  else if( i + 1 < int( urlStr.length() ) )
-    name = urlStr.mid( i + 1, 256 );
-  else {
+  if ( name.isEmpty() ) {
     // URL ends with '/' (e.g. http://www.kde.org/)
     // guess a reasonable filename
@@ -2411,4 +2403,6 @@ void KMComposeWin::slotAttachFileResult(
   }
 
+  name.truncate( 256 ); // is this needed?
+
   QCString encoding = KMMsgBase::autoDetectCharset(partCharset,
     KMMessage::preferredCharsets(), name);


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

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