• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

messagelist

  • sources
  • kde-4.12
  • kdepim
  • messagelist
  • core
storagemodelbase.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * Copyright 2008 Szymon Tomasz Stefanek <pragma@kvirc.net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  *
19  *******************************************************************************/
20 
21 #include "core/storagemodelbase.h"
22 
23 #include "core/settings.h"
24 
25 using namespace MessageList::Core;
26 
27 StorageModel::StorageModel( QObject * parent )
28  : QAbstractItemModel( parent )
29 {
30 }
31 
32 StorageModel::~StorageModel()
33 {
34 }
35 
36 int StorageModel::initialUnreadRowCountGuess() const
37 {
38  return rowCount( QModelIndex() );
39 }
40 
41 unsigned long StorageModel::preSelectedMessage() const
42 {
43  const QString storageModelId = id();
44  Q_ASSERT( !storageModelId.isEmpty() );
45 
46  KConfigGroup conf( Settings::self()->config(),
47  MessageList::Util::storageModelSelectedMessageGroup() );
48 
49  // QVariant supports unsigned int OR unsigned long long int, NOT unsigned long int... doh...
50  qulonglong defValue = 0;
51 
52  return conf.readEntry( MessageList::Util::messageUniqueIdConfigName().arg( storageModelId ), defValue );
53 }
54 
55 void StorageModel::savePreSelectedMessage( unsigned long uniqueIdOfMessage )
56 {
57  const QString storageModelId = id();
58  Q_ASSERT( !storageModelId.isEmpty() );
59 
60  KConfigGroup conf( Settings::self()->config(),
61  MessageList::Util::storageModelSelectedMessageGroup() );
62 
63  if ( uniqueIdOfMessage )
64  {
65  // QVariant supports unsigned int OR unsigned long long int, NOT unsigned long int... doh...
66  qulonglong val = uniqueIdOfMessage;
67 
68  conf.writeEntry( MessageList::Util::messageUniqueIdConfigName().arg( storageModelId ), val );
69  } else
70  conf.deleteEntry( MessageList::Util::messageUniqueIdConfigName().arg( storageModelId ) );
71 }
72 
73 
74 #include "storagemodelbase.moc"
MessageList::Util::messageUniqueIdConfigName
MESSAGELIST_EXPORT QString messageUniqueIdConfigName()
Definition: messagelistutil.cpp:53
MessageList::Core::StorageModel::~StorageModel
~StorageModel()
Definition: storagemodelbase.cpp:32
MessageList::Core::StorageModel::StorageModel
StorageModel(QObject *parent=0)
Definition: storagemodelbase.cpp:27
MessageList::Util::storageModelSelectedMessageGroup
MESSAGELIST_EXPORT QString storageModelSelectedMessageGroup()
Definition: messagelistutil.cpp:79
MessageList::Core::StorageModel::savePreSelectedMessage
void savePreSelectedMessage(unsigned long uniqueIdOfMessage)
Stores in the unique id of the last selected message for the specified StorageModel.
Definition: storagemodelbase.cpp:55
MessageList::Core::StorageModel::id
virtual QString id() const =0
Returns an unique id for this Storage collection.
MessageList::Core::StorageModel::initialUnreadRowCountGuess
virtual int initialUnreadRowCountGuess() const
Returns (a guess for) the number of unread messages: must be pessimistic (i.e.
Definition: storagemodelbase.cpp:36
QObject
MessageList::Core::StorageModel::preSelectedMessage
unsigned long preSelectedMessage() const
Returns the unique id of the last selected message for this StorageModel.
Definition: storagemodelbase.cpp:41
MessageList::Core::Settings::self
static Settings * self()
Definition: settings.cpp:70
QAbstractItemModel
settings.h
storagemodelbase.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:32 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

messagelist

Skip menu "messagelist"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal