akonadi
22 #include "etmviewstatesaver.h"
24 #include <QtCore/QModelIndex>
25 #include <QItemSelection>
28 #include "entitytreemodel.h"
30 using namespace Akonadi;
32 ETMViewStateSaver::ETMViewStateSaver(QObject* parent)
33 : KViewStateSaver(parent)
37 QModelIndex ETMViewStateSaver::indexFromConfigString(
const QAbstractItemModel *model,
const QString& key)
const
39 if ( key.startsWith( QLatin1Char(
'x' ) ) )
46 if ( key.startsWith( QLatin1Char(
'c' ) ) ) {
48 if ( !idx.isValid() ) {
52 }
else if ( key.startsWith( QLatin1Char(
'i' ) ) ) {
54 if ( list.isEmpty() ) {
62 QString ETMViewStateSaver::indexToConfigString(
const QModelIndex& index)
const
64 if ( !index.isValid() ) {
65 return QLatin1String(
"x-1" );
69 return QString::fromLatin1(
"c%1" ).arg( c.
id() );
73 return QString::fromLatin1(
"i%1" ).arg(
id );
80 QStringList colStrings;
82 colStrings << QString::fromLatin1(
"c%1" ).arg( col.
id() );
84 restoreSelection( colStrings );
87 void ETMViewStateSaver::selectCollections(
const QList< Collection::Id >& list)
89 QStringList colStrings;
91 colStrings << QString::fromLatin1(
"c%1" ).arg( colId );
93 restoreSelection( colStrings );
98 QStringList itemStrings;
99 foreach (
const Item &item, list ) {
100 itemStrings << QString::fromLatin1(
"i%1" ).arg( item.
id() );
102 restoreSelection( itemStrings );
105 void ETMViewStateSaver::selectItems(
const QList< Item::Id >& list)
107 QStringList itemStrings;
108 foreach (
const Item::Id &itemId, list) {
109 itemStrings << QString::fromLatin1(
"i%1" ).arg( itemId );
111 restoreSelection( itemStrings );
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:27:36 by
doxygen 1.8.3.1 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.