Commit b9c664bf authored by Laurent Montel's avatar Laurent Montel 😁

Convert to QDialog

parent 4d536dcb
......@@ -34,6 +34,10 @@
#include <KFileDialog>
#include <KUrlCompletion>
#include <KLocalizedString>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
// Konsole
#include "ui_ColorSchemeEditor.h"
......@@ -51,18 +55,28 @@ const int COLOR_COLUMN = 1; // column 1 : actual colors
const int INTENSE_COLOR_COLUMN = 2; // column 2 : intense colors
ColorSchemeEditor::ColorSchemeEditor(QWidget* aParent)
: KDialog(aParent)
: QDialog(aParent)
, _isNewScheme(false)
, _colors(0)
{
// Kdialog buttons
setButtons(KDialog::Ok | KDialog::Cancel | KDialog::Apply);
connect(this, &Konsole::ColorSchemeEditor::applyClicked, this, &Konsole::ColorSchemeEditor::saveColorScheme);
connect(this, &Konsole::ColorSchemeEditor::okClicked, this, &Konsole::ColorSchemeEditor::saveColorScheme);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Apply);
QWidget *mainWidget = new QWidget(this);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mainLayout->addWidget(mainWidget);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
mainLayout->addWidget(buttonBox);
connect(buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked, this, &Konsole::ColorSchemeEditor::saveColorScheme);
connect(okButton, &QPushButton::clicked, this, &Konsole::ColorSchemeEditor::saveColorScheme);
// ui
_ui = new Ui::ColorSchemeEditor();
_ui->setupUi(mainWidget());
_ui->setupUi(mainWidget);
// description edit
_ui->descriptionEdit->setClearButtonEnabled(true);
......@@ -211,10 +225,10 @@ void ColorSchemeEditor::setup(const ColorScheme* scheme, bool isNewScheme)
_colors = new ColorScheme(*scheme);
if (_isNewScheme) {
setCaption(i18n("New Color Scheme"));
setWindowTitle(i18n("New Color Scheme"));
setDescription(i18n("New Color Scheme"));
} else {
setCaption(i18n("Edit Color Scheme"));
setWindowTitle(i18n("Edit Color Scheme"));
}
// setup description edit
......
......@@ -24,7 +24,7 @@
#include <QWidget>
// KDE
#include <KDialog>
#include <QDialog>
// Konsole
#include "Profile.h"
......@@ -52,7 +52,7 @@ class ColorScheme;
*
* When changes are made the colorsChanged() signal is emitted.
*/
class KONSOLEPRIVATE_EXPORT ColorSchemeEditor : public KDialog
class KONSOLEPRIVATE_EXPORT ColorSchemeEditor : public QDialog
{
Q_OBJECT
......
......@@ -25,19 +25,33 @@
#include "ui_HistorySizeDialog.h"
#include <KLocalizedString>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
using namespace Konsole;
HistorySizeDialog::HistorySizeDialog(QWidget* parent)
: KDialog(parent)
: QDialog(parent)
{
setCaption(i18nc("@title:window", "Adjust Scrollback"));
setButtons(KDialog::Ok | KDialog::Cancel);
setWindowTitle(i18nc("@title:window", "Adjust Scrollback"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
QWidget *mainWidget = new QWidget(this);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mainLayout->addWidget(mainWidget);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
mainLayout->addWidget(buttonBox);
setWindowModality(Qt::WindowModal);
_ui = new Ui::HistorySizeDialog();
_ui->setupUi(mainWidget());
_ui->setupUi(mainWidget);
_ui->tempWarningWidget->setVisible(true);
_ui->tempWarningWidget->setWordWrap(true);
......
......@@ -22,7 +22,7 @@
#define HISTORYSIZEDIALOG_H
// KDE
#include <KDialog>
#include <QDialog>
// Konsole
#include "Enumeration.h"
......@@ -34,7 +34,7 @@ class HistorySizeDialog;
namespace Konsole
{
class HistorySizeDialog : public KDialog
class HistorySizeDialog : public QDialog
{
Q_OBJECT
......
......@@ -24,19 +24,33 @@
#include "ui_RenameTabDialog.h"
#include <KLocalizedString>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
using Konsole::RenameTabDialog;
RenameTabDialog::RenameTabDialog(QWidget* parent)
: KDialog(parent)
: QDialog(parent)
{
setCaption(i18n("Rename Tab"));
setButtons(KDialog::Ok | KDialog::Cancel);
setWindowTitle(i18n("Rename Tab"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
QWidget *mainWidget = new QWidget(this);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mainLayout->addWidget(mainWidget);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
mainLayout->addWidget(buttonBox);
setWindowModality(Qt::WindowModal);
_ui = new Ui::RenameTabDialog();
_ui->setupUi(mainWidget());
_ui->setupUi(mainWidget);
}
RenameTabDialog::~RenameTabDialog()
......
......@@ -21,7 +21,7 @@
#define RENAMETABDIALOG_H
// KDE
#include <KDialog>
#include <QDialog>
namespace Ui
{
......@@ -30,7 +30,7 @@ class RenameTabDialog;
namespace Konsole
{
class RenameTabDialog : public KDialog
class RenameTabDialog : public QDialog
{
Q_OBJECT
......
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