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

List:       kde-commits
Subject:    KDE/kdeedu/kmplot/kmplot
From:       David Saxton <david () bluehaze ! org>
Date:       2006-03-31 21:05:04
Message-ID: 1143839104.082852.23905.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 525124 by saxton:

Fix exporting to PNG and BMP files (was passing the full url, not just the path,
to QPixmap).


 M  +48 -42    MainDlg.cpp  


--- trunk/KDE/kdeedu/kmplot/kmplot/MainDlg.cpp #525123:525124
@@ -408,57 +408,63 @@
 	                 i18n("*.svg|Scalable Vector Graphics (*.svg)\n"
 	                      "*.bmp|Bitmap 180dpi (*.bmp)\n"
 	                      "*.png|Bitmap 180dpi (*.png)"), m_parent, i18n("Export") );
-	if(!url.isEmpty())
+	if( url.isEmpty() )
+		return;
+	
+	// check if file exists and overwriting is ok.
+	bool exists = KIO::NetAccess::exists(url,false,m_parent );
+	if ( exists )
 	{
-		// check if file exists and overwriting is ok.
-		if( KIO::NetAccess::exists(url,false,m_parent ) && \
KMessageBox::warningContinueCancel( m_parent, i18n( "A file named \"%1\" already \
exists. Are you sure you want to continue and overwrite this file?" ).arg(url.url() \
), i18n( "Overwrite File?" ), KGuiItem( i18n( "&Overwrite" ) ) ) != \
KMessageBox::Continue ) return; +		int result = KMessageBox::warningContinueCancel( \
m_parent, i18n( "A file named \"%1\" already exists. Are you sure you want to \
continue and overwrite this file?" ).arg(url.url() ), i18n( "Overwrite File?" ), \
KGuiItem( i18n( "&Overwrite" ) ) ); +		if ( result != KMessageBox::Continue )
+			return;
+	}
 
-		if( url.fileName().right(4).toLower()==".svg")
+	if( url.fileName().right(4).toLower()==".svg")
+	{
+		QPicture pic;
+		View::self()->draw(&pic, 2);
+		if (url.isLocalFile() )
+			pic.save( url.path(), "SVG");
+		else
 		{
-			QPicture pic;
-			View::self()->draw(&pic, 2);
-			if (url.isLocalFile() )
-				pic.save( url.prettyURL(0), "SVG");
-			else
-			{
-				KTempFile tmp;
-				pic.save( tmp.name(), "SVG");
-				if ( !KIO::NetAccess::upload(tmp.name(), url, 0) )
-					KMessageBox::error(m_parent, i18n("The URL could not be saved.") );
-				tmp.unlink();
-			}
+			KTempFile tmp;
+			pic.save( tmp.name(), "SVG");
+			if ( !KIO::NetAccess::upload(tmp.name(), url, 0) )
+				KMessageBox::error(m_parent, i18n("The URL could not be saved.") );
+			tmp.unlink();
 		}
+	}
 
-		else if( url.fileName().right(4).toLower()==".bmp")
+	else if( url.fileName().right(4).toLower()==".bmp")
+	{
+		QPixmap pic(100, 100);
+		View::self()->draw(&pic, 3);
+		if (url.isLocalFile() )
+			pic.save(  url.path(), "BMP");
+		else
 		{
-			QPixmap pic(100, 100);
-			View::self()->draw(&pic, 3);
-			if (url.isLocalFile() )
-				pic.save(  url.prettyURL(0), "BMP");
-			else
-			{
-				KTempFile tmp;
-				pic.save( tmp.name(), "BMP");
-				if ( !KIO::NetAccess::upload(tmp.name(), url, 0) )
-					KMessageBox::error(m_parent, i18n("The URL could not be saved.") );
-				tmp.unlink();
-			}
+			KTempFile tmp;
+			pic.save( tmp.name(), "BMP");
+			if ( !KIO::NetAccess::upload(tmp.name(), url, 0) )
+				KMessageBox::error(m_parent, i18n("The URL could not be saved.") );
+			tmp.unlink();
 		}
+	}
 
-		else if( url.fileName().right(4).toLower()==".png")
+	else if( url.fileName().right(4).toLower()==".png")
+	{
+		QPixmap pic(100, 100);
+		View::self()->draw(&pic, 3);
+		if (url.isLocalFile() )
+			pic.save( url.path(), "PNG");
+		else
 		{
-			QPixmap pic(100, 100);
-			View::self()->draw(&pic, 3);
-			if (url.isLocalFile() )
-				pic.save( url.prettyURL(0), "PNG");
-			else
-			{
-				KTempFile tmp;
-				pic.save( tmp.name(), "PNG");
-				if ( !KIO::NetAccess::upload(tmp.name(), url, 0) )
-					KMessageBox::error(m_parent, i18n("The URL could not be saved.") );
-				tmp.unlink();
-			}
+			KTempFile tmp;
+			pic.save( tmp.name(), "PNG");
+			if ( !KIO::NetAccess::upload(tmp.name(), url, 0) )
+				KMessageBox::error(m_parent, i18n("The URL could not be saved.") );
+			tmp.unlink();
 		}
 	}
 }


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

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