Bug 57718

Summary: quanta can not open empty files created by touch
Product: quanta Reporter: Thilo Bangert <thilo.bangert>
Component: generalAssignee: András Manţia <amantia>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 3.1.1   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:

Description Thilo Bangert 2003-04-25 23:47:21 UTC
Version:           3.1.1 (using KDE KDE 3.1.1a)
Installed from:    Gentoo Packages

i added a directory containing empty files which were created by touch from the shell.

these files get added to the project OK, but when i try to edit them quanta complains:
"This file cannot be opened with quanta. Do you want to open with an external programm..."

anyway - these are empty files and kate can read them OK...
thanks
Thilo
Comment 1 András Manţia 2003-05-01 14:50:03 UTC
Subject: QUANTA_3_1_BRANCH: quanta

CVS commit by amantia: 

Allow opening of empty local files. [#57718]

CCMAIL: 57718-done@bugs.kde.org
CCMAIL: tamas@komaromi-komaromi.hu


  M +1 -0      ChangeLog   1.90.2.63
  M +20 -15    quanta/quantacommon.cpp   1.29.2.6
  M +3 -3      quanta/treeviews/filemanage.cpp   1.15.2.2


--- quanta/ChangeLog  #1.90.2.62:1.90.2.63
@@ -22,4 +22,5 @@
     - fix the DTD tag files, add warning if they contain syntax errors
     - use the Attribute Quotation setting
+    - allow opening of empty local files [#57718]
  - usability enhancements:
     - bring up the message output window, when and action/plugin wants to printed

--- quanta/quanta/quantacommon.cpp  #1.29.2.5:1.29.2.6
@@ -411,4 +411,7 @@ Format QuantaCommon::findFormatByFileCon
      result.text = v.toBool();
 
+  if (mime->name().startsWith("inode/"))
+     return result;
+
   QFile f(fileName);
   if (f.open(IO_ReadOnly))
@@ -419,4 +422,6 @@ Format QuantaCommon::findFormatByFileCon
         result.compression = Format::GZipCompression;
   }
+  if ((ulong) f.size() == 0)
+    result.text = true;
   return result;
 }