Commit fac3391a authored by Michael Pyne's avatar Michael Pyne

Port remainer of file renamer code away from KDialog.

parent aa19284d
......@@ -277,6 +277,8 @@ FileRenamerWidget::FileRenamerWidget(QWidget *parent) :
connect(m_exampleDialog, SIGNAL(dataChanged()), SLOT(dataSelected()));
connect(m_exampleDialog, SIGNAL(fileChanged(QString)),
this, SLOT(fileSelected(QString)));
connect(m_ui->dlgButtonBox, SIGNAL(accepted()), SIGNAL(accepted()));
connect(m_ui->dlgButtonBox, SIGNAL(rejected()), SIGNAL(rejected()));
exampleTextChanged();
}
......
......@@ -159,6 +159,10 @@ public:
*/
void saveConfig();
signals:
void accepted(); // for the QDialogButtonBox
void rejected();
protected slots:
/**
* This function should be called whenever the example text may need to be
......
......@@ -247,6 +247,13 @@
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="dlgButtonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
......
......@@ -20,27 +20,28 @@
#include <klocale.h>
FileRenamerConfigDlg::FileRenamerConfigDlg(QWidget *parent) :
KDialog(parent),
m_renamerWidget(new FileRenamerWidget(this))
FileRenamerConfigDlg::FileRenamerConfigDlg(QWidget *parent)
: QDialog(parent)
, m_renamerWidget(new FileRenamerWidget(this))
{
setObjectName( QLatin1String("file renamer dialog" ));
setObjectName(QLatin1String("file renamer dialog"));
setModal(true);
setCaption(i18n("File Renamer Options"));
setButtons(Ok | Cancel);
setWindowTitle(i18n("File Renamer Options"));
// TODO: HiDPI? Is this even still needed today?
m_renamerWidget->setMinimumSize(400, 300);
setMainWidget(m_renamerWidget);
connect(m_renamerWidget, &FileRenamerWidget::accepted, this, &QDialog::accept);
connect(m_renamerWidget, &FileRenamerWidget::rejected, this, &QDialog::reject);
auto vboxLayout = new QVBoxLayout(this);
vboxLayout->addWidget(m_renamerWidget);
}
void FileRenamerConfigDlg::accept()
{
// Make sure the config gets saved.
m_renamerWidget->saveConfig();
KDialog::accept();
QDialog::accept();
}
// vim: set et sw=4 tw=0 sta:
......@@ -15,26 +15,26 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FILERENAMERCONFIGDLG_H
#define FILERENAMERCONFIGDLG_H
#ifndef JUK_FILERENAMERCONFIGDLG_H
#define JUK_FILERENAMERCONFIGDLG_H
#include <kdialog.h>
#include <QDialog>
class FileRenamerWidget;
class FileRenamerConfigDlg : public KDialog
class FileRenamerConfigDlg : public QDialog
{
Q_OBJECT
public:
public:
FileRenamerConfigDlg(QWidget *parent);
protected slots:
protected slots:
virtual void accept();
private:
private:
FileRenamerWidget *m_renamerWidget;
};
#endif // FILERENAMERCONFIGDLG_H
#endif // JUK_FILERENAMERCONFIGDLG_H
// vim: set et sw=4 tw=0 sta:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment