tokensortmodedialog.cpp (krename-4.0.9) | : | tokensortmodedialog.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 "tokensortmodedialog.h" | #include "tokensortmodedialog.h" | |||
#include "pluginloader.h" | #include "pluginloader.h" | |||
#include "plugin.h" | #include "plugin.h" | |||
TokenSortModeDialog::TokenSortModeDialog( KRenameTokenSorter::ESimpleSortMode eS | TokenSortModeDialog::TokenSortModeDialog(KRenameTokenSorter::ESimpleSortMode eSo | |||
ortMode, QWidget* parent ) | rtMode, QWidget *parent) | |||
: QDialog( parent ) | : QDialog(parent) | |||
{ | { | |||
m_dialog.setupUi(this); | m_dialog.setupUi(this); | |||
m_dialog.radioAscending->setChecked( eSortMode == KRenameTokenSorter::eSimpl | m_dialog.radioAscending->setChecked(eSortMode == KRenameTokenSorter::eSimple | |||
eSortMode_Ascending ); | SortMode_Ascending); | |||
m_dialog.radioDescending->setChecked( eSortMode == KRenameTokenSorter::eSimp | m_dialog.radioDescending->setChecked(eSortMode == KRenameTokenSorter::eSimpl | |||
leSortMode_Descending ); | eSortMode_Descending); | |||
m_dialog.radioNumeric->setChecked( eSortMode == KRenameTokenSorter::eSimpleS | m_dialog.radioNumeric->setChecked(eSortMode == KRenameTokenSorter::eSimpleSo | |||
ortMode_Numeric ); | rtMode_Numeric); | |||
connect( m_dialog.radioPredefined, SIGNAL( clicked(bool) ), SLOT( slotEnable | connect(m_dialog.radioPredefined, &QRadioButton::clicked, | |||
Controls() ) ); | this, &TokenSortModeDialog::slotEnableControls); | |||
connect( m_dialog.radioCustom, SIGNAL( clicked(bool) ), SLOT( slotEnableCont | connect(m_dialog.radioCustom, &QRadioButton::clicked, | |||
rols() ) ); | this, &TokenSortModeDialog::slotEnableControls); | |||
m_dialog.comboPredefined->addItem( i18n("Access Date"), "accessdate;yyyyMMdd | m_dialog.comboPredefined->addItem(i18n("Access Date"), "accessdate;yyyyMMddH | |||
HHmm" ); | Hmm"); | |||
m_dialog.comboPredefined->addItem( i18n("Creation Date"), "creationdate;yyyy | m_dialog.comboPredefined->addItem(i18n("Creation Date"), "creationdate;yyyyM | |||
MMddHHmm" ); | MddHHmm"); | |||
m_dialog.comboPredefined->addItem( i18n("Filesize"), "filesize" ); | m_dialog.comboPredefined->addItem(i18n("Filesize"), "filesize"); | |||
m_dialog.comboPredefined->addItem( i18n("Group"), "group" ); | m_dialog.comboPredefined->addItem(i18n("Group"), "group"); | |||
m_dialog.comboPredefined->addItem( i18n("Modification Date"), "modificationd | m_dialog.comboPredefined->addItem(i18n("Modification Date"), "modificationda | |||
ate;yyyyMMddHHmm" ); | te;yyyyMMddHHmm"); | |||
m_dialog.comboPredefined->addItem( i18n("User"), "user" ); | m_dialog.comboPredefined->addItem(i18n("User"), "user"); | |||
initTokens(); | initTokens(); | |||
slotEnableControls(); | slotEnableControls(); | |||
} | } | |||
void TokenSortModeDialog::initTokens() | void TokenSortModeDialog::initTokens() | |||
{ | { | |||
QStringList allTokens; | QStringList allTokens; | |||
QList<Plugin*>::const_iterator it = PluginLoader::Instance()->plugins().begi | QList<Plugin *>::const_iterator it = PluginLoader::Instance()->plugins().beg | |||
n(); | in(); | |||
while( it != PluginLoader::Instance()->plugins().end() ) | while (it != PluginLoader::Instance()->plugins().end()) { | |||
{ | if (((*it)->type() & ePluginType_Token)) { | |||
if( ((*it)->type() & ePluginType_Token) ) | const QStringList &tokens = (*it)->supportedTokens(); | |||
{ | allTokens.append(tokens); | |||
const QStringList & tokens = (*it)->supportedTokens(); | ||||
allTokens.append( tokens ); | ||||
} | } | |||
++it; | ++it; | |||
} | } | |||
allTokens.sort(); | allTokens.sort(); | |||
m_dialog.comboToken->insertItems( -1, allTokens ); | m_dialog.comboToken->insertItems(-1, allTokens); | |||
} | } | |||
void TokenSortModeDialog::slotEnableControls() | void TokenSortModeDialog::slotEnableControls() | |||
{ | { | |||
m_dialog.comboToken->setEnabled( m_dialog.radioCustom->isChecked() ); | m_dialog.comboToken->setEnabled(m_dialog.radioCustom->isChecked()); | |||
m_dialog.comboPredefined->setEnabled( m_dialog.radioPredefined->isChecked() | m_dialog.comboPredefined->setEnabled(m_dialog.radioPredefined->isChecked()); | |||
); | ||||
} | } | |||
KRenameTokenSorter::ESimpleSortMode TokenSortModeDialog::getSortMode() const | KRenameTokenSorter::ESimpleSortMode TokenSortModeDialog::getSortMode() const | |||
{ | { | |||
KRenameTokenSorter::ESimpleSortMode eMode = KRenameTokenSorter::eSimpleSortM ode_Ascending; | KRenameTokenSorter::ESimpleSortMode eMode = KRenameTokenSorter::eSimpleSortM ode_Ascending; | |||
if( m_dialog.radioAscending->isChecked() ) | if (m_dialog.radioAscending->isChecked()) { | |||
{ | ||||
eMode = KRenameTokenSorter::eSimpleSortMode_Ascending; | eMode = KRenameTokenSorter::eSimpleSortMode_Ascending; | |||
} | } else if (m_dialog.radioDescending->isChecked()) { | |||
else if( m_dialog.radioDescending->isChecked() ) | ||||
{ | ||||
eMode = KRenameTokenSorter::eSimpleSortMode_Descending; | eMode = KRenameTokenSorter::eSimpleSortMode_Descending; | |||
} | } else if (m_dialog.radioNumeric->isChecked()) { | |||
else if( m_dialog.radioNumeric->isChecked() ) | ||||
{ | ||||
eMode = KRenameTokenSorter::eSimpleSortMode_Numeric; | eMode = KRenameTokenSorter::eSimpleSortMode_Numeric; | |||
} | } | |||
return eMode; | return eMode; | |||
} | } | |||
QString TokenSortModeDialog::getToken() const | QString TokenSortModeDialog::getToken() const | |||
{ | { | |||
if( m_dialog.radioCustom->isChecked() ) | if (m_dialog.radioCustom->isChecked()) { | |||
{ | ||||
return m_dialog.comboToken->currentText(); | return m_dialog.comboToken->currentText(); | |||
} | } else { | |||
else | ||||
{ | ||||
int index = m_dialog.comboPredefined->currentIndex(); | int index = m_dialog.comboPredefined->currentIndex(); | |||
return m_dialog.comboPredefined->itemData( index ).toString(); | return m_dialog.comboPredefined->itemData(index).toString(); | |||
} | } | |||
} | } | |||
End of changes. 11 change blocks. | ||||
50 lines changed or deleted | 39 lines changed or added |