[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepimlibs/akonadi
From: Volker Krause <vkrause () kde ! org>
Date: 2010-12-20 16:57:23
Message-ID: 20101220165723.75B2CAC8AA () svn ! kde ! org
[Download RAW message or body]
SVN commit 1208095 by vkrause:
Fix in-place editing of favorites. It did rename the source folder
before, instead of the favorite.
M +15 -1 favoritecollectionsmodel.cpp
M +1 -0 favoritecollectionsmodel.h
--- trunk/KDE/kdepimlibs/akonadi/favoritecollectionsmodel.cpp #1208094:1208095
@@ -198,7 +198,7 @@
QVariant Akonadi::FavoriteCollectionsModel::data( const QModelIndex &index, int role \
) const {
- if ( index.column() == 0 && role == Qt::DisplayRole ) {
+ if ( index.column() == 0 && (role == Qt::DisplayRole || role == Qt::EditRole) ) {
const QModelIndex sourceIndex = mapToSource( index );
const Collection::Id collectionId = sourceModel()->data( sourceIndex, \
EntityTreeModel::CollectionIdRole ).toLongLong();
@@ -208,6 +208,20 @@
}
}
+bool FavoriteCollectionsModel::setData(const QModelIndex& index, const QVariant& \
value, int role) +{
+ if ( index.isValid() && index.column() == 0 && role == Qt::EditRole ) {
+ const QString newLabel = value.toString();
+ if ( newLabel.isEmpty() )
+ return false;
+ const QModelIndex sourceIndex = mapToSource( index );
+ const Collection collection = sourceModel()->data( sourceIndex, \
EntityTreeModel::CollectionRole ).value<Collection>(); + setFavoriteLabel( \
collection, newLabel ); + return true;
+ }
+ return Akonadi::SelectionProxyModel::setData(index, value, role);
+}
+
QString Akonadi::FavoriteCollectionsModel::favoriteLabel( const Akonadi::Collection \
& collection ) {
if ( !collection.isValid() )
--- trunk/KDE/kdepimlibs/akonadi/favoritecollectionsmodel.h #1208094:1208095
@@ -118,6 +118,7 @@
QString favoriteLabel( const Akonadi::Collection & col );
virtual QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) \
const; + virtual bool setData(const QModelIndex& index, const QVariant& value, int \
role = Qt::EditRole);
virtual QVariant headerData( int section, Qt::Orientation orientation, int role \
= Qt::DisplayRole ) const;
public Q_SLOTS:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic