Bug 58013 - close and save with no write permissions
Summary: close and save with no write permissions
Status: RESOLVED FIXED
Alias: None
Product: quanta
Classification: Miscellaneous
Component: general (show other bugs)
Version: 3.1.1
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: András Manţia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-02 12:52 UTC by Ian Fleeton
Modified: 2003-05-02 15:09 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Fleeton 2003-05-02 12:52:30 UTC
Version:           3.1.1 (using KDE KDE 3.1.1)
Installed from:    SuSE RPMs
OS:          Linux

When closing a modified document and prompted to save and save is chosen, but Quanta cannot (for example, no write permissions), Quanta shows a friendly error message* and closes the file anyway. In the case of a saving problem Quanta should keep the file open until the user explicitly closes it without trying to save.

* Saving of the document X failed. Maybe you should try to save in another directory.
Comment 1 András Manţia 2003-05-02 15:09:28 UTC
Subject: quanta

CVS commit by amantia: 

Don't close a modified document if saving has failed [#58013].

CCMAIL: 58013-done@bugs.kde.org


  M +1 -1      ChangeLog   1.159
  M +4 -1      quanta/quanta.cpp   1.271
  M +1 -1      quanta/quanta.h   1.136
  M +8 -8      quanta/quantadoc.cpp   1.98
  M +3 -3      quanta/quantadoc.h   1.34


--- quanta/ChangeLog  #1.158:1.159
@@ -35,5 +35,5 @@
     - use the Attribute Quotation setting
     - fix the syntax of DTD tag files
-
+    - don't close a modified document if saving has failed [#58013]
   - new features:
     - "Replace selection" for script actions replaces the selection if

--- quanta/quanta/quanta.cpp  #1.270:1.271
@@ -218,6 +218,7 @@ void QuantaApp::slotFileSave()
 }
 
-void QuantaApp::slotFileSaveAs()
+bool QuantaApp::slotFileSaveAs()
 {
+  bool result = false;
   if (m_view->writeExists())
   {
@@ -244,7 +245,9 @@ void QuantaApp::slotFileSaveAs()
       }
       slotUpdateStatus(w);
+      result = true;
     }
     fileWatcher->startScan();
   }
+  return result;
 }
 

--- quanta/quanta/quanta.h  #1.135:1.136
@@ -174,5 +174,5 @@ public slots:
   void slotFileOpen( const KURL &, const QString& );
   void slotFileSave();
-  void slotFileSaveAs();
+  bool slotFileSaveAs();
   void slotFileSaveAsLocalTemplate();
   void slotFileSaveAsProjectTemplate();

--- quanta/quanta/quantadoc.cpp  #1.97:1.98
@@ -208,9 +208,9 @@ void QuantaDoc::openDocument(const KURL&
 }
 
-void QuantaDoc::saveDocument(const KURL& url)
+bool QuantaDoc::saveDocument(const KURL& url)
 {
   Document *w = write();
   KURL oldURL = w->url();
-
+  bool result = true;
   if ( !url.isEmpty())
   {
@@ -219,4 +219,5 @@ void QuantaDoc::saveDocument(const KURL&
     {
       KMessageBox::error(quantaApp, i18n("Saving of the document\n%1\nfailed.\nMaybe you should try to save in another directory.").arg(url.prettyURL()));
+      result = false;
     }
     w->closeTempFile();
@@ -237,5 +238,5 @@ void QuantaDoc::saveDocument(const KURL&
   emit title( w->url().url() );
 
-  return;
+  return result;
 }
 
@@ -365,12 +366,11 @@ bool QuantaDoc::saveModified()
            if ( write()->isUntitled() )
            {
-             quantaApp->slotFileSaveAs();
+             completed = quantaApp->slotFileSaveAs();
            }
            else
            {
-             saveDocument( write()->url());
+             completed = saveDocument( write()->url());
             };
 
-           completed=true;
            break;
 
@@ -406,5 +406,5 @@ bool QuantaDoc::isModifiedAll()
   bool modified = false;
 
-  QTabWidget *docTab =quantaApp->view()->writeTab();
+  QTabWidget *docTab = quantaApp->view()->writeTab();
   Document *w;
   for (int i = docTab->count() -1; i >=0; i--)

--- quanta/quanta/quantadoc.h  #1.33:1.34
@@ -47,5 +47,5 @@ public:
   bool newDocument(const KURL&, bool switchToExisting = true);
   void openDocument(const KURL&, const QString& a_encoding = QString::null, bool switchToExisting = true);
-  void saveDocument(const KURL&);
+  bool saveDocument(const KURL&);
   void closeDocument();
 
@@ -59,6 +59,6 @@ public:
   Document* isOpened(const KURL& url);
 
-  /// "save modified" - asks the user
-  /// for saving if the document is modified
+  // "save modified" - asks the user
+  // for saving if the document is modified
   bool saveModified();
   bool saveAll(bool dont_ask=true);