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

kopete/kopete

  • sources
  • kde-4.14
  • kdenetwork
  • kopete
  • kopete
  • contactlist
contactlistlayoutmanager.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (c) 2008 Nikolaj Hald Nielsen <nhnFreespirit@gmail.com> *
3  * Copyright (c) 2009 Roman Jarosz <kedgedev@gmail.com> *
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 *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 
21 #ifndef CONTACTLISTLAYOUTMANAGER_H
22 #define CONTACTLISTLAYOUTMANAGER_H
23 
24 #include <QStringList>
25 #include <QString>
26 #include <QMap>
27 
28 #include <kopete_export.h>
29 
30 #include "contactlistlayoutitemconfig.h"
31 
32 class QDomElement;
33 class QDomDocument;
34 
35 namespace ContactList {
36 
37 class KOPETE_CONTACT_LIST_EXPORT ContactListTokenConfig {
38 public:
39  ContactListTokenConfig()
40  : mModelRole(-1)
41  {}
42 
43  ContactListTokenConfig(int modelRole, QString configName, QString name, QString iconName)
44  : mModelRole(modelRole), mConfigName(configName), mName(name), mIconName(iconName)
45  {}
46 
47  int mModelRole;
48  QString mConfigName;
49  QString mName;
50  QString mIconName;
51 };
52 
53 class KOPETE_CONTACT_LIST_EXPORT LayoutManager : public QObject
54 {
55  Q_OBJECT
56 
57 public:
58  static LayoutManager * instance();
59 
60  QStringList layouts() const;
61  void setActiveLayout( const QString &layout );
62  void setPreviewLayout( const ContactListLayout &layout );
63  ContactListLayout layout( const QString &layout );
64  ContactListLayout activeLayout();
65  QString activeLayoutName() const;
66 
67  bool isDefaultLayout( const QString &layout ) const;
68 
69  bool addUserLayout( const QString &name, ContactListLayout layout );
70  bool deleteLayout( const QString &layout );
71 
72  enum TokenTypes {
73  PlaceHolder = 0,
74  DisplayName = 1,
75  StatusTitle = 2,
76  StatusMessage = 3,
77  ContactIcons = 4
78  };
79 
80  QList<ContactListTokenConfig> tokens() const { return m_tokens; }
81  ContactListTokenConfig token( int tokenType ) const { return m_tokens.value( tokenType ); }
82 
83 signals:
84  void activeLayoutChanged();
85  void layoutListChanged();
86 
87 private:
88  LayoutManager();
89  ~LayoutManager();
90 
91  void loadDefaultLayouts();
92  void loadUserLayouts();
93 
94  void loadLayouts( const QString &fileName, bool user );
95 
96  QDomElement createItemElement( QDomDocument doc, const QString &name, const LayoutItemConfig &item ) const;
97 
98  LayoutItemConfig parseItemConfig( const QDomElement &elem );
99 
100  static LayoutManager * s_instance;
101 
102  QMap<QString, ContactListLayout> m_layouts;
103  QString m_activeLayout;
104  ContactListLayout m_previewLayout;
105  QList<ContactListTokenConfig> m_tokens;
106 };
107 
108 }
109 
110 #endif
QMap
ContactList::ContactListTokenConfig::ContactListTokenConfig
ContactListTokenConfig(int modelRole, QString configName, QString name, QString iconName)
Definition: contactlistlayoutmanager.h:43
ContactList::LayoutItemConfig
This class wraps the data needed to paint a LayoutItemDelegate.
Definition: contactlistlayoutitemconfig.h:73
ContactList::ContactListTokenConfig::ContactListTokenConfig
ContactListTokenConfig()
Definition: contactlistlayoutmanager.h:39
ContactList::ContactListLayout
Definition: contactlistlayoutitemconfig.h:92
QObject
ContactList::ContactListTokenConfig::mName
QString mName
Definition: contactlistlayoutmanager.h:49
QString
QList
ContactList::ContactListTokenConfig
Definition: contactlistlayoutmanager.h:37
QStringList
contactlistlayoutitemconfig.h
QDomDocument
ContactList::LayoutManager
Definition: contactlistlayoutmanager.h:53
ContactList::LayoutManager::TokenTypes
TokenTypes
Definition: contactlistlayoutmanager.h:72
ContactList::ContactListTokenConfig::mConfigName
QString mConfigName
Definition: contactlistlayoutmanager.h:48
ContactList::ContactListTokenConfig::mIconName
QString mIconName
Definition: contactlistlayoutmanager.h:50
ContactList::ContactListTokenConfig::mModelRole
int mModelRole
Definition: contactlistlayoutmanager.h:47
QDomElement
ContactList::LayoutManager::tokens
QList< ContactListTokenConfig > tokens() const
Definition: contactlistlayoutmanager.h:80
ContactList::LayoutManager::token
ContactListTokenConfig token(int tokenType) const
Definition: contactlistlayoutmanager.h:81
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kopete/kopete

Skip menu "kopete/kopete"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

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