/usr/include/KF5/libkdepim/multiplyinglineeditor.h is in libkf5libkdepim-dev 4:17.12.3-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | /*
Copyright (C) 2010 Casey Link <unnamedrambler@gmail.com>
Copyright (C) 2009-2010 Klaralvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
Refactored from earlier code by:
Copyright (c) 2010 Volker Krause <vkrause@kde.org>
Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef MULTIPLYINGLINEEDITOR_H
#define MULTIPLYINGLINEEDITOR_H
#include "kdepim_export.h"
#include "multiplyingline.h"
#include <KCompletion>
#include <QWidget>
#include <QObject>
namespace KPIM {
class MultiplyingLineView;
/**
@short 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.
*/
class KDEPIM_EXPORT MultiplyingLineFactory : public QObject
{
Q_OBJECT
public:
explicit MultiplyingLineFactory(QObject *parent) : QObject(parent)
{
}
virtual ~MultiplyingLineFactory()
{
}
virtual MultiplyingLine *newLine(QWidget *parent) = 0;
virtual int maximumRecipients()
{
return -1;
}
};
/**
@short An editor that adds rows (lines) of widgets and deletes them as the user edits
Line widgets in the MultiplyingLineEditor are usually composed of multiple
basic widgets. An example is below:
-------------------------------------------------
| ComboBox| Line edit | Checkbox | <-- 1 line
-------------------------------------------------
| ComboBox| Line edit | Checkbox | <-- another line
Default behavior is one line with default settings, and when
the user edits it, another line is automatically added.
Lines are added and deleted on demand.
Implement this class and MultiplyingLineData. Then implement
MultiplyingLineFactory to return instances of your line.
*/
class KDEPIM_EXPORT MultiplyingLineEditor : public QWidget
{
Q_OBJECT
Q_PROPERTY(bool autoResizeView READ autoResizeView WRITE setAutoResizeView)
Q_PROPERTY(bool dynamicSizeHint READ dynamicSizeHint WRITE setDynamicSizeHint)
public:
// We take ownership of factory
explicit MultiplyingLineEditor(MultiplyingLineFactory *factory, QWidget *parent = nullptr);
virtual ~MultiplyingLineEditor();
/** Get the current line factory for this instance of the widget.
*/
MultiplyingLineFactory *factory() const;
/** Retrieve the data from the editor */
QList<MultiplyingLineData::Ptr> allData() const;
/** Retrieve the data of the active line */
MultiplyingLineData::Ptr activeData() const;
/** Clear all lines from the widget.
*/
void clear();
/** Returns true if the user has made any modifications to the list of
recipients.
*/
bool isModified();
/** Resets the modified flag to false.
*/
void clearModified();
/** Adds data to one line of the editor.
@param data The data you want to add.
Can be used to add an empty/default line.
*/
bool addData(const MultiplyingLineData::Ptr &data = MultiplyingLineData::Ptr());
/** Removes data provided it can be found. The Data class must support operator==
@param data The data you want to add.
*/
void removeData(const MultiplyingLineData::Ptr &data);
/**
Set the width of the left most column to be the argument width.
This method allows other widgets to align their label/combobox column with ours
by communicating how many pixels that first column is for them.
@param w what the left most column width should be
@return the width that is actually being used.
*/
int setFirstColumnWidth(int w);
/**
Set completion mode for all lines
@param mode the completion mode
*/
void setCompletionMode(KCompletion::CompletionMode mode);
/**
Set the underlying view's frame shape, default is none.
@param shape of type QFrame::Shape
*/
void setFrameStyle(int shape);
/**
Make the line view follow it's children's size
@param resize turn on or off this behavior of auto resizing
*/
void setAutoResizeView(bool resize);
bool autoResizeView();
/**
* Sets whether the size hint of the editor shall be calculated
* dynamically by the number of lines. Default is @c true.
*/
void setDynamicSizeHint(bool dynamic);
bool dynamicSizeHint() const;
virtual QList<MultiplyingLine *> lines() const;
Q_SIGNALS:
void focusUp();
void focusDown();
void completionModeChanged(KCompletion::CompletionMode);
void sizeHintChanged();
void lineDeleted(int pos);
void lineAdded(KPIM::MultiplyingLine *);
public Q_SLOTS:
void setFocus();
void setFocusTop();
void setFocusBottom();
protected:
virtual MultiplyingLine *activeLine() const;
bool mModified;
private:
MultiplyingLineFactory *mMultiplyingLineFactory = nullptr;
MultiplyingLineView *mView = nullptr;
};
}
#endif // MULTIPLYINGLINEEDITOR_H
|