17
17
***************************************************************************/
19
19
#include "dlgaccessibility.h"
20
#include "klib/configurationskeleton.h"
20
#include "klib/kcfg_settings.h"
23
#include <QtGui/QStyledItemDelegate>
23
26
#include <KConfigDialog>
27
32
#include <klib/macromodel.h>
33
#include <klib/macro.h>
34
#include "../delegates/categorizeddelegate.h"
30
37
DlgAccessibility::DlgAccessibility(KConfigDialog* parent)
45
52
connect(m_pDescriptionLE , SIGNAL(textChanged(QString)) , this,SLOT(changed()) );
46
53
connect(m_pAddTB , SIGNAL(clicked()) , this,SLOT(addMacro()) );
47
54
connect(m_pRemoveTB , SIGNAL(clicked()) , this,SLOT(removeMacro()) );
49
56
connect(m_pDelaySB , SIGNAL(valueChanged(int)) , this,SLOT(slotDelaySB(int)) );
50
57
connect(m_pNameLE , SIGNAL(textChanged(QString)) , this,SLOT(slotNameLE(QString)) );
51
58
connect(m_pCategoryCBB->lineEdit() , SIGNAL(textChanged(QString)) , this,SLOT(slotCategoryCBB(QString)) );
52
59
connect(m_pSequenceLE , SIGNAL(textChanged(QString)) , this,SLOT(slotSequenceLE(QString)) );
53
60
connect(m_pDescriptionLE , SIGNAL(textChanged(QString)) , this,SLOT(slotDescriptionLE(QString)) );
61
connect(m_pShortcuts , SIGNAL(shortcutChanged(KShortcut)) , this,SLOT(slotShortcut(KShortcut)) );
55
63
connect(this , SIGNAL(updateButtons()) , parent,SLOT(updateButtons()) );
57
connect(MacroModel::getInstance(),SIGNAL(selectMacro(Macro*)),this,SLOT(selectMacro(Macro*)));
58
connect(MacroModel::getInstance(),SIGNAL(layoutChanged()),m_pMacroListTV,SLOT(expandAll()));
59
m_pMacroListTV->setModel(MacroModel::getInstance());
65
connect(MacroModel::instance(),SIGNAL(selectMacro(Macro*)),this,SLOT(selectMacro(Macro*)));
66
connect(MacroModel::instance(),SIGNAL(layoutChanged()),m_pMacroListTV,SLOT(expandAll()));
67
m_pMacroListTV->setModel(MacroModel::instance());
68
// m_pCategoryCBB->setModel(MacroModel::instance()); //Works, but not perfect
60
69
m_pMacroListTV->expandAll();
61
connect(m_pMacroListTV->selectionModel(),SIGNAL(currentChanged(QModelIndex,QModelIndex)),MacroModel::getInstance(),SLOT(setCurrent(QModelIndex,QModelIndex)));
70
connect(m_pMacroListTV->selectionModel(),SIGNAL(currentChanged(QModelIndex,QModelIndex)),MacroModel::instance(),SLOT(setCurrent(QModelIndex,QModelIndex)));
72
m_pCategoryDelegate = new CategorizedDelegate(m_pMacroListTV);
73
m_pItemDelegate = new QStyledItemDelegate;
74
m_pCategoryDelegate->setChildDelegate(m_pItemDelegate);
75
m_pMacroListTV->setItemDelegate(m_pCategoryDelegate);
158
173
void DlgAccessibility::slotDescriptionLE(const QString& newText)
160
Macro* current = MacroModel::getInstance()->getCurrentMacro();
175
Macro* current = MacroModel::instance()->getCurrentMacro();
162
177
current->setDescription(newText);
181
void DlgAccessibility::slotShortcut(const KShortcut& shortcut)
183
Macro* current = MacroModel::instance()->getCurrentMacro();
185
current->action()->setShortcut(shortcut);