Branch 'dev/invitations' - 7 commits - incidenceeditor-ng/attendeetablemodel.cpp incidenceeditor-ng/attendeetablemodel.h incidenceeditor-ng/editoritemmanager.cpp incidenceeditor-ng/freebusyitemmodel.cpp incidenceeditor-ng/incidenceattendee.cpp incidenceeditor-ng/incidenceattendee.h incidenceeditor-ng/incidenceresource.cpp incidenceeditor-ng/incidenceresource.h incidenceeditor-ng/resourcemanagement.cpp incidenceeditor-ng/resourcemanagement.h
Sandro Knauß
knauss at kolabsys.com
Thu Sep 11 19:09:08 CEST 2014
incidenceeditor-ng/attendeetablemodel.cpp | 55 ++++++++++------
incidenceeditor-ng/attendeetablemodel.h | 9 ++
incidenceeditor-ng/editoritemmanager.cpp | 1
incidenceeditor-ng/freebusyitemmodel.cpp | 35 ++++++----
incidenceeditor-ng/incidenceattendee.cpp | 99 +++++++++++++++++++++++++++++-
incidenceeditor-ng/incidenceattendee.h | 5 +
incidenceeditor-ng/incidenceresource.cpp | 20 +++++-
incidenceeditor-ng/incidenceresource.h | 4 +
incidenceeditor-ng/resourcemanagement.cpp | 14 ++--
incidenceeditor-ng/resourcemanagement.h | 7 +-
10 files changed, 203 insertions(+), 46 deletions(-)
New commits:
commit 7a83e32473defaa9a080672898ad1b0549ffb81c
Author: Sandro Knauà <knauss at kolabsys.com>
Date: Thu Sep 11 18:59:50 2014 +0200
Add available Status to attendees of an incidence
Kolab: 3581
diff --git a/incidenceeditor-ng/freebusyitemmodel.cpp b/incidenceeditor-ng/freebusyitemmodel.cpp
index 0426ad0..8b66af5 100644
--- a/incidenceeditor-ng/freebusyitemmodel.cpp
+++ b/incidenceeditor-ng/freebusyitemmodel.cpp
@@ -258,23 +258,33 @@ void FreeBusyItemModel::setFreeBusyPeriods( const QModelIndex &parent,
ItemPrivateData *parentData = static_cast<ItemPrivateData*>( parent.internalPointer() );
QModelIndex first = index( 0, 0, parent );
QModelIndex last = index( parentData->childCount() - 1, 0, parent );
+ int fb_count = list.size();
+ int childCount = parentData->childCount();
- if ( parentData->childCount() > 0 ) {
- beginRemoveRows( parent, 0, parentData->childCount() - 1 );
- for ( int i = parentData->childCount() - 1; i >= 0; --i ) {
+ if ( childCount > 0 && fb_count < childCount ) {
+ beginRemoveRows( parent, fb_count-1<0 ? 0 : fb_count-1 , childCount - 1 );
+ for ( int i = childCount - 1; i > fb_count; --i ) {
delete parentData->removeChild( i );
}
endRemoveRows();
+ if (fb_count > 0) {
+ last = index(fb_count-1, 0, parent);
+ emit dataChanged(first, last);
+ }
+ } else if (fb_count > childCount) {
+ beginInsertRows( parent, childCount-1 < 0 ? 0 : childCount-1, fb_count - 1 );
+ for ( int i=childCount-1; i < fb_count; ++i ) {
+ ItemPrivateData *childData= new ItemPrivateData( parentData );
+ parentData->appendChild( childData );
+ }
+ endInsertRows();
+ if (childCount > 0) {
+ last = index(childCount-1, 0, parent);
+ emit dataChanged(first, last);
+ }
+ } else if (fb_count == childCount && fb_count > 0) {
+ emit dataChanged( first, last );
}
-
- int fb_count = list.size();
- beginInsertRows( parent, 0, fb_count - 1 );
- for ( int i=0; i < fb_count; ++i ) {
- ItemPrivateData *childData= new ItemPrivateData( parentData );
- parentData->appendChild( childData );
- }
- endInsertRows();
- emit dataChanged( first, last );
}
void FreeBusyItemModel::clear()
@@ -376,6 +386,7 @@ void FreeBusyItemModel::slotInsertFreeBusy( const KCalCore::FreeBusy::Ptr &fb,
item->setFreeBusy( fb );
const int row = mFreeBusyItems.indexOf( item );
const QModelIndex parent = index( row, 0 );
+ emit dataChanged(parent, parent);
setFreeBusyPeriods( parent, fb->fullBusyPeriods() );
}
}
diff --git a/incidenceeditor-ng/incidenceattendee.cpp b/incidenceeditor-ng/incidenceattendee.cpp
index bcb9b94..bab0c00 100644
--- a/incidenceeditor-ng/incidenceattendee.cpp
+++ b/incidenceeditor-ng/incidenceattendee.cpp
@@ -30,6 +30,7 @@
#include "incidencedatetime.h"
#include "schedulingdialog.h"
#include "attendeecomboboxdelegate.h"
+#include "freebusyitemmodel.h"
#ifdef KDEPIM_MOBILE_UI
#include "ui_dialogmoremobile.h"
#else
@@ -173,6 +174,12 @@ IncidenceAttendee::IncidenceAttendee( QWidget *parent, IncidenceDateTime *dateTi
connect( mConflictResolver, SIGNAL(conflictsDetected(int)),
this, SLOT(slotUpdateConflictLabel(int)) );
+ connect( mConflictResolver->model(), SIGNAL(rowsInserted(const QModelIndex&, int, int)),
+ SLOT(slotFreeBusyAdded(const QModelIndex&, int, int)) );
+ connect(mConflictResolver->model(), SIGNAL(layoutChanged()), SLOT(updateFBStatus()));
+ connect(mConflictResolver->model(), SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
+ SLOT(slotFreeBusyChanged(const QModelIndex&, const QModelIndex&)));
+
slotUpdateConflictLabel( 0 ); //initialize label
// confict resolver (should show also resources)
@@ -571,6 +578,86 @@ void IncidenceAttendee::slotConflictResolverLayoutChanged()
checkDirtyStatus();
}
+void IncidenceAttendee::slotFreeBusyAdded(const QModelIndex &parent, int first, int last)
+{
+ // We are only interested in toplevel changes
+ if (parent.isValid()) {
+ return;
+ }
+ QAbstractItemModel *model = mConflictResolver->model();
+ for (int i = first; i <= last; i++) {
+ QModelIndex index = model->index(i, 0, parent);
+ const KCalCore::Attendee::Ptr &attendee = model->data(index, FreeBusyItemModel::AttendeeRole).value<KCalCore::Attendee::Ptr>();
+ const KCalCore::FreeBusy::Ptr &fb = model->data(index, FreeBusyItemModel::FreeBusyRole).value<KCalCore::FreeBusy::Ptr>();
+ if (attendee) {
+ updateFBStatus(attendee, fb);
+ }
+ }
+}
+
+void IncidenceAttendee::slotFreeBusyChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
+{
+ // We are only interested in toplevel changes
+ if (topLeft.parent().isValid()) {
+ return;
+ }
+ QAbstractItemModel *model = mConflictResolver->model();
+ for (int i = topLeft.row(); i <= bottomRight.row(); i++) {
+ QModelIndex index = model->index(i, 0);
+ const KCalCore::Attendee::Ptr &attendee = model->data(index, FreeBusyItemModel::AttendeeRole).value<KCalCore::Attendee::Ptr>();
+ const KCalCore::FreeBusy::Ptr &fb = model->data(index, FreeBusyItemModel::FreeBusyRole).value<KCalCore::FreeBusy::Ptr>();
+ if (attendee) {
+ updateFBStatus(attendee, fb);
+ }
+ }
+}
+
+void IncidenceAttendee::updateFBStatus()
+{
+ QAbstractItemModel *model = mConflictResolver->model();
+ for (int i = 0; i < model->rowCount(); i++) {
+ QModelIndex index = model->index(i, 0);
+ const KCalCore::Attendee::Ptr &attendee = model->data(index, FreeBusyItemModel::AttendeeRole).value<KCalCore::Attendee::Ptr>();
+ const KCalCore::FreeBusy::Ptr &fb = model->data(index, FreeBusyItemModel::FreeBusyRole).value<KCalCore::FreeBusy::Ptr>();
+ if (attendee) {
+ updateFBStatus(attendee, fb);
+ }
+ }
+}
+
+void IncidenceAttendee::updateFBStatus(const KCalCore::Attendee::Ptr &attendee, const KCalCore::FreeBusy::Ptr &fb)
+{
+ KCalCore::Attendee::List attendees = mDataModel->attendees();
+ KDateTime startTime = mDateTime->currentStartDateTime();
+ KDateTime endTime = mDateTime->currentEndDateTime();
+ QAbstractItemModel *model = mConflictResolver->model();
+ if (attendees.contains(attendee)) {
+ int row = dataModel()->attendees().indexOf(attendee);
+ QModelIndex attendeeIndex = dataModel()->index(row, AttendeeTableModel::Available);
+ if (fb) {
+ KCalCore::Period::List busyPeriods = fb->busyPeriods();
+ for ( KCalCore::Period::List::Iterator it = busyPeriods.begin(); it != busyPeriods.end(); ++it ) {
+ // periods started before and laping into the incidence (s < startTime && e >= startTime)
+ // periods starting in the time of incidende (s >= startTime && s <= endTime)
+ if ( ((*it).start() < startTime && (*it).end() > startTime) ||
+ ((*it).start() >= startTime && (*it).start() <= endTime) ) {
+ switch (attendee->status()) {
+ case KCalCore::Attendee::Accepted:
+ dataModel()->setData(attendeeIndex, AttendeeTableModel::Accepted);
+ return;
+ default:
+ dataModel()->setData(attendeeIndex, AttendeeTableModel::Busy);
+ return;
+ }
+ }
+ }
+ dataModel()->setData(attendeeIndex, AttendeeTableModel::Free);
+ } else {
+ dataModel()->setData(attendeeIndex, AttendeeTableModel::Unkown);
+ }
+ }
+}
+
void IncidenceAttendee::slotUpdateConflictLabel( int count )
{
kDebug() << "slotUpdateConflictLabel";
@@ -715,6 +802,7 @@ void IncidenceAttendee::slotEventDurationChanged()
mConflictResolver->setEarliestDateTime( start );
mConflictResolver->setLatestDateTime( end );
+ updateFBStatus();
}
void IncidenceAttendee::slotOrganizerChanged( const QString &newOrganizer )
diff --git a/incidenceeditor-ng/incidenceattendee.h b/incidenceeditor-ng/incidenceattendee.h
index 36af4e8..5cb2092 100644
--- a/incidenceeditor-ng/incidenceattendee.h
+++ b/incidenceeditor-ng/incidenceattendee.h
@@ -24,6 +24,7 @@
#include "incidenceeditor-ng.h"
#include "attendeetablemodel.h"
+#include <KCalCore/FreeBusy>
namespace Ui {
class EventOrTodoDesktop;
@@ -105,6 +106,10 @@ class INCIDENCEEDITORS_NG_EXPORT IncidenceAttendee : public IncidenceEditor
void slotConflictResolverAttendeeRemoved(const QModelIndex &index, int first, int last);
void slotConflictResolverAttendeeChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
void slotConflictResolverLayoutChanged();
+ void slotFreeBusyAdded(const QModelIndex &index, int first, int last);
+ void slotFreeBusyChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+ void updateFBStatus();
+ void updateFBStatus(const KCalCore::Attendee::Ptr &attendee, const KCalCore::FreeBusy::Ptr &fb);
void slotGroupSubstitutionAttendeeAdded(const QModelIndex &index, int first, int last);
void slotGroupSubstitutionAttendeeRemoved(const QModelIndex &index, int first, int last);
commit e848a62a53d7a82312d5fe88574d73f84b96ed81
Author: Sandro Knauà <knauss at kolabsys.com>
Date: Thu Sep 11 18:57:49 2014 +0200
Added available status for attendes to AttendeeTableModel
diff --git a/incidenceeditor-ng/attendeetablemodel.cpp b/incidenceeditor-ng/attendeetablemodel.cpp
index c2d0246..022f98a 100644
--- a/incidenceeditor-ng/attendeetablemodel.cpp
+++ b/incidenceeditor-ng/attendeetablemodel.cpp
@@ -54,12 +54,25 @@ QVariant AttendeeTableModel::data(const QModelIndex &index, int role) const
return attendee->role();
case FullName:
return attendee->fullName();
- case Available:
+ case Available: {
+ AvailableStatus available = attendeeAvailable[attendee];
if (role == Qt::DisplayRole) {
- return i18n("Unknown");
+ switch (available) {
+ case Free:
+ return i18n("Free");
+ case Busy:
+ return i18n("Busy");
+ case Accepted:
+ return i18n("Accepted");
+ case Unkown:
+ return i18n("Unknown");
+ default:
+ return i18n("Unknown");
+ }
} else {
- return 0; //attendeeList.at(index.row()).available;
+ return available;
}
+ }
case Status:
return attendee->status();
case CuType:
@@ -103,7 +116,7 @@ bool AttendeeTableModel::setData(const QModelIndex& index, const QVariant& value
addEmptyAttendee();
break;
case Available:
- //attendeeList[index.row()].available = value.toBool();
+ attendeeAvailable[attendee] = static_cast<AvailableStatus>(value.toInt());
break;
case Status:
attendee->setStatus(static_cast<KCalCore::Attendee::PartStat>(value.toInt()));
@@ -172,6 +185,7 @@ bool AttendeeTableModel::removeRows(int position, int rows, const QModelIndex &p
beginRemoveRows(parent, position, position + rows-1);
for (int row = 0; row < rows; ++row) {
+ attendeeAvailable.remove(attendeeList.at(position));
attendeeList.remove(position);
}
@@ -197,6 +211,7 @@ void AttendeeTableModel::setAttendees(const KCalCore::Attendee::List attendees)
emit layoutAboutToBeChanged();
attendeeList = attendees;
+ attendeeAvailable = QMap<KCalCore::Attendee::Ptr, AvailableStatus>();
addEmptyAttendee();
diff --git a/incidenceeditor-ng/attendeetablemodel.h b/incidenceeditor-ng/attendeetablemodel.h
index 01599a4..9098331 100644
--- a/incidenceeditor-ng/attendeetablemodel.h
+++ b/incidenceeditor-ng/attendeetablemodel.h
@@ -51,6 +51,14 @@ public:
Response
};
+ enum AvailableStatus {
+ Unkown,
+ Free,
+ Accepted,
+ Busy,
+ Tentative
+ };
+
AttendeeTableModel(const KCalCore::Attendee::List &resources, QObject *parent = 0);
int rowCount(const QModelIndex &parent = QModelIndex()) const;
@@ -80,6 +88,7 @@ private:
void addEmptyAttendee();
KCalCore::Attendee::List attendeeList;
+ QMap<KCalCore::Attendee::Ptr, AvailableStatus> attendeeAvailable;
bool mKeepEmpty;
bool mRemoveEmptyLines;
};
commit 4e0ff2246f76ad1488ed6a07b52814d757e5f700
Author: Sandro Knauà <knauss at kolabsys.com>
Date: Thu Sep 11 18:56:36 2014 +0200
cleanup attendeetablemodel
diff --git a/incidenceeditor-ng/attendeetablemodel.cpp b/incidenceeditor-ng/attendeetablemodel.cpp
index 0fb3074..c2d0246 100644
--- a/incidenceeditor-ng/attendeetablemodel.cpp
+++ b/incidenceeditor-ng/attendeetablemodel.cpp
@@ -47,12 +47,13 @@ QVariant AttendeeTableModel::data(const QModelIndex &index, int role) const
return QVariant();
}
+ KCalCore::Attendee::Ptr attendee = attendeeList[index.row()];
if (role == Qt::DisplayRole || role == Qt::EditRole) {
switch (index.column()) {
case Role:
- return attendeeList[index.row()]->role();
+ return attendee->role();
case FullName:
- return attendeeList[index.row()]->fullName();
+ return attendee->fullName();
case Available:
if (role == Qt::DisplayRole) {
return i18n("Unknown");
@@ -60,20 +61,20 @@ QVariant AttendeeTableModel::data(const QModelIndex &index, int role) const
return 0; //attendeeList.at(index.row()).available;
}
case Status:
- return attendeeList[index.row()]->status();
+ return attendee->status();
case CuType:
- return attendeeList[index.row()]->cuType();
+ return attendee->cuType();
case Response:
- return attendeeList[index.row()]->RSVP();
+ return attendee->RSVP();
case Name:
- return attendeeList[index.row()]->name();
+ return attendee->name();
case Email:
- return attendeeList[index.row()]->email();
+ return attendee->email();
}
}
if (role == AttendeeRole) {
- return QVariant::fromValue(attendeeList[index.row()]);
+ return QVariant::fromValue(attendee);
}
return QVariant();
}
@@ -82,21 +83,22 @@ bool AttendeeTableModel::setData(const QModelIndex& index, const QVariant& value
{
QString email, name;
if (index.isValid() && role == Qt::EditRole) {
+ KCalCore::Attendee::Ptr attendee = attendeeList[index.row()];
switch (index.column()) {
case Role:
- attendeeList[index.row()]->setRole(static_cast<KCalCore::Attendee::Role>(value.toInt()));
+ attendee->setRole(static_cast<KCalCore::Attendee::Role>(value.toInt()));
break;
case FullName:
if (mRemoveEmptyLines && value.toString().trimmed().isEmpty()) {
// Do not remove last empty line if mKeepEmpty==true (only works if initaly there is only one empty line)
- if (!mKeepEmpty || !(attendeeList[index.row()]->name().isEmpty() && attendeeList[index.row()]->email().isEmpty())) {
+ if (!mKeepEmpty || !(attendee->name().isEmpty() && attendee->email().isEmpty())) {
removeRows(index.row(), 1);
return true;
}
}
KPIMUtils::extractEmailAddressAndName(value.toString(), email, name);
- attendeeList[index.row()]->setName(name);
- attendeeList[index.row()]->setEmail(email);
+ attendee->setName(name);
+ attendee->setEmail(email);
addEmptyAttendee();
break;
@@ -104,13 +106,13 @@ bool AttendeeTableModel::setData(const QModelIndex& index, const QVariant& value
//attendeeList[index.row()].available = value.toBool();
break;
case Status:
- attendeeList[index.row()]->setStatus(static_cast<KCalCore::Attendee::PartStat>(value.toInt()));
+ attendee->setStatus(static_cast<KCalCore::Attendee::PartStat>(value.toInt()));
break;
case CuType:
- attendeeList[index.row()]->setCuType(static_cast<KCalCore::Attendee::CuType>(value.toInt()));
+ attendee->setCuType(static_cast<KCalCore::Attendee::CuType>(value.toInt()));
break;
case Response:
- attendeeList[index.row()]->setRSVP(value.toBool());
+ attendee->setRSVP(value.toBool());
break;
default:
return false;
commit 8fdbbb424c31c54d3645d3ad898eb00262e3e6d8
Author: Sandro Knauà <knauss at kolabsys.com>
Date: Thu Sep 11 18:51:46 2014 +0200
cleanup
diff --git a/incidenceeditor-ng/resourcemanagement.cpp b/incidenceeditor-ng/resourcemanagement.cpp
index c1c4410..582f89d 100644
--- a/incidenceeditor-ng/resourcemanagement.cpp
+++ b/incidenceeditor-ng/resourcemanagement.cpp
@@ -296,12 +296,6 @@ void ResourceManagement::showDetails(const KLDAP::LdapObject &obj, const KLDAP::
mModel->addItem(freebusy);
}
-void ResourceManagement::slotInsertFreeBusy(const KCalCore::FreeBusy::Ptr &fb, const QString &email)
-{
- kDebug() << fb << email;
-
-}
-
void ResourceManagement::slotLayoutChanged()
{
for(int i = 1; i < mUi->treeResults->model()->columnCount(QModelIndex());i++) {
diff --git a/incidenceeditor-ng/resourcemanagement.h b/incidenceeditor-ng/resourcemanagement.h
index c5b2f7b..6929547 100644
--- a/incidenceeditor-ng/resourcemanagement.h
+++ b/incidenceeditor-ng/resourcemanagement.h
@@ -75,8 +75,6 @@ private slots:
*/
void slotOwnerSearchFinished();
- void slotInsertFreeBusy( const KCalCore::FreeBusy::Ptr &fb, const QString &email );
-
void slotLayoutChanged();
private:
commit 3c265b01986a2b2d09b9eafd81f8b7fbbb039ace
Author: Sandro Knauà <knauss at kolabsys.com>
Date: Wed Sep 10 23:55:21 2014 +0200
Initalize currectAction with None to not trigger load two times
diff --git a/incidenceeditor-ng/editoritemmanager.cpp b/incidenceeditor-ng/editoritemmanager.cpp
index d0b54d6..cb75c4f 100644
--- a/incidenceeditor-ng/editoritemmanager.cpp
+++ b/incidenceeditor-ng/editoritemmanager.cpp
@@ -77,6 +77,7 @@ class ItemEditorPrivate
ItemEditorPrivate::ItemEditorPrivate( Akonadi::IncidenceChanger *changer, EditorItemManager *qq )
: q_ptr( qq ), mItemMonitor( 0 ), mIsCounterProposal( false )
+ , currentAction(EditorItemManager::None)
{
mFetchScope.fetchFullPayload();
mFetchScope.setAncestorRetrieval( Akonadi::ItemFetchScope::Parent );
commit 6392eeb642161bf98c6993ba3231b492cf464436
Author: Sandro Knauà <knauss at kolabsys.com>
Date: Wed Sep 10 23:44:54 2014 +0200
Change of attendeestatus triggers update isDirty
Kolab: 3582
diff --git a/incidenceeditor-ng/incidenceattendee.cpp b/incidenceeditor-ng/incidenceattendee.cpp
index cb34435..bcb9b94 100644
--- a/incidenceeditor-ng/incidenceattendee.cpp
+++ b/incidenceeditor-ng/incidenceattendee.cpp
@@ -230,7 +230,12 @@ void IncidenceAttendee::load( const KCalCore::Incidence::Ptr &incidence )
mUi->mOrganizerLabel->setVisible( true );
}
- mDataModel->setAttendees(incidence->attendees());
+ KCalCore::Attendee::List attendees;
+ foreach(const KCalCore::Attendee::Ptr &a, incidence->attendees()) {
+ attendees << KCalCore::Attendee::Ptr(new KCalCore::Attendee(*a));
+ }
+
+ mDataModel->setAttendees(attendees);
slotUpdateConflictLabel(0);
setActions( incidence->type() );
@@ -309,10 +314,10 @@ bool IncidenceAttendee::isDirty() const
// Okay, again not the most efficient algorithm, but I'm assuming that in the
// bulk of the use cases, the number of attendees is not much higher than 10 or so.
- foreach(const KCalCore::Attendee::Ptr & attendee, originalList) {
+ foreach(const KCalCore::Attendee::Ptr &attendee, originalList) {
bool found = false;
for (int i = 0; i < newList.count(); ++i) {
- if (newList[i] == attendee) {
+ if (*(newList[i]) == *attendee) {
newList.remove(i);
found = true;
break;
commit 04634cde8dd5dec45b52e6ba4224ee562523f512
Author: Sandro Knauà <knauss at kolabsys.com>
Date: Wed Sep 10 11:07:59 2014 +0200
Ok button of resourcemanagement book resource
Kolab: 3397
diff --git a/incidenceeditor-ng/incidenceresource.cpp b/incidenceeditor-ng/incidenceresource.cpp
index 23e229b..bf50b78 100644
--- a/incidenceeditor-ng/incidenceresource.cpp
+++ b/incidenceeditor-ng/incidenceresource.cpp
@@ -64,9 +64,11 @@ IncidenceResource::IncidenceResource(IncidenceAttendee* ieAttendee, Ui::EventOrT
: IncidenceEditor(0)
, mUi(ui)
, dataModel(ieAttendee->dataModel())
+ , resourceDialog(new ResourceManagement())
{
setObjectName("IncidenceResource");
-
+ connect(resourceDialog, SIGNAL(okClicked()),
+ SLOT(dialogOkPressed()));
#ifndef KDEPIM_MOBILE_UI
QStringList attrs;
@@ -140,10 +142,22 @@ void IncidenceResource::bookResource()
void IncidenceResource::findResources()
{
- ResourceManagement* dialog = new ResourceManagement();
- dialog->show();
+ resourceDialog->show();
+}
+
+void IncidenceResource::dialogOkPressed()
+{
+ ResourceItem::Ptr item = resourceDialog->selectedItem();
+ QString name = item->ldapObject().value(QLatin1String("cn"));
+ QString email = item->ldapObject().value(QLatin1String("mail"));
+#ifndef KDEPIM_MOBILE_UI
+ KCalCore::Attendee::Ptr attendee(new KCalCore::Attendee(name, email));
+ attendee->setCuType(KCalCore::Attendee::Resource);
+ dataModel->insertAttendee(dataModel->rowCount(), attendee);
+#endif
}
+
void IncidenceResource::layoutChanged()
{
#ifndef KDEPIM_MOBILE_UI
diff --git a/incidenceeditor-ng/incidenceresource.h b/incidenceeditor-ng/incidenceresource.h
index 11ac84e..9d9dd43 100644
--- a/incidenceeditor-ng/incidenceresource.h
+++ b/incidenceeditor-ng/incidenceresource.h
@@ -35,6 +35,7 @@ class EventOrTodoMore;
namespace IncidenceEditorNG
{
+class ResourceManagement;
class INCIDENCEEDITORS_NG_EXPORT IncidenceResource : public IncidenceEditor
{
@@ -65,6 +66,7 @@ private slots:
void layoutChanged();
void updateCount();
+ void dialogOkPressed();
private:
#ifdef KDEPIM_MOBILE_UI
Ui::EventOrTodoMore *mUi;
@@ -77,6 +79,8 @@ private:
/** used dataModel to rely on*/
AttendeeTableModel *dataModel;
+
+ ResourceManagement* resourceDialog;
};
}
diff --git a/incidenceeditor-ng/resourcemanagement.cpp b/incidenceeditor-ng/resourcemanagement.cpp
index e9c31b0..c1c4410 100644
--- a/incidenceeditor-ng/resourcemanagement.cpp
+++ b/incidenceeditor-ng/resourcemanagement.cpp
@@ -155,6 +155,7 @@ public:
ResourceManagement::ResourceManagement()
{
+ setButtonText(KDialog::Ok, i18nc("@action:button add resource to attendeelist", "Book resource"));
mUi = new Ui_resourceManagement;
@@ -218,6 +219,12 @@ ResourceManagement::ResourceManagement()
connect(resourcemodel,SIGNAL(layoutChanged()),SLOT(slotLayoutChanged()));
}
+ResourceItem::Ptr ResourceManagement::selectedItem() const
+{
+ return mSelectedItem;
+}
+
+
void ResourceManagement::slotStartSearch(const QString &text)
{
((ResourceModel*)mUi->treeResults->model())->startSearch(text);
@@ -226,6 +233,7 @@ void ResourceManagement::slotStartSearch(const QString &text)
void ResourceManagement::slotShowDetails(const QModelIndex & current)
{
ResourceItem::Ptr item = current.model()->data(current, ResourceModel::Resource).value<ResourceItem::Ptr>();
+ mSelectedItem = item;
showDetails(item->ldapObject(), item->ldapClient());
}
diff --git a/incidenceeditor-ng/resourcemanagement.h b/incidenceeditor-ng/resourcemanagement.h
index 8dedb4f..c5b2f7b 100644
--- a/incidenceeditor-ng/resourcemanagement.h
+++ b/incidenceeditor-ng/resourcemanagement.h
@@ -49,6 +49,8 @@ class INCIDENCEEDITORS_NG_EXPORT ResourceManagement : public KDialog
public:
ResourceManagement();
+ ResourceItem::Ptr selectedItem() const;
+
private:
/* Shows the details of a resource
*
@@ -67,7 +69,7 @@ private slots:
*
*/
void slotShowDetails(const QModelIndex & current);
-
+
/**
* The Owner search is done
*/
@@ -80,6 +82,7 @@ private slots:
private:
FreeBusyItemModel *mModel;
ResourceItem::Ptr mOwnerItem;
+ ResourceItem::Ptr mSelectedItem;
Ui_resourceManagement *mUi;
};
More information about the commits
mailing list