Commit f943b1a1 authored by Tobias Koenig's avatar Tobias Koenig

bring back the IM edit widget

svn path=/trunk/KDE/kdepim/kcontactmanager/editor/; revision=915948
parent f582758e
......@@ -25,6 +25,7 @@
#include "displaynameeditwidget.h"
#include "emaileditwidget.h"
#include "imagewidget.h"
#include "imeditwidget.h"
#include "nameeditwidget.h"
#include "phoneeditwidget.h"
#include "soundeditwidget.h"
......@@ -72,7 +73,7 @@ class ContactEditor::Private
EmailEditWidget *mEmailWidget;
KLineEdit *mHomepageWidget;
KLineEdit *mBlogWidget;
KLineEdit *mIMWidget;
IMEditWidget *mIMWidget;
// widgets from phones group
PhoneEditWidget *mPhonesWidget;
......@@ -210,7 +211,7 @@ void ContactEditor::Private::initGuiContactTab()
label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
internetLayout->addWidget( label, 3, 0 );
mIMWidget = new KLineEdit;
mIMWidget = new IMEditWidget;
label->setBuddy( mIMWidget );
internetLayout->addWidget( mIMWidget, 3, 1 );
......@@ -452,6 +453,7 @@ void ContactEditor::loadContact( const KABC::Addressee &contact )
d->mEmailWidget->loadContact( contact );
d->mHomepageWidget->setUrl( contact.url() );
d->mBlogWidget->setText( d->loadCustom( contact, "BlogFeed" ) );
d->mIMWidget->loadContact( contact );
// phones group
d->mPhonesWidget->loadContact( contact );
......@@ -497,6 +499,7 @@ void ContactEditor::storeContact( KABC::Addressee &contact ) const
d->mEmailWidget->storeContact( contact );
contact.setUrl( KUrl( d->mHomepageWidget->text().trimmed() ) );
d->storeCustom( contact, "BlogFeed", d->mBlogWidget->text().trimmed() );
d->mIMWidget->storeContact( contact );
// phones group
d->mPhonesWidget->storeContact( contact );
......
/*
This file is part of KContactManager.
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "imeditwidget.h"
#include <QtGui/QHBoxLayout>
#include <kabc/addressee.h>
#include <klineedit.h>
IMEditWidget::IMEditWidget( QWidget *parent )
: QWidget( parent )
{
QHBoxLayout *layout = new QHBoxLayout( this );
layout->setMargin( 0 );
mIMEdit = new KLineEdit;
layout->addWidget( mIMEdit );
}
IMEditWidget::~IMEditWidget()
{
}
void IMEditWidget::loadContact( const KABC::Addressee &contact )
{
mIMEdit->setText( contact.custom( "KADDRESSBOOK", "X-IMAddress" ) );
}
void IMEditWidget::storeContact( KABC::Addressee &contact ) const
{
if ( !mIMEdit->text().isEmpty() )
contact.insertCustom( "KADDRESSBOOK", "X-IMAddress", mIMEdit->text() );
else
contact.removeCustom( "KADDRESSBOOK", "X-IMAddress" );
}
void IMEditWidget::setReadOnly( bool readOnly )
{
mIMEdit->setReadOnly( readOnly );
}
#include "imeditwidget.moc"
/*
This file is part of KContactManager.
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef IMEDITWIDGET_H
#define IMEDITWIDGET_H
#include <QtGui/QWidget>
namespace KABC
{
class Addressee;
}
class KLineEdit;
/**
* This widget displays an input field for changing
* the instant messaging id of a contact.
*/
class IMEditWidget : public QWidget
{
Q_OBJECT
public:
IMEditWidget( QWidget *parent = 0 );
~IMEditWidget();
void loadContact( const KABC::Addressee &contact );
void storeContact( KABC::Addressee &contact ) const;
void setReadOnly( bool readOnly );
private:
KLineEdit *mIMEdit;
};
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment