blob: 79e4440efd3fd637c21554ebb45dcc2289d0cdb4 (
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
66
67
|
/*
* Copyright (c) 2012 Tobias Markmann
* Licensed under the simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
#include "QtVCardAddressLabelField.h"
#include "ui_QtVCardAddressLabelField.h"
#define GETTER_SETTER_CHECKBOX_IMPL( METHOD_NAME, UI_NAME ) \
void QtVCardAddressLabelField::set##METHOD_NAME(const bool METHOD_NAME) { \
ui->checkBox##UI_NAME->setChecked(METHOD_NAME); \
} \
\
bool QtVCardAddressLabelField::get##METHOD_NAME() const { \
return ui->checkBox##UI_NAME->checkState() == Qt::Checked; \
}
namespace Swift {
QtVCardAddressLabelField::QtVCardAddressLabelField(QWidget* parent, bool editable) :
QWidget(parent),
ui(new Ui::QtVCardAddressLabelField) {
ui->setupUi(this);
setEditable(editable);
}
QtVCardAddressLabelField::~QtVCardAddressLabelField() {
delete ui;
}
bool QtVCardAddressLabelField::isEditable() const {
return editable;
}
void QtVCardAddressLabelField::setEditable(bool editable) {
this->editable = editable;
ui->plainTextEditLINES->setReadOnly(!editable);
}
bool QtVCardAddressLabelField::isEmpty() const {
return false;
}
GETTER_SETTER_CHECKBOX_IMPL(Home, HOME)
GETTER_SETTER_CHECKBOX_IMPL(Work, WORK)
GETTER_SETTER_CHECKBOX_IMPL(Postal, POSTAL)
GETTER_SETTER_CHECKBOX_IMPL(Parcel, PARCEL)
GETTER_SETTER_CHECKBOX_IMPL(Preferred, PREF)
void QtVCardAddressLabelField::setDeliveryType(DeliveryType type) {
ui->comboBoxDOM_INTL->setCurrentIndex(type);
}
QtVCardAddressLabelField::DeliveryType QtVCardAddressLabelField::getDeliveryType() const {
return ui->comboBoxDOM_INTL->currentIndex() == 1 ? InternationalDelivery : DomesticDelivery;
}
void QtVCardAddressLabelField::setLines(const QString& lines) {
ui->plainTextEditLINES->setPlainText(lines);
}
QString QtVCardAddressLabelField::getLines() const {
return ui->plainTextEditLINES->toPlainText();
}
}
|