Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-libclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-libclient
Commits
d0c086c2
Commit
d0c086c2
authored
Jun 23, 2014
by
Emmanuel Lepage Vallee
Browse files
Options
Downloads
Patches
Plain Diff
[ #50194 ] Fix the 'hooks' config page
parent
c894730d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/CMakeLists.txt
+2
-0
2 additions, 0 deletions
src/CMakeLists.txt
src/hookmanager.cpp
+127
-0
127 additions, 0 deletions
src/hookmanager.cpp
src/hookmanager.h
+83
-0
83 additions, 0 deletions
src/hookmanager.h
with
212 additions
and
0 deletions
src/CMakeLists.txt
+
2
−
0
View file @
d0c086c2
...
@@ -106,6 +106,7 @@ set( qtsflphone_LIB_SRCS
...
@@ -106,6 +106,7 @@ set( qtsflphone_LIB_SRCS
#Other
#Other
sflphone_const.h
sflphone_const.h
categorizedcompositenode.cpp
categorizedcompositenode.cpp
hookmanager.cpp
)
)
set
(
qtsflphone_LIB_HDRS
set
(
qtsflphone_LIB_HDRS
...
@@ -141,6 +142,7 @@ set( qtsflphone_LIB_HDRS
...
@@ -141,6 +142,7 @@ set( qtsflphone_LIB_HDRS
transitionalcontactbackend.h
transitionalcontactbackend.h
abstractitembackend.h
abstractitembackend.h
itembackendmodel.h
itembackendmodel.h
hookmanager.h
video/videodevice.h
video/videodevice.h
video/videodevicemodel.h
video/videodevicemodel.h
video/videocodec.h
video/videocodec.h
...
...
This diff is collapsed.
Click to expand it.
src/hookmanager.cpp
0 → 100644
+
127
−
0
View file @
d0c086c2
/****************************************************************************
* Copyright (C) 2014 by Savoir-Faire Linux *
* Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#include
"hookmanager.h"
#include
<QtCore/QCoreApplication>
#include
"dbus/configurationmanager.h"
HookManager
*
HookManager
::
m_spInstance
=
nullptr
;
HookManager
::
HookManager
()
:
QObject
(
QCoreApplication
::
instance
())
{
ConfigurationManagerInterface
&
configurationManager
=
DBus
::
ConfigurationManager
::
instance
();
QMap
<
QString
,
QString
>
hooks
=
configurationManager
.
getHookSettings
();
m_AddPrefix
=
hooks
[
HookManager
::
Names
::
PHONE_NUMBER_HOOK_ADD_PREFIX
];
m_SipFeild
=
hooks
[
HookManager
::
Names
::
URLHOOK_SIP_FIELD
];
m_Command
=
hooks
[
HookManager
::
Names
::
URLHOOK_COMMAND
];
m_Iax2Enabled
=
hooks
[
HookManager
::
Names
::
URLHOOK_IAX2_ENABLED
]
==
"true"
?
true
:
false
;
m_SipEnabled
=
hooks
[
HookManager
::
Names
::
URLHOOK_SIP_ENABLED
]
==
"true"
?
true
:
false
;
m_PhoneNumberEnabled
=
hooks
[
HookManager
::
Names
::
PHONE_NUMBER_HOOK_ENABLED
]
==
"true"
?
true
:
false
;
}
HookManager
::~
HookManager
()
{
}
void
HookManager
::
save
()
{
ConfigurationManagerInterface
&
configurationManager
=
DBus
::
ConfigurationManager
::
instance
();
QMap
<
QString
,
QString
>
hooks
;
hooks
[
HookManager
::
Names
::
PHONE_NUMBER_HOOK_ADD_PREFIX
]
=
m_AddPrefix
;
hooks
[
HookManager
::
Names
::
URLHOOK_SIP_FIELD
]
=
m_SipFeild
;
hooks
[
HookManager
::
Names
::
URLHOOK_COMMAND
]
=
m_Command
;
hooks
[
HookManager
::
Names
::
URLHOOK_IAX2_ENABLED
]
=
m_Iax2Enabled
?
"true"
:
"false"
;
hooks
[
HookManager
::
Names
::
URLHOOK_SIP_ENABLED
]
=
m_SipEnabled
?
"true"
:
"false"
;
hooks
[
HookManager
::
Names
::
PHONE_NUMBER_HOOK_ENABLED
]
=
m_PhoneNumberEnabled
?
"true"
:
"false"
;
configurationManager
.
setHookSettings
(
hooks
);
}
HookManager
*
HookManager
::
instance
()
{
if
(
!
m_spInstance
)
m_spInstance
=
new
HookManager
();
return
m_spInstance
;
}
QString
HookManager
::
prefix
()
const
{
return
m_AddPrefix
;
}
QString
HookManager
::
sipFeild
()
const
{
return
m_SipFeild
;
}
QString
HookManager
::
command
()
const
{
return
m_Command
;
}
bool
HookManager
::
isIax2Enabled
()
const
{
return
m_Iax2Enabled
;
}
bool
HookManager
::
isSipEnabled
()
const
{
return
m_SipEnabled
;
}
bool
HookManager
::
isPhoneNumberEnabled
()
const
{
return
m_PhoneNumberEnabled
;
}
void
HookManager
::
setPrefix
(
const
QString
&
prefix
)
{
m_AddPrefix
=
prefix
;
save
();
}
void
HookManager
::
setSipFeild
(
const
QString
&
field
)
{
m_SipFeild
=
field
;
save
();
}
void
HookManager
::
setCommand
(
const
QString
&
command
)
{
m_Command
=
command
;
save
();
}
void
HookManager
::
setIax2Enabled
(
bool
enabled
)
{
m_Iax2Enabled
=
enabled
;
save
();
}
void
HookManager
::
setSipEnabled
(
bool
enabled
)
{
m_SipEnabled
=
enabled
;
save
();
}
void
HookManager
::
setPhoneNumberEnabled
(
bool
enabled
)
{
m_PhoneNumberEnabled
=
enabled
;
save
();
}
This diff is collapsed.
Click to expand it.
src/hookmanager.h
0 → 100644
+
83
−
0
View file @
d0c086c2
/****************************************************************************
* Copyright (C) 2014 by Savoir-Faire Linux *
* Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifndef HOOKMANAGER_H
#define HOOKMANAGER_H
#include
"typedefs.h"
/**
* This class allow to get and set the different hooks
*/
class
LIB_EXPORT
HookManager
:
public
QObject
{
Q_OBJECT
public:
static
HookManager
*
instance
();
//Properties
Q_PROPERTY
(
QString
prefix
READ
prefix
WRITE
setPrefix
)
Q_PROPERTY
(
QString
sipFeild
READ
sipFeild
WRITE
setSipFeild
)
Q_PROPERTY
(
QString
command
READ
command
WRITE
setCommand
)
Q_PROPERTY
(
bool
iax2Enabled
READ
isIax2Enabled
WRITE
setIax2Enabled
)
Q_PROPERTY
(
bool
sipEnabled
READ
isSipEnabled
WRITE
setSipEnabled
)
Q_PROPERTY
(
bool
phoneNumberEnabled
READ
isPhoneNumberEnabled
WRITE
setPhoneNumberEnabled
)
//Getters
QString
prefix
()
const
;
QString
sipFeild
()
const
;
QString
command
()
const
;
bool
isIax2Enabled
()
const
;
bool
isSipEnabled
()
const
;
bool
isPhoneNumberEnabled
()
const
;
//Setters
void
setPrefix
(
const
QString
&
prefix
);
void
setSipFeild
(
const
QString
&
field
);
void
setCommand
(
const
QString
&
command
);
void
setIax2Enabled
(
bool
enabled
);
void
setSipEnabled
(
bool
enabled
);
void
setPhoneNumberEnabled
(
bool
enabled
);
private:
explicit
HookManager
();
virtual
~
HookManager
();
void
save
();
class
Names
{
public:
constexpr
static
const
char
*
PHONE_NUMBER_HOOK_ADD_PREFIX
=
"PHONE_NUMBER_HOOK_ADD_PREFIX"
;
constexpr
static
const
char
*
URLHOOK_SIP_FIELD
=
"URLHOOK_SIP_FIELD"
;
constexpr
static
const
char
*
URLHOOK_COMMAND
=
"URLHOOK_COMMAND"
;
constexpr
static
const
char
*
URLHOOK_IAX2_ENABLED
=
"URLHOOK_IAX2_ENABLED"
;
constexpr
static
const
char
*
URLHOOK_SIP_ENABLED
=
"URLHOOK_SIP_ENABLED"
;
constexpr
static
const
char
*
PHONE_NUMBER_HOOK_ENABLED
=
"PHONE_NUMBER_HOOK_ENABLED"
;
};
//Attributes
QString
m_AddPrefix
;
QString
m_SipFeild
;
QString
m_Command
;
bool
m_Iax2Enabled
;
bool
m_SipEnabled
;
bool
m_PhoneNumberEnabled
;
static
HookManager
*
m_spInstance
;
};
#endif
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment