[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepim/kalarm
From: David Jarvie <djarvie () kde ! org>
Date: 2010-11-12 1:52:14
Message-ID: 20101112015214.76363AC89E () svn ! kde ! org
[Download RAW message or body]
SVN commit 1195824 by djarvie:
Implement alarm refresh facility
M +31 -1 akonadimodel.cpp
M +8 -0 akonadimodel.h
M +0 -2 collectionmodel.cpp
M +1 -4 mainwindow.cpp
M +3 -3 resourceselector.cpp
--- trunk/KDE/kdepim/kalarm/akonadimodel.cpp #1195823:1195824
@@ -81,7 +81,8 @@
* Constructor.
*/
AkonadiModel::AkonadiModel(ChangeRecorder* monitor, QObject* parent)
- : EntityTreeModel(monitor, parent)
+ : EntityTreeModel(monitor, parent),
+ mMonitor(monitor)
{
// Set lazy population to enable the contents of unselected collections to be \
ignored setItemPopulationStrategy(LazyPopulation);
@@ -1144,6 +1145,33 @@
#endif
/******************************************************************************
+* Reload a collection from Akonadi storage. The backend data is not reloaded.
+*/
+bool AkonadiModel::reloadCollection(const Akonadi::Collection& collection)
+{
+ if (!collection.isValid())
+ return false;
+ kDebug() << collection.id();
+ mMonitor->setCollectionMonitored(collection, false);
+ mMonitor->setCollectionMonitored(collection, true);
+ return true;
+}
+
+/******************************************************************************
+* Reload a collection from Akonadi storage. The backend data is not reloaded.
+*/
+void AkonadiModel::reload()
+{
+ kDebug();
+ const Collection::List collections = mMonitor->collectionsMonitored();
+ foreach (const Collection& collection, collections)
+ {
+ mMonitor->setCollectionMonitored(collection, false);
+ mMonitor->setCollectionMonitored(collection, true);
+ }
+}
+
+/******************************************************************************
* Called when a collection modification job has completed.
* Checks for any error.
*/
@@ -1549,6 +1577,7 @@
*/
void AkonadiModel::slotRowsInserted(const QModelIndex& parent, int start, int end)
{
+ kDebug() << start << "-" << end << "(parent =" << parent << ")";
for (int row = start; row <= end; ++row)
{
const QModelIndex ix = index(row, 0, parent);
@@ -1570,6 +1599,7 @@
*/
void AkonadiModel::slotRowsAboutToBeRemoved(const QModelIndex& parent, int start, \
int end) {
+ kDebug() << start << "-" << end << "(parent =" << parent << ")";
EventList events = eventList(parent, start, end);
if (!events.isEmpty())
emit eventsToBeRemoved(events);
--- trunk/KDE/kdepim/kalarm/akonadimodel.h #1195823:1195824
@@ -118,6 +118,12 @@
*/
bool removeCollection(const Akonadi::Collection&);
+ /** Reload a collection's data from Akonadi storage (not from the backend). \
*/ + bool reloadCollection(const Akonadi::Collection&);
+
+ /** Reload all collections' data from Akonadi storage (not from the \
backend). */ + void reload();
+
bool isCollectionBeingDeleted(Akonadi::Collection::Id) const;
QModelIndex itemIndex(Akonadi::Item::Id id) const
@@ -256,6 +262,8 @@
static QPixmap* mAudioIcon;
static QSize mIconSize;
static int mTimeHourPos; // position of hour within time string, or \
-1 if leading zeroes included +
+ Akonadi::ChangeRecorder* mMonitor;
QMap<Akonadi::Collection::Id, Akonadi::Collection::Rights> \
mCollectionRights; // last writable status of each collection
QMap<Akonadi::Collection::Id, bool> mCollectionEnabled; // last enabled \
status of each collection
QMap<KJob*, CollJobData> mPendingCollectionJobs; // pending collection \
creation/deletion jobs, with collection ID & name
--- trunk/KDE/kdepim/kalarm/collectionmodel.cpp #1195823:1195824
@@ -164,13 +164,11 @@
*/
Collection CollectionListModel::collection(int row) const
{
-// return AkonadiModel::instance()->data(mapToSource(index(row, 0)), \
EntityTreeModel::CollectionRole).value<Collection>();
return data(index(row, 0), EntityTreeModel::CollectionRole).value<Collection>();
}
Collection CollectionListModel::collection(const QModelIndex& index) const
{
-// return AkonadiModel::instance()->data(mapToSource(index), \
EntityTreeModel::CollectionRole).value<Collection>();
return data(index, EntityTreeModel::CollectionRole).value<Collection>();
}
--- trunk/KDE/kdepim/kalarm/mainwindow.cpp #1195823:1195824
@@ -666,10 +666,7 @@
{
kDebug();
#ifdef USE_AKONADI
-#ifdef __GNUC__
-#warning How to reload Akonadi data?
-#endif
-// mListFilterModel->reload();
+ AkonadiModel::instance()->reload();
#else
EventListModel::alarms()->reload();
#endif
--- trunk/KDE/kdepim/kalarm/resourceselector.cpp #1195823:1195824
@@ -501,9 +501,9 @@
void ResourceSelector::reloadResource()
{
#ifdef USE_AKONADI
-#ifdef __GNUC__
-#warning reloadResource() not implemented
-#endif
+ Collection collection = currentResource();
+ if (collection.isValid())
+ AkonadiModel::instance()->reloadCollection(collection);
#else
AlarmResource* resource = currentResource();
if (resource)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic