Commit 0d925246 authored by Yuri Chornoivan's avatar Yuri Chornoivan

Port away from deprecated KDialog

parent 33f41a6f
......@@ -21,7 +21,6 @@
#include "settings.h"
#include <KConfigDialog>
#include <KDialog>
#include <KLineEdit>
#include <KLocalizedString>
#include <KUrlRequester>
......
......@@ -25,13 +25,14 @@
#include "kget_debug.h"
#include <KDialog>
#include <QDialog>
#include <KGlobal>
#include <QTabWidget>
#include <KTitleWidget>
#include <QGridLayout>
#include <KSharedConfig>
#include <KConfigGroup>
using namespace kt;
......
......@@ -28,19 +28,23 @@
#include <KStandardGuiItem>
#include <QCloseEvent>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
using namespace bt;
namespace kt
{
ScanDlg::ScanDlg(KJob *job, QWidget* parent)
: KDialog(parent), m_job(static_cast<Job*>(job))
: QDialog(parent), m_job(static_cast<Job*>(job))
{
setButtons(KDialog::None);
Ui::ScanDlgBase ui;
QWidget *widget = new QWidget(this);
QVBoxLayout *mainLayout = new QVBoxLayout;
ui.setupUi(widget);
setMainWidget(widget);
mainLayout->addWidget(widget);
m_torrent_label = ui.torrent_label;
m_chunks_found = ui.chunks_found;
m_chunks_failed = ui.chunks_failed;
......@@ -79,13 +83,13 @@ namespace kt
m_job->kill(false);
m_job = nullptr;
}
KDialog::reject();
QDialog::reject();
deleteLater();
}
void ScanDlg::accept()
{
KDialog::accept();
QDialog::accept();
deleteLater();
}
......
......@@ -21,9 +21,9 @@
#ifndef KT_SCANDLG_HH
#define KT_SCANDLG_HH
#include <QDialog>
#include <QTimer>
#include <QMutex>
#include <KDialog>
#include <version.h>
#include <torrent/job.h>
......@@ -38,7 +38,7 @@ namespace kt
{
class TorrentInterface;
class ScanDlg : public KDialog
class ScanDlg : public QDialog
{
Q_OBJECT
public:
......
......@@ -28,7 +28,7 @@
#include <QStyledItemDelegate>
#include <KCModule>
#include <KDialog>
#include <QDialog>
class QSortFilterProxyModel;
class QStandardItemModel;
......
......@@ -15,8 +15,9 @@
#include <QSize>
#include <kdialog.h>
#include <QDialog>
#include <QDebug>
#include <KConfigGroup>
KGET_EXPORT_PLUGIN_CONFIG(DlgContentFetchSettingWidget)
......@@ -111,10 +112,10 @@ void DlgContentFetchSettingWidget::slotConfigureScript()
Kross::ChildrenInterface::AutoConnectSignals);
m_p_action->trigger();
KDialog *dialog = new KDialog(this);
QDialog *dialog = new QDialog(this);
dialog->setObjectName("configure_script");
dialog->setCaption(i18nc("Configure script", "Configure script"));
dialog->enableButtonOk(false);
dialog->setWindowTitle(i18nc("Configure script", "Configure script"));
dialog->okButton->setEnabled(false);
dialog->setModal(true);
SettingWidgetAdaptor *widget = new SettingWidgetAdaptor(dialog);
......@@ -123,11 +124,12 @@ void DlgContentFetchSettingWidget::slotConfigureScript()
if (widget->findChild<QWidget*>())
{
dialog->enableButtonOk(true);
dialog->okButton->setEnabled(true);
}
dialog->setMainWidget(widget);
dialog->showButtonSeparator(true);
QVBoxLayout *mainLayout = new QVBoxLayout;
dialog->setLayout(mainLayout);
mainLayout->addWidget(widget);
// dirty hack, add the ok/canel button size manually
dialog->resize(widget->size()+QSize(0,30));
dialog->show();
......
......@@ -14,13 +14,19 @@
#include <kross/core/manager.h>
#include <kross/core/interpreter.h>
#include <kfiledialog.h>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
DlgScriptEditing::DlgScriptEditing(QWidget *p_parent)
: KDialog(p_parent)
: QDialog(p_parent)
{
QWidget *mainWidget = new QWidget(this);
ui.setupUi(mainWidget);
setMainWidget(mainWidget);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mainLayout->addWidget(mainWidget);
setWindowTitle(i18n("Add New Script"));
init();
......@@ -28,11 +34,13 @@ DlgScriptEditing::DlgScriptEditing(QWidget *p_parent)
DlgScriptEditing::DlgScriptEditing(QWidget *p_parent,
const QStringList &script)
: KDialog(p_parent)
: QDialog(p_parent)
{
QWidget *mainWidget = new QWidget(this);
ui.setupUi(mainWidget);
setMainWidget(mainWidget);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mainLayout->addWidget(mainWidget);
setWindowTitle(i18n("Edit Script"));
ui.scriptPathRequester->setUrl(QUrl::fromLocalFile(script[0]));
......@@ -45,7 +53,7 @@ DlgScriptEditing::DlgScriptEditing(QWidget *p_parent,
void DlgScriptEditing::init()
{
ui.scriptPathRequester->setMode(KFile::File | KFile::ExistingOnly | KFile::LocalOnly);
ui.scriptPathRequester->fileDialog()->setCaption(i18n("Set Script File"));
ui.scriptPathRequester->fileDialog()->setWindowTitle(i18n("Set Script File"));
QStringList filter;
foreach(Kross::InterpreterInfo* info, Kross::Manager::self().interpreterInfos())
......@@ -53,8 +61,17 @@ void DlgScriptEditing::init()
ui.scriptPathRequester->setFilter(filter.join(" "));
setModal(true);
setButtons(KDialog::Ok | KDialog::Cancel);
showButtonSeparator(true);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
QWidget *mainWidget = new QWidget(this);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mainLayout->addWidget(mainWidget);
okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::accepted, this, &DlgScriptEditing::accept);
connect(buttonBox, &QSIGNAL(rejected()), this, &DlgScriptEditing::reject);
mainLayout->addWidget(buttonBox);
connect(ui.scriptPathRequester,SIGNAL(textChanged(QString)),
this, SLOT(slotChangeText()));
......@@ -70,7 +87,7 @@ DlgScriptEditing::~DlgScriptEditing()
void DlgScriptEditing::slotChangeText()
{
enableButton(KDialog::Ok, !(ui.scriptPathRequester->url().isEmpty() ||
okButton->setEnabled(!(ui.scriptPathRequester->url().isEmpty() ||
ui.scriptUrlRegexpEdit->text().isEmpty()));
}
......
......@@ -15,7 +15,7 @@
#include <QStringList>
class DlgScriptEditing : public KDialog
class DlgScriptEditing : public QDialog
{
Q_OBJECT
......@@ -31,6 +31,7 @@ class DlgScriptEditing : public KDialog
void slotChangeText();
private:
Ui::DlgScriptEditing ui;
QPushButton *okButton;
};
#endif // DLG_SCRIPT_EDITING_H
......@@ -29,9 +29,8 @@
#include <KIO/RenameDialog>
#include <KLocalizedString>
#include <KMessageBox>
#include <KDialog>
#include <QDialog>
#include <QFile>
#include <QDomElement>
......
......@@ -24,14 +24,20 @@
#include <QSortFilterProxyModel>
#include <KLocalizedString>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
FileSelectionDlg::FileSelectionDlg(FileModel *model, QWidget *parent)
: KDialog(parent)
: QDialog(parent)
{
setCaption(i18n("File Selection"));
setWindowTitle(i18n("File Selection"));
QWidget *widget = new QWidget(this);
ui.setupUi(widget);
setMainWidget(widget);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mainLayout->addWidget(widget);
QSortFilterProxyModel *proxy = new QSortFilterProxyModel(this);
proxy->setSourceModel(model);
ui.treeView->setModel(proxy);
......@@ -40,5 +46,11 @@ FileSelectionDlg::FileSelectionDlg(FileModel *model, QWidget *parent)
ui.treeView->hideColumn(FileItem::ChecksumVerified);
ui.treeView->hideColumn(FileItem::SignatureVerified);
setButtons(KDialog::Ok | KDialog::Cancel);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::accepted, this, &FileSelectionDlg::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &FileSelectionDlg::reject);
mainLayout->addWidget(buttonBox);
}
......@@ -20,13 +20,13 @@
#ifndef FILESELECTIONDLG_H
#define FILESELECTIONDLG_H
#include <KDialog>
#include <QDialog>
#include "ui_fileselection.h"
class FileModel;
class FileSelectionDlg : public KDialog
class FileSelectionDlg : public QDialog
{
Q_OBJECT
......
......@@ -30,12 +30,13 @@
#include <KLocalizedString>
#include <KMessageBox>
#include <QDebug>
#include <KDialog>
#include <QDialog>
#include <QFile>
#include <QDomElement>
#include <QStandardPaths>
#include <KConfigGroup>
Metalink::Metalink(TransferGroup * parent, TransferFactory * factory,
Scheduler * scheduler, const QUrl & source, const QUrl & dest,
......@@ -204,7 +205,7 @@ bool Metalink::metalinkInit(const QUrl &src, const QByteArray &data)
//the metalink-file has just been downloaded, so ask the user to choose the files that
// should be downloaded
if (m_metalinkJustDownloaded) {
KDialog *dialog = new FileSelectionDlg(fileModel());
QDialog *dialog = new FileSelectionDlg(fileModel());
dialog->setAttribute(Qt::WA_DeleteOnClose);
connect(dialog, SIGNAL(finished(int)), this, SLOT(fileDlgFinished(int)));
......
......@@ -32,12 +32,13 @@
#include <KIO/RenameDialog>
#include <KLocalizedString>
#include <KMessageBox>
#include <KDialog>
#include <QDialog>
#include <QFile>
#include <QDomElement>
#include <QStandardPaths>
#include <KConfigGroup>
/**
* @return Hex value from a base64 value
......
......@@ -32,12 +32,13 @@
#include <KIO/RenameDialog>
#include <KLocalizedString>
#include <KMessageBox>
#include <KDialog>
#include <QDialog>
#include <QFile>
#include <QDomElement>
#include <QStandardPaths>
#include <KConfigGroup>
MetalinkXml::MetalinkXml(TransferGroup * parent, TransferFactory * factory,
Scheduler * scheduler, const QUrl & source, const QUrl & dest,
......
......@@ -16,18 +16,29 @@
#include "kget_debug.h"
#include <qdebug.h>
#include <KLocalizedString>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
DlgEngineEditing::DlgEngineEditing(QWidget *parent)
: KDialog(parent)
: QDialog(parent)
{
QWidget *mainWidget = new QWidget(this);
ui.setupUi(mainWidget);
setMainWidget(mainWidget);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mainLayout->addWidget(mainWidget);
setWindowTitle(i18n("Insert Engine"));
setModal(true);
setButtons(KDialog::Ok | KDialog::Cancel);
showButtonSeparator(true);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::accepted, this, &DlgEngineEditing::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &DlgEngineEditing::reject);
mainLayout->addWidget(buttonBox);
ui.engineNameLabel->setText(i18n("Engine name:"));
ui.urlLabel->setText(i18n("URL:"));
......@@ -42,7 +53,7 @@ DlgEngineEditing::~DlgEngineEditing()
void DlgEngineEditing::slotChangeText()
{
enableButton(KDialog::Ok, !ui.urlEdit->text().isEmpty());
okButton->setEnabled(!ui.urlEdit->text().isEmpty());
}
QString DlgEngineEditing::engineName() const
......
......@@ -15,9 +15,9 @@
#include "ui_dlgmirrorsearch.h"
#include <KCModule>
#include <KDialog>
#include <QDialog>
class DlgEngineEditing : public KDialog
class DlgEngineEditing : public QDialog
{
Q_OBJECT
......@@ -32,6 +32,7 @@ private slots:
private:
Ui::DlgEngineEditing ui;
QPushButton *okButton;
};
class DlgSettingsWidget : public KCModule
......
......@@ -17,7 +17,6 @@ GroupSettingsDialog::GroupSettingsDialog(QWidget *parent, TransferGroupHandler *
m_group(group)
{
setWindowTitle(i18n("Group Settings for %1", group->name()));
//showButtonSeparator(true);
ui.setupUi(this);
......
......@@ -31,7 +31,6 @@ RenameFile::RenameFile(FileModel *model, const QModelIndex &index, QWidget *pare
m_index(index)
{
setWindowTitle(i18n("Rename File"));
//showButtonSeparator(true);
ui.setupUi(this);
const QString originalName = m_model->data(m_index, Qt::DisplayRole).toString();
......
......@@ -31,7 +31,6 @@ TransferSettingsDialog::TransferSettingsDialog(QWidget *parent, TransferHandler
m_proxy(nullptr)
{
setWindowTitle(i18n("Transfer Settings for %1", m_transfer->source().fileName()));
//showButtonSeparator(true);
ui.setupUi(this);
......
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