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

List:       kde-commits
Subject:    branches/kopete/0.12/kopete/kopete/config/identity
From:       Michaƫl Larouche <michael.larouche () kdemail ! net>
Date:       2006-04-09 14:54:54
Message-ID: 1144594494.126107.23873.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 527913 by mlarouche:

BUG: 124175

Use MD5 Hash as filename to save custom images in global identity.
So no non-ASCII characters will be in filename.



 M  +15 -2     kopeteidentityconfig.cpp  


--- branches/kopete/0.12/kopete/kopete/config/identity/kopeteidentityconfig.cpp \
#527912:527913 @@ -26,6 +26,7 @@
 #include <qradiobutton.h>
 #include <qcombobox.h>
 #include <qapplication.h>
+#include <qbuffer.h>
 
 // KDE includes
 #include <kcombobox.h>
@@ -41,6 +42,7 @@
 #include <kurlrequester.h>
 #include <kinputdialog.h>
 #include <kpixmapregionselectordialog.h>
+#include <kmdcodec.h>
 
 // KDE KIO includes
 #include <kio/netaccess.h>
@@ -515,8 +517,8 @@
 
 void KopeteIdentityConfig::slotChangePhoto(const QString &photoUrl)
 {
-	QString saveLocation = locateLocal("appdata", \
                "globalidentitiespictures/"+d->selectedIdentity.replace(" ", \
                "-")+".png");
-
+	QString saveLocation;
+	
 	QImage photo(photoUrl);
 	// use KABC photo size 100x140
 	photo = KPixmapRegionSelectorDialog::getSelectedImage( QPixmap(photo), 100, 140, \
this ); @@ -531,6 +533,17 @@
 				photo = photo.scaleWidth(100);
 		}
 
+		// Use MD5 hash to save the filename, so no problems will occur with the filename \
because of non-ASCII characters. +		// Bug 124175: My personnal picture doesn't \
appear cause of l10n +		QByteArray tempArray;
+		QBuffer tempBuffer(tempArray);
+		tempBuffer.open( IO_WriteOnly );
+		photo.save(&tempBuffer, "PNG");
+		KMD5 context(tempArray);
+		// Save the image to a file.
+		saveLocation = context.hexDigest() + ".png";
+		saveLocation = locateLocal( "appdata", \
QString::fromUtf8("globalidentitiespictures/%1").arg( saveLocation ) ); +
 		if(!photo.save(saveLocation, "PNG"))
 		{
 			KMessageBox::sorry(this, 


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

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