~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to kde/src/conf/dlgaccessibility.cpp

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2014-01-28 18:23:36 UTC
  • mfrom: (1.1.11)
  • mto: This revision was merged to the branch mainline in revision 24.
  • Revision ID: package-import@ubuntu.com-20140128182336-3xenud1kbnwmf3mz
* New upstream release 
  - Fixes "New Upstream Release" (Closes: #735846)
  - Fixes "Ringtone does not stop" (Closes: #727164)
  - Fixes "[sflphone-kde] crash on startup" (Closes: #718178)
  - Fixes "sflphone GUI crashes when call is hung up" (Closes: #736583)
* Build-Depends: ensure GnuTLS 2.6
  - libucommon-dev (>= 6.0.7-1.1), libccrtp-dev (>= 2.0.6-3)
  - Fixes "FTBFS Build-Depends libgnutls{26,28}-dev" (Closes: #722040)
* Fix "boost 1.49 is going away" unversioned Build-Depends: (Closes: #736746)
* Add Build-Depends: libsndfile-dev, nepomuk-core-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/****************************************************************************
2
 
 *   Copyright (C) 2012-2013 by Savoir-Faire Linux                          *
 
2
 *   Copyright (C) 2012-2014 by Savoir-Faire Linux                          *
3
3
 *   Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
4
4
 *                                                                          *
5
5
 *   This library is free software; you can redistribute it and/or          *
17
17
 ***************************************************************************/
18
18
 
19
19
#include "dlgaccessibility.h"
20
 
#include "klib/configurationskeleton.h"
 
20
#include "klib/kcfg_settings.h"
 
21
 
 
22
//Qt
 
23
#include <QtGui/QStyledItemDelegate>
21
24
 
22
25
//KDE
23
26
#include <KConfigDialog>
24
27
#include <KLocale>
 
28
#include <KIcon>
 
29
#include <KAction>
25
30
 
26
31
//SFLPhone
27
32
#include <klib/macromodel.h>
 
33
#include <klib/macro.h>
 
34
#include "../delegates/categorizeddelegate.h"
28
35
 
29
36
///Constructor
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()) );
48
 
   
 
55
 
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)) );
54
62
 
55
63
   connect(this , SIGNAL(updateButtons()) , parent,SLOT(updateButtons()) );
56
 
   
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());
 
64
 
 
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)));
 
71
 
 
72
   m_pCategoryDelegate = new CategorizedDelegate(m_pMacroListTV);
 
73
   m_pItemDelegate     = new QStyledItemDelegate;
 
74
   m_pCategoryDelegate->setChildDelegate(m_pItemDelegate);
 
75
   m_pMacroListTV->setItemDelegate(m_pCategoryDelegate);
62
76
}
63
77
 
64
78
///Destructor
70
84
///Save
71
85
void DlgAccessibility::updateSettings()
72
86
{
73
 
   MacroModel::getInstance()->save();
 
87
   MacroModel::instance()->save();
74
88
}
75
89
 
76
90
///Load
92
106
 
93
107
void DlgAccessibility::addMacro()
94
108
{
95
 
   Macro* ret = MacroModel::getInstance()->newMacro();
 
109
   Macro* ret = MacroModel::instance()->newMacro();
96
110
   if (ret) {
97
111
      m_pMacroFrm->setEnabled(true);
98
112
   }
100
114
 
101
115
void DlgAccessibility::removeMacro()
102
116
{
103
 
   
 
117
   MacroModel::instance()->removeMacro(m_pMacroListTV->selectionModel()->currentIndex());
104
118
}
105
119
 
106
120
void DlgAccessibility::selectMacro(Macro* macro)
112
126
      m_pDelaySB->setValue(macro->delay());
113
127
      m_pSequenceLE->setText(macro->sequence());
114
128
      m_pDescriptionLE->setText(macro->description());
 
129
      m_pShortcuts->setShortcut(macro->action()->shortcut());
115
130
      m_pMacroFrm->setEnabled(true);
116
131
      m_pNameLE->selectAll();
117
132
      m_pNameLE->setFocus();
125
140
//Widget change
126
141
void DlgAccessibility::slotNameLE(const QString& newText)
127
142
{
128
 
   Macro* current = MacroModel::getInstance()->getCurrentMacro();
 
143
   Macro* current = MacroModel::instance()->getCurrentMacro();
129
144
   if (current) {
130
145
      current->setName(newText);
131
146
   }
133
148
 
134
149
void DlgAccessibility::slotCategoryCBB(const QString& newText)
135
150
{
136
 
   Macro* current = MacroModel::getInstance()->getCurrentMacro();
 
151
   Macro* current = MacroModel::instance()->getCurrentMacro();
137
152
   if (current) {
138
153
      current->setCategory(newText);
139
154
   }
141
156
 
142
157
void DlgAccessibility::slotDelaySB(int newValue)
143
158
{
144
 
   Macro* current = MacroModel::getInstance()->getCurrentMacro();
 
159
   Macro* current = MacroModel::instance()->getCurrentMacro();
145
160
   if (current) {
146
161
      current->setDelay(newValue);
147
162
   }
149
164
 
150
165
void DlgAccessibility::slotSequenceLE(const QString& newText)
151
166
{
152
 
   Macro* current = MacroModel::getInstance()->getCurrentMacro();
 
167
   Macro* current = MacroModel::instance()->getCurrentMacro();
153
168
   if (current) {
154
169
      current->setSequence(newText);
155
170
   }
157
172
 
158
173
void DlgAccessibility::slotDescriptionLE(const QString& newText)
159
174
{
160
 
   Macro* current = MacroModel::getInstance()->getCurrentMacro();
 
175
   Macro* current = MacroModel::instance()->getCurrentMacro();
161
176
   if (current) {
162
177
      current->setDescription(newText);
163
178
   }
164
179
}
 
180
 
 
181
void DlgAccessibility::slotShortcut(const KShortcut& shortcut)
 
182
{
 
183
   Macro* current = MacroModel::instance()->getCurrentMacro();
 
184
   if (current)
 
185
      current->action()->setShortcut(shortcut);
 
186
}