author | alwin <alwin> | 2005-02-27 13:40:06 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-02-27 13:40:06 (UTC) |
commit | 952ed8b53ee74217c3aa839dada3119bb399b9a3 (patch) (unidiff) | |
tree | 1ab11166322e31deb9429deae83f34018b69d6eb | |
parent | cfca93daadf9c0c6c41a4f1eed26dcac318056f1 (diff) | |
download | opie-952ed8b53ee74217c3aa839dada3119bb399b9a3.zip opie-952ed8b53ee74217c3aa839dada3119bb399b9a3.tar.gz opie-952ed8b53ee74217c3aa839dada3119bb399b9a3.tar.bz2 |
all xml-files starting with "common" in name will not be listed
-rw-r--r-- | noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp b/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp index 6f24ea0..f4005bb 100644 --- a/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp +++ b/noncore/applets/zkbapplet/keyzcfg/cfgdlg.cpp | |||
@@ -1,36 +1,39 @@ | |||
1 | 1 | ||
2 | #include <qdir.h> | 2 | #include <qdir.h> |
3 | #include <qregexp.h> | ||
3 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
4 | #include <qpe/qcopenvelope_qws.h> | 5 | #include <qpe/qcopenvelope_qws.h> |
5 | #include <unistd.h> | 6 | #include <unistd.h> |
6 | #include "cfgdlg.h" | 7 | #include "cfgdlg.h" |
7 | 8 | ||
8 | CfgDlg::CfgDlg(QWidget* parent, CfgFile* cf, QApplication* app, bool mod): | 9 | CfgDlg::CfgDlg(QWidget* parent, CfgFile* cf, QApplication* app, bool mod): |
9 | QDialog(parent, "CfgDlg", mod), cfile(cf), application(app) { | 10 | QDialog(parent, "CfgDlg", mod), cfile(cf), application(app) { |
10 | 11 | ||
11 | setCaption(tr("keyz configurator")); | 12 | setCaption(tr("keyz configurator")); |
12 | 13 | ||
14 | static QRegExp r("^common.*\\.xml$"); | ||
15 | static QRegExp r2("^zkb\\.xml$"); | ||
13 | QGridLayout* gl = new QGridLayout(this, 7, 5, 5, 5); | 16 | QGridLayout* gl = new QGridLayout(this, 7, 5, 5, 5); |
14 | 17 | ||
15 | QLabel* flabel = new QLabel("Available Keymaps", this); | 18 | QLabel* flabel = new QLabel("Available Keymaps", this); |
16 | files = new QListBox(this); | 19 | files = new QListBox(this); |
17 | QPushButton* addButton = new QPushButton(">>", this); //add->setText("Add"); | 20 | QPushButton* addButton = new QPushButton(">>", this); //add->setText("Add"); |
18 | connect(addButton, SIGNAL(clicked()), this, SLOT(add())); | 21 | connect(addButton, SIGNAL(clicked()), this, SLOT(add())); |
19 | QLabel* klabel = new QLabel("Selected Keymaps", this); | 22 | QLabel* klabel = new QLabel("Selected Keymaps", this); |
20 | keymaps = new QListBox(this); | 23 | keymaps = new QListBox(this); |
21 | connect(keymaps, SIGNAL(highlighted(const QString&)), this, SLOT(keymapHighlighted(const QString&))); | 24 | connect(keymaps, SIGNAL(highlighted(const QString&)), this, SLOT(keymapHighlighted(const QString&))); |
22 | QPushButton* delButton = new QPushButton("<<", this); //del->setText("Delete"); | 25 | QPushButton* delButton = new QPushButton("<<", this); //del->setText("Delete"); |
23 | connect(delButton, SIGNAL(clicked()), this, SLOT(del())); | 26 | connect(delButton, SIGNAL(clicked()), this, SLOT(del())); |
24 | QPushButton* slabelButton = new QPushButton("Set Label", this); //apply->setText("Apply"); | 27 | QPushButton* slabelButton = new QPushButton("Set Label", this); //apply->setText("Apply"); |
25 | connect(slabelButton, SIGNAL(clicked()), this, SLOT(setLabel())); | 28 | connect(slabelButton, SIGNAL(clicked()), this, SLOT(setLabel())); |
26 | QLabel* l = new QLabel("Label", this); | 29 | QLabel* l = new QLabel("Label", this); |
27 | label = new QLineEdit(this); | 30 | label = new QLineEdit(this); |
28 | QLabel* adlabel = new QLabel("Auto Repeat Delay (ms)", this); | 31 | QLabel* adlabel = new QLabel("Auto Repeat Delay (ms)", this); |
29 | QLabel* aplabel = new QLabel("Auto Repeat Period (ms)", this); | 32 | QLabel* aplabel = new QLabel("Auto Repeat Period (ms)", this); |
30 | ad = new QSpinBox(50, 5000, 5, this); | 33 | ad = new QSpinBox(50, 5000, 5, this); |
31 | ap = new QSpinBox(0, 5000, 5, this); | 34 | ap = new QSpinBox(0, 5000, 5, this); |
32 | 35 | ||
33 | //QLabel* adms = new QLabel("ms", this); | 36 | //QLabel* adms = new QLabel("ms", this); |
34 | //QLabel* apms = new QLabel("ms", this); | 37 | //QLabel* apms = new QLabel("ms", this); |
35 | 38 | ||
36 | //QCheckBox* enable = new QCheckBox("Enable", t); | 39 | //QCheckBox* enable = new QCheckBox("Enable", t); |
@@ -51,49 +54,49 @@ CfgDlg::CfgDlg(QWidget* parent, CfgFile* cf, QApplication* app, bool mod): | |||
51 | gl->addWidget(label, 4, 1); | 54 | gl->addWidget(label, 4, 1); |
52 | gl->addMultiCellWidget(slabelButton, 4, 4, 3, 4); | 55 | gl->addMultiCellWidget(slabelButton, 4, 4, 3, 4); |
53 | 56 | ||
54 | gl->addMultiCellWidget(adlabel, 5, 5, 0, 2); | 57 | gl->addMultiCellWidget(adlabel, 5, 5, 0, 2); |
55 | gl->addMultiCellWidget(ad, 5, 5, 3, 4); | 58 | gl->addMultiCellWidget(ad, 5, 5, 3, 4); |
56 | //gl->addWidget(adms, 5, 3); | 59 | //gl->addWidget(adms, 5, 3); |
57 | 60 | ||
58 | gl->addMultiCellWidget(aplabel, 6, 6, 0, 2); | 61 | gl->addMultiCellWidget(aplabel, 6, 6, 0, 2); |
59 | gl->addMultiCellWidget(ap, 6, 6, 3, 4); | 62 | gl->addMultiCellWidget(ap, 6, 6, 3, 4); |
60 | 63 | ||
61 | //gl->addWidget(apms, 6, 3); | 64 | //gl->addWidget(apms, 6, 3); |
62 | 65 | ||
63 | QList<CfgEntry>& e = cfile->getEntries(); | 66 | QList<CfgEntry>& e = cfile->getEntries(); |
64 | 67 | ||
65 | for(uint i = 0; i < e.count(); i++) { | 68 | for(uint i = 0; i < e.count(); i++) { |
66 | CfgEntry* entry = e.at(i); | 69 | CfgEntry* entry = e.at(i); |
67 | keymaps->insertItem(entry->getFile()); | 70 | keymaps->insertItem(entry->getFile()); |
68 | m.insert(entry->getFile(), entry->getLabel()); | 71 | m.insert(entry->getFile(), entry->getLabel()); |
69 | } | 72 | } |
70 | 73 | ||
71 | QDir dir(QPEApplication::qpeDir()+"share/zkb", "*.xml"); | 74 | QDir dir(QPEApplication::qpeDir()+"share/zkb", "*.xml"); |
72 | QStringList flist = dir.entryList(); | 75 | QStringList flist = dir.entryList(); |
73 | QStringList::Iterator sit; | 76 | QStringList::Iterator sit; |
74 | for(sit = flist.begin(); sit != flist.end(); ++sit) { | 77 | for(sit = flist.begin(); sit != flist.end(); ++sit) { |
75 | if (*sit != "common.xml" && *sit != "zkb.xml" && m.find(*sit) == m.end()) { | 78 | if (r.match(*sit)==-1 && r2.match(*sit)==-1&& m.find(*sit) == m.end()) { |
76 | files->insertItem(*sit); | 79 | files->insertItem(*sit); |
77 | } | 80 | } |
78 | } | 81 | } |
79 | 82 | ||
80 | ad->setValue(cfile->getAutorepeatDelay()); | 83 | ad->setValue(cfile->getAutorepeatDelay()); |
81 | ap->setValue(cfile->getAutorepeatPeriod()); | 84 | ap->setValue(cfile->getAutorepeatPeriod()); |
82 | 85 | ||
83 | //gl->addMultiCellWidget(enable, 7, 7, 0, 4); | 86 | //gl->addMultiCellWidget(enable, 7, 7, 0, 4); |
84 | } | 87 | } |
85 | 88 | ||
86 | CfgDlg::~CfgDlg() { | 89 | CfgDlg::~CfgDlg() { |
87 | } | 90 | } |
88 | 91 | ||
89 | void CfgDlg::add() { | 92 | void CfgDlg::add() { |
90 | if (!files->currentText().isEmpty()) { | 93 | if (!files->currentText().isEmpty()) { |
91 | QString t = files->currentText(); | 94 | QString t = files->currentText(); |
92 | files->removeItem(files->currentItem()); | 95 | files->removeItem(files->currentItem()); |
93 | keymaps->insertItem(t); | 96 | keymaps->insertItem(t); |
94 | cfile->replaceEntry(t, ""); | 97 | cfile->replaceEntry(t, ""); |
95 | m.replace(t, ""); | 98 | m.replace(t, ""); |
96 | } | 99 | } |
97 | } | 100 | } |
98 | 101 | ||
99 | void CfgDlg::del() { | 102 | void CfgDlg::del() { |