Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 4ff5d0ce authored by Lukas Appelhans's avatar Lukas Appelhans

Port to KDialog and fix some ui glitches

parent cd65a026
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>481</width>
<height>167</height>
<height>187</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
......@@ -29,7 +29,7 @@
</item>
<item row="0" column="1">
<widget class="KLineEdit" name="url">
<property name="clickMessage">
<property name="clickMessage" stdset="0">
<string>Enter a URL</string>
</property>
<property name="showClearButton" stdset="0">
......@@ -98,9 +98,21 @@
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Yes</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KIntNumInput</class>
<extends>QWidget</extends>
<header>knuminput.h</header>
</customwidget>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
......@@ -111,11 +123,6 @@
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
<customwidget>
<class>KIntNumInput</class>
<extends>QWidget</extends>
<header>knuminput.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
......
......@@ -27,7 +27,7 @@
#include <KStandardGuiItem>
MirrorAddDlg::MirrorAddDlg(MirrorModel *model, QWidget *parent, Qt::WFlags flags)
: KDialog(parent, flags),
: QDialog(parent, flags),
m_model(model),
m_countryModel(0)
{
......@@ -35,7 +35,7 @@ MirrorAddDlg::MirrorAddDlg(MirrorModel *model, QWidget *parent, Qt::WFlags flags
}
MirrorAddDlg::MirrorAddDlg(MirrorModel *model, QSortFilterProxyModel *countryModel, QWidget *parent, Qt::WFlags flags)
: KDialog(parent, flags),
: QDialog(parent, flags),
m_model(model),
m_countryModel(countryModel)
{
......@@ -44,7 +44,7 @@ MirrorAddDlg::MirrorAddDlg(MirrorModel *model, QSortFilterProxyModel *countryMod
QSize MirrorAddDlg::sizeHint() const
{
QSize sh = KDialog::sizeHint();
QSize sh = QDialog::sizeHint();
sh.setHeight(minimumSize().height());
sh.setWidth(sh.width() * 1.5);
return sh;
......@@ -52,10 +52,8 @@ QSize MirrorAddDlg::sizeHint() const
void MirrorAddDlg::init()
{
setCaption(i18n("Add mirror"));
QWidget *widget = new QWidget(this);
ui.setupUi(widget);
setMainWidget(widget);
setWindowTitle(i18n("Add mirror"));
ui.setupUi(this);
if (m_countryModel)
{
......@@ -63,13 +61,14 @@ void MirrorAddDlg::init()
ui.location->setCurrentIndex(-1);
}
setButtons(KDialog::Yes | KDialog::Cancel);
setButtonGuiItem(KDialog::Yes, KStandardGuiItem::add());
KGuiItem::assign(ui.buttonBox->button(QDialogButtonBox::Yes), KStandardGuiItem::add());
updateButton();
connect(ui.url, SIGNAL(textChanged(QString)), this, SLOT(updateButton(QString)));
connect(this, &MirrorAddDlg::yesClicked, this, &MirrorAddDlg::addMirror);
connect(this, &QDialog::accepted, this, &MirrorAddDlg::addMirror);
connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
}
void MirrorAddDlg::showItem(MirrorItem::DataType type, bool show)
......@@ -105,8 +104,7 @@ void MirrorAddDlg::updateButton(const QString &text)
{
enabled = true;
}
enableButton(KDialog::Yes, enabled);
enableButton(KDialog::User1, enabled);
ui.buttonBox->button(QDialogButtonBox::Yes)->setEnabled(enabled);
}
void MirrorAddDlg::addMirror()
......@@ -134,6 +132,7 @@ MirrorSettings::MirrorSettings(QWidget *parent, TransferHandler *handler, const
ui.setupUi(this);
KGuiItem::assign(ui.add, KStandardGuiItem::add());
KGuiItem::assign(ui.remove, KStandardGuiItem::remove());
KGuiItem::assign(ui.closeButton, KStandardGuiItem::close());
ui.treeView->setModel(m_proxy);
ui.treeView->header()->setResizeMode(QHeaderView::ResizeToContents);
ui.treeView->hideColumn(MirrorItem::Priority);
......@@ -149,8 +148,7 @@ MirrorSettings::MirrorSettings(QWidget *parent, TransferHandler *handler, const
setWindowTitle(i18n("Modify the used mirrors"));
connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(ui.closeButton, &QPushButton::clicked, this, &QDialog::accept);
}
QSize MirrorSettings::sizeHint() const
......
......@@ -22,7 +22,7 @@
#include "mirrormodel.h"
#include "../../core/basedialog.h"
#include <KDialog>
#include <QDialog>
#include "ui_mirrorsettings.h"
#include "ui_mirroradddlg.h"
......@@ -30,7 +30,7 @@
class QSortFilterProxyModel;
class TransferHandler;
class MirrorAddDlg : public KDialog
class MirrorAddDlg : public QDialog
{
Q_OBJECT
......
......@@ -30,7 +30,14 @@
</property>
</spacer>
</item>
<item row="0" column="0" rowspan="3">
<item row="3" column="1">
<widget class="QPushButton" name="closeButton">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item row="0" column="0" rowspan="4">
<widget class="QTreeView" name="treeView">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
......@@ -52,19 +59,6 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
......
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