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

List:       kde-commits
Subject:    playground/utils/gwenrename [POSSIBLY UNSAFE]
From:       Spiros Georgaras <sngeorgaras () otenet ! gr>
Date:       2008-02-29 17:10:46
Message-ID: 1204305046.006886.18053.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 780646 by sngeorgaras:

fixing list invertion, implementing bug report, updating docs


 M  +10 -2     ChangeLog  
 M  +7 -1      dirsdata.cpp  
 M  +59 -22    doc/en/index.docbook  
 M  +5 -0      initaskmode.ui.h  
 M  +17 -16    rename.ui  
 M  +22 -11    rename.ui.h   [POSSIBLY UNSAFE: KRun::runCommand]
 M  +7 -3      timestamp.ui.h  


--- trunk/playground/utils/gwenrename/ChangeLog #780645:780646
@@ -1,6 +1,14 @@
-
 GwenRename 1.1-beta4pre:
-- Items addition/removal available through the context menu
+- GwenRename can now be executed without parameters. In this case the user will
+  have to   select the folder cotaining the files to be renamed, through the
+  "Folder selection" dialog.
+- A mode selection dialog was added. It will be presented to the user, when a
+  single folder is passed to GwenRename.
+- Files/folders can now be added/removed from the list of items that will be
+  renamed, from within the program, using the ListView context menu
+- Started writing the user manual. Added help to the program dialogs
+- Layout changes
+-Many more minor changes
 
 GwenRename 1.1-beta3:
 - Layout changes
