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

List:       koffice-devel
Subject:    Re: Bug 93853: JJ: KWord/KPresenter: no network transparency when
From:       Giovanni Venturi <gventuri73 () tiscali ! it>
Date:       2004-12-01 21:33:00
Message-ID: 200412012233.00559.gventuri73 () tiscali ! it
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


Alle 01:24, mercoledì 1 dicembre 2004, Giovanni Venturi ha scritto:
> I attach the first patch (just for KWord now).
> If you like it I commit. I tryed it and it works.
> Gianni
And that's KPresenter patch. Can I commit both?
Gianni
-- 
A KDE Italian translator
Slackware GNU/Linux current version - kernel 2.6.9

["kpresenter.patch" (text/x-diff)]

Index: kpresenter_view.cc
===================================================================
RCS file: /home/kde/koffice/kpresenter/kpresenter_view.cc,v
retrieving revision 1.1084
diff -u -p -u -p -r1.1084 kpresenter_view.cc
--- kpresenter_view.cc	29 Nov 2004 19:12:21 -0000	1.1084
+++ kpresenter_view.cc	1 Dec 2004 20:53:40 -0000
@@ -730,24 +730,55 @@ void KPresenterView::savePicture( const 
     KFileDialog fd( oldFile, QString::null, this, 0, TRUE );
     fd.setMimeFilter( mimetypes );
     fd.setCaption(i18n("Save Picture"));
+    fd.setOperationMode(KFileDialog::Saving);
     if ( fd.exec() == QDialog::Accepted )
     {
         url = fd.selectedURL();
-        if( url.isEmpty() )
-        {
-            KMessageBox::sorry( this, i18n("File name is empty."),
-                                i18n("Save Picture"));
-            return;
-        }
-        // ### TODO: (JJ:) network transparency, use KIO::NetAccess::upload
-        QFile file( url.path() );
-        if ( file.open( IO_ReadWrite ) ) {
-            picture.save( &file );
-            file.close();
-        }
-        else
-            KMessageBox::error(this, i18n("Error during saving."),
-                               i18n("Save Picture"));
+	if ( url.isValid() )
+            {
+                if ( url.isLocalFile() )
+	        {
+                    QFile file( url.path() );
+                    if ( file.open( IO_ReadWrite ) )
+		    {
+                        picture.save( &file );
+                        file.close();
+                    }
+		    else
+		    {
+                        KMessageBox::error(this,
+                                   i18n("Error during saving."),
+                                   i18n("Save Picture"));
+                    }
+	        }
+	        else
+	        {
+	            KTempFile tempFile;
+                    tempFile.setAutoDelete( true );
+	            if ( tempFile.status() == 0 )
+		    {
+		        QFile file( tempFile.name() );
+		        if ( file.open( IO_ReadWrite ) )
+		        {
+		            picture.save( &file );
+                            file.close();
+			    if ( !KIO::NetAccess::upload( tempFile.name(), url, this ) )
+			    {
+			        KMessageBox::sorry( this, i18n(
+				    "Unable to save the file to '%1'.").arg( url.prettyURL() ),
+				    i18n("Save Failed") );
+		            }
+                        }
+		        else
+		            KMessageBox::error(this,
+                                   i18n("Error during saving."),
+                                   i18n("Save Picture"));
+                    }
+		    else
+		        KMessageBox::sorry( this, i18n(
+			  "Error during saving."), i18n("Save Picture") );
+	        }
+	    }
     }
 }
 

[Attachment #8 (application/pgp-signature)]

_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


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

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