• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

akonadi

  • sources
  • kde-4.12
  • kdepimlibs
  • akonadi
  • contact
  • editor
  • im
imitemdialog.cpp
1 /*
2 IM address item editor widget for KDE PIM
3 
4 Copyright 2012 Jonathan Marten <jjm@keelhaul.me.uk>
5 
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) version 3, or any
10 later version accepted by the membership of KDE e.V. (or its
11 successor approved by the membership of KDE e.V.), which shall
12 act as a proxy defined in Section 6 of version 3 of the license.
13 
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18 
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library. If not, see <http://www.gnu.org/licenses/>.
21 */
22 
23 #include "imitemdialog.h"
24 
25 #include "immodel.h"
26 #include "improtocols.h"
27 
28 #include <QFormLayout>
29 
30 #include <kcombobox.h>
31 #include <klineedit.h>
32 #include <klocalizedstring.h>
33 #include <kicon.h>
34 
35 IMItemDialog::IMItemDialog( QWidget *parent )
36  : KDialog( parent )
37 {
38  setButtons( Ok | Cancel );
39  setDefaultButton( Ok );
40 
41  QWidget *widget = new QWidget( this );
42  setMainWidget( widget );
43 
44  QFormLayout *layout = new QFormLayout( widget );
45 
46  mProtocolCombo = new KComboBox;
47  mProtocolCombo->addItem( i18nc( "@item:inlistbox select from a list of IM protocols",
48  "Select..." ) );
49  layout->addRow( i18nc( "@label:listbox", "Protocol:" ), mProtocolCombo );
50 
51  const QStringList protocols = IMProtocols::self()->protocols();
52  foreach ( const QString &protocol, protocols ) {
53  mProtocolCombo->addItem( KIcon( IMProtocols::self()->icon( protocol ) ),
54  IMProtocols::self()->name( protocol ),
55  protocol );
56  }
57 
58  mNameEdit = new KLineEdit;
59  layout->addRow( i18nc( "@label:textbox IM address", "Address:" ), mNameEdit );
60 
61  connect( mProtocolCombo, SIGNAL(currentIndexChanged(int)), SLOT(slotUpdateButtons()) );
62  connect( mNameEdit, SIGNAL(textChanged(QString)), SLOT(slotUpdateButtons()) );
63 
64  slotUpdateButtons();
65 }
66 
67 void IMItemDialog::setAddress( const IMAddress &address )
68 {
69  mProtocolCombo->setCurrentIndex(
70  IMProtocols::self()->protocols().indexOf( address.protocol() ) + 1 );
71 
72  mNameEdit->setText( address.name() );
73  slotUpdateButtons();
74 }
75 
76 IMAddress IMItemDialog::address() const
77 {
78  return IMAddress( mProtocolCombo->itemData( mProtocolCombo->currentIndex() ).toString(),
79  mNameEdit->text(), false );
80 }
81 
82 void IMItemDialog::slotUpdateButtons()
83 {
84  enableButtonOk( mProtocolCombo->currentIndex()>0 && !mNameEdit->text().isEmpty() );
85 }
86 
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal