5 #include "FingerNames.h"
10 FMEnroll::FMEnroll(DeviceModel device
, int finger
, QWidget
*parent
) :
11 KDialog(parent
), finger_(finger
), device_(device
) {
12 // Modal dialog, only Cancel button, precedent by separator
14 showButtonSeparator(true);
15 setButtons(KDialog::Cancel
);
18 dbc
= FMDbusConn::getConn();
20 iface
= dbc
->claimDevice(device_
.device
, getlogin());
22 // Init and traslate UI components
25 setMainWidget(mainPanel
);
28 statusLayout
->addWidget(statusLabel
);
29 statusLayout
->addWidget(actualStatus
);
30 mainLayout
->addLayout(statusLayout
);
32 stagesLayout
->addStretch();
33 for (int i
= 0; i
< ENROLL_STAGES
; i
++) {
34 stagesLayout
->addWidget(stages
[i
]);
36 stagesLayout
->addStretch();
38 mainLayout
->addLayout(stagesLayout
);
39 mainPanel
->setLayout(mainLayout
);
41 setMaximumSize(minimumSizeHint());
44 void FMEnroll::initComponents() {
45 mainPanel
= new QWidget();
46 statusLabel
= new QLabel();
47 actualStatus
= new QLabel();
48 statusLayout
= new QHBoxLayout();
49 stagesLayout
= new QHBoxLayout();
50 mainLayout
= new QVBoxLayout();
52 for (int i
= 0; i
< ENROLL_STAGES
; i
++) {
53 stages
[i
] = new QCheckBox();
54 stages
[i
]->setEnabled(false);
58 void FMEnroll::retranslate() {
60 setWindowTitle(i18n("Enrolling finger..."));
63 setWhatsThis(i18n("Enroll finger window"));
66 statusLabel
->setText(i18n("Status")+":");
68 // Set stages tooltips
69 for (int i
= 0; i
< ENROLL_STAGES
; i
++) {
70 QString msg
= i18n("Stage %1").arg(i
+ 1);
71 stages
[i
]->setToolTip(msg
);
72 stages
[i
]->setWhatsThis(i18n("Current enrollment progess..."));
75 QString msg
= QString("Swipe \"%1\" on \"%2\"").arg(fingerNames
[finger_
].name
, device_
.name
);
76 actualStatus
->setText(i18n(msg
.toLatin1()));
82 FMEnroll::~FMEnroll() {
83 if (statusLabel
) delete statusLabel
;
84 if (actualStatus
) delete actualStatus
;
85 if (statusLayout
) delete statusLayout
;
86 for (int i
= 0; i
< ENROLL_STAGES
; i
++) {
87 if (stages
[i
]) delete stages
[i
];
89 if (stagesLayout
) delete stagesLayout
;
90 if (mainLayout
) delete mainLayout
;
91 if (mainPanel
) delete mainPanel
;
93 dbc
->releaseDevice(device_
.device
);