"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/progressdialog.cpp" between
krename-4.0.9.tar.gz and krename-4.90.90.tar.gz

About: KRename is a batch file-renamer (KDE).

progressdialog.cpp  (krename-4.0.9):progressdialog.cpp  (krename-4.90.90)
skipping to change at line 28 skipping to change at line 28
#include "progressdialog.h" #include "progressdialog.h"
#include "batchrenamer.h" #include "batchrenamer.h"
#include "krenameimpl.h" #include "krenameimpl.h"
#include <QMenu> #include <QMenu>
#include <kiconloader.h> #include <kiconloader.h>
#include <krun.h> #include <krun.h>
ProgressDialog::ProgressDialog( ESplitMode eSplitMode, unsigned int dot, QWidget ProgressDialog::ProgressDialog(ESplitMode eSplitMode, unsigned int dot, QWidget
* parent ) *parent)
: QDialog( parent ), m_canceled( false ), m_renamer( NULL ), m_eSplitMode( e : QDialog(parent), m_canceled(false), m_renamer(nullptr), m_eSplitMode(eSpli
SplitMode ), m_dot( dot ) tMode), m_dot(dot)
{ {
m_widget.setupUi( this ); m_widget.setupUi(this);
m_buttonMore = m_widget.buttonBox->addButton( i18n("&Rename more..."), QDia m_buttonMore = m_widget.buttonBox->addButton(i18n("&Rename more..."), QDial
logButtonBox::ActionRole ); ogButtonBox::ActionRole);
m_buttonUndo = m_widget.buttonBox->addButton( i18n("&Undo"), QDialogButtonB m_buttonUndo = m_widget.buttonBox->addButton(i18n("&Undo"), QDialogButtonBo
ox::ActionRole ); x::ActionRole);
m_buttonDest = m_widget.buttonBox->addButton( i18n("&Open Destination"), QD m_buttonDest = m_widget.buttonBox->addButton(i18n("&Open Destination"), QDi
ialogButtonBox::ActionRole ); alogButtonBox::ActionRole);
m_buttonClose = m_widget.buttonBox->button( QDialogButtonBox::Close ); m_buttonClose = m_widget.buttonBox->button(QDialogButtonBox::Close);
m_buttonUndo->setEnabled( false ); m_buttonUndo->setEnabled(false);
m_buttonMore->setEnabled( false ); m_buttonMore->setEnabled(false);
m_buttonClose->setEnabled( false ); m_buttonClose->setEnabled(false);
connect( m_widget.buttonCancel, SIGNAL(clicked(bool)), SLOT(slotCancelled()) connect(m_widget.buttonCancel, &QPushButton::clicked,
); this, &ProgressDialog::slotCancelled);
connect( m_buttonDest, SIGNAL(clicked(bool)), SLOT(slotOpenDestinat connect(m_buttonDest, &QPushButton::clicked,
ion())); this, &ProgressDialog::slotOpenDestination);
connect( m_buttonUndo, SIGNAL(clicked(bool)), SLOT(slotUndo())); connect(m_buttonUndo, &QPushButton::clicked,
this, &ProgressDialog::slotUndo);
QMenu* menu = new QMenu( this ); QMenu *menu = new QMenu(this);
menu->addAction( i18n("Restart &KRename..."), this, SLOT(slotRestartKRename( menu->addAction(i18n("Restart &KRename..."), this, SLOT(slotRestartKRename()
)) ); ));
menu->addSeparator(); menu->addSeparator();
m_actProcessed = menu->addAction( i18n("Rename Processed Files &Again...") m_actProcessed = menu->addAction(i18n("Rename Processed Files &Again..."),
, this, SLOT(slotRenameProcessedAgain())); this, SLOT(slotRenameProcessedAgain()));
m_actUnprocessed = menu->addAction( i18n("Rename &Unprocessed Files Again... m_actUnprocessed = menu->addAction(i18n("Rename &Unprocessed Files Again..."
"), this, SLOT(slotRenameUnprocessedAgain())); ), this, SLOT(slotRenameUnprocessedAgain()));
menu->addAction( i18n("&Rename All Files Again..."), this, SLOT(slo menu->addAction(i18n("&Rename All Files Again..."), this, SLOT(slot
tRenameAllAgain())); RenameAllAgain()));
m_buttonMore->setMenu( menu ); m_buttonMore->setMenu(menu);
} }
void ProgressDialog::slotCancelled() void ProgressDialog::slotCancelled()
{ {
m_canceled = true; m_canceled = true;
} }
void ProgressDialog::slotOpenDestination() void ProgressDialog::slotOpenDestination()
{ {
new KRun( m_dest, this ); new KRun(m_dest, this);
} }
void ProgressDialog::slotRestartKRename() void ProgressDialog::slotRestartKRename()
{ {
(void*)KRenameImpl::launch( QRect( 0, 0, 0, 0 ), KRenameFile::List() ); (void *)KRenameImpl::launch(QRect(0, 0, 0, 0), KRenameFile::List());
QDialog::done( 0 ); QDialog::done(0);
} }
void ProgressDialog::slotRenameProcessedAgain() void ProgressDialog::slotRenameProcessedAgain()
{ {
KRenameFile::List list; KRenameFile::List list;
KRenameFile::List::const_iterator it = m_renamer->files()->begin(); KRenameFile::List::const_iterator it = m_renamer->files()->begin();
list.reserve( m_renamer->files()->count() ); list.reserve(m_renamer->files()->count());
while( it != m_renamer->files()->end() ) while (it != m_renamer->files()->end()) {
{ if (!(*it).hasError()) {
if( !(*it).hasError() ) KRenameFile file(m_renamer->buildDestinationUrl(*it), (*it).isDirect
{ ory(), m_eSplitMode, m_dot);
KRenameFile file( m_renamer->buildDestinationUrl( *it ), (*it).isDir file.setIcon(file.icon());
ectory(), m_eSplitMode, m_dot ); list.append(file);
file.setIcon( file.icon() );
list.append( file );
} }
++it; ++it;
} }
(void*)KRenameImpl::launch( QRect( 0, 0, 0, 0 ), list ); (void *)KRenameImpl::launch(QRect(0, 0, 0, 0), list);
QDialog::done( 0 ); QDialog::done(0);
} }
void ProgressDialog::slotRenameUnprocessedAgain() void ProgressDialog::slotRenameUnprocessedAgain()
{ {
KRenameFile::List list; KRenameFile::List list;
KRenameFile::List::const_iterator it = m_renamer->files()->begin(); KRenameFile::List::const_iterator it = m_renamer->files()->begin();
list.reserve( m_renamer->files()->count() ); list.reserve(m_renamer->files()->count());
while( it != m_renamer->files()->end() ) while (it != m_renamer->files()->end()) {
{ if ((*it).hasError()) {
if( (*it).hasError() ) KRenameFile file(*it);
{ file.setManualChanges(QString(), eManualChangeMode_None); // reset
KRenameFile file( *it ); manual changes!!
file.setManualChanges( QString::null, eManualChangeMode_None ); // r list.append(file);
eset manual changes!!
list.append( file );
} }
++it; ++it;
} }
(void*)KRenameImpl::launch( QRect( 0, 0, 0, 0 ), list ); (void *)KRenameImpl::launch(QRect(0, 0, 0, 0), list);
QDialog::done( 0 ); QDialog::done(0);
} }
void ProgressDialog::slotRenameAllAgain() void ProgressDialog::slotRenameAllAgain()
{ {
KRenameFile::List list; KRenameFile::List list;
KRenameFile::List::const_iterator it = m_renamer->files()->begin(); KRenameFile::List::const_iterator it = m_renamer->files()->begin();
list.reserve( m_renamer->files()->count() ); list.reserve(m_renamer->files()->count());
while( it != m_renamer->files()->end() ) while (it != m_renamer->files()->end()) {
{ KRenameFile file(m_renamer->buildDestinationUrl(*it), (*it).isDirectory(
KRenameFile file( m_renamer->buildDestinationUrl( *it ), (*it).isDirecto ), m_eSplitMode, m_dot);
ry(), m_eSplitMode, m_dot ); file.setIcon(file.icon());
file.setIcon( file.icon() ); list.append(file);
list.append( file );
++it; ++it;
} }
(void*)KRenameImpl::launch( QRect( 0, 0, 0, 0 ), list ); (void *)KRenameImpl::launch(QRect(0, 0, 0, 0), list);
QDialog::done( 0 ); QDialog::done(0);
} }
void ProgressDialog::slotUndo() void ProgressDialog::slotUndo()
{ {
if( m_renamer ) if (m_renamer) {
{ m_widget.buttonCancel->setEnabled(true);
m_widget.buttonCancel->setEnabled( true );
m_buttonUndo->setEnabled( false ); m_buttonUndo->setEnabled(false);
m_buttonMore->setEnabled( false ); m_buttonMore->setEnabled(false);
m_renamer->undoFiles( this ); m_renamer->undoFiles(this);
} }
} }
void ProgressDialog::renamingDone( bool enableMore, bool enableUndo, BatchRename r* renamer, int errors ) void ProgressDialog::renamingDone(bool enableMore, bool enableUndo, BatchRenamer *renamer, int errors)
{ {
m_widget.buttonCancel->setEnabled( false ); m_widget.buttonCancel->setEnabled(false);
m_buttonUndo->setEnabled( enableUndo ); m_buttonUndo->setEnabled(enableUndo);
m_buttonMore->setEnabled( enableMore ); // Do allow renaming processed files m_buttonMore->setEnabled(enableMore); // Do allow renaming processed files
after undo after undo
m_buttonClose->setEnabled( true ); m_buttonClose->setEnabled(true);
m_actProcessed->setEnabled ( renamer->files()->count() != errors ); m_actProcessed->setEnabled(renamer->files()->count() != errors);
m_actUnprocessed->setEnabled( 0 != errors ); m_actUnprocessed->setEnabled(0 != errors);
m_renamer = renamer; m_renamer = renamer;
} }
void ProgressDialog::print( const QString & text, const QString & pixmap ) void ProgressDialog::print(const QString &text, const QString &pixmap)
{ {
QPixmap icon = SmallIcon(pixmap); QPixmap icon = SmallIcon(pixmap);
new QListWidgetItem( icon, text, m_widget.display ); new QListWidgetItem(icon, text, m_widget.display);
} }
void ProgressDialog::error( const QString & text ) void ProgressDialog::error(const QString &text)
{ {
this->print( text, "cancel" ); this->print(text, "cancel");
} }
void ProgressDialog::warning( const QString & text ) void ProgressDialog::warning(const QString &text)
{ {
this->print( text, "help-hint" ); this->print(text, "help-hint");
} }
#include "progressdialog.moc"
 End of changes. 28 change blocks. 
86 lines changed or deleted 81 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)