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

List:       kde-commits
Subject:    playground/utils/gwenrename
From:       Spiros Georgaras <sngeorgaras () otenet ! gr>
Date:       2008-02-27 15:40:16
Message-ID: 1204126816.054546.7993.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 779958 by sngeorgaras:

fixing renaming procedure regression


 D             doc/index.docbook  
 M  +3 -0      inputdir.ui  
 M  +3 -2      main.cpp  
 D             namepartbase.ui  
 D             namepartbase.ui.h  
 M  +24 -9     rename.ui.h  


--- trunk/playground/utils/gwenrename/inputdir.ui #779957:779958
@@ -157,6 +157,9 @@
                             <property name="text">
                                 <string></string>
                             </property>
+                            <property name="toolTip" stdset="0">
+                                <string>Clear content</string>
+                            </property>
                         </widget>
                         <widget class="KComboBox">
                             <property name="name">
--- trunk/playground/utils/gwenrename/main.cpp #779957:779958
@@ -34,11 +34,12 @@
 #include "filesdata.h"
 #include "dirsdata.h"
 #include "iconload.h"
-#include "namepart.h"
 #include "initaskmode.h"
 #include "inputdir.h"
 #include "main.h"
+//#include "namepart.h"
 
+
 filesData f;
 dirsData g;
 bool InitiatedRename=FALSE;
@@ -49,7 +50,7 @@
 KAboutData * ab;
 bool noProfiles=FALSE;
 
-namePartBase* b;
+//namePartBase* b;
 int askResult=2;
 QString askDir;
 
--- trunk/playground/utils/gwenrename/rename.ui.h #779957:779958
@@ -416,6 +416,14 @@
 	QString toConv="-";
 	if(spaceToUnder->isChecked()) toConv="_";
 	
+	QString thePath=f.files[0].dirPath();
+// 	qWarning("thePath = %s",thePath.latin1());
+	if(thePath.isEmpty() || thePath.startsWith(".")){
+// 		qWarning("using calculated path");
+		int tmpIndex=g.ren[0].oldFileName.findRev("/");
+		thePath=g.ren[0].oldFileName.left(tmpIndex);
+// 		qWarning("thePath = %s",thePath.latin1());
+	}
 	for(int i=0;i<g.numOfFiles;i++){
 		// In this block newName = Prefix + specified new Name
 		if(g.ren[g.getSorted(i)].selected){
@@ -423,34 +431,36 @@
 				if(spaceToUnder->isChecked() || spaceToDash->isChecked() \
||underToSpace->isChecked() ||dashToSpace->isChecked()){  // 					QString \
suf=g.ren[g.getSorted(i)].Suffix;  // 					suf.replace(" ",toConv);
-					g.ren[g.getSorted(i)].newFileName=f.files[0].dirPath() + "/" \
+g.ren[g.getSorted(i)].newName + \
                g.ren[g.getSorted(i)].Counter+g.ren[g.getSorted(i)].newSuffix;
-					g.ren[g.getSorted(i)].newTmpFileName=f.files[0].dirPath() + "/" \
+g.ren[g.getSorted(i)].newTmpName + \
g.ren[g.getSorted(i)].Counter+g.ren[g.getSorted(i)].newSuffix; +
+					g.ren[g.getSorted(i)].newFileName=thePath + "/" +g.ren[g.getSorted(i)].newName \
+ g.ren[g.getSorted(i)].Counter+g.ren[g.getSorted(i)].newSuffix; \
+					g.ren[g.getSorted(i)].newTmpFileName=thePath + "/" \
+g.ren[g.getSorted(i)].newTmpName + \
g.ren[g.getSorted(i)].Counter+g.ren[g.getSorted(i)].newSuffix;  }else{
-					g.ren[g.getSorted(i)].newFileName=f.files[0].dirPath() + "/" \
+g.ren[g.getSorted(i)].newName + \
                g.ren[g.getSorted(i)].Counter+g.ren[g.getSorted(i)].Suffix;
-					g.ren[g.getSorted(i)].newTmpFileName=f.files[0].dirPath() + "/" \
+g.ren[g.getSorted(i)].newTmpName + \
g.ren[g.getSorted(i)].Counter+g.ren[g.getSorted(i)].Suffix; \
+					g.ren[g.getSorted(i)].newFileName=thePath + "/" +g.ren[g.getSorted(i)].newName \
+ g.ren[g.getSorted(i)].Counter+g.ren[g.getSorted(i)].Suffix; \
+					g.ren[g.getSorted(i)].newTmpFileName=thePath + "/" \
+g.ren[g.getSorted(i)].newTmpName + \
g.ren[g.getSorted(i)].Counter+g.ren[g.getSorted(i)].Suffix;  }
 			}else{
 				if(spaceToUnder->isChecked() || spaceToDash->isChecked() \
                ||underToSpace->isChecked() ||dashToSpace->isChecked()){
-					g.ren[g.getSorted(i)].newFileName=f.files[0].dirPath() + "/" \
+g.ren[g.getSorted(i)].newName + g.ren[g.getSorted(i)].Counter +  \
g.ren[g.getSorted(i)].newSuffix +"." + g.ren[g.getSorted(i)].newExtension; \
+					g.ren[g.getSorted(i)].newFileName=thePath + "/" +g.ren[g.getSorted(i)].newName \
+ g.ren[g.getSorted(i)].Counter +  g.ren[g.getSorted(i)].newSuffix +"." + \
g.ren[g.getSorted(i)].newExtension;  // 					qWarning("%s",toConv.latin1());
 // 					qWarning("prefix = %s",g.ren[g.getSorted(i)].Prefix.latin1());
 // 					qWarning("suffix = %s",g.ren[g.getSorted(i)].Suffix.latin1());
 // 					qWarning("newsuffix = %s",g.ren[g.getSorted(i)].newSuffix.latin1());
 // 					qWarning("newName = %s",g.ren[g.getSorted(i)].newName.latin1());
 // 					qWarning("newFileName = %s",g.ren[g.getSorted(i)].newFileName.latin1());
-					g.ren[g.getSorted(i)].newTmpFileName=f.files[0].dirPath() + "/" \
+g.ren[g.getSorted(i)].newTmpName + g.ren[g.getSorted(i)].Counter + \
g.ren[g.getSorted(i)].newSuffix + "." + g.ren[g.getSorted(i)].newExtension; \
+					g.ren[g.getSorted(i)].newTmpFileName=thePath + "/" \
+g.ren[g.getSorted(i)].newTmpName + g.ren[g.getSorted(i)].Counter + \
g.ren[g.getSorted(i)].newSuffix + "." + g.ren[g.getSorted(i)].newExtension;  }else{
-					g.ren[g.getSorted(i)].newFileName=f.files[0].dirPath() + "/" \
+g.ren[g.getSorted(i)].newName + g.ren[g.getSorted(i)].Counter +  \
g.ren[g.getSorted(i)].Suffix+"." + g.ren[g.getSorted(i)].newExtension; \
+					g.ren[g.getSorted(i)].newFileName=thePath + "/" +g.ren[g.getSorted(i)].newName \
+ g.ren[g.getSorted(i)].Counter +  g.ren[g.getSorted(i)].Suffix+"." + \
g.ren[g.getSorted(i)].newExtension;  // 					qWarning("prefix = \
%s",g.ren[g.getSorted(i)].Prefix.latin1());  // 					qWarning("suffix = \
%s",g.ren[g.getSorted(i)].Suffix.latin1());  // 					qWarning("newName = \
%s",g.ren[g.getSorted(i)].newName.latin1());  // 					qWarning("newFileName = \
                %s",g.ren[g.getSorted(i)].newFileName.latin1());				
-					g.ren[g.getSorted(i)].newTmpFileName=f.files[0].dirPath() + "/" \
+g.ren[g.getSorted(i)].newTmpName + g.ren[g.getSorted(i)].Counter + \
g.ren[g.getSorted(i)].Suffix+ "." + g.ren[g.getSorted(i)].newExtension; \
+					g.ren[g.getSorted(i)].newTmpFileName=thePath + "/" \
+g.ren[g.getSorted(i)].newTmpName + g.ren[g.getSorted(i)].Counter + \
g.ren[g.getSorted(i)].Suffix+ "." + g.ren[g.getSorted(i)].newExtension;  }
 			}
 		}
