blob: d35f732441d85e60f6446a7d0c76301d4626d69d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/*
* Copyright (c) 2012 Tobias Markmann
* Licensed under the simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
#include "QtVCardRoleField.h"
#include "ui_QtVCardRoleField.h"
namespace Swift {
QtVCardRoleField::QtVCardRoleField(QWidget* parent, bool editable) :
QWidget(parent),
ui(new Ui::QtVCardRoleField) {
ui->setupUi(this);
connect(ui->lineEditROLE, SIGNAL(textChanged(QString)), SLOT(onTextChanged(QString)));
setEditable(editable);
}
QtVCardRoleField::~QtVCardRoleField() {
delete ui;
}
bool QtVCardRoleField::isEditable() const {
return editable;
}
void QtVCardRoleField::setEditable(bool editable) {
this->editable = editable;
if (this->editable) {
ui->lineEditROLE->show();
ui->labelROLE->hide();
} else {
ui->lineEditROLE->hide();
ui->labelROLE->show();
}
}
bool QtVCardRoleField::isEmpty() const {
return ui->lineEditROLE->text().isEmpty();
}
void QtVCardRoleField::setRole(const QString role) {
ui->lineEditROLE->setText(role);
}
QString QtVCardRoleField::getRole() const {
return ui->lineEditROLE->text();
}
void QtVCardRoleField::onTextChanged(const QString& text) {
ui->labelROLE->setText(text);
}
}
|