filedialogextwidget.cpp (krename-4.0.9) | : | filedialogextwidget.cpp (krename-4.90.90) | ||
---|---|---|---|---|
skipping to change at line 20 | skipping to change at line 20 | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * This program is free software; you can redistribute it and/or modify * | |||
* it under the terms of the GNU General Public License as published by * | * it under the terms of the GNU General Public License as published by * | |||
* 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 "filedialogextwidget.h" | #include "filedialogextwidget.h" | |||
#include <KLocalizedString> | ||||
// Qt includes | // Qt includes | |||
#include <QHBoxLayout> | #include <QHBoxLayout> | |||
#include <QToolTip> | ||||
#include <QVBoxLayout> | #include <QVBoxLayout> | |||
#include <QUrl> | ||||
#include <klocale.h> | #include <QDialogButtonBox> | |||
#include <QPushButton> | ||||
FileDialogExtWidget::FileDialogExtWidget() | FileDialogExtWidget::FileDialogExtWidget(QWidget *parent) | |||
: QWidget() | : QDialog(parent) | |||
{ | { | |||
QVBoxLayout* layout = new QVBoxLayout( this ); | QVBoxLayout *mainLayout = new QVBoxLayout; | |||
QHBoxLayout* hbox = new QHBoxLayout(); | setLayout(mainLayout); | |||
checkDir = new QCheckBox( i18n("Add directory names &with filenames"), | m_fileWidget = new KFileWidget(QUrl()); | |||
this ); | m_fileWidget->setOperationMode(KFileWidget::Opening); | |||
checkRecursive = new QCheckBox( i18n("Add subdirectories &recursively"), thi | m_fileWidget->setMode(KFile::Files | KFile::Directory | KFile::ExistingOnly) | |||
s ); | ; | |||
checkHidden = new QCheckBox( i18n("Add &hidden directories"), this ); | ||||
checkOnlyDir = new QCheckBox( i18n("Add directory names only"), this ); | connect(m_fileWidget, &KFileWidget::accepted, [&]() { | |||
m_fileWidget->accept(); | ||||
hbox->addSpacing ( 20 ); | ||||
hbox->addWidget ( checkHidden ); | // We have to do this manually for some reason | |||
hbox->setStretchFactor( checkHidden, 4 ); | accept(); | |||
}); | ||||
layout->addWidget( checkDir ); | layout()->addWidget(m_fileWidget); | |||
layout->addWidget( checkRecursive ); | ||||
layout->addLayout( hbox ); | QWidget *extraWidget = new QWidget; | |||
layout->addWidget( checkOnlyDir ); | QVBoxLayout *extraLayout = new QVBoxLayout; | |||
extraWidget->setLayout(extraLayout); | ||||
connect( checkRecursive, SIGNAL( clicked() ), SLOT( enableControls() )); | checkDir = new QCheckBox(i18n("Add folder names &with filenames"), thi | |||
s); | ||||
checkRecursive->setToolTip( i18n("Walk recursively through the directory tre | checkRecursive = new QCheckBox(i18n("Add subfolders &recursively"), this); | |||
e and add also the content " | checkHidden = new QCheckBox(i18n("Add &hidden folders"), this); | |||
"of all subdirectories to the list of files | checkOnlyDir = new QCheckBox(i18n("Add folder names only"), this); | |||
to rename.") ); | ||||
checkHidden->setToolTip( i18n("If not checked, KRename will ignore directori | QHBoxLayout *hbox = new QHBoxLayout; | |||
es starting " | hbox->addSpacing(20); | |||
"with a dot during recursive adding.") ); | hbox->addWidget(checkHidden); | |||
checkOnlyDir->setToolTip( i18n("Add only the directory names and not the nam | hbox->setStretchFactor(checkHidden, 4); | |||
es " | ||||
"of the files in the directory to KRename.") | extraLayout->addWidget(checkDir); | |||
); | extraLayout->addWidget(checkRecursive); | |||
checkDir->setToolTip( i18n("This option causes KRename to add also the name | extraLayout->addLayout(hbox); | |||
of the base " | extraLayout->addWidget(checkOnlyDir); | |||
"directory of the selected files to its list.") ) | m_fileWidget->setCustomWidget(extraWidget); | |||
; | ||||
connect(checkRecursive, &QCheckBox::clicked, | ||||
this, &FileDialogExtWidget::enableControls); | ||||
checkRecursive->setToolTip(i18n("Walk recursively through the folder tree an | ||||
d also add the content " | ||||
"of all subfolders to the list of files to r | ||||
ename.")); | ||||
checkHidden->setToolTip(i18n("If not checked, KRename will ignore folders st | ||||
arting " | ||||
"with a dot during recursive adding.")); | ||||
checkOnlyDir->setToolTip(i18n("Add only the folder names and not the names " | ||||
"of the files in the folder to KRename.")); | ||||
checkDir->setToolTip(i18n("This option causes KRename to also add the name o | ||||
f the base " | ||||
"folder of the selected files to its list.")); | ||||
enableControls(); | enableControls(); | |||
QDialogButtonBox *buttonBox = new QDialogButtonBox; | ||||
buttonBox->addButton(m_fileWidget->okButton(), QDialogButtonBox::AcceptRole) | ||||
; | ||||
buttonBox->addButton(m_fileWidget->cancelButton(), QDialogButtonBox::RejectR | ||||
ole); | ||||
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); | ||||
connect(buttonBox, &QDialogButtonBox::accepted, | ||||
m_fileWidget, &KFileWidget::slotOk); | ||||
layout()->addWidget(buttonBox); | ||||
} | } | |||
void FileDialogExtWidget::enableControls() | void FileDialogExtWidget::enableControls() | |||
{ | { | |||
checkHidden->setEnabled( checkRecursive->isChecked() ); | checkHidden->setEnabled(checkRecursive->isChecked()); | |||
} | } | |||
#include "filedialogextwidget.moc" | ||||
End of changes. 10 change blocks. | ||||
40 lines changed or deleted | 68 lines changed or added |