• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 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 <KLocalizedString>
31
32using namespace KCalCore;
33using namespace Akonadi;
34
35PublishDialog::PublishDialog(QWidget *parent)
36 : KDialog(parent), d(new Private(this))
37{
38 setCaption(i18n("Select Addresses"));
39 setButtons(Ok|Cancel|Help);
40 setHelp("group-scheduling", "korganizer");
41 QWidget *widget = new QWidget(this);
42 widget->setObjectName("PublishFreeBusy");
43 d->mUI.setupUi(widget);
44 setMainWidget(widget);
45 d->mUI.mListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
46 d->mUI.mNameLineEdit->setEnabled(false);
47 d->mUI.mEmailLineEdit->setEnabled(false);
48
49 setButtonToolTip(Ok, i18n("Send email to these recipients"));
50 setButtonWhatsThis(Ok, i18n("Clicking the <b>Ok</b> button will cause "
51 "an email to be sent to the recipients you "
52 "have entered."));
53 setButtonToolTip(Cancel, i18n("Cancel recipient selection and the email"));
54 setButtonWhatsThis(Cancel, i18n("Clicking the <b>Cancel</b> button will "
55 "cause the email operation to be terminated."));
56
57 setButtonWhatsThis(Help, i18n("Click the <b>Help</b> button to read "
58 "more information about Group Scheduling."));
59
60 d->mUI.mNew->setIcon(KIcon("list-add"));
61 d->mUI.mRemove->setIcon(KIcon("list-remove"));
62 d->mUI.mRemove->setEnabled(false);
63 d->mUI.mSelectAddressee->setIcon(KIcon("view-pim-contacts"));
64 d->mUI.mNameLineEdit->setTrapReturnKey( true );
65 d->mUI.mEmailLineEdit->setTrapReturnKey( true );
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
80PublishDialog::~PublishDialog()
81{
82 delete d;
83}
84
85void 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
96QString 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
Akonadi
FreeBusyManager::Singleton.
Definition actionstatemanager_p.h:28
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Wed Jan 24 2024 00:00:00 by doxygen 1.10.0 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
  • Related Pages

kdepimlibs-4.14.10 API Reference

Skip menu "kdepimlibs-4.14.10 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