Branch 'kolab/integration/4.13.0' - 3 commits - kontact/plugins korganizer/actionmanager.cpp korganizer/calendarview.cpp korganizer/calendarview.h
Christian Mollekopf
mollekopf at kolabsys.com
Tue Dec 30 23:09:38 CET 2014
kontact/plugins/korganizer/CMakeLists.txt | 22 ++++++++++---
korganizer/actionmanager.cpp | 48 +++++++++++++++---------------
korganizer/calendarview.cpp | 25 ++++++++++-----
korganizer/calendarview.h | 5 +--
4 files changed, 60 insertions(+), 40 deletions(-)
New commits:
commit 628dd0b5a0a7b5824c8b3fdbc96343b5437b6a48
Author: Christian Mollekopf <chrigi_1 at fastmail.fm>
Date: Tue Dec 30 23:06:35 2014 +0100
Search for search collections without etm.
This makes the system less error prone and fixes issue #3914
KOLAB: #3914
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index af231d5..a710ae2 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -82,6 +82,7 @@
#include <Akonadi/Calendar/TodoPurger>
#include <Akonadi/SearchCreateJob>
#include <Akonadi/CollectionModifyJob>
+#include <Akonadi/CollectionFetchJob>
#include <Akonadi/SearchQuery>
#include <akonadi/persistentsearchattribute.h>
#include <akonadi/entitydisplayattribute.h>
@@ -129,8 +130,7 @@ CalendarView::CalendarView( QWidget *parent ) : CalendarViewBase( parent ),
mCalendar = Akonadi::ETMCalendar::Ptr( new Akonadi::ETMCalendar( CalendarSupport::calendarSingleton() ) );
mCalendar->setObjectName( QLatin1String("KOrg Calendar") );
- connect(mCalendar->entityTreeModel(), SIGNAL(collectionTreeFetched(Akonadi::Collection::List)),
- SLOT(onCheckVirtualCollections(Akonadi::Collection::List)));
+ setupSearchCollections();
mCalendarClipboard = new Akonadi::CalendarClipboard( mCalendar, mChanger, this );
mITIPHandler = new Akonadi::ITIPHandler( this );
mITIPHandler->setCalendar( mCalendar );
@@ -276,7 +276,7 @@ CalendarView::CalendarView( QWidget *parent ) : CalendarViewBase( parent ),
// IdentityManager
connect(&mIdentityManager, SIGNAL(changed()),
- SLOT(onIdentitiesChanged()));
+ SLOT(createOrUpdateSearchCollections()));
//TODO: do a pretty Summary,
QString s;
@@ -338,20 +338,29 @@ Akonadi::ETMCalendar::Ptr CalendarView::calendar() const
return mCalendar;
}
-void CalendarView::onCheckVirtualCollections(const Akonadi::Collection::List &collections)
+void CalendarView::setupSearchCollections()
{
- foreach(Akonadi::Collection col, collections) {
- kDebug() << "found collection:" << col.name();
+ Akonadi::CollectionFetchJob *fetchJob = new Akonadi::CollectionFetchJob(Akonadi::Collection(1), Akonadi::CollectionFetchJob::FirstLevel);
+ connect(fetchJob, SIGNAL(result(KJob*)), this, SLOT(onSearchCollectionsFetched(KJob*)));
+}
+
+void CalendarView::onSearchCollectionsFetched(KJob *job)
+{
+ if (job->error()) {
+ kWarning() << job->errorString();
+ }
+ Akonadi::CollectionFetchJob *fetchJob = static_cast<Akonadi::CollectionFetchJob*>(job);
+ Q_FOREACH(const Akonadi::Collection &col, fetchJob->collections()) {
if (col.name() == QLatin1String("OpenInvitations")) {
mOpenInvitationCollection = col;
} else if (col.name() == QLatin1String("DeclinedInvitations")) {
mDeclineCollection = col;
}
}
- onIdentitiesChanged();
+ createOrUpdateSearchCollections();
}
-void CalendarView::onIdentitiesChanged()
+void CalendarView::createOrUpdateSearchCollections()
{
Akonadi::SearchQuery query;
foreach (const QString email, mIdentityManager.allEmails()) {
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index b77beb5..14b554e 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -658,12 +658,13 @@ class KORGANIZERPRIVATE_EXPORT CalendarView : public KOrg::CalendarViewBase,
void onCheckableProxyToggled( bool newState );
void onTodosPurged(bool success, int numDeleted, int numIgnored);
- void onCheckVirtualCollections(const Akonadi::Collection::List &collections);
+ void onSearchCollectionsFetched(KJob *job);
void createSearchJobFinished(KJob *job);
void modifyResult(KJob* job);
- void onIdentitiesChanged();
+ void createOrUpdateSearchCollections();
private:
void init();
+ void setupSearchCollections();
Akonadi::Collection selectedCollection() const;
Akonadi::Collection::List checkedCollections() const;
commit 222c8ecf6074a339cf6b95e20e15b9571da9265d
Author: Christian Mollekopf <chrigi_1 at fastmail.fm>
Date: Tue Dec 30 17:11:26 2014 +0100
Disable unsupported views.
diff --git a/korganizer/actionmanager.cpp b/korganizer/actionmanager.cpp
index 6e8e610..a4fa5c1 100644
--- a/korganizer/actionmanager.cpp
+++ b/korganizer/actionmanager.cpp
@@ -384,30 +384,30 @@ void ActionManager::initActions()
connect( action, SIGNAL(triggered(bool)),
mCalendarView->viewManager(), SLOT(showAgendaView()) );
- action = new KAction( KIcon( QLatin1String("view-calendar-list") ), i18n( "&Event List" ), this );
- mACollection->addAction( QLatin1String("view_list"), action );
- connect( action, SIGNAL(triggered(bool)), mCalendarView->viewManager(),
- SLOT(showListView()) );
-
- action = new KAction( KIcon( QLatin1String("view-calendar-tasks") ), i18n( "&To-do List" ), this );
- mACollection->addAction( QLatin1String("view_todo"), action );
- connect( action, SIGNAL(triggered(bool)), mCalendarView->viewManager(),
- SLOT(showTodoView()) );
-
- action = new KAction( KIcon( QLatin1String("view-calendar-journal" )), i18n( "&Journal" ), this );
- mACollection->addAction( QLatin1String("view_journal"), action );
- connect( action, SIGNAL(triggered(bool)), mCalendarView->viewManager(),
- SLOT(showJournalView()) );
-
- action = new KAction( KIcon( QLatin1String("view-calendar-timeline") ), i18n( "Time&line" ), this );
- mACollection->addAction( QLatin1String("view_timeline"), action );
- connect( action, SIGNAL(triggered(bool)), mCalendarView->viewManager(),
- SLOT(showTimeLineView()) );
-
- action = new KAction( KIcon( QLatin1String("view-calendar-time-spent") ), i18n( "Time&spent" ), this );
- mACollection->addAction( QLatin1String("view_timespent"), action );
- connect( action, SIGNAL(triggered(bool)), mCalendarView->viewManager(),
- SLOT(showTimeSpentView()) );
+ // action = new KAction( KIcon( QLatin1String("view-calendar-list") ), i18n( "&Event List" ), this );
+ // mACollection->addAction( QLatin1String("view_list"), action );
+ // connect( action, SIGNAL(triggered(bool)), mCalendarView->viewManager(),
+ // SLOT(showListView()) );
+
+ // action = new KAction( KIcon( QLatin1String("view-calendar-tasks") ), i18n( "&To-do List" ), this );
+ // mACollection->addAction( QLatin1String("view_todo"), action );
+ // connect( action, SIGNAL(triggered(bool)), mCalendarView->viewManager(),
+ // SLOT(showTodoView()) );
+
+ // action = new KAction( KIcon( QLatin1String("view-calendar-journal" )), i18n( "&Journal" ), this );
+ // mACollection->addAction( QLatin1String("view_journal"), action );
+ // connect( action, SIGNAL(triggered(bool)), mCalendarView->viewManager(),
+ // SLOT(showJournalView()) );
+
+ // action = new KAction( KIcon( QLatin1String("view-calendar-timeline") ), i18n( "Time&line" ), this );
+ // mACollection->addAction( QLatin1String("view_timeline"), action );
+ // connect( action, SIGNAL(triggered(bool)), mCalendarView->viewManager(),
+ // SLOT(showTimeLineView()) );
+
+ // action = new KAction( KIcon( QLatin1String("view-calendar-time-spent") ), i18n( "Time&spent" ), this );
+ // mACollection->addAction( QLatin1String("view_timespent"), action );
+ // connect( action, SIGNAL(triggered(bool)), mCalendarView->viewManager(),
+ // SLOT(showTimeSpentView()) );
//~~~~~~~~~~~~~~~~~~~~~~~~~~~ REFRESH ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
action = new KAction( i18n( "&Refresh" ), this );
commit 9ddba3821153b13a13b1282f57c29d27451726f0
Author: Christian Mollekopf <chrigi_1 at fastmail.fm>
Date: Tue Dec 30 17:05:19 2014 +0100
Made journal plugin optional.
diff --git a/kontact/plugins/korganizer/CMakeLists.txt b/kontact/plugins/korganizer/CMakeLists.txt
index 28af69f..19fbb32 100644
--- a/kontact/plugins/korganizer/CMakeLists.txt
+++ b/kontact/plugins/korganizer/CMakeLists.txt
@@ -41,13 +41,24 @@ IF(BUILD_todo)
ENDIF(BUILD_todo)
########### next target ###############
-set(kontact_journalplugin_PART_SRCS journalplugin.cpp ${libcommon_SRCS})
+IF(DISABLE_ALL_OPTIONAL_PLUGINS AND NOT DEFINED BUILD_journal)
+ SET(_DEFAULT_OPTION_VALUE FALSE)
+ENDIF(DISABLE_ALL_OPTIONAL_PLUGINS AND NOT DEFINED BUILD_journal)
+
+OPTION(BUILD_journal "Build journal plugin" ${_DEFAULT_OPTION_VALUE})
+IF(BUILD_journal)
+ set(kontact_journalplugin_PART_SRCS journalplugin.cpp ${libcommon_SRCS})
+
+ qt4_add_dbus_interfaces(kontact_journalplugin_PART_SRCS ${CMAKE_SOURCE_DIR}/korganizer/org.kde.Korganizer.Calendar.xml)
+
+ kde4_add_plugin(kontact_journalplugin ${kontact_journalplugin_PART_SRCS})
-qt4_add_dbus_interfaces(kontact_journalplugin_PART_SRCS ${CMAKE_SOURCE_DIR}/korganizer/org.kde.Korganizer.Calendar.xml)
+ target_link_libraries(kontact_journalplugin ${KDE4_KPARTS_LIBS} ${KDEPIMLIBS_KONTACTINTERFACE_LIBS})
-kde4_add_plugin(kontact_journalplugin ${kontact_journalplugin_PART_SRCS})
+ install(TARGETS kontact_journalplugin DESTINATION ${PLUGIN_INSTALL_DIR})
+ install(FILES journalplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kontact)
-target_link_libraries(kontact_journalplugin ${KDE4_KPARTS_LIBS} ${KDEPIMLIBS_KONTACTINTERFACE_LIBS})
+ENDIF(BUILD_journal)
########### next target ###############
@@ -85,9 +96,8 @@ add_subdirectory(tests)
install(TARGETS kcm_apptsummary DESTINATION ${PLUGIN_INSTALL_DIR})
install(TARGETS kontact_korganizerplugin DESTINATION ${PLUGIN_INSTALL_DIR})
-install(TARGETS kontact_journalplugin DESTINATION ${PLUGIN_INSTALL_DIR})
-install(FILES korganizerplugin.desktop journalplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kontact)
+install(FILES korganizerplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kontact)
install(FILES kcmapptsummary.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES korganizer.setdlg DESTINATION ${DATA_INSTALL_DIR}/kontact/ksettingsdialog)
More information about the commits
mailing list