summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-18 10:40:53 (UTC)
committer zautrix <zautrix>2005-06-18 10:40:53 (UTC)
commit3c6bc55a0c7abf758df57bbb3dc0842bd6b87e6c (patch) (side-by-side diff)
treebb721da362282858a047659ac1d0c6780a8b15f5
parent2cbe93f970eddb6b61d3fc42ccff1a500e806723 (diff)
downloadkdepimpi-3c6bc55a0c7abf758df57bbb3dc0842bd6b87e6c.zip
kdepimpi-3c6bc55a0c7abf758df57bbb3dc0842bd6b87e6c.tar.gz
kdepimpi-3c6bc55a0c7abf758df57bbb3dc0842bd6b87e6c.tar.bz2
fixx
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koeditordetails.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/korganizer/koeditordetails.cpp b/korganizer/koeditordetails.cpp
index 6ecf978..7354940 100644
--- a/korganizer/koeditordetails.cpp
+++ b/korganizer/koeditordetails.cpp
@@ -4,132 +4,136 @@
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 thse 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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.
*/
#include <qtooltip.h>
#include <qfiledialog.h>
#include <qlayout.h>
#include <qvbox.h>
#include <qbuttongroup.h>
#include <qvgroupbox.h>
#include <qwidgetstack.h>
#include <qdatetime.h>
#include <qapp.h>
#include <klocale.h>
#include <kglobal.h>
#include <kiconloader.h>
#include <kstandarddirs.h>
#include <kmessagebox.h>
#ifndef KORG_NOKABC
#ifdef DESKTOP_VERSION
#include <kabc/addresseedialog.h>
#else //DESKTOP_VERSION
#include <externalapphandler.h>
#endif //DESKTOP_VERSION
#endif
#include <libkcal/incidence.h>
#include "koprefs.h"
#include "koeditordetails.h"
template <>
CustomListViewItem<class Attendee *>::~CustomListViewItem()
{
delete mData;
}
template <>
void CustomListViewItem<class Attendee *>::updateItem()
{
setText(0,mData->name());
setText(1,mData->email());
setText(2,mData->roleStr());
setText(3,mData->statusStr());
- if (mData->RSVP() && !mData->email().isEmpty())
+ if (mData->RSVP() && !mData->email().isEmpty()) {
setPixmap(4,SmallIcon("mailappt"));
- else
+ setSortKey(4,"j");
+ }
+ else {
setPixmap(4,SmallIcon("nomailappt"));
+ setSortKey(4,"n");
+ }
}
KOEditorDetails::KOEditorDetails (int spacing,QWidget* parent,const char* name)
: QWidget( parent, name), mDisableItemUpdate( false )
{
QGridLayout *topLayout = new QGridLayout(this);
topLayout->setSpacing(spacing);
QString organizer = KOPrefs::instance()->email();
mOrganizerLabel = new QLabel(i18n("Organizer: %1").arg(organizer),this);
mListView = new KListView(this,"mListView");
mListView->addColumn(i18n("Name"),180);
mListView->addColumn(i18n("Email"),180);
mListView->addColumn(i18n("Role"),60);
mListView->addColumn(i18n("Status"),100);
mListView->addColumn(i18n("RSVP"),35);
if ( QApplication::desktop()->width() <= 320 || QApplication::desktop()->height() <= 240) {
int hei = 80;
if ( QApplication::desktop()->height() <= 240 )
hei = 60;
mListView->setFixedHeight(hei);
}
mListView->setAllColumnsShowFocus (true );
//mListView->setSingleClick( true );
connect(mListView,SIGNAL(selectionChanged(QListViewItem *)),
SLOT(updateAttendeeInput()));
connect(mListView,SIGNAL(executed(QListViewItem * ,const QPoint&, int )),
SLOT(itemClicked(QListViewItem * ,const QPoint& , int )));
mRsvpButton = new QCheckBox(this);
mRsvpButton->setText(i18n("Request response"));
mAddressBookButton = new QPushButton(i18n("Address &Book..."),this);
QLabel *attendeeLabel = new QLabel(this);
attendeeLabel->setText(i18n("Name:"));
attendeeLabel->setFixedSize( attendeeLabel->sizeHint() );
mNameEdit = new QLineEdit(this);
connect(mNameEdit,SIGNAL(textChanged(const QString &)),
SLOT(updateAttendeeItem()));
mUidEdit = new QLineEdit(0);
mUidEdit->setText("");
QLabel *emailLabel = new QLabel(this);
emailLabel->setText(i18n("Email:"));
mEmailEdit = new QLineEdit(this);
connect(mEmailEdit,SIGNAL(textChanged(const QString &)),
SLOT(updateAttendeeItem()));
QLabel *attendeeRoleLabel = new QLabel(this);
attendeeRoleLabel->setText(i18n("Role:"));
mRoleCombo = new QComboBox(false,this);
mRoleCombo->insertStringList(Attendee::roleList());
connect(mRoleCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem()));
QLabel *statusLabel = new QLabel(this);
statusLabel->setText( i18n("Status:") );
mStatusCombo = new QComboBox(false,this);
mStatusCombo->insertStringList(Attendee::statusList());
connect(mStatusCombo,SIGNAL(activated(int)),SLOT(updateAttendeeItem()));
@@ -406,69 +410,71 @@ void KOEditorDetails::updateAttendeeInput()
fillAttendeeInput( aItem );
} else {
clearAttendeeInput();
}
}
void KOEditorDetails::clearAttendeeInput()
{
mNameEdit->setText("");
mUidEdit->setText("");
mEmailEdit->setText("");
mRoleCombo->setCurrentItem(0);
mStatusCombo->setCurrentItem(0);
mRsvpButton->setChecked(true);
setEnabledAttendeeInput( false );
}
void KOEditorDetails::fillAttendeeInput( AttendeeListItem *aItem )
{
Attendee *a = aItem->data();
mDisableItemUpdate = true;
mNameEdit->setText(a->name());
mUidEdit->setText(a->uid());
mEmailEdit->setText(a->email());
mRoleCombo->setCurrentItem(a->role());
mStatusCombo->setCurrentItem(a->status());
mRsvpButton->setChecked(a->RSVP());
mDisableItemUpdate = false;
setEnabledAttendeeInput( true );
}
void KOEditorDetails::setEnabledAttendeeInput( bool enabled )
{
mNameEdit->setEnabled( enabled );
mEmailEdit->setEnabled( enabled );
mRoleCombo->setEnabled( enabled );
mStatusCombo->setEnabled( enabled );
mRsvpButton->setEnabled( enabled );
mRemoveButton->setEnabled( enabled );
}
void KOEditorDetails::itemClicked(QListViewItem * item ,const QPoint & pnt, int c )
{
if ( item && c == 4 ) {
mRsvpButton->setChecked( !mRsvpButton->isChecked() );
updateAttendeeItem();
}
}
void KOEditorDetails::updateAttendeeItem()
{
if (mDisableItemUpdate) return;
QListViewItem *item = mListView->selectedItem();
AttendeeListItem *aItem = static_cast<AttendeeListItem *>( item );
if ( !aItem ) return;
Attendee *a = aItem->data();
a->setName( mNameEdit->text() );
a->setUid( mUidEdit->text() );
a->setEmail( mEmailEdit->text() );
+ if ( mEmailEdit->text().isEmpty() )
+ mRsvpButton->setChecked( false );
+ a->setRSVP( mRsvpButton->isChecked() );
a->setRole( Attendee::Role( mRoleCombo->currentItem() ) );
a->setStatus( Attendee::PartStat( mStatusCombo->currentItem() ) );
- a->setRSVP( mRsvpButton->isChecked() );
aItem->updateItem();
}