+// 		qWarning("newTmpFileName = %s",g.ren[g.getSorted(i)].newTmpFileName.latin1());
 	}
-
+// qWarning("oldNameFileName = %s",g.ren[0].oldFileName.latin1());
 	if(g.numOfSlectedItems()==0){
 		rShow->setChecked(true);
 		lSelected->setText(QString(i18n("%1/%2 items \
selected")).arg(0).arg(g.numOfFiles,0,10)); @@ -478,6 +488,8 @@
 			if(g.ren[g.getSorted(i)].oldFileName!=g.ren[g.getSorted(i)].newFileName){
 				QDir fr=QDir(g.ren[g.getSorted(i)].oldFileName);
 				if(!fr.rename(g.ren[g.getSorted(i)].oldFileName,g.ren[g.getSorted(i)].newTmpFileName)){
 +// 					qWarning("%s -> \
%s",g.ren[g.getSorted(i)].oldFileName.latin1(),g.ren[g.getSorted(i)].newTmpFileName.latin1());
 +// 					qWarning("renameError 1");
 					if(it==-1) renameError(-1,0);
 					else renameError(i,0);
 					close(TRUE);
@@ -491,6 +503,7 @@
 			if(g.ren[g.getSorted(i)].oldFileName!=g.ren[g.getSorted(i)].newFileName){
 				QDir fr=QDir(g.ren[g.getSorted(i)].newTmpFileName);
 				if(!fr.rename(g.ren[g.getSorted(i)].newTmpFileName,g.ren[g.getSorted(i)].newFileName)){
 +// 					qWarning("renameError 2");
 					renameError(i,1);
 					close(TRUE);
 				}
@@ -2655,6 +2668,8 @@
 	//
 	// Do I need that check?
 	//
+// 	qWarning("itemsSkipped=%d , \
itemsToManipulate=%d",itemsSkipped,itemsToManipulate); +	
 	if(itemsSkipped<itemsToManipulate){
 		updateViewEnabled=false;
 		g.resetHasbeenSorted();


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

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