mirror of
https://github.com/altlinux/admc.git
synced 2025-02-09 01:57:26 +03:00
redo edit query folder dialog in designer
This commit is contained in:
parent
ebbc16f175
commit
4747690c05
@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include "edit_query_folder_dialog.h"
|
||||
#include "ui_edit_query_folder_dialog.h"
|
||||
|
||||
#include "ad_filter.h"
|
||||
#include "console_impls/query_item_impl.h"
|
||||
@ -28,43 +29,16 @@
|
||||
#include "status.h"
|
||||
#include "console_impls/item_type.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFormLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QModelIndex>
|
||||
|
||||
EditQueryFolderDialog::EditQueryFolderDialog(ConsoleWidget *console_arg)
|
||||
: QDialog(console_arg) {
|
||||
ui = new Ui::EditQueryFolderDialog();
|
||||
ui->setupUi(this);
|
||||
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
|
||||
console = console_arg;
|
||||
|
||||
setWindowTitle(tr("Edit Query Folder"));
|
||||
|
||||
name_edit = new QLineEdit();
|
||||
description_edit = new QLineEdit();
|
||||
|
||||
auto form_layout = new QFormLayout();
|
||||
|
||||
auto button_box = new QDialogButtonBox();
|
||||
auto ok_button = button_box->addButton(QDialogButtonBox::Ok);
|
||||
button_box->addButton(QDialogButtonBox::Cancel);
|
||||
|
||||
form_layout->addRow(tr("Name:"), name_edit);
|
||||
form_layout->addRow(tr("Description:"), description_edit);
|
||||
|
||||
const auto layout = new QVBoxLayout();
|
||||
setLayout(layout);
|
||||
layout->addLayout(form_layout);
|
||||
layout->addWidget(ok_button);
|
||||
|
||||
connect(
|
||||
button_box, &QDialogButtonBox::accepted,
|
||||
this, &QDialog::accept);
|
||||
connect(
|
||||
button_box, &QDialogButtonBox::rejected,
|
||||
this, &QDialog::reject);
|
||||
}
|
||||
|
||||
void EditQueryFolderDialog::open() {
|
||||
@ -72,16 +46,16 @@ void EditQueryFolderDialog::open() {
|
||||
const QString current_name = index.data(Qt::DisplayRole).toString();
|
||||
const QString current_description = index.data(QueryItemRole_Description).toString();
|
||||
|
||||
name_edit->setText(current_name);
|
||||
description_edit->setText(current_description);
|
||||
ui->name_edit->setText(current_name);
|
||||
ui->description_edit->setText(current_description);
|
||||
|
||||
QDialog::open();
|
||||
}
|
||||
|
||||
void EditQueryFolderDialog::accept() {
|
||||
const QModelIndex index = console->get_selected_item(ItemType_QueryFolder);
|
||||
const QString name = name_edit->text();
|
||||
const QString description = description_edit->text();
|
||||
const QString name = ui->name_edit->text();
|
||||
const QString description = ui->description_edit->text();
|
||||
|
||||
if (!console_query_or_folder_name_is_good(name, index.parent(), this, index)) {
|
||||
return;
|
||||
|
@ -23,9 +23,12 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class QLineEdit;
|
||||
class ConsoleWidget;
|
||||
|
||||
namespace Ui {
|
||||
class EditQueryFolderDialog;
|
||||
}
|
||||
|
||||
class EditQueryFolderDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
@ -35,8 +38,7 @@ public:
|
||||
void open() override;
|
||||
|
||||
private:
|
||||
QLineEdit *name_edit;
|
||||
QLineEdit *description_edit;
|
||||
Ui::EditQueryFolderDialog *ui;
|
||||
ConsoleWidget *console;
|
||||
|
||||
void accept() override;
|
||||
|
88
src/admc/edit_query_folder_dialog.ui
Normal file
88
src/admc/edit_query_folder_dialog.ui
Normal file
@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EditQueryFolderDialog</class>
|
||||
<widget class="QDialog" name="EditQueryFolderDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>127</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Edit Query Folder</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="nameLabel">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="name_edit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="descriptionLabel">
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="description_edit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>EditQueryFolderDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>EditQueryFolderDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
x
Reference in New Issue
Block a user