Commit d33b2a13 authored by Laurent Montel's avatar Laurent Montel 😁

It's a dead code. => remove it

parent 3e8c9cb3
......@@ -197,7 +197,6 @@ set(korganizerprivate_LIB_SRCS
kowindowlist.cpp
navigatorbar.cpp
previewdialog.cpp
publishdialog.cpp
searchdialog.cpp
statusdialog.cpp
views/agendaview/koagendaview.cpp
......@@ -217,7 +216,6 @@ set(korganizerprivate_LIB_SRCS
filteredit_base.ui
kogroupwareprefspage.ui
multiagendaviewconfigwidget.ui
publishdialog_base.ui
searchdialog_base.ui
timescaleedit_base.ui
)
......
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
Copyright (c) 2009 Allen Winter <winter@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.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
// TODO: validate hand-entered email addresses
// TODO: don't allow duplicates; at least remove dupes when passing back
// TODO: the list in PublishDialog::addresses()
#include "publishdialog.h"
#include <Akonadi/Contact/EmailAddressSelectionDialog>
#include <KCalCore/Attendee>
#include <KCalCore/Person>
#include <KPIMUtils/Email>
PublishDialog::PublishDialog( QWidget *parent )
: KDialog( parent )
{
setCaption( i18n( "Select Addresses" ) );
setButtons( Ok|Cancel|Help );
setHelp( QLatin1String("group-scheduling"), QLatin1String("korganizer") );
QWidget *widget = new QWidget( this );
widget->setObjectName( QLatin1String("PublishFreeBusy") );
mUI.setupUi( widget );
setMainWidget( widget );
mUI.mListWidget->setSelectionMode( QAbstractItemView::SingleSelection );
mUI.mNameLineEdit->setEnabled( false );
mUI.mEmailLineEdit->setEnabled( false );
setButtonToolTip( Ok, i18n( "Send email to these recipients" ) );
setButtonWhatsThis( Ok, i18n( "Clicking the <b>Ok</b> button will cause "
"an email to be sent to the recipients you "
"have entered." ) );
setButtonToolTip( Cancel, i18n( "Cancel recipient selection and the email" ) );
setButtonWhatsThis( Cancel, i18n( "Clicking the <b>Cancel</b> button will "
"cause the email operation to be terminated." ) );
setButtonWhatsThis( Help, i18n( "Click the <b>Help</b> button to read "
"more information about Group Scheduling." ) );
mUI.mAdd->setIcon( KIcon( QLatin1String("list-add") ) );
mUI.mRemove->setIcon( KIcon( QLatin1String("list-remove") ) );
mUI.mRemove->setEnabled( false );
mUI.mSelectAddressee->setIcon( KIcon( QLatin1String("view-pim-contacts") ) );
connect( mUI.mListWidget, SIGNAL(itemSelectionChanged()),
SLOT(updateInput()) );
connect( mUI.mAdd, SIGNAL(clicked()),
SLOT(addItem()) );
connect( mUI.mRemove, SIGNAL(clicked()),
SLOT(removeItem()) );
connect( mUI.mSelectAddressee, SIGNAL(clicked()),
SLOT(openAddressbook()) );
connect( mUI.mNameLineEdit, SIGNAL(textChanged(QString)),
SLOT(updateItem()) );
connect( mUI.mEmailLineEdit, SIGNAL(textChanged(QString)),
SLOT(updateItem()) );
}
PublishDialog::~PublishDialog()
{
}
void PublishDialog::addAttendee( const KCalCore::Attendee::Ptr &attendee )
{
mUI.mNameLineEdit->setEnabled( true );
mUI.mEmailLineEdit->setEnabled( true );
QListWidgetItem *item = new QListWidgetItem( mUI.mListWidget );
KCalCore::Person person( attendee->name(), attendee->email() );
item->setText( person.fullName() );
mUI.mListWidget->addItem( item );
mUI.mRemove->setEnabled( !mUI.mListWidget->selectedItems().isEmpty() );
}
QString PublishDialog::addresses()
{
QString to;
const int count = mUI.mListWidget->count();
for ( int i=0; i<count; ++i ) {
const QListWidgetItem *item = mUI.mListWidget->item( i );
if( !item->text().isEmpty() ) {
to += item->text();
if ( i < count-1 ) {
to += QLatin1String(", ");
}
}
}
return to;
}
void PublishDialog::addItem()
{
mUI.mNameLineEdit->setEnabled( true );
mUI.mEmailLineEdit->setEnabled( true );
QListWidgetItem *item = new QListWidgetItem( mUI.mListWidget );
mUI.mListWidget->addItem( item );
mUI.mListWidget->setItemSelected( item, true );
mUI.mNameLineEdit->setText( i18n( "(EmptyName)" ) );
mUI.mEmailLineEdit->setText( i18n( "(EmptyEmail)" ) );
mUI.mRemove->setEnabled( true );
}
void PublishDialog::removeItem()
{
if ( mUI.mListWidget->selectedItems().isEmpty() ) {
return;
}
QListWidgetItem *item;
item = mUI.mListWidget->selectedItems().first();
int row = mUI.mListWidget->row( item );
delete mUI.mListWidget->takeItem( row );
if ( !mUI.mListWidget->count() ) {
mUI.mNameLineEdit->setText( QString() );
mUI.mNameLineEdit->setEnabled( false );
mUI.mEmailLineEdit->setText( QString() );
mUI.mEmailLineEdit->setEnabled( false );
mUI.mRemove->setEnabled( false );
return;
}
if ( row > 0 ) {
row--;
}
mUI.mListWidget->setCurrentRow( row );
}
void PublishDialog::openAddressbook()
{
Akonadi::EmailAddressSelectionDialog dlg( this );
if ( !dlg.exec() ) {
return;
}
const Akonadi::EmailAddressSelection::List selections = dlg.selectedAddresses();
if ( !selections.isEmpty() ) {
foreach ( const Akonadi::EmailAddressSelection &selection, selections ) {
mUI.mNameLineEdit->setEnabled( true );
mUI.mEmailLineEdit->setEnabled( true );
QListWidgetItem *item = new QListWidgetItem( mUI.mListWidget );
mUI.mListWidget->setItemSelected( item, true );
mUI.mNameLineEdit->setText( selection.name() );
mUI.mEmailLineEdit->setText( selection.email() );
mUI.mListWidget->addItem( item );
}
mUI.mRemove->setEnabled( true );
}
}
void PublishDialog::updateItem()
{
if ( !mUI.mListWidget->selectedItems().count() ) {
return;
}
KCalCore::Person person( mUI.mNameLineEdit->text(), mUI.mEmailLineEdit->text() );
QListWidgetItem *item = mUI.mListWidget->selectedItems().first();
item->setText( person.fullName() );
}
void PublishDialog::updateInput()
{
if ( !mUI.mListWidget->selectedItems().count() ) {
return;
}
mUI.mNameLineEdit->setEnabled( true );
mUI.mEmailLineEdit->setEnabled( true );
QListWidgetItem *item = mUI.mListWidget->selectedItems().first();
QString mail, name;
KPIMUtils::extractEmailAddressAndName( item->text(), mail, name );
mUI.mNameLineEdit->setText( name );
mUI.mEmailLineEdit->setText( mail );
}
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@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.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KORG_PUBLISHDIALOG_H
#define KORG_PUBLISHDIALOG_H
#include "ui_publishdialog_base.h"
#include <KCalCore/Attendee>
#include <KDialog>
class PublishDialog_base;
class PublishDialog : public KDialog
{
Q_OBJECT
public:
explicit PublishDialog( QWidget *parent=0 );
~PublishDialog();
void addAttendee( const KCalCore::Attendee::Ptr &attendee );
QString addresses();
signals:
void numMessagesChanged( int );
protected slots:
void addItem();
void removeItem();
void openAddressbook();
void updateItem();
void updateInput();
protected:
Ui::PublishDialog_base mUI;
};
#endif
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PublishDialog_base</class>
<widget class="QWidget" name="PublishDialog_base">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>410</width>
<height>326</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QListWidget" name="mListWidget">
<property name="minimumSize">
<size>
<width>300</width>
<height>250</height>
</size>
</property>
<property name="toolTip">
<string>The list of addressees to receive the invitation</string>
</property>
<property name="whatsThis">
<string>This is a list of all the addresses you have currently selected to receive the iCalendar invitation.</string>
</property>
</widget>
</item>
<item row="0" column="1" rowspan="3">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="mAdd">
<property name="toolTip">
<string>Add a new recipient</string>
</property>
<property name="whatsThis">
<string>Click this button and you will be able to enter a name and email for a new addressee to add to the recipients list</string>
</property>
<property name="text">
<string>&amp;Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="mRemove">
<property name="toolTip">
<string>Remove the recipient currently selected</string>
</property>
<property name="whatsThis">
<string>Click this button to remove the recipient currently selected from the list</string>
</property>
<property name="text">
<string>&amp;Remove</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="mSelectAddressee">
<property name="toolTip">
<string>Select a recipient from your address book</string>
</property>
<property name="whatsThis">
<string>Click this button to show another dialog where you will be able to select a recipient from your address book</string>
</property>
<property name="text">
<string>&amp;Select...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>14</width>
<height>258</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="TextLabel1">
<property name="text">
<string comment="recipient name">Name:</string>
</property>
<property name="buddy">
<cstring>mNameLineEdit</cstring>
</property>
</widget>
</item>
<item>
<widget class="KLineEdit" name="mNameLineEdit">
<property name="toolTip">
<string>The recipient's name</string>
</property>
<property name="whatsThis">
<string>This field contains the name of the recipient</string>
</property>
<property name="ClearButtonShown" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="TextLabel2">
<property name="text">
<string comment="recipient email">Email:</string>
</property>
<property name="buddy">
<cstring>mEmailLineEdit</cstring>
</property>
</widget>
</item>
<item>
<widget class="KLineEdit" name="mEmailLineEdit">
<property name="toolTip">
<string>The recipient's email address</string>
</property>
<property name="whatsThis">
<string>This field contains the email address of the recipient</string>
</property>
<property name="text">
<string/>
</property>
<property name="ClearButtonShown" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>mListWidget</tabstop>
<tabstop>mRemove</tabstop>
<tabstop>mSelectAddressee</tabstop>
<tabstop>mNameLineEdit</tabstop>
<tabstop>mEmailLineEdit</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
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