[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-15 17:13:07
Message-ID: 1203095587.904747.28848.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 775375 by sngeorgaras:
fixing inputdir history
adding icons to listview context menu
M +8 -2 Makefile.am
AM all-items.png
AM all-type-items.png
M +18 -5 inputdir.ui.h
M +12 -1 rename.ui
M +86 -57 rename.ui.h
AM undo.png
--- trunk/playground/utils/gwenrename/Makefile.am #775374:775375
@@ -50,8 +50,11 @@
$(INSTALL_DATA) $(srcdir)/stop.png \
$(kde_datadir)/gwenrename/icons/hicolor/16x16/actions/stop.png $(INSTALL_DATA) \
$(srcdir)/help.png $(kde_datadir)/gwenrename/icons/hicolor/16x16/actions/help.png \
$(INSTALL_DATA) $(srcdir)/khelpcenter.png \
$(kde_datadir)/gwenrename/icons/hicolor/16x16/actions/khelpcenter.png
- $(INSTALL_DATA) $(srcdir)/khelpcenter.png \
$(kde_datadir)/gwenrename/icons/hicolor/16x16/actions/filefind.png
-
+ $(INSTALL_DATA) $(srcdir)/undo.png \
$(kde_datadir)/gwenrename/icons/hicolor/16x16/actions/undo.png + $(INSTALL_DATA) \
$(srcdir)/filefind.png \
$(kde_datadir)/gwenrename/icons/hicolor/16x16/actions/filefind.png + $(INSTALL_DATA) \
$(srcdir)/all-items.png \
$(kde_datadir)/gwenrename/icons/hicolor/16x16/actions/all-items.png + $(INSTALL_DATA) \
$(srcdir)/all-type-items.png \
$(kde_datadir)/gwenrename/icons/hicolor/16x16/actions/all-type-items.png +
uninstall-local:
-rm -f $(kde_datadir)/konqueror/servicemenus/konqgwenrename.desktop
-rm -f $(kde_datadir)/gwenview/tools/gwenrename.desktop
@@ -70,7 +73,10 @@
-rm -f $(kde_datadir)/gwenrename/icons/hicolor/16x16/actions/stop.png
-rm -f $(kde_datadir)/gwenrename/icons/hicolor/16x16/actions/help.png
-rm -f $(kde_datadir)/gwenrename/icons/hicolor/16x16/actions/khelpcenter.png
+ -rm -f $(kde_datadir)/gwenrename/icons/hicolor/16x16/actions/undo.png
-rm -f $(kde_datadir)/gwenrename/icons/hicolor/16x16/actions/filefind.png
+ -rm -f $(kde_datadir)/gwenrename/icons/hicolor/16x16/actions/all-items.png
+ -rm -f $(kde_datadir)/gwenrename/icons/hicolor/16x16/actions/all-type-items.png
# this is where the desktop file will go
shelldesktopdir = $(kde_appsdir)/Utilities
** trunk/playground/utils/gwenrename/all-items.png #property svn:mime-type
+ application/octet-stream
** trunk/playground/utils/gwenrename/all-type-items.png #property svn:mime-type
+ application/octet-stream
--- trunk/playground/utils/gwenrename/inputdir.ui.h #775374:775375
@@ -73,11 +73,24 @@
}
void InputDir::buttonOkClicked(){
- if(!dir->contains(dir->currentText())){
- dir->insertItem(dir->currentText(),0);
- numOfHistoryItems++;
- writeHistory();
- }
+ int found=-1;
+ QString tmp=dir->currentText();
+ for(int i=0;i<HISTORY_ITEMS;i++)
+ if(dir->text(i)==tmp){
+ found=i;
+ break;
+ }
+ if(found==-1){
+ numOfHistoryItems++;
+ dir->insertItem(tmp,0);
+ writeHistory();
+ }else{
+ if(found!=0){
+ dir->removeItem(found);
+ dir->insertItem(tmp,0);
+ writeHistory();
+ }
+ }
dir->setSizeLimit(10);
accept();
}
--- trunk/playground/utils/gwenrename/rename.ui #775374:775375
@@ -2212,6 +2212,12 @@
<receiver>GwenRename</receiver>
<slot>dashToSpaceClicked()</slot>
</connection>
+ <connection>
+ <sender>View</sender>
+ <signal>doubleClicked(QListViewItem*)</signal>
+ <receiver>GwenRename</receiver>
+ <slot>viewDoubleClicked(QListViewItem*)</slot>
+ </connection>
</connections>
<tabstops>
<tabstop>rShow</tabstop>
@@ -2303,6 +2309,7 @@
<slot access="private" specifier="non virtual">sortToggled( bool state )</slot>
<slot access="private">AdjustExtension()</slot>
<slot access="private">ViewMouseButtonPressed( int button, QListViewItem * item, \
const QPoint & pos, int c )</slot> + <slot>reFixList( bool mode, bool \
calculateType )</slot> <slot access="private">AddToList()</slot>
<slot access="private">RemoveFromList()</slot>
<slot access="private">mnuSelectAll( void )</slot>
@@ -2322,6 +2329,10 @@
<slot access="private">clearrExt()</slot>
<slot access="private">clearNewPrefix()</slot>
<slot access="private">clearNewSuffix()</slot>
+ <slot access="private">showHelp()</slot>
+ <slot access="private">ListFromSelection()</slot>
+ <slot access="private">InvertList()</slot>
+ <slot access="private">viewDoubleClicked( QListViewItem * item )</slot>
</slots>
<functions>
<function access="private">destroy()</function>
@@ -2373,10 +2384,10 @@
<function access="private">renameError( int index, int mode )</function>
<function access="private" returnType="bool">historyItemExist( KComboBox * com, \
QString s )</function> <function access="private">exitError( int errorMsg \
)</function>
- <function access="private" specifier="non virtual">reFixList( bool mode \
)</function>
<function access="private" specifier="non virtual">updateAfterSelection( void \
)</function>
<function access="private" specifier="non virtual">setNewFileData( int id, bool \
state )</function>
<function access="private">makeSelectionFromString( QString str, bool useCase, \
bool invertSelection, bool addToCurrentSelection, bool useRegExp )</function> + \
<function access="private">setList( bool state )</function> </functions>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
--- trunk/playground/utils/gwenrename/rename.ui.h #775374:775375
@@ -120,7 +120,6 @@
iconload ic;
int col0;
KPopupMenu* popM;
-// // KPopupMenu* popT;
//================================
void GwenRename::init(){
tMult=0;
@@ -129,34 +128,6 @@
activeExtension=0;
loadIcons();
-// popT = new KPopupMenu();
-// popT->insertTitle(i18n("Multiple file selection"));
-// popT->insertItem(i18n("All items"),this,SLOT(mnuSelectAll()));
-// itemsOfSelectedType=popT->insertItem(i18n("All items of selected \
type"),this,SLOT(mnuSelectByType()));
-// popT->insertSeparator();
-// popT->insertItem(i18n("Invert current \
selection"),this,SLOT(mnuInvertSelection()));
-// popT->insertSeparator();
-// popT->insertItem(i18n("Items containing a \
string"),this,SLOT(mnuShowSelectionDialog()));
- popM= new KPopupMenu();
- popM->insertTitle(i18n("Manage files"));
- addToListID=popM->insertItem(i18n("Add to list"),this,SLOT(AddToList()));
- popM->insertItem(i18n("Remove from list"),this,SLOT(RemoveFromList()));
- popM->insertSeparator();
- popM->insertItem(i18n("Create list from \
selection"),this,SLOT(ListFromSelection()));
-
-
-// selectMenuID=popM->insertItem(i18n("Multiple file selection"),popT);
- popM->insertTitle(i18n("Multiple file selection"));
- popM->insertItem(i18n("All items"),this,SLOT(mnuSelectAll()));
- itemsOfSelectedType=popM->insertItem(i18n("All items of selected \
type"),this,SLOT(mnuSelectByType()));
- popM->insertSeparator();
- popM->insertItem(i18n("Invert current selection"),this,SLOT(mnuInvertSelection()));
- popM->insertSeparator();
- popM->insertItem(i18n("Items containing a \
string"),this,SLOT(mnuShowSelectionDialog()));
- popM->insertTitle(i18n("Help"));
- popM->insertItem(i18n("Show help"),this,SLOT(showHelp()));
-
-
setIcon(ic.Icon(9));
rName->setSizeLimit(HISTORY_ITEMS+1);
nPref->setSizeLimit(HISTORY_ITEMS+1);
@@ -254,8 +225,7 @@
//================================
void GwenRename::destroy(){
delete [] pr.data;
-// delete popT;
- delete popM;
+// delete popM;
if(tMult)
delete tMult;
}
@@ -746,8 +716,10 @@
View->clear();
KListViewItem * itemVisible=0;
KListViewItem * item = new KListViewItem( View, 0 );
- if(rStep->value()<0 || (sort->isChecked() && sort->isEnabled())) \
View->setSorting(2);
- else View->setSorting(1);
+ if(rStep->value()<0 || (sort->isChecked() && sort->isEnabled()))
+ View->setSorting(2);
+ else
+ View->setSorting(1);
for(int i=0,k=0;i<g.numOfFiles;i++){
if(g.ren[g.getSorted(i)].selected){
QString firstColumn, secondColumn;
@@ -2294,6 +2266,16 @@
picture=QStringList("16x16/apps/khelpcenter.png");
picture+="gwenrename/icons/hicolor/16x16/actions/khelpcenter.png";
if( ic.loadIcon(picture,16)==-1) errorExists++;
+ picture=QStringList("16x16/actions/undo.png");
+ picture+="gwenrename/icons/hicolor/16x16/actions/undo.png";
+ if( ic.loadIcon(picture,17)==-1) errorExists++;
+ picture=QStringList("gwenrename/icons/hicolor/16x16/actions/all-items.png");
+ if( ic.loadIcon(picture,18)==-1) errorExists++;
+ picture=QStringList("gwenrename/icons/hicolor/16x16/actions/all-type-items.png");
+ if( ic.loadIcon(picture,19)==-1) errorExists++;
+ picture=QStringList("16x16/actions/filefind.png");
+ picture+="gwenrename/icons/hicolor/16x16/actions/filefind.png";
+ if( ic.loadIcon(picture,20)==-1) errorExists++;
if(errorExists==1) exitError(2);
else if(errorExists>1) exitError(3);
@@ -2415,26 +2397,46 @@
void GwenRename::ViewMouseButtonPressed( int button, QListViewItem * item, const \
QPoint & pos, int c ){ if(item && button==Qt::RightButton){
- if (rShow->isChecked()){
- popM->setItemEnabled(addToListID,true);
- popM->setItemEnabled(selectMenuID,true);
- if(filesSelectedType==-2)
-// popT->setItemEnabled(itemsOfSelectedType,false);
- popM->setItemEnabled(itemsOfSelectedType,false);
- else
-// popT->setItemEnabled(itemsOfSelectedType,true);
- popM->setItemEnabled(itemsOfSelectedType,true);
+ popM= new KPopupMenu();
+ if(lSelected->text().startsWith("0") && !rShow->isChecked()){
+ popM->insertTitle(i18n("Help"));
+ popM->insertItem(ic.Icon(15),i18n("Show help"),this,SLOT(showHelp()));
}else{
- popM->setItemEnabled(addToListID,false);
- popM->setItemEnabled(selectMenuID,false);
-
+
+ popM->insertTitle(i18n("List management"));
+ if (rShow->isChecked())
+ addToListID=popM->insertItem(ic.Icon(6),i18n("Add to \
list"),this,SLOT(AddToList())); + popM->insertItem(ic.Icon(7),i18n("Remove from \
list"),this,SLOT(RemoveFromList())); + popM->insertSeparator();
+ if (rShow->isChecked())
+ popM->insertItem(ic.Icon(17),i18n("Invert list"),this,SLOT(InvertList()));
+ popM->insertItem(ic.Icon(8),i18n("Create list from \
selection"),this,SLOT(ListFromSelection())); + if (rShow->isChecked()){
+ popM->insertTitle(i18n("Multiple file selection"));
+ popM->insertItem(ic.Icon(18),i18n("All items"),this,SLOT(mnuSelectAll()));
+ itemsOfSelectedType=popM->insertItem(ic.Icon(19),i18n("All items of selected \
type"),this,SLOT(mnuSelectByType())); + popM->insertItem(ic.Icon(17),i18n("Invert \
current selection"),this,SLOT(mnuInvertSelection())); \
+ popM->insertItem(ic.Icon(20),i18n("Items containing a \
string"),this,SLOT(mnuShowSelectionDialog())); + }
+ popM->insertTitle(i18n("Help"));
+ popM->insertItem(ic.Icon(15),i18n("Show help"),this,SLOT(showHelp()));
}
popM->exec(pos);
+ delete popM;
}
}
+void GwenRename::viewDoubleClicked( QListViewItem * item ){
+ if(item){
+ if(item->text(1).isNull()) return;
+ if(item->pixmap(0))
+ RemoveFromList();
+ else
+ AddToList();
+ }
+}
-void GwenRename::reFixList(bool mode){
+void GwenRename::reFixList(bool mode, bool calculateType){
int i=0,found=-1;
bool noNeedToManipulate;
QString readName,onlyReadName,fullReadName,msg;
@@ -2442,15 +2444,16 @@
int itemsToManipulate=0;
int itemsSkipped=0;
- // Find first selected file and get its type
- filesSelectedType=-2;
- for(int k=0;k<g.numOfFiles;k++)
- if(g.ren[k].selected){
- filesSelectedType=g.whatType(k);
- break;
- }
- //qWarning("filesSelectedType = %d",filesSelectedType);
-
+ if(calculateType){
+ // Find first selected file and get its type
+ filesSelectedType=-2;
+ for(int k=0;k<g.numOfFiles;k++)
+ if(g.ren[k].selected){
+ filesSelectedType=g.whatType(k);
+ break;
+ }
+ //qWarning("filesSelectedType = %d",filesSelectedType);
+ }
// if no file is selected, make type=isFile
//if(filesSelectedType==-2) filesSelectedType=1;
@@ -2609,13 +2612,13 @@
void GwenRename::AddToList(){
//qWarning("GwenRename::Addtolist");
- reFixList(true);
+ reFixList(true,true);
}
void GwenRename::RemoveFromList(){
//qWarning("GwenRename::Removefromlist");
- reFixList(false);
+ reFixList(false,true);
}
@@ -2844,3 +2847,29 @@
}
+
+
+void GwenRename::showHelp(){
+
+}
+
+
+void GwenRename::ListFromSelection(){
+ setList(false);
+ reFixList(true,false);
+}
+
+
+void GwenRename::InvertList(){
+
+}
+
+
+void GwenRename::setList( bool state ){
+ for(int k=0;k<g.numOfFiles;k++){
+ g.ren[k].selected=state;
+ g.ren[k].newFileName=QString::null;
+ }
+}
+
+
** trunk/playground/utils/gwenrename/undo.png #property svn:mime-type
+ application/octet-stream
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic