Commit 918fad2c authored by Laurent Montel's avatar Laurent Montel 😁

Now we can show incidenceFor for collection in korganizer. Necessary to specify this attribute

parent 34c972a5
......@@ -3,6 +3,8 @@ kde4_no_enable_final(calendarsupport)
include_directories(
${QT_QTDBUS_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/mailcommon
${CMAKE_SOURCE_DIR}/pimcommon
)
add_definitions(-DQT_NO_CAST_FROM_ASCII)
add_definitions(-DQT_NO_CAST_TO_ASCII)
......@@ -18,7 +20,6 @@ set(calendarsupport_LIB_SRCS
categoryconfig.cpp
categoryhierarchyreader.cpp
cellitem.cpp
collectiongeneralpage.cpp
collectionselection.cpp
eventarchiver.cpp
identitymanager.cpp
......@@ -79,4 +80,32 @@ set_target_properties(calendarsupport
)
install(TARGETS calendarsupport ${INSTALL_TARGETS_DEFAULT_ARGS})
set(calendarsupportcollectionpage_LIB_SRCS
collectiongeneralpage.cpp
)
kde4_add_library(calendarsupportcollectionpage ${LIBRARY_TYPE} ${calendarsupportcollectionpage_LIB_SRCS})
target_link_libraries(
calendarsupportcollectionpage
${KDEPIMLIBS_AKONADI_LIBS}
${KDEPIMLIBS_KCALCORE_LIBS}
${KDEPIMLIBS_KCALUTILS_LIBS}
${KDE4_KDEUI_LIBS}
${KDE4_KIO_LIBS}
${KDE4_KUTILS_LIBS}
mailcommon
pimcommon
akonadi-calendar
)
set_target_properties(calendarsupportcollectionpage
PROPERTIES VERSION ${GENERIC_LIB_VERSION}
SOVERSION ${GENERIC_LIB_SOVERSION}
)
install(TARGETS calendarsupportcollectionpage ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES calendarplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
/*
This file is part of the KDE project
Copyright (C) 2007 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef CALENDARSUPPORTCOLLECTIONPAGE_EXPORT_H
#define CALENDARSUPPORTCOLLECTIONPAGE_EXPORT_H
/* needed for KDE_EXPORT and KDE_IMPORT macros */
#include <kdemacros.h>
#ifndef CALENDARSUPPORTCOLLECTIONPAGE_EXPORT
# if defined(KDEPIM_STATIC_LIBS)
/* No export/import for static libraries */
# define CALENDARSUPPORTCOLLECTIONPAGE_EXPORT
# elif defined(MAKE_CALENDARSUPPORTCOLLECTIONPAGE_LIB)
/* We are building this library */
# define CALENDARSUPPORTCOLLECTIONPAGE_EXPORT KDE_EXPORT
# else
/* We are using this library */
# define CALENDARSUPPORTCOLLECTIONPAGE_EXPORT KDE_IMPORT
# endif
#endif
#endif
......@@ -19,7 +19,7 @@
*/
#include "collectiongeneralpage.h"
#include "pimcommon/util/pimutil.h"
#include <Akonadi/Collection>
#include <Akonadi/EntityDisplayAttribute>
#include <akonadi/calendar/blockalarmsattribute.h>
......@@ -38,15 +38,23 @@
#include <QLabel>
#include <QVBoxLayout>
#include <mailcommon/collectionpage/collectionannotationsattribute.h>
#include <mailcommon/collectionpage/collectiontypeutil.h>
#include <mailcommon/collectionpage/incidencesforwidget.h>
using namespace Akonadi;
using namespace CalendarSupport;
CollectionGeneralPage::CollectionGeneralPage( QWidget *parent )
: CollectionPropertiesPage( parent )
: CollectionPropertiesPage( parent ),
mIncidencesForComboBox(0)
{
setObjectName( QLatin1String( "CalendarSupport::CollectionGeneralPage" ) );
setPageTitle( i18nc( "@title:tab General settings for a folder.", "General" ) );
}
void CollectionGeneralPage::init(const Akonadi::Collection &collection)
{
QVBoxLayout *topLayout = new QVBoxLayout( this );
topLayout->setSpacing( KDialog::spacingHint() );
......@@ -98,6 +106,26 @@ CollectionGeneralPage::CollectionGeneralPage( QWidget *parent )
hbox->addStretch();
#endif
if ( PimCommon::Util::isImapResource(collection.resource()) ) {
const MailCommon::CollectionAnnotationsAttribute *annotationAttribute =
collection.attribute<MailCommon::CollectionAnnotationsAttribute>();
const QMap<QByteArray, QByteArray> annotations =
( annotationAttribute ?
annotationAttribute->annotations() :
QMap<QByteArray, QByteArray>() );
MailCommon::CollectionTypeUtil collectionUtil;
const MailCommon::CollectionTypeUtil::IncidencesFor incidencesFor =
collectionUtil.incidencesForFromString( QLatin1String(annotations.value( MailCommon::CollectionTypeUtil::kolabIncidencesFor() )) );
hbox = new QHBoxLayout();
topLayout->addItem( hbox );
mIncidencesForComboBox = new MailCommon::IncidencesForWidget(this);
hbox->addWidget(mIncidencesForComboBox);
mIncidencesForComboBox->setCurrentIndex( incidencesFor );
}
topLayout->addStretch( 100 ); // eat all superfluous space
}
......@@ -107,6 +135,7 @@ CollectionGeneralPage::~CollectionGeneralPage()
void CollectionGeneralPage::load( const Akonadi::Collection &collection )
{
init(collection);
mNameEdit->setEnabled( collection.rights() & Collection::CanChangeCollection );
const QString displayName = collection.displayName();
......
......@@ -20,7 +20,7 @@
#ifndef CALENDARSUPPORT_COLLECTIONGENERALPAGE_H
#define CALENDARSUPPORT_COLLECTIONGENERALPAGE_H
#include "calendarsupport_export.h"
#include "calendarsupportcollectionpage_export.h"
#include <Akonadi/CollectionPropertiesPage>
......@@ -28,9 +28,12 @@ class KLineEdit;
class KIconButton;
class QCheckBox;
namespace MailCommon {
class IncidencesForWidget;
}
namespace CalendarSupport {
class CALENDARSUPPORT_EXPORT CollectionGeneralPage : public Akonadi::CollectionPropertiesPage
class CALENDARSUPPORTCOLLECTIONPAGE_EXPORT CollectionGeneralPage : public Akonadi::CollectionPropertiesPage
{
Q_OBJECT
......@@ -42,10 +45,12 @@ class CALENDARSUPPORT_EXPORT CollectionGeneralPage : public Akonadi::CollectionP
void save( Akonadi::Collection &collection );
private:
void init(const Akonadi::Collection &collection);
QCheckBox *mBlockAlarmsCheckBox;
KLineEdit *mNameEdit;
QCheckBox *mIconCheckBox;
KIconButton *mIconButton;
MailCommon::IncidencesForWidget *mIncidencesForComboBox;
};
AKONADI_COLLECTION_PROPERTIES_PAGE_FACTORY( CollectionGeneralPageFactory, CollectionGeneralPage )
......
......@@ -255,6 +255,7 @@ set(korganizerprivate_LIB_SRCS
kdgantt2
korganizer_core
korganizer_interfaces
calendarsupportcollectionpage
${KDEPIMLIBS_AKONADI_CALENDAR_LIBS}
${KDEPIMLIBS_AKONADI_LIBS}
${KDEPIMLIBS_KABC_LIBS}
......
......@@ -20,13 +20,14 @@
#ifndef MAILCOMMON_COLLECTIONANNOTATIONSATTRIBUTE_H
#define MAILCOMMON_COLLECTIONANNOTATIONSATTRIBUTE_H
#include "mailcommon_export.h"
#include <Akonadi/Attribute>
#include <QMap>
namespace MailCommon {
class CollectionAnnotationsAttribute : public Akonadi::Attribute
class MAILCOMMON_EXPORT CollectionAnnotationsAttribute : public Akonadi::Attribute
{
public:
CollectionAnnotationsAttribute();
......
......@@ -59,6 +59,7 @@ target_link_libraries(korganizer-mobile
incidenceeditorsngmobile
eventviews
calendarsupport
calendarsupportcollectionpage
kdepim
)
......
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