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

akonadi

  • akonadi
  • calendar
publishdialog.cpp
1 /*
2  Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
3  Copyright (c) 2009 Allen Winter <winter@kde.org>
4 
5  This library is free software; you can redistribute it and/or modify it
6  under the terms of the GNU Library General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or (at your
8  option) any later version.
9 
10  This library is distributed in the hope that it will be useful, but WITHOUT
11  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13  License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to the
17  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18  02110-1301, USA.
19 */
20 
21 // TODO: validate hand-entered email addresses
22 // TODO: don't allow duplicates; at least remove dupes when passing back
23 // TODO: the list in PublishDialog::addresses()
24 
25 #include "publishdialog_p.h"
26 
27 #include <kcalcore/attendee.h>
28 #include <kcalcore/person.h>
29 
30 #include <KLineEdit>
31 #include <KLocalizedString>
32 
33 using namespace KCalCore;
34 using namespace Akonadi;
35 
36 PublishDialog::PublishDialog( QWidget *parent )
37  : KDialog( parent ), d( new Private( this ) )
38 {
39  setCaption( i18n( "Select Addresses" ) );
40  setButtons( Ok|Cancel|Help );
41  setHelp( "group-scheduling", "korganizer" );
42  QWidget *widget = new QWidget( this );
43  widget->setObjectName( "PublishFreeBusy" );
44  d->mUI.setupUi( widget );
45  setMainWidget( widget );
46  d->mUI.mListWidget->setSelectionMode( QAbstractItemView::SingleSelection );
47  d->mUI.mNameLineEdit->setEnabled( false );
48  d->mUI.mEmailLineEdit->setEnabled( false );
49 
50  setButtonToolTip( Ok, i18n( "Send email to these recipients" ) );
51  setButtonWhatsThis( Ok, i18n( "Clicking the <b>Ok</b> button will cause "
52  "an email to be sent to the recipients you "
53  "have entered." ) );
54  setButtonToolTip( Cancel, i18n( "Cancel recipient selection and the email" ) );
55  setButtonWhatsThis( Cancel, i18n( "Clicking the <b>Cancel</b> button will "
56  "cause the email operation to be terminated." ) );
57 
58  setButtonWhatsThis( Help, i18n( "Click the <b>Help</b> button to read "
59  "more information about Group Scheduling." ) );
60 
61  d->mUI.mNew->setIcon( KIcon( "list-add" ) );
62  d->mUI.mRemove->setIcon( KIcon( "list-remove" ) );
63  d->mUI.mRemove->setEnabled( false );
64  d->mUI.mSelectAddressee->setIcon( KIcon( "view-pim-contacts" ) );
65 
66  connect( d->mUI.mListWidget, SIGNAL(itemSelectionChanged()),
67  d, SLOT(updateInput()) );
68  connect( d->mUI.mNew, SIGNAL(clicked()),
69  d, SLOT(addItem()) );
70  connect( d->mUI.mRemove, SIGNAL(clicked()),
71  d, SLOT(removeItem()) );
72  connect( d->mUI.mSelectAddressee, SIGNAL(clicked()),
73  d, SLOT(openAddressbook()) );
74  connect( d->mUI.mNameLineEdit, SIGNAL(textChanged(QString)),
75  d, SLOT(updateItem()) );
76  connect( d->mUI.mEmailLineEdit, SIGNAL(textChanged(QString)),
77  d, SLOT(updateItem()) );
78 }
79 
80 PublishDialog::~PublishDialog()
81 {
82  delete d;
83 }
84 
85 void PublishDialog::addAttendee( const Attendee::Ptr &attendee )
86 {
87  d->mUI.mNameLineEdit->setEnabled( true );
88  d->mUI.mEmailLineEdit->setEnabled( true );
89  QListWidgetItem *item = new QListWidgetItem( d->mUI.mListWidget );
90  Person person( attendee->name(), attendee->email() );
91  item->setText( person.fullName() );
92  d->mUI.mListWidget->addItem( item );
93  d->mUI.mRemove->setEnabled( !d->mUI.mListWidget->selectedItems().isEmpty() );
94 }
95 
96 QString PublishDialog::addresses() const
97 {
98  QString to;
99  QListWidgetItem *item;
100  const int count = d->mUI.mListWidget->count();
101  for ( int i=0; i<count; ++i ) {
102  item = d->mUI.mListWidget->item( i );
103  if( !item->text().isEmpty() ) {
104  to += item->text();
105  if ( i < count-1 ) {
106  to += ", ";
107  }
108  }
109  }
110  return to;
111 }
112 
113 #include "publishdialog.moc"
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Nov 26 2013 09:03:18 by doxygen 1.8.5 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-4.11.3 API Reference

Skip menu "kdepimlibs-4.11.3 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
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