source: src-qt4/pc-zmanager/dialogname.cpp @ 125dbc9

9.2-releasereleng/10.0releng/10.0.1releng/10.0.2releng/10.0.3releng/10.1
Last change on this file since 125dbc9 was 125dbc9, checked in by Kris Moore <kris@…>, 15 months ago

Welcome the new 'pc-zmanager' for ZFS & Disk Management

A HUGE Thank You to: Claudio L <claudio@…>

Update pkg-plist and add it to the control panel

  • Property mode set to 100644
File size: 1.5 KB
Line 
1#include <QLineEdit>
2#include <QCheckBox>
3#include "dialogname.h"
4#include "ui_dialogname.h"
5
6DialogName::DialogName(QWidget *parent) :
7    QDialog(parent),
8    ui(new Ui::DialogName)
9{
10    ui->setupUi(this);
11    isValid=false;
12}
13
14DialogName::~DialogName()
15{
16    delete ui;
17}
18
19
20
21void DialogName::setForbiddenList(QStringList& a)
22{
23    forbidden=a;
24    on_nameEdit_textChanged(ui->nameEdit->text());
25}
26
27void DialogName::setTitle(QString t)
28{
29    this->setWindowTitle(t);
30}
31
32void DialogName::setName(QString t)
33{
34    ui->nameEdit->setText(t);
35}
36
37QString DialogName::getName()
38{
39    return ui->nameEdit->text();
40}
41
42
43void DialogName::done(int result)
44{
45    if(result==QDialog::Accepted && !isValid) return;
46        QDialog::done(result);
47}
48
49void DialogName::on_nameEdit_textChanged(const QString &arg1)
50{
51    if(arg1.isEmpty() || forbidden.contains(arg1)) {
52        ui->nameEdit->setStyleSheet("background-color: rgb(255, 188, 183);");
53        isValid=false;
54    }
55    else {
56        ui->nameEdit->setStyleSheet("");
57        isValid=true;
58    }
59}
60
61void DialogName::on_checkAltRoot_stateChanged(int arg1)
62{
63    Q_UNUSED(arg1);
64
65    ui->editAltRoot->setEnabled(ui->checkAltRoot->isChecked());
66}
67
68bool DialogName::importReadOnly()
69{
70    return ui->checkReadOnly->isChecked();
71}
72
73bool DialogName::importSetAltRoot()
74{
75    return ui->checkAltRoot->isChecked();
76}
77
78QString DialogName::getAltRoot()
79{
80    return ui->editAltRoot->text();
81}
82
83
84void DialogName::showOptions(bool show)
85{
86    ui->frame->setVisible(show);
87}
Note: See TracBrowser for help on using the repository browser.