--- trunk/playground/utils/gwenrename/dirsdata.cpp #780645:780646
@@ -93,6 +93,7 @@
 		if(ren==NULL) return -1;
 		for(int k=0;k<numOfFiles;k++){
 			ren[k].oldFileName=files[k].filePath();
+	qWarning("--> dirsData::setLink -> ren[k].oldFileName = \
%s",ren[k].oldFileName.latin1());  ren[k].newFileName=files[k].filePath();
 			ren[k].oldName=files[k].baseName(TRUE);
 			ren[k].oldExtension=files[k].extension(FALSE);
@@ -134,7 +135,9 @@
 int dirsData::setFilesInDir(bool select){
 	if(numOfFiles>0){
 		ren=new newFile[numOfFiles];
-		if(ren==NULL) return -1;
+		if(ren==NULL)
+			return -1;
+		qWarning("\n\n\n=========\n");
 		for(int k=0;k<numOfFiles;k++){
 			resetFileNames(k);
 			ren[k].selected=select;
@@ -148,7 +151,10 @@
 }
 //================================
 void dirsData::resetFileNames(int k){
+	qWarning("\"%s\"",ren[k].oldFileName.latin1());
 	ren[k].oldFileName=files[k].filePath();
+// 	qWarning("====== resetFileNames -> files[k].filePath() = \
%s",files[k].filePath().latin1()); +	qWarning("       \
\"%s\"",ren[k].oldFileName.latin1());  ren[k].newFileName=files[k].filePath();
 	ren[k].oldName=files[k].baseName(TRUE);
 	ren[k].oldExtension=files[k].extension(FALSE);
--- trunk/playground/utils/gwenrename/doc/en/index.docbook #780645:780646
@@ -31,8 +31,8 @@
 
 <legalnotice>&FDLNotice;</legalnotice>
 
-<date>2008-02-25</date>
-<releaseinfo>0.4</releaseinfo>
+<date>2008-02-29</date>
+<releaseinfo>0.5</releaseinfo>
 
 <abstract>
 <para>
@@ -82,16 +82,6 @@
 </chapter>
 
 
-<chapter id="GwenRename-features">
-<title>GwenRename Features</title>
-
-
-
-<para>Empty page!!!</para>
-
-</chapter>
-
-
 <chapter id="using-GwenRename">
 <title>Using GwenRename</title>
 
@@ -288,24 +278,71 @@
 </listitem>
 </itemizedlist>
 
-
+<sect3 id="context-menu"><title>Context menu</title>
+<para>By right clicking on the Items list, the context menu is available to the \
user. When <guimenu>Show all items</guimenu> is not checked, a reduced version of the \
menu is displayed.</para>  <mediaobject>
 <imageobject>
 <imagedata fileref="context.png" format="PNG" />
 </imageobject>
 </mediaobject>
 
+<para>The functions available through the context menu are:</para>
 
-<sect3 id="lm3"><title>List management</title>
-<para></para>
+<sect4 id="lm3"><title>List management</title>
+<itemizedlist>
+<listitem>
+<para><guimenu>Add to list</guimenu></para>
+<para>Adds the selectded items to the Items list</para>
+</listitem>
+<listitem>
+<para><guimenu>Remove from list</guimenu></para>
+<para>Removes the selectded items from the Items list</para>
+</listitem>
+<listitem>
+<para><guimenu>Invert list</guimenu></para>
+<para>Inverts the Items list. <!--If both files and folders are to be inserted to \
the Items list,--> </para> +</listitem>
+<listitem>
+<para><guimenu>Create list from selection</guimenu></para>
+<para>Replaces the Items list with the selected items</para>
+</listitem>
+</itemizedlist>
+
+</sect4>
+<sect4 id="sel3"><title>Selection management</title>
+<itemizedlist>
+<listitem>
+<para><guimenu>All items</guimenu></para>
+<para>Selects all items</para>
+</listitem>
+<listitem>
+<para><guimenu>All items of selected type</guimenu></para>
+<para>Selects all items of selected type</para>
+</listitem>
+<listitem>
+<para><guimenu>Invert current selection</guimenu></para>
+<para>Inverts the currently selected items</para>
+</listitem>
+<listitem>
+<para><guimenu>Create selection from list</guimenu></para>
+<para>Selects all items from the Items list</para>
+</listitem>
+<listitem>
+<para><guimenu>Items containing a string</guimenu></para>
+<para>Selects items based on a search string. It uses the <ulink \
url="search-window.html">Items Selection Window</ulink> </para> +</listitem>
+</itemizedlist>
+
+</sect4>
+<sect4 id="help3"><title>Help</title>
+<itemizedlist>
+<listitem>
+<para><guimenu>Show help</guimenu></para>
+</listitem>
+</itemizedlist>
+</sect4>
+
 </sect3>
-<sect3 id="sel3"><title>Selection management</title>
-<para></para>
-</sect3>
-<sect3 id="help3"><title>Help</title>
-<para></para>
-</sect3>
-
 </sect2>
 </sect1>
 
--- trunk/playground/utils/gwenrename/initaskmode.ui.h #780645:780646
@@ -35,6 +35,11 @@
 
 void initAskMode::showHelp(){
 		KRun::runCommand(QString("khelpcenter \
\"help:/gwenrename/using-GwenRename.html#mode-selection\"")); +		
+		
+
+// 		KURL url(QString("mailto:sng@hellug.gr?subject=GwenRename selection \
error&body=I have just stumbled to this error\n\nError Code = \
%1").arg(theErrorMessage)); +// 		new KRun(url);
 }
 
 
--- trunk/playground/utils/gwenrename/rename.ui #780645:780646
@@ -2317,21 +2317,22 @@
     <include location="local" impldecl="in implementation">rename.ui.h</include>
 </includes>
 <variables>
+    <variable access="private">QListViewItem *firstSelectedItem;</variable>
+    <variable access="private">QString fisrtSelectedItem;</variable>
+    <variable access="private">int filesSelectedType;</variable>
+    <variable access="private">int addToListID;</variable>
+    <variable>bool updateExtViewRunning;</variable>
+    <variable>bool updateNameViewRunning;</variable>
+    <variable>bool updateViewRunning;</variable>
+    <variable>int compoundExtensions;</variable>
+    <variable>int activeExtension;</variable>
+    <variable>bool updateCounterRunning;</variable>
+    <variable>bool updateCounterViewRunning;</variable>
+    <variable access="private">int selectMenuID;</variable>
+    <variable access="private">int itemsOfSelectedType;</variable>
+    <variable access="private">multiSelTool *tMult;</variable>
     <variable access="private">bool updateViewEnabled;</variable>
-    <variable access="private">multiSelTool *tMult;</variable>
-    <variable access="private">int itemsOfSelectedType;</variable>
-    <variable access="private">int selectMenuID;</variable>
-    <variable>bool updateCounterViewRunning;</variable>
-    <variable>bool updateCounterRunning;</variable>
-    <variable>int activeExtension;</variable>
-    <variable>int compoundExtensions;</variable>
-    <variable>bool updateViewRunning;</variable>
-    <variable>bool updateNameViewRunning;</variable>
-    <variable>bool updateExtViewRunning;</variable>
-    <variable access="private">int addToListID;</variable>
-    <variable access="private">int filesSelectedType;</variable>
-    <variable access="private">QString fisrtSelectedItem;</variable>
-    <variable access="private">QListViewItem *firstSelectedItem;</variable>
+    <variable>int theErrorMessage;</variable>
 </variables>
 <slots>
     <slot access="private">init()</slot>
@@ -2379,6 +2380,8 @@
     <slot access="private">mnuInvertSelection( void )</slot>
     <slot access="private">mnuShowSelectionDialog( void )</slot>
     <slot access="private">AdjustPartName()</slot>
+    <slot>AdjustPartNameFromSufix()</slot>
+    <slot>AdjustPartNameFromPrefix()</slot>
     <slot access="private">underToSpaceClicked()</slot>
     <slot access="private">dashToSpaceClicked()</slot>
     <slot access="private">spaceToUnderClicked()</slot>
@@ -2395,8 +2398,6 @@
     <slot access="private">ListFromSelection()</slot>
     <slot access="private">SelectionFromList()</slot>
     <slot access="private">InvertList()</slot>
-    <slot>AdjustPartNameFromSufix()</slot>
-    <slot>AdjustPartNameFromPrefix()</slot>
 </slots>
 <functions>
     <function access="private">destroy()</function>
--- trunk/playground/utils/gwenrename/rename.ui.h #780645:780646
@@ -970,7 +970,15 @@
 // 		else if(cmbProfile->hasFocus()) // profile
 // 				 KRun::runCommand(QString("khelpcenter \
\"help:/gwenrename/time-stamping-window.html\""));  // 		else
+		
+		
+		
 				 KRun::runCommand(QString("khelpcenter \"help:/gwenrename/main-window.html\""));
+				 
+				 
+// 		KURL url(QString("help:/gwenrename/main-window.html").arg(theErrorMessage));
+// 		new KRun(url);
+				 
 	}else{
 		if(cmbProfile->editable()){
 			if(cmbProfile->hasFocus()){
@@ -2096,7 +2104,6 @@
 	KConfig config("gwenrenamerc");
 	config.setGroup("NameHistory");
 	rName->clear();
-	rName->insertItem("");
 	for(int i=0;i<HISTORY_ITEMS;i++){
 		group=QString("Exp%1").arg(i);
 		tmp=config.readEntry(group,QString::null);
@@ -2108,7 +2115,6 @@
 	rName->setCurrentText("");
 	config.setGroup("PrefixHistory");
 	nPref->clear();
-	nPref->insertItem("");
 	for(int i=0;i<HISTORY_ITEMS;i++){
 		group=QString("Exp%1").arg(i);
 		tmp=config.readEntry(group,QString::null);
@@ -2120,7 +2126,6 @@
 	nPref->setCurrentText("");
 	config.setGroup("SuffixHistory");
 	nSuf->clear();
-	nSuf->insertItem("");
 	for(int i=0;i<HISTORY_ITEMS;i++){
 		group=QString("Exp%1").arg(i);
 		tmp=config.readEntry(group,QString::null);
@@ -2132,7 +2137,6 @@
 	nSuf->setCurrentText("");
 	config.setGroup("ExtensionHistory");
 	rExt->clear();
-	rExt->insertItem("");
 	for(int i=0;i<HISTORY_ITEMS;i++){
 		group=QString("Exp%1").arg(i);
 		tmp=config.readEntry(group,QString::null);
@@ -2527,7 +2531,7 @@
 	}
 		// if no file is selected, make type=isFile
 	 //if(filesSelectedType==-2) filesSelectedType=1;
-	
+	qWarning("filesSelectedType = %d",filesSelectedType);
 	for ( ; it.current(); ++it ){
 		noNeedToManipulate=false;
 		readName=it.current()->text(1);
@@ -2538,15 +2542,15 @@
 		fullReadName.replace("//","/");
 		if(it.current()->isSelected()){
 			itemsToManipulate++;
-			//qWarning("%d. %s (%s - \
%s)",i,readName.latin1(),onlyReadName.latin1(),fullReadName.latin1()); +// \
qWarning("%d. %s (%s - \
%s)",i,readName.latin1(),onlyReadName.latin1(),fullReadName.latin1());  i++;
 			for(int k=0;k<g.numOfFiles;k++){
-// 				qWarning("--------\n%s\n%s",fullReadName.latin1(),g.ren[k].oldFileName.latin1());
 +//  				qWarning("--------\n%s\n%s",fullReadName.latin1(),g.ren[k].oldFileName.latin1());
  if(fullReadName==g.ren[k].oldFileName){
 					found=k;
-// 					qWarning(" --> Item %s found as %d ",fullReadName.latin1(),k);
+//  					qWarning(" --> Item %s found as %d ",fullReadName.latin1(),k);
 					if(g.ren[k].selected==mode){
-						//qWarning(" --> Item %s is selected ok...",onlyReadName.latin1());
+// 						qWarning(" --> Item %s is selected ok...",onlyReadName.latin1());
 						noNeedToManipulate=true;
 //						itemsSkipped++;
 					}
@@ -2608,7 +2612,9 @@
 			}
 		}
 	}else{
-		*msg="<p>A programming error has occurred!!!<br>This is a known error, and I'm \
working on it<br><br><b>GwenRename</b> will exit now so that there's no chance to \
loose data!!!</p>"; +		KURL url(QString("mailto:sng@hellug.gr?subject=GwenRename \
Selection list error&body=I have just stumbled to this error\n\nError Code = \
%1").arg(theErrorMessage)); +		new KRun(url);
+		*msg="<p>A programming error has occurred!!!<br>This is a known error, and I'm \
working on it<br><br><b>GwenRename</b> will exit now so that there's no chance to \
loose data!!!<br><br>An email message describing this error has been prepared for \
you. Please send this bug report; it will help me <b>fix</b> this error.<br><br>Thank \
you</p>";  KMessageBox::error(this,*msg,QString::null,KMessageBox::AllowLink);
 		CancelIt();
 	}
@@ -2708,12 +2714,14 @@
 
 void GwenRename::AddToList(){
 	//qWarning("GwenRename::Addtolist");
+	theErrorMessage=2;
 	reFixList(true,true);
 }
 
 
 void GwenRename::RemoveFromList(){
 	//qWarning("GwenRename::Removefromlist");
+	theErrorMessage=3;
 	reFixList(false,true);
 }
 
@@ -2979,13 +2987,15 @@
 
 
 void GwenRename::showHelp(){
-
+	KRun::runCommand(QString("khelpcenter \
\"help:/gwenrename/main-window.html#context-menu\""));  }
 
 
 void GwenRename::ListFromSelection(){
 	setList(false);
 	View->setEnabled(false);
+	filesSelectedType=-2;
+	theErrorMessage=4;
 	reFixList(true,false);
 	View->setEnabled(true);
 }
@@ -3029,6 +3039,7 @@
 			readName=g.ren[k].oldFileName.remove(QRegExp("^.*/"));
 			if(g.whatType(k)==2)
 				readName.prepend("/");
+			theErrorMessage=1;
 			itemsSkipped=checkItemToList(readName, k, false, true, itemsSkipped, &msg);
 		}else
 			g.ren[k].newFileName=QString::null;
--- trunk/playground/utils/gwenrename/timestamp.ui.h #780645:780646
@@ -373,8 +373,13 @@
 }
 
 void tStamp::keyPressEvent( QKeyEvent *e ){
-	if(e->key()==Qt::Key_F1 && e->state()==Qt::NoButton)
+	if(e->key()==Qt::Key_F1 && e->state()==Qt::NoButton){
+		e->accept();
 		showHelp();
+	}else if(e->key()==Qt::Key_Escape && e->state()==Qt::NoButton){
+		e->accept();
+		reject();
+	}
 }
 
 
@@ -383,8 +388,7 @@
 }
 
 
-void tStamp::txtFormatCleared()
-{
+void tStamp::txtFormatCleared(){
     txtFormat->setCurrentText(QString::null);
     txtFormat->setFocus();
 }


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

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