Source Code (Use browser search to find items of interest.)
Class Index
kwrite'KGuiCmdConfigTab (./kdeutils/kwrite/kguicommand.h:292)
class KGuiCmdConfigTab : public QWidget {
Q_OBJECT
public:
KGuiCmdConfigTab(QWidget *parent, KGuiCmdManager *, const char *name = 0L);
void updateKeyList();
protected slots:
void categoryChanged(int);
void commandChanged(int);
void keyChanged(int);
void accelChanged();
void assign();
void remove();
void defaults();
protected:
// virtual void done(int);
QListBox *commandList;
QListBox *keyList;
KAccelInput *accelInput;
QLabel *currentBinding;
QPushButton *assignButton;
QPushButton *removeButton;
KGuiCmdManager *commandManager;
KGuiCmdCategory *category;
KGuiCmd *command;
};
kwrite'KGuiCmdConfigTab::KGuiCmdConfigTab() (./kdeutils/kwrite/kguicommand.cpp:984)
KGuiCmdConfigTab::KGuiCmdConfigTab(QWidget *parent, KGuiCmdManager *manager,
const char *name) : QWidget(parent, name), commandManager(manager) {
int z;
QRect r;
QComboBox *combo;
QLabel *label;
QButton *button;
commandManager->saveAccels();
combo = new QComboBox(false, this); //read only combo
label = new QLabel(combo, i18n("Category:"), this);
connect(combo, SIGNAL(activated(int)), SLOT(categoryChanged(int)));
r.setRect(10, 5, 150, 25);
label->setGeometry(r);
r.moveBy(0, 25);
combo->setGeometry(r);
for (z = 0; z < (int) commandManager->categoryCount(); z++) {
combo->insertItem(commandManager->getCategory(z)->getName());
}
commandList = new QListBox(this);
label = new QLabel(commandList, i18n("Commands:"), this);
connect(commandList, SIGNAL(highlighted(int)), SLOT(commandChanged(int)));
r.moveBy(0, 25);
label->setGeometry(r);
r.moveBy(0, 25);
r.setHeight(185);
commandList->setGeometry(r);
keyList = new QListBox(this);
label = new QLabel(keyList, i18n("Current Keys:"), this);
connect(keyList, SIGNAL(highlighted(int)), SLOT(keyChanged(int)));
r.setRect(r.right() +10, 5, 180, 25);
label->setGeometry(r);
r.moveBy(0, 25);
r.setHeight(85);
keyList->setGeometry(r);
accelInput = new KAccelInput(this);
label = new QLabel(accelInput, i18n("Press New Shortcut Key:"), this);
r.setRect(r.x(), r.bottom() +5, r.width(), 25);
label->setGeometry(r);
r.moveBy(0, 25);
accelInput->setGeometry(r);
currentBinding = new QLabel(this);
r.setRect(r.x(), r.bottom() +5, r.width(), 60);
currentBinding->setGeometry(r);
/*
button = new QPushButton(i18n("OK"), this);
connect(button, SIGNAL(clicked()), this, SLOT(assign()));
connect(button, SIGNAL(clicked()), this, SLOT(accept()));
r.setRect(r.x(), r.bottom() + 10, 80, 25);
button->setGeometry(r);
button = new QPushButton(i18n("Cancel"), this);
connect(button, SIGNAL(clicked()), this, SLOT(reject()));
r.moveBy(100, 0);
button->setGeometry(r);
*/
assignButton = new QPushButton(i18n("Assign"), this);
assignButton->setEnabled(false);
connect(accelInput, SIGNAL(valid(bool)), assignButton, SLOT(setEnabled(bool)));
connect(accelInput, SIGNAL(changed()), this, SLOT(accelChanged()));
connect(assignButton, SIGNAL(clicked()), this, SLOT(assign()));
r.setRect(r.right() +10, 30, 80, 25);
assignButton->setGeometry(r);
removeButton = new QPushButton(i18n("Remove"), this);
removeButton->setEnabled(false);
connect(removeButton, SIGNAL(clicked()), this, SLOT(remove()));
r.moveBy(0, 30);
removeButton->setGeometry(r);
button = new QPushButton(i18n("Defaults"), this);
connect(button, SIGNAL(clicked()), this, SLOT(defaults()));
r.moveBy(0, 30);
button->setGeometry(r);
categoryChanged(0);
}
kwrite'KGuiCmdConfigTab::updateKeyList() (./kdeutils/kwrite/kguicommand.cpp:1068)
void KGuiCmdConfigTab::updateKeyList() {
int z, count, current;
current = keyList->currentItem();
keyList->clear();
count = command->accelCount();
for (z = 0; z < count; z++) {
keyList->insertItem(command->getAccelString(z));
}
count = keyList->count();
if (current >= count) current = count -1;
if (current >= 0) keyList->setCurrentItem(current);
else removeButton->setEnabled(false);
}
kwrite'KGuiCmdConfigTab::categoryChanged() (./kdeutils/kwrite/kguicommand.cpp:1084)
void KGuiCmdConfigTab::categoryChanged(int n) {
int z;
category = commandManager->getCategory(n);
commandList->clear();
for (z = 0; z < (int) category->commandCount(); z++) {
commandList->insertItem(removeAnd(category->getCommand(z)->getName()));
}
commandChanged(0);
}
kwrite'KGuiCmdConfigTab::commandChanged() (./kdeutils/kwrite/kguicommand.cpp:1095)
void KGuiCmdConfigTab::commandChanged(int n) {
command = category->getCommand(n);
updateKeyList();
}
kwrite'KGuiCmdConfigTab::keyChanged() (./kdeutils/kwrite/kguicommand.cpp:1100)
void KGuiCmdConfigTab::keyChanged(int) {
removeButton->setEnabled(true);
}
kwrite'KGuiCmdConfigTab::accelChanged() (./kdeutils/kwrite/kguicommand.cpp:1104)
void KGuiCmdConfigTab::accelChanged() {
KGuiCmd *command;
command = commandManager->containsAccel(accelInput->getKeyCode1(),
accelInput->getKeyCode2());
if (command != 0L) {
QString s;
// s.sprintf(i18n("Key Binding used in:\n%s\n%s"),
// command->getCategoryName(), removeAnd(command->getName()).data());
// currentBinding->setText(s);
currentBinding->setText(i18n("Key Binding used in:\n%1\n%2")
.arg(command->getCategoryName()).arg(removeAnd(command->getName())));
} else {
if (accelInput->getKeyCode1() == Key_Escape+META+ALT+CTRL+SHIFT)
currentBinding->setText(i18n("Hi Emacs Fan! ;-)"));
else currentBinding->setText("");
}
}
kwrite'KGuiCmdConfigTab::assign() (./kdeutils/kwrite/kguicommand.cpp:1124)
void KGuiCmdConfigTab::assign() {
commandManager->removeAccel(accelInput->getKeyCode1(),
accelInput->getKeyCode2());
command->addAccel(accelInput->getKeyCode1(), accelInput->getKeyCode2());
accelInput->clear();
updateKeyList();
}
kwrite'KGuiCmdConfigTab::remove() (./kdeutils/kwrite/kguicommand.cpp:1133)
void KGuiCmdConfigTab::remove() {
int n;
n = keyList->currentItem();
if (n >= 0) command->removeAccel(n);
updateKeyList();
}
kwrite'KGuiCmdConfigTab::defaults() (./kdeutils/kwrite/kguicommand.cpp:1141)
void KGuiCmdConfigTab::defaults() {
commandManager->restoreDefault();
updateKeyList();
}