diff --git a/plugins/messageviewer/bodypartformatter/memorycalendarmemento.cpp b/plugins/messageviewer/bodypartformatter/memorycalendarmemento.cpp index e211f17f79..9ea3391547 100644 --- a/plugins/messageviewer/bodypartformatter/memorycalendarmemento.cpp +++ b/plugins/messageviewer/bodypartformatter/memorycalendarmemento.cpp @@ -1,69 +1,70 @@ /* Copyright (C) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company Author: Sérgio Martins 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) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. 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, see . */ #include "memorycalendarmemento.h" #include #include #include #include using namespace MessageViewer; MemoryCalendarMemento::MemoryCalendarMemento() : QObject( 0 ), mLoaded( false ) { // We reuse the EntityTreeModel from the calendar singleton to save memory. // We don't reuse the entire ETMCalendar because we want a different selection model mCalendar = Akonadi::ETMCalendar::Ptr( new Akonadi::ETMCalendar( CalendarSupport::calendarSingleton() ) ); mCalendar->setCollectionFilteringEnabled(false); + connect(mCalendar.data(), SIGNAL(calendarChanged()), this, SLOT(onCalendarChanged())); if (mCalendar->isLoaded()) { kDebug() << "Calendar is already loaded."; QTimer::singleShot(1, this, SLOT(onCalendarChanged())); } else { kDebug() << "Waiting for calendar to load."; - connect(mCalendar.data(), SIGNAL(calendarChanged()), this, SLOT(onCalendarChanged())); } } void MemoryCalendarMemento::onCalendarChanged() { + kDebug() << "Calendar changed"; if (mCalendar->isLoaded() && !mLoaded) { kDebug() << "Calendar is loaded."; mLoaded = true; emit update( Viewer::Delayed ); } } bool MemoryCalendarMemento::finished() const { return mLoaded; } KCalCore::MemoryCalendar::Ptr MemoryCalendarMemento::calendar() const { Q_ASSERT( finished() ); return mCalendar; } void MemoryCalendarMemento::detach() { disconnect( this, SIGNAL(update(MessageViewer::Viewer::UpdateMode)), 0, 0 ); }