Libkdepim

multiplyinglineeditor.h
1 /*
2  Copyright (C) 2010 Casey Link <[email protected]>
3  Copyright (C) 2009-2010 Klaralvdalens Datakonsult AB, a KDAB Group company <[email protected]>
4 
5  Refactored from earlier code by:
6  Copyright (c) 2010 Volker Krause <[email protected]>
7  Copyright (c) 2004 Cornelius Schumacher <[email protected]>
8 
9  This library is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or (at your
12  option) any later version.
13 
14  This library is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
17  License for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with this library; see the file COPYING.LIB. If not, write to the
21  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  02110-1301, USA.
23 */
24 
25 #ifndef MULTIPLYINGLINEEDITOR_H
26 #define MULTIPLYINGLINEEDITOR_H
27 
28 #include "kdepim_export.h"
29 
30 #include "multiplyingline.h"
31 
32 #include <KCompletion>
33 #include <QWidget>
34 #include <QObject>
35 
36 namespace KPIM {
37 class MultiplyingLineView;
38 
44 class KDEPIM_EXPORT MultiplyingLineFactory : public QObject
45 {
46  Q_OBJECT
47 public:
48  explicit MultiplyingLineFactory(QObject *parent) : QObject(parent)
49  {
50  }
51 
52  virtual ~MultiplyingLineFactory()
53  {
54  }
55 
56  virtual MultiplyingLine *newLine(QWidget *parent) = 0;
57  virtual int maximumRecipients()
58  {
59  return -1;
60  }
61 };
62 
81 class KDEPIM_EXPORT MultiplyingLineEditor : public QWidget
82 {
83  Q_OBJECT
84  Q_PROPERTY(bool autoResizeView READ autoResizeView WRITE setAutoResizeView)
85  Q_PROPERTY(bool dynamicSizeHint READ dynamicSizeHint WRITE setDynamicSizeHint)
86 
87 public:
88 
89  // We take ownership of factory
90  explicit MultiplyingLineEditor(MultiplyingLineFactory *factory, QWidget *parent = nullptr);
91 
92  ~MultiplyingLineEditor() override;
93 
96  MultiplyingLineFactory *factory() const;
97 
99  QList<MultiplyingLineData::Ptr> allData() const;
100 
102  MultiplyingLineData::Ptr activeData() const;
103 
106  void clear();
107 
111  bool isModified();
112 
115  void clearModified();
116 
121  bool addData(const MultiplyingLineData::Ptr &data = MultiplyingLineData::Ptr());
122 
126  void removeData(const MultiplyingLineData::Ptr &data);
127 
135  int setFirstColumnWidth(int w);
136 
141  void setCompletionMode(KCompletion::CompletionMode mode);
142 
147  void setFrameStyle(int shape);
148 
153  void setAutoResizeView(bool resize);
154  bool autoResizeView();
155 
160  void setDynamicSizeHint(bool dynamic);
161  bool dynamicSizeHint() const;
162 
163  virtual QList<MultiplyingLine *> lines() const;
164 
165 Q_SIGNALS:
166  void focusUp();
167  void focusDown();
168  void completionModeChanged(KCompletion::CompletionMode);
169  void sizeHintChanged();
170  void lineDeleted(int pos);
171  void lineAdded(KPIM::MultiplyingLine *);
172 
173 public Q_SLOTS:
174  void setFocus();
175  void setFocusTop();
176  void setFocusBottom();
177 
178 protected:
179  virtual MultiplyingLine *activeLine() const;
180  bool mModified;
181 
182 private:
183  MultiplyingLineFactory *mMultiplyingLineFactory = nullptr;
184  MultiplyingLineView *mView = nullptr;
185 };
186 }
187 #endif // MULTIPLYINGLINEEDITOR_H
An Abstract Base Class used to create MultiplyingLines Subclass this class and MultiplyingLine, then implement newLine() such that it allocates and returns an instance of your MultiplyingLine.
Abstract Base Class representing a line in the Multiplying line widget.
Class KCheckComboBox::Private.
An editor that adds rows (lines) of widgets and deletes them as the user edits.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Jun 5 2020 23:01:43 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.