blob: 3cad247d1a5ab509e3ff86acb8f9817428e6d965 (
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
56
57
58
59
60
61
62
63
64
65
|
/*
* Copyright (c) 2012 Tobias Markmann
* Licensed under the simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
#include "QtVCardBirthdayField.h"
#include "ui_QtVCardBirthdayField.h"
#include <QLayout>
namespace Swift {
QtVCardBirthdayField::QtVCardBirthdayField(QWidget* parent, bool editable) :
QWidget(parent),
ui(new Ui::QtVCardBirthdayField) {
ui->setupUi(this);
connect(ui->deleteField, SIGNAL(clicked()), SLOT(onDeleteFieldPressed()));
setEditable(editable);
}
QtVCardBirthdayField::~QtVCardBirthdayField() {
delete ui;
}
bool QtVCardBirthdayField::isEditable() const {
return editable;
}
void QtVCardBirthdayField::setEditable(bool editable) {
if (editable) {
ui->labelBDAY->hide();
ui->dateEditBDAY->show();
ui->deleteField->show();
} else {
ui->dateEditBDAY->hide();
ui->deleteField->hide();
ui->labelBDAY->show();
}
this->editable = editable;
}
bool QtVCardBirthdayField::isEmpty() const {
return false;
}
void QtVCardBirthdayField::setBirthday(const QDate& date) {
ui->labelBDAY->setText(date.toString());
ui->dateEditBDAY->setDate(date);
}
QDate QtVCardBirthdayField::getBirthday() const {
return ui->dateEditBDAY->date();
}
void QtVCardBirthdayField::onDateChanged(QDate date) {
ui->labelBDAY->setText(date.toString());
}
void QtVCardBirthdayField::onDeleteFieldPressed() {
delete this;
}
}
|