"Fossies" - the Fresh Open Source Software Archive  

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

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

previewlist.cpp  (krename-4.0.9):previewlist.cpp  (krename-4.90.90)
skipping to change at line 23 skipping to change at line 23
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
***************************************************************************/ ***************************************************************************/
#include "previewlist.h" #include "previewlist.h"
#include "customdialog.h" #include "customdialog.h"
#include "krenamemodel.h" #include "krenamemodel.h"
#include "klocale.h"
#include "kmenu.h"
#include <QContextMenuEvent> #include <QContextMenuEvent>
#include <QMenu>
#include <QPointer>
PreviewList::PreviewList( QWidget* parent ) PreviewList::PreviewList(QWidget *parent)
: QTreeView( parent ), m_model( NULL ) : QTreeView(parent), m_model(nullptr)
{ {
m_menu = new KMenu( "KRename", this ); // we need any text here so that we h m_menu = new QMenu("KRename", this); // we need any text here so that we h
ave a title ave a title
m_menu->addAction( QIcon(), i18n("&Change filename manually..."), this, SLOT m_menu->addAction(i18n("&Change filename manually..."), this, SLOT(slotManua
(slotManually()), QKeySequence("F2") ); lly()), QKeySequence("F2"));
m_menu->addSeparator(); m_menu->addSeparator();
m_menu->addAction( i18n("&Open"), this, SLOT( slotOpen() ) ); m_menu->addAction(i18n("&Open"), this, SLOT(slotOpen()));
m_menu->addSeparator(); m_menu->addSeparator();
m_menu->addAction( i18n("&Add..."), this, SIGNAL( addFiles() ) ); m_menu->addAction(i18n("&Add..."), this, SIGNAL(addFiles()));
m_menu->addAction( i18n("&Remove"), this, SLOT( slotRemove() ) ); m_menu->addAction(i18n("&Remove"), this, SLOT(slotRemove()));
connect( this, SIGNAL( activated(const QModelIndex&)), this, SLOT( slotManua lly() ) ); connect(this, &PreviewList::activated, this, &PreviewList::slotManually);
} }
PreviewList::~PreviewList() PreviewList::~PreviewList()
{ {
} }
void PreviewList::contextMenuEvent( QContextMenuEvent* e ) void PreviewList::contextMenuEvent(QContextMenuEvent *e)
{ {
// only show a context menu if we have model and contents // only show a context menu if we have model and contents
if( m_model && m_model->rowCount() ) if (m_model && m_model->rowCount() && currentIndex().isValid()) {
{ const KRenameFile &file = m_model->file(this->currentIndex().row());
const KRenameFile& file = m_model->file( this->currentIndex().row() );
m_menu->setTitle( file.srcUrl().prettyUrl() ); m_menu->setTitle(file.srcUrl().toDisplayString(QUrl::PreferLocalFile));
m_menu->popup( e->globalPos() ); m_menu->popup(e->globalPos());
} }
} }
void PreviewList::slotOpen() void PreviewList::slotOpen()
{ {
m_model->run( this->currentIndex(), this ); m_model->run(this->currentIndex(), this);
} }
void PreviewList::slotRemove() void PreviewList::slotRemove()
{ {
QList<int> list; QList<int> list;
list.append( this->currentIndex().row() ); list.append(this->currentIndex().row());
m_model->removeFiles( list ); m_model->removeFiles(list);
emit updateCount(); emit updateCount();
} }
void PreviewList::slotManually() void PreviewList::slotManually()
{ {
CustomDialog dialog(m_model->file( this->currentIndex().row() ), this); QPointer<CustomDialog> dialog = new CustomDialog(m_model->file(this->current
if( dialog.exec() == QDialog::Accepted ) Index().row()), this);
{ if (dialog->exec() == QDialog::Accepted) {
QString manual = QString::null; QString manual;
EManualChangeMode mode = eManualChangeMode_None; EManualChangeMode mode = eManualChangeMode_None;
if( dialog.hasManualChanges() ) if (dialog->hasManualChanges()) {
{ manual = dialog->manualChanges();
manual = dialog.manualChanges(); mode = dialog->manualChangeMode();
mode = dialog.manualChangeMode();
} }
m_model->file( this->currentIndex().row() ).setManualChanges( manual, mo de ); m_model->file(this->currentIndex().row()).setManualChanges(manual, mode) ;
} }
delete dialog;
} }
#include "previewlist.moc"
 End of changes. 18 change blocks. 
31 lines changed or deleted 29 lines changed or added

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