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

kmail

  • sources
  • kde-4.12
  • kdepim
  • kmail
  • widgets
collectionpane.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KMail, the KDE mail client.
3  Copyright (c) 2010 Montel Laurent <montel@kde.org>
4 
5  KMail is free software; you can redistribute it and/or modify it
6  under the terms of the GNU General Public License, version 2, as
7  published by the Free Software Foundation.
8 
9  KMail is distributed in the hope that it will be useful, but
10  WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 
20 #include "collectionpane.h"
21 #include "kmkernel.h"
22 #include "kernel/mailkernel.h"
23 
24 #include "foldercollection.h"
25 #include <kpimidentities/identitymanager.h>
26 #include <kpimidentities/identity.h>
27 #include <akonadi/kmime/messagefolderattribute.h>
28 
29 using namespace MailCommon;
30 
31 CollectionPane::CollectionPane( bool restoreSession, QAbstractItemModel *model, QItemSelectionModel *selectionModel, QWidget *parent )
32  :MessageList::Pane( restoreSession, model, selectionModel, parent )
33 {
34 }
35 
36 CollectionPane::~CollectionPane()
37 {
38 }
39 
40 void CollectionPane::writeConfig(bool /*restoreSession*/)
41 {
42  MessageList::Pane::writeConfig(!GlobalSettings::self()->startSpecificFolderAtStartup());
43 }
44 
45 MessageList::StorageModel *CollectionPane::createStorageModel( QAbstractItemModel *model, QItemSelectionModel *selectionModel, QObject *parent )
46 {
47  return new CollectionStorageModel( model, selectionModel, parent );
48 }
49 
50 CollectionStorageModel::CollectionStorageModel( QAbstractItemModel *model, QItemSelectionModel *selectionModel, QObject *parent )
51  : MessageList::StorageModel( model, selectionModel, parent )
52 {
53 }
54 
55 CollectionStorageModel::~CollectionStorageModel()
56 {
57 }
58 
59 bool CollectionStorageModel::isOutBoundFolder( const Akonadi::Collection& c ) const
60 {
61  if ( c.hasAttribute<Akonadi::MessageFolderAttribute>()
62  && c.attribute<Akonadi::MessageFolderAttribute>()->isOutboundFolder() ) {
63  return true;
64  }
65  QSharedPointer<FolderCollection> fd = FolderCollection::forCollection( c, false );
66  if ( fd ) {
67  const QString folderString( QString::number( c.id() ) );
68  // default setting
69  const KPIMIdentities::Identity & identity =
70  kmkernel->identityManager()->identityForUoidOrDefault( fd->identity() );
71 
72  bool isOnline = false;
73  if ( CommonKernel->isSystemFolderCollection(c) &&
74  !kmkernel->isImapFolder( c, isOnline ) ) {
75  // local system folders
76  if ( c == CommonKernel->inboxCollectionFolder() ||
77  c == CommonKernel->trashCollectionFolder() )
78  return false;
79  if ( c == CommonKernel->outboxCollectionFolder() ||
80  c == CommonKernel->sentCollectionFolder() ||
81  c == CommonKernel->templatesCollectionFolder() ||
82  c == CommonKernel->draftsCollectionFolder() )
83  return true;
84  } else if ( identity.drafts() == folderString ||
85  identity.templates() == folderString ||
86  identity.fcc() == folderString )
87  // drafts, templates or sent of the identity
88  return true;
89  else
90  return false;
91  }
92 
93  return false;
94 }
95 
96 #include "collectionpane.moc"
QSharedPointer
Definition: collectionmailinglistpage.h:34
CollectionStorageModel::CollectionStorageModel
CollectionStorageModel(QAbstractItemModel *model, QItemSelectionModel *selectionModel, QObject *parent=0)
Create a StorageModel wrapping the specified folder.
Definition: collectionpane.cpp:50
QWidget
CollectionStorageModel::~CollectionStorageModel
~CollectionStorageModel()
Definition: collectionpane.cpp:55
CollectionPane::createStorageModel
MessageList::StorageModel * createStorageModel(QAbstractItemModel *model, QItemSelectionModel *selectionModel, QObject *parent)
Definition: collectionpane.cpp:45
CollectionStorageModel
Definition: collectionpane.h:36
QObject
CollectionPane::CollectionPane
CollectionPane(bool restoreSession, QAbstractItemModel *model, QItemSelectionModel *selectionModel, QWidget *parent=0)
Definition: collectionpane.cpp:31
CollectionStorageModel::isOutBoundFolder
bool isOutBoundFolder(const Akonadi::Collection &c) const
Definition: collectionpane.cpp:59
collectionpane.h
CollectionPane::writeConfig
void writeConfig(bool restoreSession)
Definition: collectionpane.cpp:40
kmkernel
#define kmkernel
Definition: kmkernel.h:22
GlobalSettings::self
static GlobalSettings * self()
Definition: globalsettings.cpp:30
kmkernel.h
CollectionPane::~CollectionPane
~CollectionPane()
Definition: collectionpane.cpp:36
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:51 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kmail

Skip menu "kmail"
  • 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