]> git.lyx.org Git - lyx.git/blob - src/frontends/kde/kdeBC.C
87ec207db514d5d1171498bcecc9aae8fd1befac
[lyx.git] / src / frontends / kde / kdeBC.C
1 #include <config.h>
2
3 #ifdef __GNUG__
4 #pragma implementation
5 #endif
6
7 #include "kdeBC.h"
8 #include <qpushbutton.h>
9
10 kdeBC::kdeBC(string const & cancel, string const & close)
11         : ButtonControllerBase(cancel, close),
12           okay_(0), apply_(0), cancel_(0), undo_all_(0), read_only_()
13 {}
14
15
16 void kdeBC::refresh()
17 {
18         if (okay_) {
19                 if (bp().buttonStatus(ButtonPolicy::OKAY)) {
20                         okay_->setEnabled(true);
21                 } else {
22                         okay_->setEnabled(false);
23                 }
24         }
25         if (apply_) {
26                 if (bp().buttonStatus(ButtonPolicy::APPLY)) {
27                         apply_->setEnabled(true);
28                 } else {
29                         apply_->setEnabled(false);
30                 }
31         }
32         if (undo_all_) {
33                 if (bp().buttonStatus(ButtonPolicy::UNDO_ALL)) {
34                         undo_all_->setEnabled(true);
35                 } else {
36                         undo_all_->setEnabled(false);
37                 }
38         }
39         if (cancel_) {
40                 if (bp().buttonStatus(ButtonPolicy::CANCEL)) {
41                         cancel_->setText(cancel_label.c_str());
42                 } else {
43                         cancel_->setText(close_label.c_str());
44                 }
45         }
46         if (!read_only_.empty()) {
47                 bool enable = true;
48                 if (bp().isReadOnly()) enable = false;
49                         
50                 for (std::list<QWidget *>::iterator iter = read_only_.begin();
51                      iter != read_only_.end(); ++iter) {
52                         (*iter)->setEnabled(enable);
53                 }
54         }
55 }