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

List:       kde-commits
Subject:    kdeaddons/kfile-plugins/txt
From:       Waldo Bastian <bastian () kde ! org>
Date:       2003-05-25 16:43:48
[Download RAW message or body]

CVS commit by waba: 

Don't provide word & line count for files > 100Kb, it's too slow.


  M +8 -2      kfile_txt.cpp   1.5


--- kdeaddons/kfile-plugins/txt/kfile_txt.cpp  #1.4:1.5
@@ -68,4 +68,5 @@ bool KTxtPlugin::readInfo(KFileMetaInfo&
     QString fileFormat;
     QString line;
+    bool skipTotals = (totChars > 100*1024); // 100K is the max we read
  
     int bytesRead = 0;
@@ -96,4 +97,6 @@ bool KTxtPlugin::readInfo(KFileMetaInfo&
             else if (line[len-1]=='\r')
                 fileFormat = i18n("Macintosh");
+            if (skipTotals)
+                break;
         }
 
@@ -111,6 +114,9 @@ bool KTxtPlugin::readInfo(KFileMetaInfo&
 
     KFileMetaInfoGroup group = appendGroup(info, "General");
+    if (!skipTotals)
+    {
     appendItem(group, "Lines", totLines);
     appendItem(group, "Words", totWords);
+    }
     appendItem(group, "Characters", totChars);
     appendItem(group, "Format", fileFormat);


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

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