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

libkdepim

  • sources
  • kde-4.12
  • kdepim
  • libkdepim
  • multiplyingline
multiplyinglineeditor.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 Casey Link <unnamedrambler@gmail.com>
3  Copyright (C) 2009-2010 Klaralvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
4 
5  Refactored from earlier code by:
6  Copyright (c) 2010 Volker Krause <vkrause@kde.org>
7  Copyright (c) 2004 Cornelius Schumacher <schumacher@kde.org>
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 #include "multiplyinglineeditor.h"
26 #include "multiplyinglineview_p.h"
27 
28 #include <KDebug>
29 #include <KDialog>
30 
31 #include <QHBoxLayout>
32 using namespace KPIM;
33 MultiplyingLineEditor::MultiplyingLineEditor( MultiplyingLineFactory* factory, QWidget *parent )
34  : QWidget( parent ), mModified( false ), mMultiplyingLineFactory( factory )
35 {
36  QBoxLayout *topLayout = new QHBoxLayout();
37  topLayout->setSpacing( KDialog::spacingHint() );
38  topLayout->setMargin( 0 );
39  setLayout( topLayout );
40 
41  mView = new MultiplyingLineView( mMultiplyingLineFactory, this );
42  topLayout->addWidget( mView );
43  connect( mView, SIGNAL(focusUp()), SIGNAL(focusUp()) );
44  connect( mView, SIGNAL(focusDown()), SIGNAL(focusDown()) );
45  connect( mView, SIGNAL(completionModeChanged(KGlobalSettings::Completion)),
46  SIGNAL(completionModeChanged(KGlobalSettings::Completion)) );
47  connect( mView, SIGNAL(lineDeleted(int)), SIGNAL(lineDeleted(int)) );
48  connect( mView, SIGNAL(lineAdded(KPIM::MultiplyingLine*)), SIGNAL(lineAdded(KPIM::MultiplyingLine*)) );
49  connect( mView, SIGNAL(sizeHintChanged()),
50  SIGNAL(sizeHintChanged()) );
51 }
52 
53 MultiplyingLineEditor::~MultiplyingLineEditor()
54 {
55  delete mMultiplyingLineFactory;
56 }
57 
58 void MultiplyingLineEditor::addData( const MultiplyingLineData::Ptr &data )
59 {
60  MultiplyingLine* line = mView->emptyLine();
61  if( !line )
62  line = mView->addLine();
63  if( line && data )
64  line->setData( data );
65 }
66 
67 void MultiplyingLineEditor::removeData( const MultiplyingLineData::Ptr &data )
68 {
69  mView->removeData( data );
70 }
71 
72 void MultiplyingLineEditor::clear()
73 {
74  foreach ( MultiplyingLine *line, mView->lines() )
75  line->slotPropagateDeletion();
76 }
77 
78 bool MultiplyingLineEditor::isModified()
79 {
80  return mModified || mView->isModified();
81 }
82 
83 void MultiplyingLineEditor::clearModified()
84 {
85  mModified = false;
86  mView->clearModified();
87 }
88 
89 void MultiplyingLineEditor::setFocus()
90 {
91  mView->setFocus();
92 }
93 
94 void MultiplyingLineEditor::setFocusTop()
95 {
96  mView->setFocusTop();
97 }
98 
99 void MultiplyingLineEditor::setFocusBottom()
100 {
101  mView->setFocusBottom();
102 }
103 
104 int MultiplyingLineEditor::setFirstColumnWidth( int w )
105 {
106  return mView->setFirstColumnWidth( w );
107 }
108 
109 void MultiplyingLineEditor::setCompletionMode( KGlobalSettings::Completion mode )
110 {
111  mView->setCompletionMode( mode );
112 }
113 
114 MultiplyingLineFactory* MultiplyingLineEditor::factory() const
115 {
116  return mMultiplyingLineFactory;
117 }
118 
119 QList< MultiplyingLineData::Ptr > MultiplyingLineEditor::allData() const
120 {
121  return mView->allData();
122 }
123 
124 MultiplyingLineData::Ptr MultiplyingLineEditor::activeData() const
125 {
126  return mView->activeLine()->data();
127 }
128 
129 
130 QList< MultiplyingLine* > MultiplyingLineEditor::lines() const
131 {
132  return mView->lines();
133 }
134 
135 MultiplyingLine* MultiplyingLineEditor::activeLine() const
136 {
137  return mView->activeLine();
138 }
139 
140 void MultiplyingLineEditor::setFrameStyle( int shape )
141 {
142  mView->setFrameStyle( shape );
143 }
144 
145 void MultiplyingLineEditor::setAutoResizeView( bool resize )
146 {
147  mView->setAutoResize( resize );
148 }
149 
150 bool MultiplyingLineEditor::autoResizeView()
151 {
152  return mView->autoResize();
153 }
154 
155 void MultiplyingLineEditor::setDynamicSizeHint( bool dynamic )
156 {
157  mView->setDynamicSizeHint( dynamic );
158 }
159 
160 bool MultiplyingLineEditor::dynamicSizeHint() const
161 {
162  return mView->dynamicSizeHint();
163 }
164 
165 #include "multiplyinglineeditor.moc"
KPIM::MultiplyingLineView::allData
QList< MultiplyingLineData::Ptr > allData() const
KPIM::MultiplyingLineView::setFocusBottom
void setFocusBottom()
KPIM::MultiplyingLineView::setAutoResize
void setAutoResize(bool resize)
Make this widget follow it's children's size.
KPIM::MultiplyingLineEditor::setDynamicSizeHint
void setDynamicSizeHint(bool dynamic)
Sets whether the size hint of the editor shall be calculated dynamically by the number of lines...
Definition: multiplyinglineeditor.cpp:155
KPIM::MultiplyingLineEditor::dynamicSizeHint
bool dynamicSizeHint() const
KPIM::MultiplyingLineEditor::lineDeleted
void lineDeleted(int pos)
KPIM::MultiplyingLineView
Definition: multiplyinglineview_p.h:38
KPIM::MultiplyingLineEditor::isModified
bool isModified()
Returns true if the user has made any modifications to the list of recipients.
Definition: multiplyinglineeditor.cpp:78
KPIM::MultiplyingLineView::activeLine
MultiplyingLine * activeLine() const
KPIM::MultiplyingLineView::isModified
bool isModified() const
Returns true if the user has made any modifications to the list of recipients.
KPIM::MultiplyingLineView::lines
QList< MultiplyingLine * > lines() const
QWidget
KPIM::MultiplyingLineEditor::focusDown
void focusDown()
KPIM::MultiplyingLineView::setFirstColumnWidth
int setFirstColumnWidth(int)
QScrollArea Set the width of the left most column to be the argument width.
KPIM::MultiplyingLineView::removeData
void removeData(const MultiplyingLineData::Ptr &data)
Removes data provided it can be found.
KPIM::MultiplyingLineEditor::setAutoResizeView
void setAutoResizeView(bool resize)
Make the line view follow it's children's size.
Definition: multiplyinglineeditor.cpp:145
KPIM::MultiplyingLineView::emptyLine
MultiplyingLine * emptyLine() const
KPIM::MultiplyingLineEditor::setFocusBottom
void setFocusBottom()
Definition: multiplyinglineeditor.cpp:99
KPIM::MultiplyingLineView::dynamicSizeHint
bool dynamicSizeHint() const
KPIM::MultiplyingLineEditor::clearModified
void clearModified()
Resets the modified flag to false.
Definition: multiplyinglineeditor.cpp:83
KPIM::MultiplyingLineEditor::activeData
MultiplyingLineData::Ptr activeData() const
Retrieve the data of the active line.
Definition: multiplyinglineeditor.cpp:124
KPIM::MultiplyingLineEditor::lineAdded
void lineAdded(KPIM::MultiplyingLine *)
KPIM::MultiplyingLineEditor::~MultiplyingLineEditor
virtual ~MultiplyingLineEditor()
Definition: multiplyinglineeditor.cpp:53
KPIM::MultiplyingLineEditor::sizeHintChanged
void sizeHintChanged()
KPIM::MultiplyingLineEditor::activeLine
virtual MultiplyingLine * activeLine() const
Definition: multiplyinglineeditor.cpp:135
KPIM::MultiplyingLineFactory
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.
Definition: multiplyinglineeditor.h:45
KPIM::MultiplyingLineData::Ptr
QSharedPointer< MultiplyingLineData > Ptr
Definition: multiplyingline.h:44
KPIM::MultiplyingLine::setData
virtual void setData(const MultiplyingLineData::Ptr &data)=0
Set the data of this line.
KPIM::MultiplyingLineEditor::setCompletionMode
void setCompletionMode(KGlobalSettings::Completion mode)
Set completion mode for all lines.
Definition: multiplyinglineeditor.cpp:109
multiplyinglineeditor.h
KPIM::MultiplyingLineEditor::setFirstColumnWidth
int setFirstColumnWidth(int w)
Set the width of the left most column to be the argument width.
Definition: multiplyinglineeditor.cpp:104
KPIM::MultiplyingLineEditor::setFocusTop
void setFocusTop()
Definition: multiplyinglineeditor.cpp:94
KPIM::MultiplyingLineView::setCompletionMode
void setCompletionMode(KGlobalSettings::Completion mode)
KPIM::MultiplyingLineView::setFocus
void setFocus()
KPIM::MultiplyingLineEditor::mModified
bool mModified
Definition: multiplyinglineeditor.h:171
KPIM::MultiplyingLineEditor::allData
QList< MultiplyingLineData::Ptr > allData() const
Retrieve the data from the editor.
Definition: multiplyinglineeditor.cpp:119
KPIM::MultiplyingLine::slotPropagateDeletion
void slotPropagateDeletion()
Definition: multiplyingline.cpp:40
KPIM::MultiplyingLine
Abstract Base Class representing a line in the Multiplying line widget.
Definition: multiplyingline.h:64
KPIM::MultiplyingLineEditor::autoResizeView
bool autoResizeView()
multiplyinglineview_p.h
KPIM::MultiplyingLine::data
virtual MultiplyingLineData::Ptr data() const =0
Retrieve the data.
KPIM::MultiplyingLineView::setDynamicSizeHint
void setDynamicSizeHint(bool dynamic)
Sets whether the size hint of the editor shall be calculated dynamically by the number of lines...
KPIM::MultiplyingLineEditor::MultiplyingLineEditor
MultiplyingLineEditor(MultiplyingLineFactory *factory, QWidget *parent=0)
Definition: multiplyinglineeditor.cpp:33
KPIM::MultiplyingLineEditor::focusUp
void focusUp()
KPIM::MultiplyingLineEditor::completionModeChanged
void completionModeChanged(KGlobalSettings::Completion)
KPIM::MultiplyingLineEditor::removeData
void removeData(const MultiplyingLineData::Ptr &data)
Removes data provided it can be found.
Definition: multiplyinglineeditor.cpp:67
KPIM::MultiplyingLineEditor::factory
MultiplyingLineFactory * factory() const
Get the current line factory for this instance of the widget.
Definition: multiplyinglineeditor.cpp:114
KPIM::MultiplyingLineEditor::setFocus
void setFocus()
Definition: multiplyinglineeditor.cpp:89
KPIM::MultiplyingLineEditor::addData
void addData(const MultiplyingLineData::Ptr &data=MultiplyingLineData::Ptr())
Adds data to one line of the editor.
Definition: multiplyinglineeditor.cpp:58
KPIM::MultiplyingLineView::addLine
MultiplyingLine * addLine()
KPIM::MultiplyingLineEditor::lines
virtual QList< MultiplyingLine * > lines() const
Definition: multiplyinglineeditor.cpp:130
KPIM::MultiplyingLineView::clearModified
void clearModified()
Resets the modified flag to false.
KPIM::MultiplyingLineView::setFocusTop
void setFocusTop()
KPIM::MultiplyingLineEditor::clear
void clear()
Clear all lines from the widget.
Definition: multiplyinglineeditor.cpp:72
KPIM::MultiplyingLineView::autoResize
bool autoResize()
QList
KPIM::MultiplyingLineEditor::setFrameStyle
void setFrameStyle(int shape)
Set the underlying view's frame shape, default is none.
Definition: multiplyinglineeditor.cpp:140
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:03 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkdepim

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

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