1
// -*- Mode: c++-mode; c-basic-offset: 2; indent-tabs-mode: t; tab-width: 2; -*-
3
// Copyright (C) 2003 Grzegorz Jaskiewicz <gj at pointblue.com.pl>
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.
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.
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
22
#include "gaduaccount.h"
23
#include "gaduprotocol.h"
25
#include "ui_gaduawayui.h"
27
#include "kopeteonlinestatus.h"
29
#include <ktextedit.h>
32
#include <qradiobutton.h>
33
#include <qlineedit.h>
35
GaduAway::GaduAway( GaduAccount* account, QWidget* parent )
36
: KDialog( parent ), account_( account )
38
setCaption( i18n( "Away Dialog" ) );
39
setButtons( KDialog::Ok | KDialog::Cancel );
40
setDefaultButton( KDialog::Ok );
41
showButtonSeparator( true );
43
Kopete::OnlineStatus ks;
46
QWidget* w = new QWidget( this );
47
ui_ = new Ui::GaduAwayUI;
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);
57
ks = account->myself()->onlineStatus();
58
s = GaduProtocol::protocol()->statusToWithDescription( ks );
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);
66
ui_->buttonGroup_->button( s )->setChecked(true);
69
ui_->textEdit_->setText( account->myself()->property( "statusMessage" ).value().toString() );
70
connect( this, SIGNAL(applyClicked()), SLOT(slotApply()) );
79
GaduAway::status() const
81
return ui_->buttonGroup_->checkedId();
85
GaduAway::awayText() const
87
return ui_->textEdit_->text();
95
account_->changeStatus( GaduProtocol::protocol()->convertStatus( status() ),awayText() );
99
#include "gaduaway.moc"