~neon/kdenetwork/trunk

« back to all changes in this revision

Viewing changes to kopete/protocols/gadu/gaduaway.cpp

  • Committer: uwolfer
  • Date: 2013-06-08 10:12:41 UTC
  • Revision ID: svn-v4:283d02a7-25f6-0310-bc7c-ecb5cbfe19da:trunk/KDE/kdenetwork:1357331
kdenetwork has moved to Git

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// -*- Mode: c++-mode; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 2; -*-
2
 
//
3
 
// Copyright (C) 2003 Grzegorz Jaskiewicz       <gj at pointblue.com.pl>
4
 
//
5
 
// gaduaway.cpp
6
 
//
7
 
// This program is free software; you can redistribute it and/or
8
 
// modify it under the terms of the GNU General Public License
9
 
// as published by the Free Software Foundation; either version 2
10
 
// of the License, or (at your option) any later version.
11
 
//
12
 
// This program is distributed in the hope that it will be useful,
13
 
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
// GNU General Public License for more details.
16
 
//
17
 
// You should have received a copy of the GNU General Public License
18
 
// along with this program; if not, write to the Free Software
19
 
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20
 
// 02110-1301, USA.
21
 
 
22
 
#include "gaduaccount.h"
23
 
#include "gaduprotocol.h"
24
 
#include "gaduaway.h"
25
 
#include "ui_gaduawayui.h"
26
 
 
27
 
#include "kopeteonlinestatus.h"
28
 
 
29
 
#include <ktextedit.h>
30
 
#include <klocale.h>
31
 
 
32
 
#include <qradiobutton.h>
33
 
#include <qlineedit.h>
34
 
 
35
 
GaduAway::GaduAway( GaduAccount* account, QWidget* parent )
36
 
: KDialog( parent ), account_( account )
37
 
{
38
 
        setCaption(  i18n( "Away Dialog" ) );
39
 
        setButtons( KDialog::Ok | KDialog::Cancel );
40
 
        setDefaultButton( KDialog::Ok );
41
 
        showButtonSeparator( true );
42
 
 
43
 
        Kopete::OnlineStatus ks;
44
 
        int s;
45
 
 
46
 
        QWidget* w = new QWidget( this );
47
 
        ui_ = new Ui::GaduAwayUI;
48
 
        ui_->setupUi( w );
49
 
        setMainWidget( w );
50
 
 
51
 
        ui_->buttonGroup_->setId(ui_->onlineButton_, GG_STATUS_AVAIL_DESCR);
52
 
        ui_->buttonGroup_->setId(ui_->awayButton_, GG_STATUS_BUSY_DESCR);
53
 
        ui_->buttonGroup_->setId(ui_->invisibleButton_, GG_STATUS_INVISIBLE_DESCR);
54
 
        ui_->buttonGroup_->setId(ui_->offlineButton_, GG_STATUS_NOT_AVAIL_DESCR);
55
 
        
56
 
        
57
 
        ks = account->myself()->onlineStatus();
58
 
        s  = GaduProtocol::protocol()->statusToWithDescription( ks );
59
 
 
60
 
 
61
 
        if ( s == GG_STATUS_NOT_AVAIL_DESCR ) {
62
 
                ui_->buttonGroup_->button( GG_STATUS_NOT_AVAIL_DESCR )->setDisabled( true );
63
 
                ui_->buttonGroup_->button( GG_STATUS_AVAIL_DESCR)->setChecked(true);
64
 
        }
65
 
        else {
66
 
                ui_->buttonGroup_->button( s )->setChecked(true);
67
 
        }
68
 
 
69
 
        ui_->textEdit_->setText( account->myself()->property( "statusMessage" ).value().toString() );
70
 
        connect( this, SIGNAL(applyClicked()), SLOT(slotApply()) );
71
 
}
72
 
 
73
 
GaduAway::~GaduAway()
74
 
{
75
 
        delete ui_;
76
 
}
77
 
 
78
 
int
79
 
GaduAway::status() const
80
 
{
81
 
        return ui_->buttonGroup_->checkedId();
82
 
}
83
 
 
84
 
QString
85
 
GaduAway::awayText() const
86
 
{
87
 
        return ui_->textEdit_->text();
88
 
}
89
 
 
90
 
 
91
 
void
92
 
GaduAway::slotApply()
93
 
{
94
 
        if ( account_ ) {
95
 
                account_->changeStatus( GaduProtocol::protocol()->convertStatus( status() ),awayText() );
96
 
        }
97
 
}
98
 
 
99
 
#include "gaduaway.moc"