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

« back to all changes in this revision

Viewing changes to kde/src/conf/dlgpresence.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
/****************************************************************************
 
2
 *   Copyright (C) 2013-2014 by Savoir-Faire Linux                          *
 
3
 *   Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
 
4
 *                                                                          *
 
5
 *   This library is free software; you can redistribute it and/or          *
 
6
 *   modify it under the terms of the GNU Lesser General Public             *
 
7
 *   License as published by the Free Software Foundation; either           *
 
8
 *   version 2.1 of the License, or (at your option) any later version.     *
 
9
 *                                                                          *
 
10
 *   This library is distributed in the hope that it will be useful,        *
 
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
 
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU      *
 
13
 *   Lesser General Public License for more details.                        *
 
14
 *                                                                          *
 
15
 *   You should have received a copy of the GNU General Public License      *
 
16
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
 
17
 ***************************************************************************/
 
18
#include "dlgpresence.h"
 
19
 
 
20
//KDE
 
21
#include <KIcon>
 
22
 
 
23
//Sflphone
 
24
#include <lib/presencestatusmodel.h>
 
25
#include "klib/tipmanager.h"
 
26
#include "klib/tip.h"
 
27
 
 
28
DlgPresence::DlgPresence(QWidget *parent) : QWidget(parent),m_Changed(false)
 
29
{
 
30
   setupUi(this);
 
31
   m_pView->setModel(PresenceStatusModel::instance());
 
32
   m_pUp->setIcon     ( KIcon( "go-up"       ) );
 
33
   m_pDown->setIcon   ( KIcon( "go-down"     ) );
 
34
   m_pAdd->setIcon    ( KIcon( "list-add"    ) );
 
35
   m_pRemove->setIcon ( KIcon( "list-remove" ) );
 
36
   connect(m_pAdd   , SIGNAL(clicked()),PresenceStatusModel::instance() ,SLOT(addRow())       );
 
37
   connect(m_pUp    , SIGNAL(clicked()),this                            ,SLOT(slotMoveUp())   );
 
38
   connect(m_pDown  , SIGNAL(clicked()),this                            ,SLOT(slotMoveDown()) );
 
39
   connect(m_pRemove, SIGNAL(clicked()),this                            ,SLOT(slotRemoveRow()));
 
40
   connect(this     , SIGNAL(updateButtons()) , parent                  ,SLOT(updateButtons()));
 
41
   connect(PresenceStatusModel::instance(),SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(slotChanged()));
 
42
 
 
43
   m_pView->horizontalHeader()->setResizeMode(0,QHeaderView::ResizeToContents);
 
44
   m_pView->horizontalHeader()->setResizeMode(1,QHeaderView::Stretch);
 
45
   for (int i=2;i<PresenceStatusModel::instance()->columnCount();i++) {
 
46
      m_pView->horizontalHeader()->setResizeMode(i,QHeaderView::ResizeToContents);
 
47
   }
 
48
 
 
49
   //Add an info tip in the account list
 
50
   m_pTipManager = new TipManager(m_pView);
 
51
   m_pTip = new Tip(i18n("In this table, it is possible to manage different presence states. "
 
52
   "The \"Message\" and \"Present\" values will be exported to the server for every accounts that support it. "
 
53
   "The other fields are designed to make presence status management easier. Please note that some SIP registrar "
 
54
   "have incomplete presence status (publishing) support."),this);
 
55
   m_pTip->setMaximumWidth(510);
 
56
   m_pTipManager->setCurrentTip(m_pTip);
 
57
}
 
58
 
 
59
DlgPresence::~DlgPresence()
 
60
{
 
61
   delete m_pTipManager;
 
62
   delete m_pTip;
 
63
}
 
64
 
 
65
void DlgPresence::updateWidgets()
 
66
{
 
67
   
 
68
}
 
69
 
 
70
void DlgPresence::updateSettings()
 
71
{
 
72
   PresenceStatusModel::instance()->save();
 
73
   m_Changed = false;
 
74
   emit updateButtons();
 
75
}
 
76
 
 
77
bool DlgPresence::hasChanged()
 
78
{
 
79
   return m_Changed;
 
80
}
 
81
 
 
82
void DlgPresence::slotChanged()
 
83
{
 
84
   m_Changed = true;
 
85
   emit updateButtons();
 
86
}
 
87
 
 
88
void DlgPresence::slotRemoveRow()
 
89
{
 
90
   PresenceStatusModel::instance()->removeRow(m_pView->currentIndex());
 
91
}
 
92
 
 
93
 
 
94
void DlgPresence::slotMoveUp()
 
95
{
 
96
   PresenceStatusModel::instance()->moveUp(m_pView->currentIndex());
 
97
}
 
98
 
 
99
void DlgPresence::slotMoveDown()
 
100
{
 
101
   PresenceStatusModel::instance()->moveDown(m_pView->currentIndex());
 
102
}