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

List:       kde-commits
Subject:    kdelibs/kio/kfile
From:       Stephan Binner <binner () kde ! org>
Date:       2005-02-20 12:00:02
Message-ID: 20050220120002.24F611B94C () office ! kde ! org
[Download RAW message or body]

CVS commit by binner: 

Enhance renaming preselection: use mime type database, else search from right


  M +11 -3     kpropertiesdialog.cpp   1.335


--- kdelibs/kio/kfile/kpropertiesdialog.cpp  #1.334:1.335
@@ -88,4 +88,5 @@ extern "C" {
 #include <kio/renamedlg.h>
 #include <kio/netaccess.h>
+#include <kio/kservicetypefactory.h>
 #include <kfiledialog.h>
 #include <kmimetype.h>
@@ -865,7 +866,14 @@ KFilePropsPlugin::KFilePropsPlugin( KPro
 
     // Enhanced rename: Don't highlight the file extension.
-    int firstDot = filename.find('.');
-    if (firstDot > 0)
-      d->m_lined->setSelection(0, firstDot);
+    QString pattern;
+    KServiceTypeFactory::self()->findFromPattern( filename, &pattern );
+    if (!pattern.isEmpty() && pattern.at(0)=='*' && pattern.find('*',1)==-1)
+      d->m_lined->setSelection(0, filename.length()-pattern.stripWhiteSpace().length()+1);
+    else
+    {
+      int lastDot = filename.findRev('.');
+      if (lastDot > 0)
+        d->m_lined->setSelection(0, lastDot);
+    }
 
     connect( d->m_lined, SIGNAL( textChanged( const QString & ) ),


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

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