1
/****************************************************************************
2
* Copyright (C) 2013-2014 by Savoir-Faire Linux *
3
* Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
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. *
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. *
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"
24
#include <lib/presencestatusmodel.h>
25
#include "klib/tipmanager.h"
28
DlgPresence::DlgPresence(QWidget *parent) : QWidget(parent),m_Changed(false)
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()));
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);
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);
59
DlgPresence::~DlgPresence()
65
void DlgPresence::updateWidgets()
70
void DlgPresence::updateSettings()
72
PresenceStatusModel::instance()->save();
77
bool DlgPresence::hasChanged()
82
void DlgPresence::slotChanged()
88
void DlgPresence::slotRemoveRow()
90
PresenceStatusModel::instance()->removeRow(m_pView->currentIndex());
94
void DlgPresence::slotMoveUp()
96
PresenceStatusModel::instance()->moveUp(m_pView->currentIndex());
99
void DlgPresence::slotMoveDown()
101
PresenceStatusModel::instance()->moveDown(m_pView->currentIndex());