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

List:       kde-commits
Subject:    kdeutils/kgpg
From:       Jean-Baptiste Mardelle <bj () altern ! org>
Date:       2004-01-25 13:58:39
Message-ID: 20040125135839.2AE64906D () office ! kde ! org
[Download RAW message or body]

CVS commit by mardelle: 

Fix grave bug #73105.
It introduces a new string, no other way to fix...
Should I backport to 3_2_BRANCH and/or to 3_2_RELEASE ? 


  M +36 -15    kgpgeditor.cpp   1.30


--- kdeutils/kgpg/kgpgeditor.cpp  #1.29:1.30
@@ -260,6 +260,11 @@ return;
                 return;
         }
+
+        KTempFile tmpfile;
+        if (Docname.isLocalFile())
+        {
         QFile f(filn);
         if ( !f.open( IO_WriteOnly ) ) {
+                KMessageBox::sorry(this,i18n("The document could not been saved, \
please check your permissions and disk space."));  return;
         }
@@ -268,4 +272,20 @@ return;
         t << view->editor->text().utf8();
         f.close();
+        }
+        else 
+        {
+        QTextStream *stream = tmpfile.textStream();
+        *stream << view->editor->text().utf8();
+        tmpfile.close();
+        delete stream;
+        if(!KIO::NetAccess::upload(tmpfile.name(), Docname))
+        {
+                KMessageBox::sorry(this,i18n("The document could not been saved, \
please check your permissions and disk space.")); +                tmpfile.unlink();
+                return;
+        }
+        tmpfile.unlink();
+        }
+        
         fileSave->setEnabled(false);
         setCaption(Docname.fileName(),false);
@@ -279,5 +299,6 @@ void KgpgApp::slotFileSaveAs()
                                          i18n("*|All Files"), this, i18n("Save \
As"));  if(!url.isEmpty()) {
-
+                if (url.isLocalFile())
+                {
                 QString filn=url.path();
                 QFile f(filn);
@@ -288,15 +309,15 @@ void KgpgApp::slotFileSaveAs()
                                 return;
                 }
-
-                if ( !f.open( IO_WriteOnly ) ) {
+                f.close();
+                }
+                else if (KIO::NetAccess::exists(url))
+                {
+                QString message=i18n("Overwrite existing file \
%1?").arg(url.filename()); +                        int \
result=KMessageBox::warningContinueCancel(this,QString(message),i18n("Warning"),i18n("Overwrite"));
 +                        if (result==KMessageBox::Cancel)
                         return;
                 }
-
-                QTextStream t( &f );
-                t << view->editor->text();
-                f.close();
                 Docname=url;
-                fileSave->setEnabled(false);
-                setCaption(url.fileName(),false);
+        slotFileSave();
         }
 }


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

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